You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by di...@apache.org on 2016/01/11 20:15:49 UTC

[13/13] ambari git commit: AMBARI-12885: Dynamic stack extensions - install and upgrade support for custom services (tthorpe via dili)

AMBARI-12885: Dynamic stack extensions - install and upgrade support for custom services (tthorpe via dili)


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

Branch: refs/heads/AMBARI-12885
Commit: 647929db39b0093319270a4fc41966dd45f53ac7
Parents: 53583b2
Author: Di Li <di...@apache.org>
Authored: Mon Jan 11 14:11:50 2016 -0500
Committer: Di Li <di...@apache.org>
Committed: Mon Jan 11 14:11:50 2016 -0500

----------------------------------------------------------------------
 .../ambari_agent/CustomServiceOrchestrator.py   |   3 +-
 .../src/main/python/ambari_agent/FileCache.py   |   8 +
 ambari-server/conf/unix/ambari.properties       |   1 +
 .../ambari/server/api/query/QueryImpl.java      |   1 +
 .../server/api/query/render/BaseRenderer.java   |   4 +-
 .../api/query/render/DefaultRenderer.java       |   2 +
 ...nfigurationDependencyResourceDefinition.java |  44 ++
 ...xtensionConfigurationResourceDefinition.java |  55 ++
 .../ExtensionDependencyResourceDefinition.java  |  44 ++
 ...ionLevelConfigurationResourceDefinition.java |  44 ++
 .../ExtensionLinkResourceDefinition.java        |  55 ++
 ...ensionOperatingSystemResourceDefinition.java |  52 ++
 .../ExtensionRepositoryResourceDefinition.java  |  49 ++
 ...sionRepositoryVersionResourceDefinition.java |  46 ++
 .../resources/ExtensionResourceDefinition.java  |  54 ++
 ...nsionServiceComponentResourceDefinition.java |  47 ++
 .../ExtensionServiceResourceDefinition.java     |  60 ++
 .../ExtensionVersionResourceDefinition.java     |  56 ++
 .../resources/ResourceInstanceFactoryImpl.java  |  68 ++
 .../server/api/services/AmbariMetaInfo.java     | 518 ++++++++++++-
 ...atibleExtensionRepositoryVersionService.java | 114 +++
 .../api/services/ExtensionLinksService.java     |  97 +++
 .../ExtensionOperatingSystemService.java        | 127 +++
 .../services/ExtensionRepositoryService.java    | 161 ++++
 .../ExtensionRepositoryVersionService.java      | 160 ++++
 .../server/api/services/ExtensionsService.java  | 487 ++++++++++++
 .../server/api/services/StacksService.java      |  23 +
 .../stackadvisor/StackAdvisorHelper.java        |   4 +-
 .../server/configuration/Configuration.java     |   9 +
 .../AmbariCustomCommandExecutionHelper.java     |   3 +-
 .../controller/AmbariManagementController.java  | 138 ++++
 .../AmbariManagementControllerImpl.java         | 766 +++++++++++++++++-
 .../ambari/server/controller/AmbariServer.java  |   2 +
 .../server/controller/ControllerModule.java     |   2 +
 ...ExtensionConfigurationDependencyRequest.java |  44 ++
 ...xtensionConfigurationDependencyResponse.java |  95 +++
 .../ExtensionConfigurationRequest.java          |  43 +
 .../ExtensionConfigurationResponse.java         | 248 ++++++
 .../ExtensionLevelConfigurationRequest.java     |  42 +
 .../ExtensionLevelConfigurationResponse.java    |  45 ++
 .../server/controller/ExtensionLinkRequest.java |  81 ++
 .../controller/ExtensionLinkResponse.java       | 140 ++++
 .../ExtensionOperatingSystemRequest.java        |  47 ++
 .../ExtensionOperatingSystemResponse.java       |  63 ++
 .../controller/ExtensionRepositoryRequest.java  |  81 ++
 .../controller/ExtensionRepositoryResponse.java | 143 ++++
 .../server/controller/ExtensionRequest.java     |  38 +
 .../server/controller/ExtensionResponse.java    |  57 ++
 .../ExtensionServiceComponentRequest.java       |  40 +
 .../ExtensionServiceComponentResponse.java      | 387 +++++++++
 .../controller/ExtensionServiceRequest.java     |  42 +
 .../controller/ExtensionServiceResponse.java    | 200 +++++
 .../controller/ExtensionVersionRequest.java     |  40 +
 .../controller/ExtensionVersionResponse.java    | 218 ++++++
 .../controller/ResourceProviderFactory.java     |   3 +
 .../StackConfigurationDependencyResponse.java   |   6 +-
 .../controller/StackConfigurationResponse.java  |   6 +
 .../StackServiceComponentResponse.java          |  57 ++
 .../AbstractControllerResourceProvider.java     |  22 +
 ...ensionRepositoryVersionResourceProvider.java | 183 +++++
 .../internal/DefaultProviderModule.java         |   2 +
 .../server/controller/internal/Extension.java   | 777 +++++++++++++++++++
 .../ExtensionArtifactResourceProvider.java      | 658 ++++++++++++++++
 ...ConfigurationDependencyResourceProvider.java | 143 ++++
 .../ExtensionConfigurationResourceProvider.java | 194 +++++
 .../ExtensionDependencyResourceProvider.java    | 254 ++++++
 ...nsionLevelConfigurationResourceProvider.java | 177 +++++
 .../internal/ExtensionLinkResourceProvider.java | 261 +++++++
 ...xtensionOperatingSystemResourceProvider.java | 147 ++++
 .../ExtensionRepositoryResourceProvider.java    | 236 ++++++
 ...ensionRepositoryVersionResourceProvider.java | 523 +++++++++++++
 .../internal/ExtensionResourceProvider.java     | 116 +++
 ...tensionServiceComponentResourceProvider.java | 206 +++++
 .../ExtensionServiceResourceProvider.java       | 170 ++++
 .../ExtensionVersionResourceProvider.java       | 203 +++++
 .../server/controller/internal/RequestImpl.java |   1 +
 .../StackServiceComponentResourceProvider.java  |  30 +
 .../ambari/server/controller/spi/Resource.java  |  28 +
 .../controller/utilities/PropertyHelper.java    |  32 +-
 .../listeners/upgrade/StackVersionListener.java |   5 +
 .../orm/dao/ClusterExtensionVersionDAO.java     | 192 +++++
 .../ambari/server/orm/dao/ExtensionDAO.java     | 164 ++++
 .../ambari/server/orm/dao/ExtensionLinkDAO.java | 236 ++++++
 .../orm/dao/ExtensionRepositoryVersionDAO.java  | 171 ++++
 .../orm/dao/HostComponentDesiredStateDAO.java   |  15 +
 .../server/orm/dao/HostComponentStateDAO.java   |  15 +
 .../server/orm/dao/HostExtensionVersionDAO.java | 229 ++++++
 .../entities/ClusterConfigMappingEntity.java    |   2 +-
 .../entities/ClusterExtensionVersionEntity.java | 223 ++++++
 .../server/orm/entities/ExtensionEntity.java    | 152 ++++
 .../orm/entities/ExtensionLinkEntity.java       | 135 ++++
 .../ExtensionRepositoryVersionEntity.java       | 251 ++++++
 .../HostComponentDesiredStateEntity.java        |  18 +
 .../orm/entities/HostComponentStateEntity.java  |  24 +
 .../ambari/server/orm/entities/HostEntity.java  |  15 +-
 .../entities/HostExtensionVersionEntity.java    | 183 +++++
 .../orm/entities/RoleSuccessCriteriaEntity.java |   1 +
 .../apache/ambari/server/stack/BaseModule.java  |   4 +-
 .../server/stack/CommonServiceDirectory.java    |   7 +-
 .../ambari/server/stack/ComponentModule.java    |   3 +-
 .../server/stack/ConfigurationModule.java       |   3 +-
 .../ambari/server/stack/ExtensionDirectory.java | 494 ++++++++++++
 .../ambari/server/stack/ExtensionHelper.java    | 168 ++++
 .../ambari/server/stack/ExtensionModule.java    | 714 +++++++++++++++++
 .../server/stack/ModuleFileUnmarshaller.java    |  12 +
 .../ambari/server/stack/ServiceDirectory.java   | 111 ++-
 .../ambari/server/stack/ServiceModule.java      |  31 +-
 .../ambari/server/stack/StackContext.java       |  21 +-
 .../server/stack/StackDefinitionModule.java     |   3 +-
 .../ambari/server/stack/StackDirectory.java     |  14 +-
 .../ambari/server/stack/StackManager.java       | 298 ++++++-
 .../server/stack/StackManagerFactory.java       |   3 +
 .../apache/ambari/server/stack/StackModule.java | 253 +++++-
 .../server/stack/StackServiceDirectory.java     |   7 +-
 .../apache/ambari/server/stack/ThemeModule.java |   3 +-
 .../org/apache/ambari/server/state/Cluster.java |  44 ++
 .../ambari/server/state/ComponentInfo.java      |  58 ++
 .../apache/ambari/server/state/ExtensionId.java | 155 ++++
 .../ambari/server/state/ExtensionInfo.java      | 414 ++++++++++
 .../server/state/PropertyDependencyInfo.java    |   4 -
 .../server/state/ServiceComponentHost.java      |  13 +
 .../apache/ambari/server/state/ServiceInfo.java |  19 +
 .../apache/ambari/server/state/StackInfo.java   |  29 +
 .../server/state/cluster/ClusterImpl.java       | 471 ++++++++++-
 .../state/stack/AbstractLatestRepoCallable.java | 172 ++++
 .../state/stack/ExtensionMetainfoXml.java       | 184 +++++
 .../server/state/stack/ExtensionsXml.java       | 151 ++++
 .../stack/LatestExtensionRepoCallable.java      |  54 ++
 .../server/state/stack/LatestRepoCallable.java  | 142 +---
 .../server/state/stack/OperationType.java       |  28 +
 .../server/state/stack/ServiceMetainfoXml.java  |   4 +
 .../state/stack/StackRoleCommandOrder.java      |   2 -
 .../stack/upgrade/RepositoryVersionHelper.java  |  51 ++
 .../ExtensionServiceComponentHostSummary.java   | 132 ++++
 .../svccomphost/ServiceComponentHostImpl.java   | 130 +++-
 .../ServiceComponentHostSummary.java            |  34 +-
 .../ambari/server/upgrade/StackUpgradeUtil.java |   1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |  39 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |  69 +-
 .../src/main/resources/META-INF/persistence.xml |   5 +
 .../AMBARI_METRICS/0.1.0/metainfo.xml           |   1 +
 .../HBASE/0.96.0.2.0/metainfo.xml               |   1 +
 .../common-services/HDFS/2.1.0.2.0/metainfo.xml |   1 +
 .../ZOOKEEPER/3.4.5.2.0/metainfo.xml            |   2 +
 .../src/main/resources/key_properties.json      |  52 +-
 .../src/main/resources/properties.json          | 113 ++-
 .../resources/scripts/stack_layout_advisor.py   | 147 ++++
 .../stacks/HDP/2.3/services/HBASE/metainfo.xml  |   1 +
 .../stacks/HDP/2.3/services/HDFS/metainfo.xml   |   1 +
 .../src/main/resources/stacks/stack_advisor.py  |  13 +-
 .../resources/stacks/stack_layout_advisor.py    | 449 +++++++++++
 .../api/services/ExtensionsServiceTest.java     | 215 +++++
 .../internal/ExtensionResourceProviderTest.java |  91 +++
 .../server/stack/ComponentModuleTest.java       |   2 +-
 .../ambari/server/stack/ServiceModuleTest.java  |   2 +-
 .../stack/StackManagerCommonServicesTest.java   |  16 +-
 .../server/stack/StackManagerExtensionTest.java | 105 +++
 .../server/stack/StackManagerMiscTest.java      |  12 +-
 .../ambari/server/stack/StackManagerTest.java   |  47 +-
 .../ambari/server/stack/ThemeModuleTest.java    |   2 +-
 .../resources/extensions/EXT/0.1/metainfo.xml   |  26 +
 .../extensions/EXT/0.1/repos/repoinfo.xml       |  26 +
 .../OOZIE2/configuration/oozie2-site.xml        | 245 ++++++
 .../EXT/0.1/services/OOZIE2/metainfo.xml        | 110 +++
 .../0.1/services/OOZIE2/package/dummy-script.py |  20 +
 .../EXT/0.1/services/PIG2/metainfo.xml          |  26 +
 .../EXT/0.1/upgrades/upgrade_test.xml           | 240 ++++++
 .../resources/extensions/EXT/0.2/metainfo.xml   |  27 +
 .../extensions/EXT/0.2/repos/repoinfo.xml       |  26 +
 .../EXT/0.2/services/OOZIE2/metainfo.xml        | 110 +++
 .../EXT/0.2/upgrades/upgrade_test.xml           | 240 ++++++
 .../stacks/OTHER/1.0/services/PIG2/metainfo.xml |  30 +
 .../stacks_with_extensions/HDP/0.1/metainfo.xml |  22 +
 .../HDP/0.1/repos/repoinfo.xml                  |  57 ++
 .../HDP/0.1/services/HDFS/metainfo.xml          |  46 ++
 .../HDP/0.1/services/MAPREDUCE/metainfo.xml     |  23 +
 .../HDP/0.1/services/PIG/metainfo.xml           |  26 +
 .../HDP/0.2/extensions/EXT/0.2/metainfo.xml     |  27 +
 .../0.2/extensions/EXT/0.2/repos/repoinfo.xml   |  26 +
 .../EXT/0.2/services/OOZIE2/metainfo.xml        | 110 +++
 .../HDP/0.2/extensions/extensions.xml           |  23 +
 .../stacks_with_extensions/HDP/0.2/metainfo.xml |  22 +
 .../HDP/0.2/repos/repoinfo.xml                  |  57 ++
 .../HDP/0.2/services/HBASE/metainfo.xml         |  26 +
 .../0.2/services/HDFS/configuration/global.xml  | 145 ++++
 .../services/HDFS/configuration/hadoop-env.xml  | 223 ++++++
 .../services/HDFS/configuration/hbase-site.xml  | 137 ++++
 .../services/HDFS/configuration/hdfs-log4j.xml  | 199 +++++
 .../services/HDFS/configuration/hdfs-site.xml   | 396 ++++++++++
 .../HDP/0.2/services/HDFS/metainfo.xml          |  30 +
 .../0.2/services/HDFS/package/dummy-script.py   |  20 +
 .../HDP/0.2/services/HIVE/metainfo.xml          |  26 +
 .../HDP/0.2/services/MAPREDUCE/metainfo.xml     |  23 +
 .../HDP/0.2/services/OOZIE2/metainfo.xml        |  28 +
 .../HDP/0.2/services/ZOOKEEPER/metainfo.xml     |  26 +
 .../stack-select/src/main/py/stack-select.ini   |  85 ++
 196 files changed, 20324 insertions(+), 296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 6c1a161..e3e45ba 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -145,7 +145,8 @@ class CustomServiceOrchestrator():
 
         # forces a hash challenge on the directories to keep them updated, even
         # if the return type is not used
