ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlun...@apache.org
Subject [3/3] ambari git commit: AMBARI-21467: Json Software Registry Implementation (jluniya)
Date Wed, 19 Jul 2017 06:42:44 GMT
AMBARI-21467: Json Software Registry Implementation (jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4450fd7e
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4450fd7e
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4450fd7e

Branch: refs/heads/branch-feature-AMBARI-14714
Commit: 4450fd7ef27eebaeac23c371fa92032d5f31dd12
Parents: c01ff0b
Author: Jayush Luniya <jluniya@hortonworks.com>
Authored: Tue Jul 18 23:42:37 2017 -0700
Committer: Jayush Luniya <jluniya@hortonworks.com>
Committed: Tue Jul 18 23:42:37 2017 -0700

----------------------------------------------------------------------
 .../RegistryMpackResourceDefinition.java        |  65 +++++
 .../RegistryMpackVersionResourceDefinition.java |  48 ++++
 .../resources/RegistryResourceDefinition.java   |  50 +++-
 .../RegistryScenarioResourceDefinition.java     |  51 ++++
 .../resources/ResourceInstanceFactoryImpl.java  |  12 +
 .../ambari/server/api/services/BaseService.java |  70 +++---
 .../api/services/RegistryRequestSwagger.java    |  30 ---
 .../server/api/services/RegistryService.java    | 153 ------------
 .../registry/RegistryMpackRequestSwagger.java   |  30 +++
 .../services/registry/RegistryMpackService.java | 145 ++++++++++++
 .../RegistryMpackVersionRequestSwagger.java     |  30 +++
 .../registry/RegistryMpackVersionService.java   | 150 ++++++++++++
 .../registry/RegistryRequestSwagger.java        |  30 +++
 .../RegistryScenarioRequestSwagger.java         |  30 +++
 .../registry/RegistryScenarioService.java       | 144 ++++++++++++
 .../api/services/registry/RegistryService.java  | 165 +++++++++++++
 .../controller/AmbariManagementController.java  |  13 +-
 .../AmbariManagementControllerImpl.java         |  14 +-
 .../server/controller/ControllerModule.java     |   6 +-
 .../server/controller/RegistryMpackRequest.java |  52 ++++
 .../controller/RegistryMpackResponse.java       | 111 +++++++++
 .../controller/RegistryMpackVersionRequest.java |  64 +++++
 .../RegistryMpackVersionResponse.java           | 127 ++++++++++
 .../server/controller/RegistryRequest.java      | 112 ++++++---
 .../controller/RegistryScenarioRequest.java     |  52 ++++
 .../controller/RegistryScenarioResponse.java    | 112 +++++++++
 .../AbstractControllerResourceProvider.java     |   6 +
 .../internal/RegistryMpackResourceProvider.java | 202 ++++++++++++++++
 .../RegistryMpackVersionResourceProvider.java   | 235 +++++++++++++++++++
 .../internal/RegistryResourceProvider.java      |   4 +-
 .../RegistryScenarioResourceProvider.java       | 200 ++++++++++++++++
 .../ambari/server/controller/spi/Resource.java  |   6 +
 .../RegistryMpackNotFoundException.java         |  29 +++
 .../RegistryMpackVersionNotFoundException.java  |  29 +++
 .../RegistryScenarioNotFoundException.java      |  29 +++
 .../apache/ambari/server/registry/Registry.java |  30 ++-
 .../ambari/server/registry/RegistryFactory.java |   9 +-
 .../server/registry/RegistryFactoryImpl.java    |  62 +++++
 .../ambari/server/registry/RegistryImpl.java    |  96 --------
 .../ambari/server/registry/RegistryManager.java |   3 +-
 .../server/registry/RegistryManagerImpl.java    |   9 +-
 .../ambari/server/registry/RegistryMpack.java   |  57 +++++
 .../registry/RegistryMpackCompatiblity.java     |  46 ++++
 .../server/registry/RegistryMpackService.java   |  41 ++++
 .../server/registry/RegistryMpackVersion.java   |  61 +++++
 .../server/registry/RegistryScenario.java       |  43 ++++
 .../server/registry/RegistryScenarioMpack.java  |  32 +++
 .../server/registry/json/JsonRegistry.java      | 188 +++++++++++++++
 .../registry/json/JsonRegistryDefinition.java   |  57 +++++
 .../server/registry/json/JsonRegistryMpack.java |  84 +++++++
 .../json/JsonRegistryMpackCompatibility.java    |  52 ++++
 .../registry/json/JsonRegistryMpackService.java |  42 ++++
 .../registry/json/JsonRegistryMpackVersion.java |  80 +++++++
 .../registry/json/JsonRegistryScenario.java     |  56 +++++
 .../json/JsonRegistryScenarioMpack.java         |  36 +++
 55 files changed, 3316 insertions(+), 374 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackResourceDefinition.java
new file mode 100644
index 0000000..aec53ae
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackResourceDefinition.java
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.resources;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Resource definition for registry mpack resource types.
+ */
+public class RegistryMpackResourceDefinition extends BaseResourceDefinition {
+
+  /**
+   * Constructor
+   */
+  public RegistryMpackResourceDefinition() {
+    super(Resource.Type.RegistryMpack);
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public String getPluralName() {
+    return "mpacks";
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public String getSingularName() {
+    return "mpack";
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    Set<SubResourceDefinition> subs = new HashSet<>();
+    subs.add(new SubResourceDefinition(Resource.Type.RegistryMpackVersion));
+    return subs;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackVersionResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackVersionResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackVersionResourceDefinition.java
new file mode 100644
index 0000000..bc80a7f
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryMpackVersionResourceDefinition.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Resource definition for registry mpack version resource types.
+ */
+public class RegistryMpackVersionResourceDefinition extends BaseResourceDefinition{
+  /**
+   * Constructor
+   */
+  public RegistryMpackVersionResourceDefinition() {
+    super(Resource.Type.RegistryMpackVersion);
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override public String getPluralName() {
+    return "versions";
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override public String getSingularName() {
+    return "version";
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryResourceDefinition.java
index e48b058..ec397bb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryResourceDefinition.java
@@ -17,22 +17,52 @@
  */
 package org.apache.ambari.server.api.resources;
 
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.Resource.Type;
 
 /**
- * Resource Definition for Registry Resource types.
+ * Resource Definition for registry resource types.
  */
 public class RegistryResourceDefinition extends BaseResourceDefinition {
 
-    public RegistryResourceDefinition() {
-        super(Type.Registry);
-    }
+  /**
+   * Constructor
+   */
+  public RegistryResourceDefinition() {
+    super(Type.Registry);
+  }
+
+  /**
+   * {@inheritDoc}
+   *
+   * @return
+   */
+  @Override
+  public String getPluralName() {
+    return "registries";
+  }
 
-    @Override public String getPluralName() {
-        return "registries";
-    }
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public String getSingularName() {
+    return "registry";
+  }
 
-    @Override public String getSingularName() {
-        return "registry";
-    }
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    Set<SubResourceDefinition> subs = new HashSet<>();
+    subs.add(new SubResourceDefinition(Resource.Type.RegistryScenario));
+    subs.add(new SubResourceDefinition(Resource.Type.RegistryMpack));
+    return subs;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryScenarioResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryScenarioResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryScenarioResourceDefinition.java
new file mode 100644
index 0000000..addeb0a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/RegistryScenarioResourceDefinition.java
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Resource definition for registry mpack scenario types.
+ */
+public class RegistryScenarioResourceDefinition extends BaseResourceDefinition {
+
+  /**
+   * Constructor
+   */
+  public RegistryScenarioResourceDefinition() {
+    super(Resource.Type.RegistryScenario);
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public String getPluralName() {
+    return "scenarios";
+  }
+
+  /**
+   * {@inheritDoc}
+   * @return
+   */
+  @Override
+  public String getSingularName() {
+    return "scenario";
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
index 55b7b29..34070e1 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ResourceInstanceFactoryImpl.java
@@ -153,6 +153,18 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
         resourceDefinition = new RegistryResourceDefinition();
         break;
 
+      case RegistryScenario:
+        resourceDefinition = new RegistryScenarioResourceDefinition();
+        break;
+
+      case RegistryMpack:
+        resourceDefinition = new RegistryMpackResourceDefinition();
+        break;
+
+      case RegistryMpackVersion:
+        resourceDefinition = new RegistryMpackVersionResourceDefinition();
+        break;
+
       case Mpack:
         resourceDefinition = new MpackResourceDefinition();
         break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
index d24780b..ce5f354 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/BaseService.java
@@ -49,46 +49,46 @@ import org.slf4j.LoggerFactory;
 public abstract class BaseService {
   public final static MediaType MEDIA_TYPE_TEXT_CSV_TYPE = new MediaType("text", "csv");
 
-  static final String MSG_SUCCESSFUL_OPERATION = "Successful operation";
-  static final String MSG_REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet";
-  static final String MSG_INVALID_ARGUMENTS = "Invalid arguments";
-  static final String MSG_INVALID_REQUEST = "Invalid request";
-  static final String MSG_CLUSTER_NOT_FOUND = "Cluster not found";
-  static final String MSG_CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found";
-  static final String MSG_NOT_AUTHENTICATED = "Not authenticated";
-  static final String MSG_PERMISSION_DENIED = "Not permitted to perform the operation";
-  static final String MSG_SERVER_ERROR = "Internal server error";
-  static final String MSG_RESOURCE_ALREADY_EXISTS = "The requested resource already exists.";
-  static final String MSG_RESOURCE_NOT_FOUND = "The requested resource doesn't exist.";
-
-  static final String QUERY_FIELDS = "fields";
-  static final String QUERY_FILTER_DESCRIPTION = "Filter fields in the response (identifier fields are mandatory)";
-  static final String QUERY_SORT = "sortBy";
-  static final String QUERY_SORT_DESCRIPTION = "Sort resources in result by (asc | desc)";
-  static final String QUERY_PAGE_SIZE = "page_size";
-  static final String QUERY_PAGE_SIZE_DESCRIPTION = "The number of resources to be returned for the paged response.";
-  static final String DEFAULT_PAGE_SIZE = "10";
-  static final String QUERY_FROM = "from";
-  static final String QUERY_FROM_DESCRIPTION = "The starting page resource (inclusive).  \"start\" is also accepted.";
-  static final String QUERY_FROM_VALUES = "range[0, infinity]";
-  static final String DEFAULT_FROM = "0";
-  static final String QUERY_TO = "to";
-  static final String QUERY_TO_DESCRIPTION = "The ending page resource (inclusive).  \"end\" is also accepted.";
-  static final String QUERY_TO_TYPE = "integer";
-  static final String QUERY_TO_VALUES = "range[1, infinity]";
-  static final String QUERY_PREDICATE = "{predicate}";
-  static final String QUERY_PREDICATE_DESCRIPTION = "The predicate to filter resources by. Omitting the predicate will " +
+  protected static final String MSG_SUCCESSFUL_OPERATION = "Successful operation";
+  protected static final String MSG_REQUEST_ACCEPTED = "Request is accepted, but not completely processed yet";
+  protected static final String MSG_INVALID_ARGUMENTS = "Invalid arguments";
+  protected static final String MSG_INVALID_REQUEST = "Invalid request";
+  protected static final String MSG_CLUSTER_NOT_FOUND = "Cluster not found";
+  protected static final String MSG_CLUSTER_OR_HOST_NOT_FOUND = "Cluster or host not found";
+  protected static final String MSG_NOT_AUTHENTICATED = "Not authenticated";
+  protected static final String MSG_PERMISSION_DENIED = "Not permitted to perform the operation";
+  protected static final String MSG_SERVER_ERROR = "Internal server error";
+  protected static final String MSG_RESOURCE_ALREADY_EXISTS = "The requested resource already exists.";
+  protected static final String MSG_RESOURCE_NOT_FOUND = "The requested resource doesn't exist.";
+
+  protected static final String QUERY_FIELDS = "fields";
+  protected static final String QUERY_FILTER_DESCRIPTION = "Filter fields in the response (identifier fields are mandatory)";
+  protected static final String QUERY_SORT = "sortBy";
+  protected static final String QUERY_SORT_DESCRIPTION = "Sort resources in result by (asc | desc)";
+  protected static final String QUERY_PAGE_SIZE = "page_size";
+  protected static final String QUERY_PAGE_SIZE_DESCRIPTION = "The number of resources to be returned for the paged response.";
+  protected static final String DEFAULT_PAGE_SIZE = "10";
+  protected static final String QUERY_FROM = "from";
+  protected static final String QUERY_FROM_DESCRIPTION = "The starting page resource (inclusive).  \"start\" is also accepted.";
+  protected static final String QUERY_FROM_VALUES = "range[0, infinity]";
+  protected static final String DEFAULT_FROM = "0";
+  protected static final String QUERY_TO = "to";
+  protected static final String QUERY_TO_DESCRIPTION = "The ending page resource (inclusive).  \"end\" is also accepted.";
+  protected static final String QUERY_TO_TYPE = "integer";
+  protected static final String QUERY_TO_VALUES = "range[1, infinity]";
+  protected static final String QUERY_PREDICATE = "{predicate}";
+  protected static final String QUERY_PREDICATE_DESCRIPTION = "The predicate to filter resources by. Omitting the predicate will " +
       "match all resources.";
 
-  static final String RESPONSE_CONTAINER_LIST = "List";
+  protected static final String RESPONSE_CONTAINER_LIST = "List";
 
-  static final String DATA_TYPE_INT = "integer";
-  static final String DATA_TYPE_STRING = "string";
+  protected static final String DATA_TYPE_INT = "integer";
+  protected static final String DATA_TYPE_STRING = "string";
 
-  static final String PARAM_TYPE_QUERY = "query";
-  static final String PARAM_TYPE_BODY = "body";
+  protected static final String PARAM_TYPE_QUERY = "query";
+  protected static final String PARAM_TYPE_BODY = "body";
 
-  static final String FIELDS_SEPARATOR = ", ";
+  protected static final String FIELDS_SEPARATOR = ", ";
 
   /**
    * Logger instance.

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryRequestSwagger.java
deleted file mode 100644
index 4399418..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryRequestSwagger.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.api.services;
-
-import org.apache.ambari.server.controller.ApiModel;
-import org.apache.ambari.server.controller.RegistryRequest;
-import org.apache.ambari.server.controller.internal.RegistryResourceProvider;
-
-import io.swagger.annotations.ApiModelProperty;
-
-@SuppressWarnings("unused") // for Swagger
-public interface RegistryRequestSwagger extends ApiModel {
-  @ApiModelProperty(name = RegistryResourceProvider.RESPONSE_KEY)
-  RegistryRequest getRegistryRequest();
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryService.java
deleted file mode 100644
index 8f5437d..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/RegistryService.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.server.api.services;
-
-import java.util.Collections;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.apache.ambari.server.api.resources.ResourceInstance;
-import org.apache.ambari.server.controller.RegistryResponse.RegistryResponseWrapper;
-import org.apache.ambari.server.controller.internal.RegistryResourceProvider;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.http.HttpStatus;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiResponse;
-import io.swagger.annotations.ApiResponses;
-
-@Path("/registries/")
-@Api(value = "Registries", description = "Endpoint for software registry specific operations")
-public class RegistryService extends BaseService {
-
-    private static final String REGISTRY_REQUEST_TYPE = "org.apache.ambari.server.api.services.RegistryRequestSwagger";
-
-    public RegistryService() {
-        super();
-    }
-
-    /**
-     * Handles: POST /registries/
-     *
-     * @param headers http headers
-     * @param ui      uri info
-     * @param body    request body
-     * @return information regarding the softare registry
-     */
-    @POST
-    @Produces(MediaType.TEXT_PLAIN)
-    @ApiOperation(value = "Connect a software registry with this Ambari instance")
-    @ApiImplicitParams({
-      @ApiImplicitParam(dataType = REGISTRY_REQUEST_TYPE, paramType = PARAM_TYPE_BODY)
-    })
-    @ApiResponses({
-      @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION),
-      @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
-      @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
-      @ApiResponse(code = HttpStatus.SC_CONFLICT, message = MSG_RESOURCE_ALREADY_EXISTS),
-      @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
-      @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
-      @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
-    })
-    public Response createRegistries(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
-        return handleRequest(headers, body, ui, Request.Type.POST, createRegistryResource(null));
-    }
-
-    /**
-     * Handles: GET /registries/
-     *
-     * @param headers http headers
-     * @param ui      uri info
-     * @param body    request body
-     * @return All software registries
-     *
-     */
-    @GET
-    @Produces(MediaType.TEXT_PLAIN)
-    @ApiOperation(value = "Returns all software registry connected with this Ambari instance",
-      response = RegistryResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
-    @ApiImplicitParams({
-      @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
-        paramType = PARAM_TYPE_QUERY, defaultValue = RegistryResourceProvider.REGISTRY_ID),
-      @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
-        paramType = PARAM_TYPE_QUERY),
-      @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
-        dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
-      @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES,
-        defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
-      @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES,
-        dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
-    })
-    public Response getRegistries(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
-        return handleRequest(headers, body, ui, Request.Type.GET,
-                createRegistryResource(null));
-    }
-
-
-    /***
-     * Handles: GET /registries/{registry_id}
-     * Return a specific software registry given an registry_id
-     *
-     * @param
-     */
-    @GET
-    @Path("{registry_id}")
-    @Produces(MediaType.TEXT_PLAIN)
-    @ApiOperation(value = "Returns information about a specific software registry that is connected with this Ambari instance",
-      response = RegistryResponseWrapper.class)
-    @ApiImplicitParams({
-      @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
-        paramType = PARAM_TYPE_QUERY, defaultValue = RegistryResourceProvider.ALL_PROPERTIES),
-    })
-    @ApiResponses({
-      @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
-      @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
-      @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
-      @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
-      @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
-    })
-    public Response getRegistry(String body, @Context HttpHeaders headers, @Context UriInfo ui,
-            @PathParam("registry_id") String registryId) {
-
-        return handleRequest(headers, body, ui, Request.Type.GET,
-                createRegistryResource(registryId));
-    }
-
-    /**
-     * Create an software registry resource instance
-     * @param registryId
-     * @return ResourceInstance
-     */
-    private ResourceInstance createRegistryResource(String registryId) {
-        return createResource(Resource.Type.Registry,
-                Collections.singletonMap(Resource.Type.Registry, registryId));
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackRequestSwagger.java
new file mode 100644
index 0000000..f744cd5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackRequestSwagger.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.controller.RegistryMpackRequest;
+import org.apache.ambari.server.controller.internal.RegistryMpackResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
+@SuppressWarnings("unused") // for Swagger
+public interface RegistryMpackRequestSwagger extends ApiModel {
+  @ApiModelProperty(name = RegistryMpackResourceProvider.RESPONSE_KEY)
+  RegistryMpackRequest getRegistryMpackRequest();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackService.java
new file mode 100644
index 0000000..c3bd0c2
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackService.java
@@ -0,0 +1,145 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.services.BaseService;
+import org.apache.ambari.server.api.services.Request;
+import org.apache.ambari.server.controller.RegistryMpackResponse.RegistryMpackResponseWrapper;
+import org.apache.ambari.server.controller.internal.RegistryMpackResourceProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * REST API endpoint for registry mpacks
+ */
+@Path("/registries/{registryId}/mpacks/")
+@Api(value = "RegistryMpacks", description = "Endpoint for registry mpacks specific operations")
+public class RegistryMpackService extends BaseService {
+
+  private static final String REGISTRY_MPACK_REQUEST_TYPE =
+    "org.apache.ambari.server.api.services.registry.RegistryMpackRequestSwagger";
+
+  /**
+   * Constructor
+   */
+  public RegistryMpackService() {
+    super();
+  }
+
+  /**
+   * Handles: GET /registries/{registryId}/mpacks
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param body        request body
+   * @param registryId  registry id
+   * @return            {@link Response} containing all mpacks in a registry
+   *
+   */
+  @GET
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns all mpacks in a registry connected with this Ambari instance",
+    response = RegistryMpackResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryMpackResourceProvider.REGISTRY_ID),
+    @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES,
+      defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+  })
+  public Response getRegistryMpacks(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId) {
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryMpackResource(registryId, null));
+  }
+
+
+  /***
+   * Handles: GET /registries/{registryId}/mpacks/{mpackName}
+   * Return information about a specific mpack in a registry
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param body        request body
+   * @param registryId  registry id
+   * @param mpackName   management pack name
+   * @return            {@link Response} containing details about the specific mpack
+   */
+  @GET
+  @Path("{mpackName}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about a specific mpack in a registry connected with this Ambari instance",
+    response = RegistryMpackResponseWrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryMpackResourceProvider.ALL_PROPERTIES),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRegistryMpack(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId, @PathParam("mpackName") String mpackName) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryMpackResource(registryId, mpackName));
+  }
+
+  /**
+   * Create a registry mpack resource instance
+   * @param registryId  software registry id
+   * @param mpackName   mpack name
+   * @return {@link ResourceInstance}
+   */
+  private ResourceInstance createRegistryMpackResource(String registryId, String mpackName) {
+    Map<Resource.Type,String> mapIds = new HashMap<>();
+    mapIds.put(Resource.Type.Registry, registryId);
+    mapIds.put(Resource.Type.RegistryMpack, mpackName);
+
+    return createResource(Resource.Type.RegistryMpack, mapIds);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionRequestSwagger.java
new file mode 100644
index 0000000..82f2506
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionRequestSwagger.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.controller.RegistryMpackVersionRequest;
+import org.apache.ambari.server.controller.internal.RegistryMpackVersionResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
+@SuppressWarnings("unused") // for Swagger
+public interface RegistryMpackVersionRequestSwagger extends ApiModel {
+  @ApiModelProperty(name = RegistryMpackVersionResourceProvider.RESPONSE_KEY)
+  RegistryMpackVersionRequest getRegistryMpackVersionRequest();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionService.java
new file mode 100644
index 0000000..241db61
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryMpackVersionService.java
@@ -0,0 +1,150 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.services.BaseService;
+import org.apache.ambari.server.api.services.Request;
+import org.apache.ambari.server.controller.RegistryMpackVersionResponse.RegistryMpackVersionResponseWrapper;
+import org.apache.ambari.server.controller.internal.RegistryMpackVersionResourceProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * REST API endpoint for registry mpack version
+ */
+@Path("/registries/{registryId}/mpacks/{mpackName}/versions/")
+@Api(value = "RegistryMpackVersions", description = "Endpoint for registry mpack versions specific operations")
+public class RegistryMpackVersionService extends BaseService {
+
+  private static final String REGISTRY_MPACK_VERSION_REQUEST_TYPE = "org.apache.ambari.server.api.services.registry.RegistryMpackVersionRequestSwagger";
+
+  /**
+   * Constructor
+   */
+  public RegistryMpackVersionService() {
+    super();
+  }
+
+  /**
+   * Handles: GET /registries/{registryId}/mpacks/{mpackName}/versions
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param body        request body
+   * @param registryId  registry id
+   * @param mpackName   management pack name
+   * @return            {@link Response} containing all versions of an mpack in a software registry
+   *
+   */
+  @GET
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns all versions of an mpack in a registry connected with this Ambari instance",
+    response = RegistryMpackVersionResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryMpackVersionResourceProvider.REGISTRY_ID),
+    @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES,
+      defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+  })
+  public Response getRegistryMpacks(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId,
+    @PathParam("mpackName") String mpackName) {
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryMpackVersionResource(registryId, mpackName, null));
+  }
+
+
+  /***
+   * Handles: GET /registries/{registryId}/mpacks/{mpackName}/versions/{mpackVersion}
+   * Return information about a specific mpack version in a registry
+   *
+   * @param headers       http headers
+   * @param ui            uri info
+   * @param body          request body
+   * @param registryId    registry id
+   * @param mpackName     management pack name
+   * @param mpackVersion  management pack version
+   * @return              {@link Response} containing information of the specific mpack version
+   */
+  @GET
+  @Path("{mpackVersion}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about a specific mpack version in a registry connected with this Ambari instance",
+    response = RegistryMpackVersionResponseWrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryMpackVersionResourceProvider.ALL_PROPERTIES),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRegistryMpack(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId, 
+    @PathParam("mpackName") String mpackName, 
+    @PathParam("mpackVersion") String mpackVersion) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryMpackVersionResource(registryId, mpackName, mpackVersion));
+  }
+
+  /**
+   * Create a registry mpack resource instance
+   * @param registryId  software registry id
+   * @param mpackName   mpack name
+   * @return {@link ResourceInstance}
+   */
+  private ResourceInstance createRegistryMpackVersionResource(String registryId, String mpackName, String mpackVersion) {
+    Map<Resource.Type,String> mapIds = new HashMap<>();
+    mapIds.put(Resource.Type.Registry, registryId);
+    mapIds.put(Resource.Type.RegistryMpack, mpackName);
+    mapIds.put(Resource.Type.RegistryMpackVersion, mpackVersion);
+
+    return createResource(Resource.Type.RegistryMpackVersion, mapIds);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryRequestSwagger.java
new file mode 100644
index 0000000..a46b5e5
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryRequestSwagger.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.controller.RegistryRequest;
+import org.apache.ambari.server.controller.internal.RegistryResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
+@SuppressWarnings("unused") // for Swagger
+public interface RegistryRequestSwagger extends ApiModel {
+  @ApiModelProperty(name = RegistryResourceProvider.RESPONSE_KEY)
+  RegistryRequest getRegistryRequest();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioRequestSwagger.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioRequestSwagger.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioRequestSwagger.java
new file mode 100644
index 0000000..7c36a23
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioRequestSwagger.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import org.apache.ambari.server.controller.ApiModel;
+import org.apache.ambari.server.controller.RegistryScenarioRequest;
+import org.apache.ambari.server.controller.internal.RegistryScenarioResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
+@SuppressWarnings("unused") // for Swagger
+public interface RegistryScenarioRequestSwagger extends ApiModel {
+  @ApiModelProperty(name = RegistryScenarioResourceProvider.RESPONSE_KEY)
+  RegistryScenarioRequest getRegistryScenarioRequest();
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioService.java
new file mode 100644
index 0000000..613ebd6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryScenarioService.java
@@ -0,0 +1,144 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.services.BaseService;
+import org.apache.ambari.server.api.services.Request;
+import org.apache.ambari.server.controller.RegistryScenarioResponse.RegistryScenarioResponseWrapper;
+import org.apache.ambari.server.controller.internal.RegistryScenarioResourceProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * REST API endpoint for registry scenario
+ */
+@Path("/registries/{registryId}/scenarios/")
+@Api(value = "RegistryScenarios", description = "Endpoint for registry scenario specific operations")
+public class RegistryScenarioService extends BaseService {
+
+  private static final String REGISTRY_REQUEST_TYPE = "org.apache.ambari.server.api.services.registry.RegistryScenarioRequestSwagger";
+
+  /**
+   * Constructor
+   */
+  public RegistryScenarioService() {
+    super();
+  }
+
+  /**
+   * Handles: GET /registries/{registryId}/scenarios
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param body        request body
+   * @param registryId  registry id
+   * @return            {@link Response} containing all scenarios in a registry
+   *
+   */
+  @GET
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns all scenarios in a registry connected with this Ambari instance",
+    response = RegistryScenarioResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryScenarioResourceProvider.REGISTRY_ID),
+    @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES,
+      defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+  })
+  public Response getRegistryScenarios(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId) {
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryScenarioResource(registryId, null));
+  }
+
+
+  /***
+   * Handles: GET /registries/{registryId}/scenarios/{scenarioName}
+   * Return information about a specific scenario in a registry
+   *
+   * @param headers       http headers
+   * @param ui            uri info
+   * @param body          request body
+   * @param registryId    registry id
+   * @param scenarioName  scenario name
+   * @return              {@link Response} containing information about specific scenario
+   */
+  @GET
+  @Path("{scenarioName}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about a specific scenario in a registry connected with this Ambari instance",
+    response = RegistryScenarioResponseWrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryScenarioResourceProvider.ALL_PROPERTIES),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRegistryScenario(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId, @PathParam("scenarioName") String scenarioName) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryScenarioResource(registryId, scenarioName));
+  }
+
+  /**
+   * Create a registry scenario resource instance
+   * @param registryId  software registry id
+   * @param scenarioName   scenario name
+   * @return {@link ResourceInstance}
+   */
+  private ResourceInstance createRegistryScenarioResource(String registryId, String scenarioName) {
+    Map<Resource.Type,String> mapIds = new HashMap<>();
+    mapIds.put(Resource.Type.Registry, registryId);
+    mapIds.put(Resource.Type.RegistryScenario, scenarioName);
+
+    return createResource(Resource.Type.RegistryScenario, mapIds);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryService.java
new file mode 100644
index 0000000..7704149
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/registry/RegistryService.java
@@ -0,0 +1,165 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.api.services.registry;
+
+import java.util.Collections;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.api.services.BaseService;
+import org.apache.ambari.server.api.services.Request;
+import org.apache.ambari.server.controller.RegistryResponse.RegistryResponseWrapper;
+import org.apache.ambari.server.controller.internal.RegistryResourceProvider;
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.http.HttpStatus;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+/**
+ * REST API endpoint for software registry
+ */
+@Path("/registries/")
+@Api(value = "Registries", description = "Endpoint for software registry specific operations")
+public class RegistryService extends BaseService {
+
+  private static final String REGISTRY_REQUEST_TYPE = "org.apache.ambari.server.api.services.registry.RegistryRequestSwagger";
+
+  /**
+   * Constructor
+   */
+  public RegistryService() {
+    super();
+  }
+
+  /**
+   * Handles: POST /registries/
+   *
+   * @param headers http headers
+   * @param ui      uri info
+   * @param body    request body
+   * @return        information regarding the software registry created
+   */
+  @POST
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Connect a software registry with this Ambari instance")
+  @ApiImplicitParams({
+    @ApiImplicitParam(dataType = REGISTRY_REQUEST_TYPE, paramType = PARAM_TYPE_BODY)
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_CREATED, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_ACCEPTED, message = MSG_REQUEST_ACCEPTED),
+    @ApiResponse(code = HttpStatus.SC_BAD_REQUEST, message = MSG_INVALID_ARGUMENTS),
+    @ApiResponse(code = HttpStatus.SC_CONFLICT, message = MSG_RESOURCE_ALREADY_EXISTS),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response createRegistries(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+    return handleRequest(headers, body, ui, Request.Type.POST, createRegistryResource(null));
+  }
+
+  /**
+   * Handles: GET /registries/
+   *
+   * @param headers http headers
+   * @param ui      uri info
+   * @param body    request body
+   * @return        {@link Response} containing all software registries
+   */
+  @GET
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns all software registry connected with this Ambari instance",
+    response = RegistryResponseWrapper.class, responseContainer = RESPONSE_CONTAINER_LIST)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryResourceProvider.REGISTRY_ID),
+    @ApiImplicitParam(name = QUERY_SORT, value = QUERY_SORT_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_PAGE_SIZE, value = QUERY_PAGE_SIZE_DESCRIPTION, defaultValue = DEFAULT_PAGE_SIZE,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_FROM, value = QUERY_FROM_DESCRIPTION, allowableValues = QUERY_FROM_VALUES,
+      defaultValue = DEFAULT_FROM, dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+    @ApiImplicitParam(name = QUERY_TO, value = QUERY_TO_DESCRIPTION, allowableValues = QUERY_TO_VALUES,
+      dataType = DATA_TYPE_INT, paramType = PARAM_TYPE_QUERY),
+  })
+  public Response getRegistries(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryResource(null));
+  }
+
+  /***
+   * Handles: GET /registries/{registryId}
+   * Return a specific software registry given an registryId
+   *
+   * @param headers     http headers
+   * @param ui          uri info
+   * @param body        request body
+   * @param registryId  registry id
+   * @return            {@link Response} containing information about specific software registry.
+   */
+  @GET
+  @Path("{registryId}")
+  @Produces(MediaType.TEXT_PLAIN)
+  @ApiOperation(value = "Returns information about a specific software registry that is connected with this Ambari instance",
+    response = RegistryResponseWrapper.class)
+  @ApiImplicitParams({
+    @ApiImplicitParam(name = QUERY_FIELDS, value = QUERY_FILTER_DESCRIPTION, dataType = DATA_TYPE_STRING,
+      paramType = PARAM_TYPE_QUERY, defaultValue = RegistryResourceProvider.ALL_PROPERTIES),
+  })
+  @ApiResponses({
+    @ApiResponse(code = HttpStatus.SC_OK, message = MSG_SUCCESSFUL_OPERATION),
+    @ApiResponse(code = HttpStatus.SC_NOT_FOUND, message = MSG_RESOURCE_NOT_FOUND),
+    @ApiResponse(code = HttpStatus.SC_UNAUTHORIZED, message = MSG_NOT_AUTHENTICATED),
+    @ApiResponse(code = HttpStatus.SC_FORBIDDEN, message = MSG_PERMISSION_DENIED),
+    @ApiResponse(code = HttpStatus.SC_INTERNAL_SERVER_ERROR, message = MSG_SERVER_ERROR),
+  })
+  public Response getRegistry(
+    String body, @Context HttpHeaders headers, @Context UriInfo ui,
+    @PathParam("registryId") String registryId) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET,
+      createRegistryResource(registryId));
+  }
+
+  /**
+   * Create an software registry resource instance
+   *
+   * @param registryId registry id
+   * @return ResourceInstance
+   */
+  private ResourceInstance createRegistryResource(String registryId) {
+    return createResource(Resource.Type.Registry,
+      Collections.singletonMap(Resource.Type.Registry, registryId));
+
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
index ef72399..635949f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementController.java
@@ -42,6 +42,7 @@ import org.apache.ambari.server.events.AmbariEvent;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.metadata.RoleCommandOrder;
 import org.apache.ambari.server.orm.entities.ExtensionLinkEntity;
+import org.apache.ambari.server.registry.Registry;
 import org.apache.ambari.server.scheduler.ExecutionScheduleManager;
 import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.encryption.CredentialStoreService;
@@ -154,7 +155,7 @@ public interface AmbariManagementController {
    *
    * @param request the request object which defines the software registry to be added
    */
-  RegistryResponse addRegistry(RegistryRequest request);
+  RegistryResponse addRegistry(RegistryRequest request) throws AmbariException;
 
   /**
    * Register the mpack defined by the attributes in the given request object.
@@ -954,5 +955,15 @@ public interface AmbariManagementController {
    */
   Set<RegistryResponse> getRegistries(Set<RegistryRequest> requests)
     throws AmbariException;
+
+  /**
+   * Get information about specific software registry
+   * @param registryId registry id
+   *
+   * @return {@link Registry}
+   *
+   * @throws AmbariException thrown if the resource cannot be read
+   */
+  Registry getRegistry(Long registryId) throws AmbariException;
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 7b2c2ae..0302b5d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -514,7 +514,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
    * {@inheritDoc}
    */
   @Override
-  public RegistryResponse addRegistry(RegistryRequest request) {
+  public RegistryResponse addRegistry(RegistryRequest request) throws AmbariException {
     Registry registry = registryManager.addRegistry(
       request.getRegistryName(), request.getRegistryType(), request.getRegistryUri());
     return new RegistryResponse(registry);
@@ -533,6 +533,18 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
     return responses;
   }
 
+  /**
+   * {@inheritDoc}
+   * @param registryId registry id
+   *
+   * @return
+   * @throws AmbariException
+   */
+  @Override
+  public Registry getRegistry(final Long registryId) throws AmbariException {
+    return registryManager.getRegistry(registryId);
+  }
+
   private Set<RegistryResponse> getRegistries(RegistryRequest request)
     throws AmbariException {
     Set<RegistryResponse> responses;

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
index 06ab011..28c0d10 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java
@@ -101,9 +101,8 @@ import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.orm.DBAccessorImpl;
 import org.apache.ambari.server.orm.PersistenceType;
 import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
-import org.apache.ambari.server.registry.Registry;
 import org.apache.ambari.server.registry.RegistryFactory;
-import org.apache.ambari.server.registry.RegistryImpl;
+import org.apache.ambari.server.registry.RegistryFactoryImpl;
 import org.apache.ambari.server.registry.RegistryManager;
 import org.apache.ambari.server.registry.RegistryManagerImpl;
 import org.apache.ambari.server.scheduler.ExecutionScheduler;
@@ -500,9 +499,8 @@ public class ControllerModule extends AbstractModule {
     install(new FactoryModuleBuilder().build(MetricPropertyProviderFactory.class));
     install(new FactoryModuleBuilder().build(UpgradeContextFactory.class));
     install(new FactoryModuleBuilder().build(MpackManagerFactory.class));
-    install(new FactoryModuleBuilder().implement(
-      Registry.class, RegistryImpl.class).build(RegistryFactory.class));
 
+    bind(RegistryFactory.class).to(RegistryFactoryImpl.class);
     bind(HostRoleCommandFactory.class).to(HostRoleCommandFactoryImpl.class);
     bind(SecurityHelper.class).toInstance(SecurityHelperImpl.getInstance());
     bind(BlueprintFactory.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackRequest.java
new file mode 100644
index 0000000..d736d65
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackRequest.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+/**
+ * Request for registry mpack resource type.
+ */
+public class RegistryMpackRequest {
+  private Long registryId;
+  private String mpackName;
+
+  /**
+   * Constructor
+   * @param registryId  registry id
+   * @param mpackName   management pack name
+   */
+  public RegistryMpackRequest(Long registryId, String mpackName) {
+    this.registryId = registryId;
+    this.mpackName = mpackName;
+  }
+
+  /**
+   * Get registry id
+   * @return
+   */
+  public Long getRegistryId() {
+    return registryId;
+  }
+
+  /**
+   * Get registry mpack
+   * @return
+   */
+  public String getMpackName() {
+    return mpackName;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackResponse.java
new file mode 100644
index 0000000..b12a866
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackResponse.java
@@ -0,0 +1,111 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import org.apache.ambari.server.controller.internal.RegistryMpackResourceProvider;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Represents a registry mpack response.
+ */
+public class RegistryMpackResponse {
+  private Long registryId;
+  private String mpackName;
+  private String mpackDescription;
+  private String mpackLogoUrl;
+
+  /**
+   * Constructor
+   * @param registryId        registry id
+   * @param mpackName         mpack name
+   * @param mpackDescription  mpack description
+   * @param mpackLogoUrl      mpack logo url
+   */
+  public RegistryMpackResponse(Long registryId, String mpackName, String mpackDescription, String mpackLogoUrl) {
+    this.registryId = registryId;
+    this.mpackName = mpackName;
+    this.mpackDescription = mpackDescription;
+    this.mpackLogoUrl = mpackLogoUrl;
+  }
+
+  /**
+   * Get registry id
+   * @return registry id
+   */
+  public Long getRegistryId() {
+    return registryId;
+  }
+
+  /**
+   * Get mpack name
+   * @return mpack name
+   */
+  public String getMpackName() {
+    return mpackName;
+  }
+
+  /**
+   * Get mpack description
+   * @return mpack description
+   */
+  public String getMpackDescription() {
+    return mpackDescription;
+  }
+
+  /**
+   * Get mpack logo url
+   * @return mpack logo url
+   */
+  public String getMpackLogoUrl() {
+    return mpackLogoUrl;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public int hashCode() {
+    int result = 1;
+    result = 31 + getRegistryId().hashCode();
+    result = 31 + getMpackName().hashCode();
+    return result;
+  }
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public boolean equals(Object obj) {
+    if (!(obj instanceof RegistryMpackResponse)) {
+      return false;
+    }
+    if (this == obj) {
+      return true;
+    }
+    RegistryMpackResponse otherResponse = (RegistryMpackResponse) obj;
+    return (getRegistryId().equals(otherResponse.getRegistryId())
+      && getMpackName().equals(otherResponse.getMpackName()));
+  }
+
+  public interface RegistryMpackResponseWrapper extends ApiModel {
+    @ApiModelProperty(name = RegistryMpackResourceProvider.RESPONSE_KEY)
+    @SuppressWarnings("unused")
+    RegistryMpackResponse getRegistryMpackResponse();
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionRequest.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionRequest.java
new file mode 100644
index 0000000..5a5b61e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionRequest.java
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+/**
+ * Request for registry mpack resource version type.
+ */
+public class RegistryMpackVersionRequest {
+  private Long registryId;
+  private String mpackName;
+  private String mpackVersion;
+
+  /**
+   * Constructor
+   * @param registryId    registry id
+   * @param mpackName     mpack name
+   * @param mpackVersion  mpack version
+   */
+  public RegistryMpackVersionRequest(
+    Long registryId, String mpackName, String mpackVersion) {
+    this.registryId = registryId;
+    this.mpackName = mpackName;
+    this.mpackVersion = mpackVersion;
+  }
+
+  /**
+   * Get registry id
+   * @return
+   */
+  public Long getRegistryId() {
+    return registryId;
+  }
+
+  /**
+   * Get mpack name
+   * @return
+   */
+  public String getMpackName() {
+    return mpackName;
+  }
+
+  /**
+   * Get mpack version
+   * @return
+   */
+  public String getMpackVersion() {
+    return mpackVersion;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4450fd7e/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
new file mode 100644
index 0000000..a0674ee
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/RegistryMpackVersionResponse.java
@@ -0,0 +1,127 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.ambari.server.controller;
+
+import java.util.List;
+
+import org.apache.ambari.server.controller.internal.RegistryMpackVersionResourceProvider;
+import org.apache.ambari.server.registry.RegistryMpackCompatiblity;
+import org.apache.ambari.server.registry.RegistryMpackService;
+
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Represents a registry mpack version response
+ */
+public class RegistryMpackVersionResponse {
+  private Long registryId;
+  private String mpackName;
+  private String mpackVersion;
+  private String mpackBuildNumber;
+  private String mpackUrl;
+  private String mpackDocUrl;
+  private List<? extends RegistryMpackService> mpackServices;
+  private List<? extends RegistryMpackCompatiblity> compatibleMpacks;
+
+  /**
+   * Constructor
+   * @param registryId        registry id
+   * @param mpackName         mpack name
+   * @param mpackVersion      mpack version
+   * @param mpackBuildNumber  mpack build number
+   * @param mpackUrl          mpack download url
+   * @param mpackDocUrl       mpack documentation url
+   * @param mpackServices     list of mpack services
+   * @param compatibleMpacks  list of compatible mpacks
+   */
+  public RegistryMpackVersionResponse(
+    Long registryId, String mpackName, String mpackVersion, String mpackBuildNumber,
+    String mpackUrl, String mpackDocUrl,
+    List<? extends RegistryMpackService> mpackServices,
+    List<? extends RegistryMpackCompatiblity> compatibleMpacks) {
+    this.registryId = registryId;
+    this.mpackName = mpackName;
+    this.mpackVersion = mpackVersion;
+    this.mpackBuildNumber = mpackBuildNumber;
+    this.mpackUrl = mpackUrl;
+    this.mpackDocUrl = mpackDocUrl;
+    this.mpackServices = mpackServices;
+    this.compatibleMpacks = compatibleMpacks;
+  }
+
+  public Long getRegistryId() {
+    return registryId;
+  }
+
+  public String getMpackName() {
+    return mpackName;
+  }
+
+  public String getMpackVersion() {
+    return mpackVersion;
+  }
+
+  public String getMpackBuildNumber() {
+    return mpackBuildNumber;
+  }
+
+  public String getMpackUrl() {
+    return mpackUrl;
+  }
+
+  public String getMpackDocUrl() {
+    return mpackDocUrl;
+  }
+
+  public List<? extends RegistryMpackService> getMpackServices() {
+    return mpackServices;
+  }
+
+  public List<? extends RegistryMpackCompatiblity> getCompatibleMpacks() {
+    return compatibleMpacks;
+  }
+
+  @Override
+  public int hashCode() {
+    int result = 1;
+    result = 31 + getRegistryId().hashCode();
+    result = 31 + getMpackName().hashCode();
+    result = 31 + getMpackVersion().hashCode();
+    return result;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (!(obj instanceof RegistryMpackVersionResponse)) {
+      return false;
+    }
+    if (this == obj) {
+      return true;
+    }
+    RegistryMpackVersionResponse otherResponse = (RegistryMpackVersionResponse) obj;
+    return (getRegistryId().equals(otherResponse.getRegistryId())
+      && getMpackName().equals(otherResponse.getMpackName())
+      && getMpackVersion().equals(otherResponse.getMpackVersion()));
+  }
+
+  public interface RegistryMpackVersionResponseWrapper extends ApiModel {
+    @ApiModelProperty(name = RegistryMpackVersionResourceProvider.RESPONSE_KEY)
+    @SuppressWarnings("unused")
+    RegistryMpackVersionResponse getRegistryMpacVersionkResponse();
+  }
+}


Mime
View raw message