-        self.file_cache.get_host_scripts_base_dir(server_url_prefix)          
+        self.file_cache.get_host_scripts_base_dir(server_url_prefix)
+        self.file_cache.get_extensions_base_dir(command, server_url_prefix)
         hook_dir = self.file_cache.get_hook_base_dir(command, server_url_prefix)
         base_dir = self.file_cache.get_service_base_dir(command, server_url_prefix)
         

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-agent/src/main/python/ambari_agent/FileCache.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/FileCache.py b/ambari-agent/src/main/python/ambari_agent/FileCache.py
index b7c5dee..2cc78ec 100644
--- a/ambari-agent/src/main/python/ambari_agent/FileCache.py
+++ b/ambari-agent/src/main/python/ambari_agent/FileCache.py
@@ -43,6 +43,7 @@ class FileCache():
   ALERTS_CACHE_DIRECTORY="alerts"
   RECOVERY_CACHE_DIRECTORY="recovery"
   STACKS_CACHE_DIRECTORY="stacks"
+  EXTENSIONS_CACHE_DIRECTORY="extensions"
   COMMON_SERVICES_DIRECTORY="common-services"
   CUSTOM_ACTIONS_CACHE_DIRECTORY="custom_actions"
   HOST_SCRIPTS_CACHE_DIRECTORY="host_scripts"
@@ -68,6 +69,13 @@ class FileCache():
     self.uptodate_paths = [] # Paths that already have been recently checked
 
 
+  def get_extensions_base_dir(self, command, server_url_prefix):
+    """
+    Returns a base directory for extensions
+    """
+    return self.provide_directory(self.cache_dir, self.EXTENSIONS_CACHE_DIRECTORY,
+                                  server_url_prefix)
+
   def get_service_base_dir(self, command, server_url_prefix):
     """
     Returns a base directory for service

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index fd1b91e..4f775db 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -43,6 +43,7 @@ jce.download.supported=true
 
 metadata.path=/var/lib/ambari-server/resources/stacks
 common.services.path=/var/lib/ambari-server/resources/common-services
+extensions.path=/var/lib/ambari-server/resources/extensions
 server.version.file=/var/lib/ambari-server/resources/version
 webapp.dir=/usr/lib/ambari-server/web
 bootstrap.dir=/var/run/ambari-server/bootstrap

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
index 36ed189..27937f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/QueryImpl.java
@@ -701,6 +701,7 @@ public class QueryImpl implements Query, ResourceInstance {
     Set<String> finalizedProperties = node.getObject();
     query.requestedProperties.clear();
     // currently not exposing temporal information to renderer
+
     query.requestedProperties.addAll(finalizedProperties);
 
     for (TreeNode<Set<String>> child : node.getChildren()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/BaseRenderer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/BaseRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/BaseRenderer.java
index 03bce14..5deb928 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/BaseRenderer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/BaseRenderer.java
@@ -73,6 +73,7 @@ public abstract class BaseRenderer implements Renderer {
    */
   protected void copyPropertiesToResult(TreeNode<QueryInfo> queryTree, TreeNode<Set<String>> propertyTree) {
     for (TreeNode<QueryInfo> node : queryTree.getChildren()) {
+      Set<String> properties = node.getObject().getProperties();
       TreeNode<Set<String>> child = propertyTree.addChild(
           node.getObject().getProperties(), node.getName());
       copyPropertiesToResult(node, child);
@@ -86,7 +87,8 @@ public abstract class BaseRenderer implements Renderer {
    * @param properties    set of properties which pk will be added to
    */
   protected void addPrimaryKey(Resource.Type resourceType, Set<String> properties) {
-    properties.add(getSchema(resourceType).getKeyPropertyId(resourceType));
+    String property = getSchema(resourceType).getKeyPropertyId(resourceType);
+    properties.add(property);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/DefaultRenderer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/DefaultRenderer.java b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/DefaultRenderer.java
index 1b996a2..1d12bf0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/DefaultRenderer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/query/render/DefaultRenderer.java
@@ -40,6 +40,8 @@ public class DefaultRenderer extends BaseRenderer implements Renderer {
       TreeNode<QueryInfo> queryTree, boolean isCollection) {
 
     QueryInfo queryInfo = queryTree.getObject();
+    Set<String> properties = queryInfo.getProperties();
+
     TreeNode<Set<String>> resultTree = new TreeNodeImpl<Set<String>>(
         null, queryInfo.getProperties(), queryTree.getName());
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationDependencyResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationDependencyResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationDependencyResourceDefinition.java
new file mode 100644
index 0000000..0da5cdd
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationDependencyResourceDefinition.java
@@ -0,0 +1,44 @@
+/**
+ * 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.resources;
+
+import org.apache.ambari.server.controller.spi.Resource.Type;
+
+public class ExtensionConfigurationDependencyResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionConfigurationDependencyResourceDefinition(Type resourceType) {
+    super(resourceType);
+  }
+
+  public ExtensionConfigurationDependencyResourceDefinition() {
+    super(Type.ExtensionConfigurationDependency);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "dependencies";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "dependency";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationResourceDefinition.java
new file mode 100644
index 0000000..33bbe55
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionConfigurationResourceDefinition.java
@@ -0,0 +1,55 @@
+/**
+ * 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.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.Resource.Type;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ExtensionConfigurationResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionConfigurationResourceDefinition(Type resourceType) {
+    super(resourceType);
+  }
+
+  public ExtensionConfigurationResourceDefinition() {
+    super(Resource.Type.ExtensionConfiguration);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "configurations";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "configuration";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    Set<SubResourceDefinition> subs = new HashSet<SubResourceDefinition>();
+    subs.add(new SubResourceDefinition(Resource.Type.ExtensionConfigurationDependency));
+
+    return subs;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionDependencyResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionDependencyResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionDependencyResourceDefinition.java
new file mode 100644
index 0000000..1678ec1
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionDependencyResourceDefinition.java
@@ -0,0 +1,44 @@
+/**
+ * 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.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Extension Service Dependency Resource Definition.
+ */
+public class ExtensionDependencyResourceDefinition extends BaseResourceDefinition {
+
+  /**
+   * Constructor.
+   */
+  public ExtensionDependencyResourceDefinition() {
+    super(Resource.Type.ExtensionServiceComponentDependency);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "dependencies";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "dependency";
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLevelConfigurationResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLevelConfigurationResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLevelConfigurationResourceDefinition.java
new file mode 100644
index 0000000..7e36808
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLevelConfigurationResourceDefinition.java
@@ -0,0 +1,44 @@
+/**
+ * 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.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.Resource.Type;
+
+public class ExtensionLevelConfigurationResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionLevelConfigurationResourceDefinition(Type resourceType) {
+    super(Resource.Type.ExtensionLevelConfiguration);
+  }
+
+  public ExtensionLevelConfigurationResourceDefinition() {
+    super(Resource.Type.ExtensionLevelConfiguration);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "configurations";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "configuration";
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLinkResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLinkResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLinkResourceDefinition.java
new file mode 100644
index 0000000..de097b0
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionLinkResourceDefinition.java
@@ -0,0 +1,55 @@
+/**
+ * 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.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;
+
+public class ExtensionLinkResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionLinkResourceDefinition(Type resourceType) {
+    super(Resource.Type.ExtensionLink);
+  }
+
+  public ExtensionLinkResourceDefinition() {
+    super(Resource.Type.ExtensionLink);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "links";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "link";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    Set<SubResourceDefinition> setChildren = new HashSet<SubResourceDefinition>();
+    //setChildren.add(new SubResourceDefinition(Resource.Type.Stack));
+    //setChildren.add(new SubResourceDefinition(Resource.Type.Extension));
+    return setChildren;
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionOperatingSystemResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionOperatingSystemResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionOperatingSystemResourceDefinition.java
new file mode 100644
index 0000000..d2b7178
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionOperatingSystemResourceDefinition.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
+ *
+ *     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.resources;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.spi.Resource;
+import org.apache.ambari.server.controller.spi.Resource.Type;
+
+public class ExtensionOperatingSystemResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionOperatingSystemResourceDefinition(Type resourceType) {
+    super(resourceType);
+  }
+
+  public ExtensionOperatingSystemResourceDefinition() {
+    super(Resource.Type.ExtensionOperatingSystem);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "operating_systems";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "operating_system";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    return Collections.singleton(new SubResourceDefinition(Resource.Type.ExtensionRepository));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryResourceDefinition.java
new file mode 100644
index 0000000..08dab56
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryResourceDefinition.java
@@ -0,0 +1,49 @@
+/**
+ * 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.resources;
+
+import java.util.Collection;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+import com.google.common.collect.Sets;
+
+public class ExtensionRepositoryResourceDefinition extends BaseResourceDefinition {
+
+  public static String VALIDATE_ONLY_DIRECTIVE = "validate_only";
+
+  public ExtensionRepositoryResourceDefinition() {
+    super(Resource.Type.ExtensionRepository);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "repositories";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "repository";
+  }
+
+  @Override
+  public Collection<String> getCreateDirectives() {
+    return Sets.newHashSet(VALIDATE_ONLY_DIRECTIVE);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryVersionResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryVersionResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryVersionResourceDefinition.java
new file mode 100644
index 0000000..a81d63a
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionRepositoryVersionResourceDefinition.java
@@ -0,0 +1,46 @@
+/**
+ * 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.resources;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+public class ExtensionRepositoryVersionResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionRepositoryVersionResourceDefinition() {
+    super(Resource.Type.ExtensionRepositoryVersion);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "repository_versions";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "repository_version";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    return Collections.singleton(new SubResourceDefinition(Resource.Type.ExtensionOperatingSystem));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionResourceDefinition.java
new file mode 100644
index 0000000..f8a79c6
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionResourceDefinition.java
@@ -0,0 +1,54 @@
+/**
+ * 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.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;
+
+public class ExtensionResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionResourceDefinition(Type resourceType) {
+    super(Resource.Type.Extension);
+  }
+
+  public ExtensionResourceDefinition() {
+    super(Resource.Type.Extension);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "extensions";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "extension";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    Set<SubResourceDefinition> setChildren = new HashSet<SubResourceDefinition>();
+    setChildren.add(new SubResourceDefinition(Resource.Type.ExtensionVersion));
+    return setChildren;
+  }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceComponentResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceComponentResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceComponentResourceDefinition.java
new file mode 100644
index 0000000..552a38e
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceComponentResourceDefinition.java
@@ -0,0 +1,47 @@
+/**
+ * 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.resources;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+import java.util.Collections;
+import java.util.Set;
+
+public class ExtensionServiceComponentResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionServiceComponentResourceDefinition() {
+    super(Resource.Type.ExtensionServiceComponent);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "components";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "component";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+    return Collections.singleton(new SubResourceDefinition(
+        Resource.Type.ExtensionServiceComponentDependency));
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceResourceDefinition.java
new file mode 100644
index 0000000..a9f32bf
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionServiceResourceDefinition.java
@@ -0,0 +1,60 @@
+/**
+ * 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.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;
+
+public class ExtensionServiceResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionServiceResourceDefinition(Type resourceType) {
+    super(resourceType);
+  }
+
+  public ExtensionServiceResourceDefinition() {
+    super(Resource.Type.ExtensionService);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "services";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "service";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+
+    Set<SubResourceDefinition> setChildren = new HashSet<SubResourceDefinition>();
+    setChildren.add(new SubResourceDefinition(Resource.Type.ExtensionConfiguration));
+    setChildren.add(new SubResourceDefinition(Resource.Type.ExtensionServiceComponent));
+    setChildren.add(new SubResourceDefinition(Type.ExtensionArtifact));
+    setChildren.add(new SubResourceDefinition(Resource.Type.Theme));
+
+    return setChildren;
+
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionVersionResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionVersionResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionVersionResourceDefinition.java
new file mode 100644
index 0000000..33ee55d
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/resources/ExtensionVersionResourceDefinition.java
@@ -0,0 +1,56 @@
+/**
+ * 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.resources;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.ambari.server.controller.spi.Resource;
+
+public class ExtensionVersionResourceDefinition extends BaseResourceDefinition {
+
+  public ExtensionVersionResourceDefinition() {
+    super(Resource.Type.ExtensionVersion);
+  }
+
+  @Override
+  public String getPluralName() {
+    return "versions";
+  }
+
+  @Override
+  public String getSingularName() {
+    return "version";
+  }
+
+  @Override
+  public Set<SubResourceDefinition> getSubResourceDefinitions() {
+
+    Set<SubResourceDefinition> children = new HashSet<SubResourceDefinition>();
+
+    children.add(new SubResourceDefinition(Resource.Type.OperatingSystem));
+    children.add(new SubResourceDefinition(Resource.Type.ExtensionService));
+    children.add(new SubResourceDefinition(Resource.Type.ExtensionLevelConfiguration));
+    children.add(new SubResourceDefinition(Resource.Type.RepositoryVersion));
+    children.add(new SubResourceDefinition(Resource.Type.ExtensionArtifact));
+    children.add(new SubResourceDefinition(Resource.Type.CompatibleRepositoryVersion));
+
+    return children;
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/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 27609e7..70dcd0e 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
@@ -166,14 +166,58 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
         resourceDefinition = new StackConfigurationDependencyResourceDefinition();
         break;
 
+      case Extension:
+        resourceDefinition = new ExtensionResourceDefinition();
+        break;
+
+      case ExtensionLink:
+        resourceDefinition = new ExtensionLinkResourceDefinition();
+        break;
+
+      case ExtensionVersion:
+        resourceDefinition = new ExtensionVersionResourceDefinition();
+        break;
+
+      case ExtensionLevelConfiguration:
+        resourceDefinition = new ExtensionLevelConfigurationResourceDefinition();
+        break;
+
+      case ExtensionService:
+        resourceDefinition = new ExtensionServiceResourceDefinition();
+        break;
+
+      case ExtensionServiceComponent:
+        resourceDefinition = new ExtensionServiceComponentResourceDefinition();
+        break;
+
+      case ExtensionServiceComponentDependency:
+        resourceDefinition = new ExtensionDependencyResourceDefinition();
+        break;
+
+      case ExtensionConfiguration:
+        resourceDefinition = new ExtensionConfigurationResourceDefinition();
+        break;
+
+      case ExtensionConfigurationDependency:
+        resourceDefinition = new ExtensionConfigurationDependencyResourceDefinition();
+        break;
+
       case OperatingSystem:
         resourceDefinition = new OperatingSystemResourceDefinition();
         break;
 
+      case ExtensionOperatingSystem:
+        resourceDefinition = new ExtensionOperatingSystemResourceDefinition();
+        break;
+
       case Repository:
         resourceDefinition = new RepositoryResourceDefinition();
         break;
 
+      case ExtensionRepository:
+        resourceDefinition = new ExtensionRepositoryResourceDefinition();
+        break;
+
       case DRFeed:
         resourceDefinition = new FeedResourceDefinition();
         break;
@@ -319,6 +363,16 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
             Resource.Type.OperatingSystem);
         break;
 
+      case ExtensionRepositoryVersion:
+        resourceDefinition = new ExtensionRepositoryVersionResourceDefinition();
+        break;
+
+      case CompatibleExtensionRepositoryVersion:
+        resourceDefinition = new SimpleResourceDefinition(Resource.Type.CompatibleExtensionRepositoryVersion,
+            "compatible_repository_version", "compatible_repository_versions",
+            Resource.Type.ExtensionOperatingSystem);
+        break;
+
       case HostStackVersion:
         resourceDefinition = new ComponentStackVersionResourceDefinition(Resource.Type.HostStackVersion);
         break;
@@ -364,6 +418,20 @@ public class ResourceInstanceFactoryImpl implements ResourceInstanceFactory {
         };
         break;
 
+      case ExtensionArtifact:
+        resourceDefinition = new BaseResourceDefinition(Resource.Type.ExtensionArtifact) {
+          @Override
+          public String getPluralName() {
+            return "artifacts";
+          }
+
+          @Override
+          public String getSingularName() {
+            return "artifact";
+          }
+        };
+        break;
+
       case Artifact:
         resourceDefinition = new SimpleResourceDefinition(Resource.Type.Artifact, "artifact", "artifacts");
         break;

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
index e35e7ac..f1cc1a9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/AmbariMetaInfo.java
@@ -22,6 +22,7 @@ import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;
 import com.google.inject.Inject;
 import com.google.inject.Singleton;
+
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ParentObjectNotFoundException;
 import org.apache.ambari.server.StackAccessException;
@@ -44,6 +45,7 @@ import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.ComponentInfo;
 import org.apache.ambari.server.state.DependencyInfo;
+import org.apache.ambari.server.state.ExtensionInfo;
 import org.apache.ambari.server.state.OperatingSystemInfo;
 import org.apache.ambari.server.state.PropertyInfo;
 import org.apache.ambari.server.state.RepositoryInfo;
@@ -66,6 +68,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.xml.bind.JAXBException;
+
 import java.io.File;
 import java.io.FileReader;
 import java.io.FilenameFilter;
@@ -99,7 +102,7 @@ public class AmbariMetaInfo {
   public static final String SERVICE_ALERT_FILE_NAME = "alerts.json";
 
   /**
-   * The filename name for a Kerberos descriptor file at either the stack or service level
+   * The filename for a Kerberos descriptor file at either the stack or service level
    */
   public static final String KERBEROS_DESCRIPTOR_FILE_NAME = "kerberos.json";
 
@@ -147,6 +150,7 @@ public class AmbariMetaInfo {
 
   private File stackRoot;
   private File commonServicesRoot;
+  private File extensionsRoot;
   private File serverVersionFile;
   private File customActionRoot;
 
@@ -226,6 +230,11 @@ public class AmbariMetaInfo {
       commonServicesRoot = new File(commonServicesPath);
     }
 
+    String extensionsPath = conf.getExtensionsPath();
+    if (extensionsPath != null && !extensionsPath.isEmpty()) {
+      extensionsRoot = new File(extensionsPath);
+    }
+
     String serverVersionFilePath = conf.getServerVersionFilePath();
     serverVersionFile = new File(serverVersionFilePath);
 
@@ -244,7 +253,7 @@ public class AmbariMetaInfo {
 
     readServerVersion();
 
-    stackManager = stackManagerFactory.create(stackRoot, commonServicesRoot,
+    stackManager = stackManagerFactory.create(stackRoot, commonServicesRoot, extensionsRoot,
         osFamily);
 
     getCustomActionDefinitions(customActionRoot);
@@ -295,6 +304,52 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Get components by service
+   *
+   * @param stackName     stack name
+   * @param version       stack version
+   * @param serviceName   service name
+   * @return List of ComponentInfo objects
+   * @throws AmbariException
+   */
+  public List<ComponentInfo> getExtensionComponentsByService(String extensionName, String version, String serviceName)
+      throws AmbariException {
+
+    ServiceInfo service;
+    try {
+      service = getExtensionService(extensionName, version, serviceName);
+    } catch (StackAccessException e) {
+      throw new ParentObjectNotFoundException("Parent Service resource doesn't exist. extensionName=" +
+	  extensionName + ", extensionVersion=" + version + ", serviceName=" + serviceName);
+    }
+    return service.getComponents();
+  }
+
+  public ComponentInfo getExtensionComponent(String extensionName, String version, String serviceName,
+                                    String componentName) throws AmbariException {
+
+    ComponentInfo component = getExtensionService(extensionName, version, serviceName).getComponentByName(componentName);
+
+    if (component == null) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", serviceName=" + serviceName
+          + ", componentName=" + componentName);
+    }
+    return component;
+  }
+
+  public ComponentInfo getExtensionComponentSafe(String extensionName, String version, String serviceName,
+                                    String componentName) throws AmbariException {
+
+    ServiceInfo service = getExtensionServiceSafe(extensionName, version, serviceName);
+    if (service == null)
+	return null;
+
+    return service.getComponentByName(componentName);
+  }
+
+  /**
    * Get all dependencies for a component.
    *
    * @param stackName  stack name
@@ -318,6 +373,29 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Get all dependencies for a component.
+   *
+   * @param extensionName  extension name
+   * @param version        extension version
+   * @param service        service name
+   * @param component      component name
+   *
+   * @return List of dependencies for the given component
+   * @throws AmbariException if unable to obtain the dependencies for the component
+   */
+  public List<DependencyInfo> getExtensionComponentDependencies(String extensionName, String version,
+                                                       String service, String component)
+                                                       throws AmbariException {
+    ComponentInfo componentInfo;
+    try {
+      componentInfo = getExtensionComponent(extensionName, version, service, component);
+    } catch (StackAccessException e) {
+      throw new ParentObjectNotFoundException("Parent Component resource doesn't exist", e);
+    }
+    return componentInfo.getDependencies();
+  }
+
+  /**
    * Obtain a specific dependency by name.
    *
    * @param stackName       stack name
@@ -353,6 +431,75 @@ public class AmbariMetaInfo {
     return foundDependency;
   }
 
+  /**
+   * Obtain a specific dependency by name.
+   *
+   * @param extensionName       extension name
+   * @param version             extension version
+   * @param service             service name
+   * @param component           component name
+   * @param dependencyName      dependency component name
+   *
+   * @return the requested dependency
+   * @throws AmbariException if unable to obtain the requested dependency
+   */
+  public DependencyInfo getExtensionComponentDependency(String extensionName, String version, String service,
+                                               String component, String dependencyName) throws AmbariException {
+
+    DependencyInfo foundDependency = null;
+    List<DependencyInfo> componentDependencies = getComponentDependencies(
+        extensionName, version, service, component);
+    Iterator<DependencyInfo> iter = componentDependencies.iterator();
+    while (foundDependency == null && iter.hasNext()) {
+      DependencyInfo dependency = iter.next();
+      if (dependencyName.equals(dependency.getComponentName())) {
+        foundDependency = dependency;
+      }
+    }
+    if (foundDependency == null) {
+      throw new StackAccessException("stackName=" + extensionName
+          + ", stackVersion= " + version
+          + ", stackService=" + service
+          + ", stackComponent= " + component
+          + ", dependency=" + dependencyName);
+    }
+
+    return foundDependency;
+  }
+
+  public Map<String, List<RepositoryInfo>> getStackAndExtensionRepository(String stackName,
+                                                         String version) throws AmbariException {
+    StackInfo stack = getStack(stackName, version);
+    List<RepositoryInfo> repositories = stack.getRepositories();
+
+    Map<String, List<RepositoryInfo>> reposResult = new HashMap<String, List<RepositoryInfo>>();
+    for (RepositoryInfo repo : repositories) {
+      if (!reposResult.containsKey(repo.getOsType())) {
+        reposResult.put(repo.getOsType(),
+            new ArrayList<RepositoryInfo>());
+      }
+      reposResult.get(repo.getOsType()).add(repo);
+    }
+
+    Collection<ExtensionInfo> extensions = stack.getExtensions();
+
+    for (ExtensionInfo extension : extensions) {
+      addExtensionRepositories(extension, reposResult);
+    }
+
+    return reposResult;
+  }
+
+  private void addExtensionRepositories(ExtensionInfo extension, Map<String, List<RepositoryInfo>> reposResult) throws AmbariException {
+    List<RepositoryInfo> repositories = extension.getRepositories();
+    for (RepositoryInfo repo : repositories) {
+      if (!reposResult.containsKey(repo.getOsType())) {
+        reposResult.put(repo.getOsType(), new ArrayList<RepositoryInfo>());
+      }
+      reposResult.get(repo.getOsType()).add(repo);
+    }
+  }
+
   public Map<String, List<RepositoryInfo>> getRepository(String stackName,
                                                          String version) throws AmbariException {
     StackInfo stack = getStack(stackName, version);
@@ -411,6 +558,64 @@ public class AmbariMetaInfo {
     return repoResult;
   }
 
+  public Map<String, List<RepositoryInfo>> getExtensionRepository(String extensionName,
+                                                         String version) throws AmbariException {
+    ExtensionInfo extension = getExtension(extensionName, version);
+    List<RepositoryInfo> repository = extension.getRepositories();
+
+    Map<String, List<RepositoryInfo>> reposResult = new HashMap<String, List<RepositoryInfo>>();
+    for (RepositoryInfo repo : repository) {
+      if (!reposResult.containsKey(repo.getOsType())) {
+        reposResult.put(repo.getOsType(),
+            new ArrayList<RepositoryInfo>());
+      }
+      reposResult.get(repo.getOsType()).add(repo);
+    }
+    return reposResult;
+  }
+
+  public List<RepositoryInfo> getExtensionRepositories(String extensionName,
+                                              String version, String osType) throws AmbariException {
+
+    ExtensionInfo extension = getExtension(extensionName, version);
+    List<RepositoryInfo> repositories = extension.getRepositories();
+
+    List<RepositoryInfo> repositoriesResult = new ArrayList<RepositoryInfo>();
+    for (RepositoryInfo repository : repositories) {
+      if (repository.getOsType().equals(osType)) {
+        repositoriesResult.add(repository);
+      }
+    }
+    return repositoriesResult;
+  }
+
+  public RepositoryInfo getExtensionRepository(String extensionName,
+                                      String version, String osType, String repoId) throws AmbariException {
+
+    List<RepositoryInfo> repositories = getExtensionRepositories(extensionName, version, osType);
+
+    if (repositories.size() == 0) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", osType=" + osType
+          + ", repoId=" + repoId);
+    }
+
+    RepositoryInfo repoResult = null;
+    for (RepositoryInfo repository : repositories) {
+      if (repository.getRepoId().equals(repoId)) {
+        repoResult = repository;
+      }
+    }
+    if (repoResult == null) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion= " + version
+          + ", osType=" + osType
+          + ", repoId= " + repoId);
+    }
+    return repoResult;
+  }
+
   /*
    * function for given a stack name and version, is it a supported stack
    */
@@ -522,6 +727,50 @@ public class AmbariMetaInfo {
     return service;
   }
 
+  /**
+   * Given a stack name and version return all the services with info
+   *
+   * @param extensionName the stack name
+   * @param version   the version of the stack
+   * @return the information of abt various services that are supported in the stack
+   * @throws AmbariException
+   */
+  public Map<String, ServiceInfo> getExtensionServices(String extensionName, String version) throws AmbariException {
+
+    Map<String, ServiceInfo> servicesInfoResult = new HashMap<String, ServiceInfo>();
+
+    Collection<ServiceInfo> services;
+    ExtensionInfo extension;
+    try {
+      extension = getExtension(extensionName, version);
+    } catch (StackAccessException e) {
+      throw new ParentObjectNotFoundException("Parent Extension Version resource doesn't exist", e);
+    }
+
+    services = extension.getServices();
+    if (services != null) {
+      for (ServiceInfo service : services) {
+        servicesInfoResult.put(service.getName(), service);
+      }
+    }
+    return servicesInfoResult;
+  }
+
+  public ServiceInfo getExtensionService(String extensionName, String version, String serviceName) throws AmbariException {
+    ServiceInfo service = getExtension(extensionName, version).getService(serviceName);
+
+    if (service == null) {
+      throw new StackAccessException("extensionName=" + extensionName + ", extensionVersion=" +
+                                     version + ", serviceName=" + serviceName);
+    }
+
+    return service;
+  }
+
+  public ServiceInfo getExtensionServiceSafe(String extensionName, String version, String serviceName) throws AmbariException {
+    return getExtension(extensionName, version).getService(serviceName);
+  }
+
   public Collection<String> getMonitoringServiceNames(String stackName, String version)
     throws AmbariException{
 
@@ -618,18 +867,93 @@ public class AmbariMetaInfo {
     return parents;
   }
 
+  public Collection<ExtensionInfo> getExtensions() {
+    return stackManager.getExtensions();
+  }
+
+  public Collection<ExtensionInfo> getExtensions(String extensionName) throws AmbariException {
+    Collection<ExtensionInfo> extensions = stackManager.getExtensions(extensionName);
+
+    if (extensions.isEmpty()) {
+      throw new StackAccessException("extensionName=" + extensionName);
+    }
+
+    return extensions;
+  }
+
+  public ExtensionInfo getExtension(String extensionName, String version) throws AmbariException {
+    ExtensionInfo result = stackManager.getExtension(extensionName, version);
+
+    if (result == null) {
+      throw new StackAccessException("Extension " + extensionName + " " + version + " is not found in Ambari metainfo");
+    }
+
+    return result;
+  }
+
+  public ExtensionInfo getExtensionByStackService(String stackName, String stackVersion, String serviceName) throws AmbariException {
+    StackInfo stack = stackManager.getStack(stackName, stackVersion);
+
+    if (stack == null) {
+      throw new StackAccessException("Stack " + stackName + " " + stackVersion + " is not found in Ambari metainfo");
+    }
+
+    return stack.getExtensionByService(serviceName);
+  }
+
   public Set<PropertyInfo> getServiceProperties(String stackName, String version, String serviceName)
       throws AmbariException {
 
     return new HashSet<PropertyInfo>(getService(stackName, version, serviceName).getProperties());
   }
 
+  public Set<PropertyInfo> getExtensionServiceProperties(String extensionName, String version, String serviceName)
+      throws AmbariException {
+
+    return new HashSet<PropertyInfo>(getExtensionService(extensionName, version, serviceName).getProperties());
+  }
+
   public Set<PropertyInfo> getStackProperties(String stackName, String version)
       throws AmbariException {
 
     return new HashSet<PropertyInfo>(getStack(stackName, version).getProperties());
   }
 
+  public Set<PropertyInfo> getExtensionProperties(String extensionName, String version)
+      throws AmbariException {
+
+    return new HashSet<PropertyInfo>(getExtension(extensionName, version).getProperties());
+  }
+
+  public Set<PropertyInfo> getPropertiesForExtensionServiceByName(String extensionName, String version, String serviceName, String propertyName)
+      throws AmbariException {
+    Set<PropertyInfo> properties = getExtensionServiceProperties(extensionName, version, serviceName);
+
+    if (properties.size() == 0) {
+      throw new StackAccessException("stackName=" + extensionName
+          + ", stackVersion=" + version
+          + ", serviceName=" + serviceName
+          + ", propertyName=" + propertyName);
+    }
+
+    Set<PropertyInfo> propertyResult = new HashSet<PropertyInfo>();
+
+    for (PropertyInfo property : properties) {
+      if (property.getName().equals(propertyName)) {
+        propertyResult.add(property);
+      }
+    }
+
+    if (propertyResult.isEmpty()) {
+      throw new StackAccessException("stackName=" + extensionName
+          + ", stackVersion=" + version
+          + ", serviceName=" + serviceName
+          + ", propertyName=" + propertyName);
+    }
+
+    return propertyResult;
+  }
+
   public Set<PropertyInfo> getPropertiesByName(String stackName, String version, String serviceName, String propertyName)
       throws AmbariException {
 
@@ -689,6 +1013,32 @@ public class AmbariMetaInfo {
     return propertyResult;
   }
 
+  public Set<PropertyInfo> getExtensionPropertiesByName(String extensionName, String version, String propertyName)
+      throws AmbariException {
+    Set<PropertyInfo> properties = getExtensionProperties(extensionName, version);
+
+    if (properties.size() == 0) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", propertyName=" + propertyName);
+    }
+
+    Set<PropertyInfo> propertyResult = new HashSet<PropertyInfo>();
+
+    for (PropertyInfo property : properties) {
+      if (property.getName().equals(propertyName)) {
+        propertyResult.add(property);
+      }
+    }
+
+    if (propertyResult.isEmpty()) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", propertyName=" + propertyName);
+    }
+
+    return propertyResult;
+  }
 
   /**
    * Lists operatingsystems supported by stack
@@ -706,6 +1056,22 @@ public class AmbariMetaInfo {
     return operatingSystems;
   }
 
+  /**
+   * Lists operatingsystems supported by extension
+   */
+  public Set<OperatingSystemInfo> getExtensionOperatingSystems(String extensionName, String version)
+      throws AmbariException {
+
+    Set<OperatingSystemInfo> operatingSystems = new HashSet<OperatingSystemInfo>();
+    ExtensionInfo extension = getExtension(extensionName, version);
+    List<RepositoryInfo> repositories = extension.getRepositories();
+    for (RepositoryInfo repository : repositories) {
+      operatingSystems.add(new OperatingSystemInfo(repository.getOsType()));
+    }
+
+    return operatingSystems;
+  }
+
   public OperatingSystemInfo getOperatingSystem(String stackName, String version, String osType)
       throws AmbariException {
 
@@ -735,6 +1101,35 @@ public class AmbariMetaInfo {
     return resultOperatingSystem;
   }
 
+  public OperatingSystemInfo getExtensionOperatingSystem(String extensionName, String version, String osType)
+      throws AmbariException {
+
+    Set<OperatingSystemInfo> operatingSystems = getOperatingSystems(extensionName, version);
+
+    if (operatingSystems.size() == 0) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", osType=" + osType);
+    }
+
+    OperatingSystemInfo resultOperatingSystem = null;
+
+    for (OperatingSystemInfo operatingSystem : operatingSystems) {
+      if (operatingSystem.getOsType().equals(osType)) {
+        resultOperatingSystem = operatingSystem;
+        break;
+      }
+    }
+
+    if (resultOperatingSystem == null) {
+      throw new StackAccessException("extensionName=" + extensionName
+          + ", extensionVersion=" + version
+          + ", osType=" + osType);
+    }
+
+    return resultOperatingSystem;
+  }
+
   private void readServerVersion() throws Exception {
     File versionFile = serverVersionFile;
     if (!versionFile.exists()) {
@@ -847,10 +1242,51 @@ public class AmbariMetaInfo {
     }
   }
 
+  /**
+   * @param extensionName the extension name
+   * @param extensionVersion the extension version
+   * @param osType the os
+   * @param repoId the repo id
+   * @param newBaseUrl the new base url
+   */
+  public void updateExtensionRepoBaseURL(String extensionName,
+      String extensionVersion, String osType, String repoId, String newBaseUrl) throws AmbariException {
+
+    // validate existing
+    RepositoryInfo ri = getExtensionRepository(extensionName, extensionVersion, osType, repoId);
+
+    if (!extensionsRoot.exists()) {
+      throw new StackAccessException("Extensions root does not exist.");
+    }
+
+    ri.setBaseUrl(newBaseUrl);
+
+    if (null != metaInfoDAO) {
+      String metaKey = generateRepoMetaKey(extensionName, extensionVersion, osType,
+          repoId, REPOSITORY_XML_PROPERTY_BASEURL);
+
+      MetainfoEntity entity = new MetainfoEntity();
+      entity.setMetainfoName(metaKey);
+      entity.setMetainfoValue(newBaseUrl);
+
+      // !!! need a way to remove
+      if (newBaseUrl.equals("")) {
+        metaInfoDAO.remove(entity);
+      } else {
+        metaInfoDAO.merge(entity);
+        ri.setBaseUrlFromSaved(true);
+      }
+    }
+  }
+
   public File getStackRoot() {
     return stackRoot;
   }
 
+  public File getExtensionsRoot() {
+    return extensionsRoot;
+  }
+
   /**
    * Return metrics for a stack service.
    */
@@ -890,6 +1326,44 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Return metrics for a stack service.
+   */
+  public Map<String, Map<String, List<MetricDefinition>>> getExtensionServiceMetrics(String extensionName,
+            String version, String serviceName) throws AmbariException {
+
+    ServiceInfo svc = getExtensionService(extensionName, version, serviceName);
+
+    if (null == svc.getMetricsFile() || !svc.getMetricsFile().exists()) {
+      LOG.debug("Metrics file for " + extensionName + "/" + version + "/" + serviceName + " not found.");
+      return null;
+    }
+
+    Map<String, Map<String, List<MetricDefinition>>> map = svc.getMetrics();
+
+    // check for cached
+    if (null == map) {
+      // data layout:
+      // "DATANODE" -> "Component" -> [ MetricDefinition, MetricDefinition, ... ]
+      //           \-> "HostComponent" -> [ MetricDefinition, ... ]
+      Type type = new TypeToken<Map<String, Map<String, List<MetricDefinition>>>>(){}.getType();
+
+      Gson gson = new Gson();
+
+      try {
+        map = gson.fromJson(new FileReader(svc.getMetricsFile()), type);
+
+        svc.setMetrics(updateComponentMetricMapWithAggregateFunctionIds(map));
+
+      } catch (Exception e) {
+        LOG.error ("Could not read the metrics file", e);
+        throw new AmbariException("Could not read metrics file", e);
+      }
+    }
+
+    return map;
+  }
+
+  /**
    * Add aggregate function support for all stack defined metrics.
    */
   private Map<String, Map<String, List<MetricDefinition>>> updateComponentMetricMapWithAggregateFunctionIds(
@@ -959,6 +1433,26 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Gets the metrics for a Role (component).
+   * @return the list of defined metrics.
+   */
+  public List<MetricDefinition> getExtensionMetrics(String extensionName, String version,
+      String serviceName, String componentName, String metricType)
+      throws AmbariException {
+
+    Map<String, Map<String, List<MetricDefinition>>> map =
+      getExtensionServiceMetrics(extensionName, version, serviceName);
+
+    if (map != null && map.containsKey(componentName)) {
+      if (map.get(componentName).containsKey(metricType)) {
+        return map.get(componentName).get(metricType);
+      }
+    }
+
+	  return null;
+  }
+
+  /**
    * Gets the alert definitions for the specified stack and service.
    *
    * @param stackName
@@ -1225,6 +1719,26 @@ public class AmbariMetaInfo {
   }
 
   /**
+   * Get all upgrade packs available for an extension.
+   *
+   * @param extensionName the extension name
+   * @param extensionVersion the extension version
+   * @return a map of upgrade packs, keyed by the name of the upgrade pack
+   */
+  public Map<String, UpgradePack> getExtensionUpgradePacks(String extensionName, String extensionVersion) {
+    try {
+      ExtensionInfo extension = getExtension(extensionName, extensionVersion);
+      return extension.getUpgradePacks() == null ?
+          Collections.<String, UpgradePack>emptyMap() : extension.getUpgradePacks();
+
+    } catch (AmbariException e) {
+      LOG.debug("Cannot load upgrade packs for non-existent extension {}-{}", extensionName, extensionVersion, e);
+    }
+
+    return Collections.emptyMap();
+  }
+
+  /**
    * Gets the fully compiled Kerberos descriptor for the relevant stack and version.
    * <p/>
    * All of the kerberos.json files from the specified stack (and version) are read, parsed and

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/CompatibleExtensionRepositoryVersionService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/CompatibleExtensionRepositoryVersionService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/CompatibleExtensionRepositoryVersionService.java
new file mode 100644
index 0000000..56c2f69
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/CompatibleExtensionRepositoryVersionService.java
@@ -0,0 +1,114 @@
+/**
+ * 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 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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service responsible for compatible repository versions requests for a stack.
+ */
+public class CompatibleExtensionRepositoryVersionService extends BaseService {
+
+  /**
+   * Extra properties to be inserted into created resource.
+   */
+  private Map<Resource.Type, String> parentKeyProperties;
+
+  /**
+   * Constructor.
+   *
+   * @param parentProperties extra properties to be inserted into created resource
+   */
+  public CompatibleExtensionRepositoryVersionService(Map<Resource.Type, String> parentProperties) {
+    parentKeyProperties = parentProperties;
+  }
+
+  /**
+   * Gets all repository versions.
+   * Handles: GET /compatible_repository_versions requests.
+   *
+   * @param headers http headers
+   * @param ui      uri info
+   */
+  @GET
+  @Produces("text/plain")
+  public Response getRepositoryVersions(@Context HttpHeaders headers, @Context UriInfo ui) {
+    return handleRequest(headers, null, ui, Request.Type.GET, createResource(null));
+  }
+
+  /**
+   * Gets a single repository version.
+   * Handles: GET /compatible_repository_versions/{repositoryVersionId} requests.
+   *
+   * @param headers               http headers
+   * @param ui                    uri info
+   * @param repositoryVersionId   the repository version id
+   * @return information regarding the specified repository
+   */
+  @GET
+  @Path("{repositoryVersionId}")
+  @Produces("text/plain")
+  public Response getRepositoryVersion(@Context HttpHeaders headers,
+      @Context UriInfo ui,
+      @PathParam("repositoryVersionId") String repositoryVersionId) {
+    return handleRequest(headers, null, ui, Request.Type.GET, createResource(repositoryVersionId));
+  }
+
+  /**
+   * Handles ANY /{repositoryVersionId}/operating_systems requests.
+   *
+   * @param repositoryVersionId the repository version id
+   * @return operating systems service
+   */
+  @Path("{repositoryVersionId}/operating_systems")
+  public ExtensionOperatingSystemService getOperatingSystemsHandler(@PathParam("repositoryVersionId") String repositoryVersionId) {
+    Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+    mapIds.putAll(parentKeyProperties);
+    mapIds.put(Resource.Type.CompatibleExtensionRepositoryVersion, repositoryVersionId);
+
+    return new ExtensionOperatingSystemService(mapIds);
+  }
+
+  /**
+   * Create a repository version resource instance.
+   *
+   * @param repositoryVersionId repository version id
+   *
+   * @return a repository resource instance
+   */
+  private ResourceInstance createResource(String repositoryVersionId) {
+    Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+    mapIds.putAll(parentKeyProperties);
+    mapIds.put(Resource.Type.CompatibleExtensionRepositoryVersion, repositoryVersionId);
+
+    return createResource(Resource.Type.CompatibleExtensionRepositoryVersion, mapIds);
+  }
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/647929db/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionLinksService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionLinksService.java b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionLinksService.java
new file mode 100644
index 0000000..b0786d1
--- /dev/null
+++ b/ambari-server/src/main/java/org/apache/ambari/server/api/services/ExtensionLinksService.java
@@ -0,0 +1,97 @@
+/**
+ * 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 java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+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.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.ambari.server.api.resources.ResourceInstance;
+import org.apache.ambari.server.controller.spi.Resource;
+
+/**
+ * Service for extension link management.
+ */
+@Path("/links/")
+public class ExtensionLinksService extends BaseService {
+
+  @GET
+  @Produces("text/plain")
+  public Response getExtensionLinks(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET, createExtensionLinkResource(null));
+  }
+
+  @GET
+  @Path("{linkId}")
+  @Produces("text/plain")
+  public Response getExtensionLink(String body, @Context HttpHeaders headers,
+                                  @Context UriInfo ui, @PathParam("linkId") String linkId) {
+
+    return handleRequest(headers, body, ui, Request.Type.GET, createExtensionLinkResource(linkId));
+  }
+
+  @POST
+  @Produces("text/plain")
+  public Response createExtensionLink(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+    return handleRequest(headers, body, ui, Request.Type.POST, createExtensionLinkResource(null));
+  }
+
+  @DELETE
+  @Path("{linkId}")
+  @Produces("text/plain")
+  public Response deleteExtensionLink(@Context HttpHeaders headers, @Context UriInfo ui,
+                                @PathParam("linkId") String linkId) {
+
+    return handleRequest(headers, null, ui, Request.Type.DELETE, createExtensionLinkResource(linkId));
+  }
+
+  @PUT
+  @Produces("text/plain")
+  public Response updateExtensionLink(String body, @Context HttpHeaders headers, @Context UriInfo ui) {
+    return handleRequest(headers, body, ui, Request.Type.PUT, createExtensionLinkResource(null));
+  }
+
+  @PUT
+  @Path("{linkId}")
+  @Produces("text/plain")
+  public Response updateExtensionLink(String body, @Context HttpHeaders headers, @Context UriInfo ui,
+          @PathParam("linkId") String linkId) {
+
+    return handleRequest(headers, body, ui, Request.Type.PUT, createExtensionLinkResource(linkId));
+  }
+
+  ResourceInstance createExtensionLinkResource(String linkId) {
+    Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+    mapIds.put(Resource.Type.ExtensionLink, linkId);
+    return createResource(Resource.Type.ExtensionLink, mapIds);
+  }
+
+}