ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject [05/51] [partial] AMBARI-7621. Import initial contribution for Ambari support on Windows to branch-windows-dev. (Jayush Luniya and Florian Barca via yusaku)
Date Tue, 07 Oct 2014 22:52:33 GMT
http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
index f40979c..464f116 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java
@@ -23,14 +23,18 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
 import org.apache.ambari.server.api.services.PersistKeyValueService;
-import org.apache.ambari.server.controller.*;
+import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.ClusterRequest;
+import org.apache.ambari.server.controller.ClusterResponse;
+import org.apache.ambari.server.controller.ConfigGroupRequest;
+import org.apache.ambari.server.controller.ConfigurationRequest;
+import org.apache.ambari.server.controller.RequestStatusResponse;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -43,14 +47,11 @@ import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.orm.dao.BlueprintDAO;
-import org.apache.ambari.server.orm.entities.BlueprintConfigEntity;
 import org.apache.ambari.server.orm.entities.BlueprintEntity;
 import org.apache.ambari.server.orm.entities.HostGroupEntity;
 import org.apache.ambari.server.state.Config;
-import org.apache.ambari.server.state.ConfigHelper;
 import org.apache.ambari.server.state.ConfigImpl;
 import org.apache.ambari.server.state.PropertyInfo;
-import org.apache.ambari.server.state.StackId;
 
 /**
  * Resource provider for cluster resources.
@@ -62,35 +63,27 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
   // Clusters
   protected static final String CLUSTER_ID_PROPERTY_ID      = PropertyHelper.getPropertyId("Clusters", "cluster_id");
   protected static final String CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("Clusters", "cluster_name");
-  protected static final String CLUSTER_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "version");
+  protected static final String CLUSTER_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "version");  
   protected static final String CLUSTER_PROVISIONING_STATE_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "provisioning_state");
   protected static final String CLUSTER_DESIRED_CONFIGS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "desired_configs");
-  protected static final String CLUSTER_DESIRED_SERVICE_CONFIG_VERSIONS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "desired_service_config_versions");
   protected static final String CLUSTER_TOTAL_HOSTS_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "total_hosts");
   protected static final String CLUSTER_HEALTH_REPORT_PROPERTY_ID = PropertyHelper.getPropertyId("Clusters", "health_report");
   protected static final String BLUEPRINT_PROPERTY_ID = PropertyHelper.getPropertyId(null, "blueprint");
 
-  /**
-   * Request info property ID.  Allow internal getResources call to bypass permissions check.
-   */
-  public static final String GET_IGNORE_PERMISSIONS_PROPERTY_ID = "get_resource/ignore_permissions";
-
-  /**
-   * The cluster primary key properties.
-   */
   private static Set<String> pkPropertyIds =
       new HashSet<String>(Arrays.asList(new String[]{CLUSTER_ID_PROPERTY_ID}));
 
+   /**
+   * Maps properties to updaters which update the property when provisioning a cluster via a blueprint
+   */
+  private Map<String, PropertyUpdater> propertyUpdaters =
+      new HashMap<String, PropertyUpdater>();
+
   /**
    * Maps configuration type (string) to associated properties
    */
   private Map<String, Map<String, String>> mapClusterConfigurations =
       new HashMap<String, Map<String, String>>();
-  /**
-   * Maps configuration type (string) to property attributes, and their values
-   */
-  private Map<String, Map<String, Map<String, String>>> mapClusterAttributes =
-      new HashMap<String, Map<String, Map<String, String>>>();
 
 
   // ----- Constructors ----------------------------------------------------
@@ -107,10 +100,21 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
                           AmbariManagementController managementController) {
 
     super(propertyIds, keyPropertyIds, managementController);
+    registerPropertyUpdaters();
+  }
+
+  /**
+   * Inject the blueprint data access object which is used to obtain blueprint entities.
+   *
+   * @param dao  blueprint data access object
+   */
+  public static void init(BlueprintDAO dao, AmbariMetaInfo metaInfo) {
+    blueprintDAO = dao;
+    stackInfo    = metaInfo;
   }
 
 
-  // ----- ResourceProvider ------------------------------------------------
+// ----- ResourceProvider ------------------------------------------------
 
   @Override
   public RequestStatus createResources(Request request)
@@ -159,26 +163,16 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
       LOG.debug("Found clusters matching getClusters request"
           + ", clusterResponseCount=" + responses.size());
     }
-
-    // Allow internal call to bypass permissions check.
-    Map<String, String> requestInfoProperties = request.getRequestInfoProperties();
-    boolean ignorePermissions = requestInfoProperties == null ? false :
-        Boolean.valueOf(requestInfoProperties.get(GET_IGNORE_PERMISSIONS_PROPERTY_ID));
-
+    
     for (ClusterResponse response : responses) {
-
-      String clusterName = response.getClusterName();
-
       Resource resource = new ResourceImpl(Resource.Type.Cluster);
       setResourceProperty(resource, CLUSTER_ID_PROPERTY_ID, response.getClusterId(), requestedIds);
-      setResourceProperty(resource, CLUSTER_NAME_PROPERTY_ID, clusterName, requestedIds);
+      setResourceProperty(resource, CLUSTER_NAME_PROPERTY_ID, response.getClusterName(), requestedIds);
       setResourceProperty(resource, CLUSTER_PROVISIONING_STATE_PROPERTY_ID, response.getProvisioningState(), requestedIds);
       setResourceProperty(resource, CLUSTER_DESIRED_CONFIGS_PROPERTY_ID, response.getDesiredConfigs(), requestedIds);
-      setResourceProperty(resource, CLUSTER_DESIRED_SERVICE_CONFIG_VERSIONS_PROPERTY_ID,
-        response.getDesiredServiceConfigVersions(), requestedIds);
       setResourceProperty(resource, CLUSTER_TOTAL_HOSTS_PROPERTY_ID, response.getTotalHosts(), requestedIds);
       setResourceProperty(resource, CLUSTER_HEALTH_REPORT_PROPERTY_ID, response.getClusterHealthReport(), requestedIds);
-
+      
       resource.setProperty(CLUSTER_VERSION_PROPERTY_ID,
           response.getDesiredStackVersion());
 
@@ -186,9 +180,8 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
         LOG.debug("Adding ClusterResponse to resource"
             + ", clusterResponse=" + response.toString());
       }
-      if (ignorePermissions || includeCluster(clusterName, true)) {
-        resources.add(resource);
-      }
+
+      resources.add(resource);
     }
     return resources;
   }
@@ -203,10 +196,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     for (Map<String, Object> requestPropertyMap : request.getProperties()) {
       Set<Map<String, Object>> propertyMaps = getPropertyMaps(requestPropertyMap, predicate);
       for (Map<String, Object> propertyMap : propertyMaps) {
-        ClusterRequest clusterRequest = getRequest(propertyMap);
-        if (includeCluster(clusterRequest.getClusterName(), false)) {
-          requests.add(clusterRequest);
-        }
+        requests.add(getRequest(propertyMap));
       }
     }
     response = modifyResources(new Command<RequestStatusResponse>() {
@@ -216,42 +206,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
       }
     });
     notifyUpdate(Resource.Type.Cluster, request, predicate);
-
-    Set<Resource> associatedResources = null;
-    for (ClusterRequest clusterRequest : requests) {
-      ClusterResponse updateResults = getManagementController().getClusterUpdateResults(clusterRequest);
-      if (updateResults != null) {
-        Map<String, Collection<ServiceConfigVersionResponse>> serviceConfigVersions = updateResults.getDesiredServiceConfigVersions();
-        if (serviceConfigVersions != null) {
-          associatedResources = new HashSet<Resource>();
-          for (Collection<ServiceConfigVersionResponse> scvCollection : serviceConfigVersions.values()) {
-            for (ServiceConfigVersionResponse serviceConfigVersionResponse : scvCollection) {
-              Resource resource = new ResourceImpl(Resource.Type.ServiceConfigVersion);
-              resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_SERVICE_NAME_PROPERTY_ID,
-                serviceConfigVersionResponse.getServiceName());
-              resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_PROPERTY_ID,
-                serviceConfigVersionResponse.getVersion());
-              resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_NOTE_PROPERTY_ID,
-                serviceConfigVersionResponse.getNote());
-              resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_GROUP_ID_PROPERTY_ID,
-                  serviceConfigVersionResponse.getGroupId());
-              resource.setProperty(ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_GROUP_NAME_PROPERTY_ID,
-                  serviceConfigVersionResponse.getGroupName());
-              if (serviceConfigVersionResponse.getConfigurations() != null) {
-                resource.setProperty(
-                  ServiceConfigVersionResourceProvider.SERVICE_CONFIG_VERSION_CONFIGURATIONS_PROPERTY_ID,
-                  serviceConfigVersionResponse.getConfigurations());
-              }
-              associatedResources.add(resource);
-            }
-          }
-
-        }
-      }
-    }
-
-
-    return getRequestStatus(response, associatedResources);
+    return getRequestStatus(response);
   }
 
   @Override
@@ -260,15 +215,13 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
 
     for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
       final ClusterRequest clusterRequest = getRequest(propertyMap);
-      if (includeCluster(clusterRequest.getClusterName(), false)) {
-        modifyResources(new Command<Void>() {
-          @Override
-          public Void invoke() throws AmbariException {
-            getManagementController().deleteCluster(clusterRequest);
-            return null;
-          }
-        });
-      }
+      modifyResources(new Command<Void>() {
+        @Override
+        public Void invoke() throws AmbariException {
+          getManagementController().deleteCluster(clusterRequest);
+          return null;
+        }
+      });
     }
     notifyDelete(Resource.Type.Cluster, predicate);
     return getRequestStatus(null);
@@ -295,32 +248,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     return checkConfigPropertyIds(baseUnsupported, "Clusters");
   }
 
-
-  // ----- ClusterResourceProvider -------------------------------------------
-
-  /**
-   * Inject the blueprint data access object which is used to obtain blueprint entities.
-   *
-   * @param dao  blueprint data access object
-   */
-  public static void init(BlueprintDAO dao, AmbariMetaInfo metaInfo, ConfigHelper ch) {
-    blueprintDAO = dao;
-    stackInfo    = metaInfo;
-    configHelper = ch;
-  }
-
-
-  /**
-   * Package-level access for cluster config
-   * @return cluster config map
-   */
-  Map<String, Map<String, String>> getClusterConfigurations() {
-    return mapClusterConfigurations;
-  }
-
-
-
-  // ----- utility methods ---------------------------------------------------
+  // ----- utility methods -------------------------------------------------
 
   /**
    * Get a cluster request object from a map of property values.
@@ -337,49 +265,15 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
         (String) properties.get(CLUSTER_VERSION_PROPERTY_ID),
         null);
 
-    List<ConfigurationRequest> configRequests = getConfigurationRequests("Clusters", properties);
-
-    ServiceConfigVersionRequest serviceConfigVersionRequest = getServiceConfigVersionRequest("Clusters", properties);
-
-    if (!configRequests.isEmpty())
-      cr.setDesiredConfig(configRequests);
+    ConfigurationRequest configRequest = getConfigurationRequest("Clusters", properties);
 
-    if (serviceConfigVersionRequest != null) {
-      cr.setServiceConfigVersionRequest(serviceConfigVersionRequest);
-    }
+    if (null != configRequest)
+      cr.setDesiredConfig(configRequest);
 
     return cr;
   }
 
   /**
-   * Helper method for creating rollback request
-   */
-  protected ServiceConfigVersionRequest getServiceConfigVersionRequest(String parentCategory, Map<String, Object> properties) {
-    ServiceConfigVersionRequest serviceConfigVersionRequest = null;
-
-    for (Map.Entry<String, Object> entry : properties.entrySet()) {
-      String absCategory = PropertyHelper.getPropertyCategory(entry.getKey());
-      String propName = PropertyHelper.getPropertyName(entry.getKey());
-
-      if (absCategory.startsWith(parentCategory + "/desired_service_config_version")) {
-        serviceConfigVersionRequest =
-            (serviceConfigVersionRequest ==null ) ? new ServiceConfigVersionRequest() : serviceConfigVersionRequest;
-
-        if (propName.equals("service_name"))
-          serviceConfigVersionRequest.setServiceName(entry.getValue().toString());
-        else if (propName.equals("service_config_version"))
-          serviceConfigVersionRequest.setVersion(Long.valueOf(entry.getValue().toString()));
-        else if (propName.equals("service_config_version_note")) {
-          serviceConfigVersionRequest.setNote(entry.getValue().toString());
-        }
-
-      }
-    }
-
-    return serviceConfigVersionRequest;
-  }
-
-  /**
    * Determine if the request is a create using a blueprint.
    *
    * @param properties  request properties
@@ -418,20 +312,10 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     BlueprintEntity blueprint = getExistingBlueprint(blueprintName);
     Stack stack = parseStack(blueprint);
 
-    Map<String, HostGroupImpl> blueprintHostGroups = parseBlueprintHostGroups(blueprint, stack);
+    Map<String, HostGroup> blueprintHostGroups = parseBlueprintHostGroups(blueprint, stack);
     applyRequestInfoToHostGroups(properties, blueprintHostGroups);
-    Collection<Map<String, String>> configOverrides = (Collection<Map<String, String>>)properties.get("configurations");
-
-    String message = null;
-    for (BlueprintConfigEntity blueprintConfig: blueprint.getConfigurations()){
-      if(blueprintConfig.getType().equals("global")){
-        message = "WARNING: Global configurations are deprecated, please use *-env";
-        break;
-      }
-    }
-
-    processConfigurations(processBlueprintConfigurations(blueprint, configOverrides),
-        processBlueprintAttributes(blueprint), stack, blueprintHostGroups);
+    processConfigurations(processBlueprintConfigurations(blueprint, (Collection<Map<String, String>>)
+        properties.get("configurations")), stack, blueprintHostGroups);
     validatePasswordProperties(blueprint, blueprintHostGroups, (String) properties.get("default_password"));
 
     String clusterName = (String) properties.get(CLUSTER_NAME_PROPERTY_ID);
@@ -446,13 +330,8 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     registerConfigGroups(clusterName, blueprintHostGroups, stack);
 
     persistInstallStateForUI();
-
-    RequestStatusResponse request = ((ServiceResourceProvider) getResourceProvider(Resource.Type.Service)).
+    return ((ServiceResourceProvider) getResourceProvider(Resource.Type.Service)).
         installAndStart(clusterName);
-
-    request.setMessage(message);
-
-    return request;
   }
 
   /**
@@ -465,11 +344,11 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws IllegalArgumentException if required password properties are missing and no
    *                                  default is specified via 'default_password'
    */
-  private void validatePasswordProperties(BlueprintEntity blueprint, Map<String, HostGroupImpl> hostGroups,
+  private void validatePasswordProperties(BlueprintEntity blueprint, Map<String, HostGroup> hostGroups,
                                           String defaultPassword) {
 
     Map<String, Map<String, Collection<String>>> missingPasswords = blueprint.validateConfigurations(
-        stackInfo, true);
+        stackInfo, PropertyInfo.PropertyType.PASSWORD);
 
     Iterator<Map.Entry<String, Map<String, Collection<String>>>> iter;
     for(iter = missingPasswords.entrySet().iterator(); iter.hasNext(); ) {
@@ -487,8 +366,8 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
           if (isPropertyInConfiguration(mapClusterConfigurations.get(configType), property)){
               propIter.remove();
           } else {
-            HostGroupImpl hg = hostGroups.get(entry.getKey());
-            if (hg != null && isPropertyInConfiguration(hg.getConfigurationProperties().get(configType), property)) {
+            HostGroup hg = hostGroups.get(entry.getKey());
+            if (hg != null && isPropertyInConfiguration(hg.getConfigurations().get(configType), property)) {
               propIter.remove();
             }  else if (setDefaultPassword(defaultPassword, configType, property)) {
               propIter.remove();
@@ -565,7 +444,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws ResourceAlreadyExistsException attempted to create a service or component that already exists
    * @throws NoSuchParentResourceException  a required parent resource is missing
    */
-  private void createServiceAndComponentResources(Map<String, HostGroupImpl> blueprintHostGroups,
+  private void createServiceAndComponentResources(Map<String, HostGroup> blueprintHostGroups,
                                                   String clusterName, Set<String> services)
                                                   throws SystemException,
                                                          UnsupportedPropertyException,
@@ -610,12 +489,12 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws ResourceAlreadyExistsException attempt to create a host or host_component which already exists
    * @throws NoSuchParentResourceException  a required parent resource is missing
    */
-  private void createHostAndComponentResources(Map<String, HostGroupImpl> blueprintHostGroups, String clusterName)
+  private void createHostAndComponentResources(Map<String, HostGroup> blueprintHostGroups, String clusterName)
       throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException {
 
     ResourceProvider hostProvider = getResourceProvider(Resource.Type.Host);
     ResourceProvider hostComponentProvider = getResourceProvider(Resource.Type.HostComponent);
-    for (HostGroupImpl group : blueprintHostGroups.values()) {
+    for (HostGroup group : blueprintHostGroups.values()) {
       for (String host : group.getHostInfo()) {
         Map<String, Object> hostProperties = new HashMap<String, Object>();
         hostProperties.put("Hosts/cluster_name", clusterName);
@@ -654,7 +533,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws ResourceAlreadyExistsException attempt to create a component which already exists
    * @throws NoSuchParentResourceException  a required parent resource is missing
    */
-  private void createComponentResources(Map<String, HostGroupImpl> blueprintHostGroups,
+  private void createComponentResources(Map<String, HostGroup> blueprintHostGroups,
                                         String clusterName, Set<String> services)
                                         throws SystemException,
                                                UnsupportedPropertyException,
@@ -662,7 +541,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
                                                NoSuchParentResourceException {
     for (String service : services) {
       Set<String> components = new HashSet<String>();
-      for (HostGroupImpl hostGroup : blueprintHostGroups.values()) {
+      for (HostGroup hostGroup : blueprintHostGroups.values()) {
         Collection<String> serviceComponents = hostGroup.getComponents(service);
         if (serviceComponents != null && !serviceComponents.isEmpty()) {
           components.addAll(serviceComponents);
@@ -694,10 +573,9 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     for (Map.Entry<String, Map<String, String>> entry : mapClusterConfigurations.entrySet()) {
       String type = entry.getKey();
 
-      Map<String, Map<String, String>> confAttributes = mapClusterAttributes.get(type);
       try {
         //todo: properly handle non system exceptions
-        setConfigurationsOnCluster(clusterName, type, entry.getValue(), confAttributes);
+        setConfigurationsOnCluster(clusterName, type, entry.getValue());
       } catch (AmbariException e) {
         throw new SystemException("Unable to set configurations on cluster.", e);
       }
@@ -714,8 +592,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws AmbariException if an exception occurs setting the properties
    */
   private void setConfigurationsOnCluster(String clusterName, String type,
-                                          Map<String, String> properties,
-                                          Map<String, Map<String, String>> propertiesAttributes) throws AmbariException {
+                                          Map<String, String> properties) throws AmbariException {
 
     Map<String, Object> clusterProperties = new HashMap<String, Object>();
     clusterProperties.put(CLUSTER_NAME_PROPERTY_ID, clusterName);
@@ -725,17 +602,8 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
       clusterProperties.put(CLUSTER_DESIRED_CONFIGS_PROPERTY_ID +
           "/properties/" + entry.getKey(), entry.getValue());
     }
-    if (propertiesAttributes != null) {
-      for (Map.Entry<String, Map<String, String>> attribute : propertiesAttributes.entrySet()) {
-        String attributeName = attribute.getKey();
-        for (Map.Entry<String, String> attributeOccurrence : attribute.getValue().entrySet()) {
-          clusterProperties.put(CLUSTER_DESIRED_CONFIGS_PROPERTY_ID + "/properties_attributes/"
-              + attributeName + "/" + attributeOccurrence.getKey(), attributeOccurrence.getValue());
-        }
-      }
-    }
     getManagementController().updateClusters(
-      Collections.singleton(getRequest(clusterProperties)), null);
+        Collections.singleton(getRequest(clusterProperties)), null);
   }
 
   /**
@@ -749,7 +617,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    */
   @SuppressWarnings("unchecked")
   private void applyRequestInfoToHostGroups(Map<String, Object> properties,
-                                            Map<String, HostGroupImpl> blueprintHostGroups)
+                                            Map<String, HostGroup> blueprintHostGroups)
                                             throws IllegalArgumentException {
 
     @SuppressWarnings("unchecked")
@@ -766,7 +634,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
       if (name == null || name.isEmpty()) {
         throw new IllegalArgumentException("Every host_group must include a non-null 'name' property");
       }
-      HostGroupImpl hostGroup = blueprintHostGroups.get(name);
+      HostGroup hostGroup = blueprintHostGroups.get(name);
 
       if (hostGroup == null) {
         throw new IllegalArgumentException("Invalid host_group specified: " + name +
@@ -786,7 +654,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
         }
         hostGroup.addHostInfo(fqdn);
       }
-      Map<String, Map<String, String>> existingConfigurations = hostGroup.getConfigurationProperties();
+      Map<String, Map<String, String>> existingConfigurations = hostGroup.getConfigurations();
       overrideExistingProperties(existingConfigurations, (Collection<Map<String, String>>)
           hostGroupProperties.get("configurations"));
 
@@ -840,9 +708,7 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @param blueprintHostGroups  host groups contained in the blueprint
    */
   private void processConfigurations(Map<String, Map<String, String>> blueprintConfigurations,
-                                     Map<String, Map<String, Map<String, String>>> blueprintAttributes,
-                                     Stack stack, Map<String, HostGroupImpl> blueprintHostGroups)  {
-
+                                    Stack stack, Map<String, HostGroup> blueprintHostGroups)  {
 
     for (String service : getServicesToDeploy(stack, blueprintHostGroups)) {
       for (String type : stack.getConfigurationTypes(service)) {
@@ -852,42 +718,21 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
           mapClusterConfigurations.put(type, typeProps);
         }
         typeProps.putAll(stack.getConfigurationProperties(service, type));
-        Map<String, Map<String, String>> stackTypeAttributes = stack.getConfigurationAttributes(service, type);
-        if (!stackTypeAttributes.isEmpty()) {
-          if (!mapClusterAttributes.containsKey(type)) {
-            mapClusterAttributes.put(type, new HashMap<String, Map<String, String>>());
-          }
-          Map<String, Map<String, String>> typeAttrs = mapClusterAttributes.get(type);
-          for (Map.Entry<String, Map<String, String>> attribute : stackTypeAttributes.entrySet()) {
-            String attributeName = attribute.getKey();
-            Map<String, String> attributes = typeAttrs.get(attributeName);
-            if (attributes == null) {
-                attributes = new HashMap<String, String>();
-                typeAttrs.put(attributeName, attributes);
-            }
-            attributes.putAll(attribute.getValue());
-          }
-        }
       }
     }
     processBlueprintClusterConfigurations(blueprintConfigurations);
-    processBlueprintClusterConfigAttributes(blueprintAttributes);
 
-    BlueprintConfigurationProcessor configurationProcessor = new BlueprintConfigurationProcessor(mapClusterConfigurations);
-    configurationProcessor.doUpdateForClusterCreate(blueprintHostGroups);
-    setMissingConfigurations(blueprintHostGroups);
-  }
-
-  /**
-   * Since global configs are deprecated since 1.7.0, but still supported.
-   * We should automatically map any globals used, to *-env dictionaries.
-   *
-   * @param blueprintConfigurations  map of blueprint configurations keyed by type
-   */
-  private void handleGlobalsBackwardsCompability(Stack stack,
-      Map<String, Map<String, String>> blueprintConfigurations, String clusterName) {
-    StackId stackId = new StackId(stack.getName(), stack.getVersion());
-    configHelper.moveDeprecatedGlobals(stackId, blueprintConfigurations, clusterName);
+    for (Map.Entry<String, Map<String, String>> entry : mapClusterConfigurations.entrySet()) {
+      for (Map.Entry<String, String> propertyEntry : entry.getValue().entrySet()) {
+        String propName = propertyEntry.getKey();
+        // see if property needs to be updated
+        PropertyUpdater propertyUpdater = propertyUpdaters.get(propName);
+        if (propertyUpdater != null) {
+          propertyEntry.setValue(propertyUpdater.update(blueprintHostGroups, propertyEntry.getValue()));
+        }
+      }
+    }
+    setMissingConfigurations();
   }
 
   /**
@@ -912,95 +757,27 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
   }
 
   /**
-   * Process cluster scoped configuration attributes provided in blueprint.
-   *
-   * @param blueprintAttributes  map of configuration type to configuration attributes and their values
-   */
-  private void processBlueprintClusterConfigAttributes(Map<String, Map<String, Map<String, String>>> blueprintAttributes) {
-    for (Map.Entry<String, Map<String, Map<String, String>>> entry : blueprintAttributes.entrySet()) {
-      Map<String, Map<String, String>> attributes = entry.getValue();
-      if (attributes != null && !attributes.isEmpty()) {
-        String type = entry.getKey();
-        if (!mapClusterAttributes.containsKey(type)) {
-          mapClusterAttributes.put(type, new HashMap<String, Map<String, String>>());
-        }
-        Map<String, Map<String, String>> typeAttrs = mapClusterAttributes.get(type);
-        for (Map.Entry<String, Map<String, String>> attribute : attributes.entrySet()) {
-          String attributeName = attribute.getKey();
-          if (!typeAttrs.containsKey(attributeName)) {
-            typeAttrs.put(attributeName, new HashMap<String, String>());
-          }
-          typeAttrs.get(attributeName).putAll(attribute.getValue());
-        }
-      }
-    }
-  }
-
-  /**
    * Explicitly set any properties that are required but not currently provided in the stack definition.
    */
-  void setMissingConfigurations(Map<String, HostGroupImpl> blueprintHostGroups) {
-    // AMBARI-5206
-    final Map<String , String> userProps = new HashMap<String , String>();
-
-    // only add user properties to the map for
-    // services actually included in the blueprint definition
-    if (isServiceIncluded("OOZIE", blueprintHostGroups)) {
-      userProps.put("oozie_user", "oozie-env");
-    }
-
-    if (isServiceIncluded("HIVE", blueprintHostGroups)) {
-      userProps.put("hive_user", "hive-env");
-      userProps.put("hcat_user", "hive-env");
-    }
-
-    if (isServiceIncluded("HBASE", blueprintHostGroups)) {
-      userProps.put("hbase_user", "hbase-env");
-    }
-
-    if (isServiceIncluded("FALCON", blueprintHostGroups)) {
-      userProps.put("falcon_user", "falcon-env");
-    }
-
+  private void setMissingConfigurations() {
+    // AMBARI-4921
+    ensureProperty("global", "user_group", "hadoop");
+    ensureProperty("global", "nagios_contact", "default@REPLACEME.NOWHERE");
+    ensureProperty("global", "smokeuser", "ambari-qa");
 
+    // AMBARI-5206
+    Map<String, String> globalConfig = mapClusterConfigurations.get("global");
+    String[] userProps = {"oozie_user", "hive_user", "hcat_user", "hbase_user", "falcon_user"};
     String proxyUserHosts  = "hadoop.proxyuser.%s.hosts";
     String proxyUserGroups = "hadoop.proxyuser.%s.groups";
 
-    for (String property : userProps.keySet()) {
-      String configType = userProps.get(property);
-      Map<String, String> configs = mapClusterConfigurations.get(configType);
-      if (configs != null) {
-        String user = configs.get(property);
-        if (user != null && !user.isEmpty()) {
-          ensureProperty("core-site", String.format(proxyUserHosts, user), "*");
-          ensureProperty("core-site", String.format(proxyUserGroups, user), "users");
-        }
-      } else {
-        LOG.debug("setMissingConfigurations: no user configuration found for type = " + configType + ".  This may be caused by an error in the blueprint configuration.");
-      }
-
-    }
-  }
-
-
-  /**
-   * Determines if any components in the specified service are
-   *   included in the current blueprint's host group definitions.
-   *
-   * @param serviceName the Hadoop service name to query on
-   * @param blueprintHostGroups the map of Host Groups in the current blueprint
-   * @return true if the named service is included in the blueprint
-   *         false if the named service it not included in the blueprint
-   */
-  protected boolean isServiceIncluded(String serviceName, Map<String, HostGroupImpl> blueprintHostGroups) {
-    for (String hostGroupName : blueprintHostGroups.keySet()) {
-      HostGroupImpl hostGroup = blueprintHostGroups.get(hostGroupName);
-      if (hostGroup.getServices().contains(serviceName)) {
-        return true;
+    for (String userProp : userProps) {
+      String user = globalConfig.get(userProp);
+      if (user != null && !user.isEmpty()) {
+        ensureProperty("core-site", String.format(proxyUserHosts, user), "*");
+        ensureProperty("core-site", String.format(proxyUserGroups, user), "users");
       }
     }
-
-    return false;
   }
 
   /**
@@ -1031,9 +808,9 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    *
    * @return set of service names which will be deployed
    */
-  private Set<String> getServicesToDeploy(Stack stack, Map<String, HostGroupImpl> blueprintHostGroups) {
+  private Set<String> getServicesToDeploy(Stack stack, Map<String, HostGroup> blueprintHostGroups) {
     Set<String> services = new HashSet<String>();
-    for (HostGroupImpl group : blueprintHostGroups.values()) {
+    for (HostGroup group : blueprintHostGroups.values()) {
       if (! group.getHostInfo().isEmpty()) {
         services.addAll(stack.getServicesForComponents(group.getComponents()));
       }
@@ -1045,6 +822,75 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
   }
 
   /**
+   * Register updaters for configuration properties.
+   */
+  private void registerPropertyUpdaters() {
+    // NAMENODE
+    propertyUpdaters.put("dfs.http.address", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("dfs.namenode.http-address", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("dfs.https.address", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("dfs.namenode.https-address", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("fs.default.name", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("fs.defaultFS", new SingleHostPropertyUpdater("NAMENODE"));
+    propertyUpdaters.put("hbase.rootdir", new SingleHostPropertyUpdater("NAMENODE"));
+
+    // SECONDARY_NAMENODE
+    propertyUpdaters.put("dfs.secondary.http.address", new SingleHostPropertyUpdater("SECONDARY_NAMENODE"));
+    propertyUpdaters.put("dfs.namenode.secondary.http-address", new SingleHostPropertyUpdater("SECONDARY_NAMENODE"));
+
+    // HISTORY_SERVER
+    propertyUpdaters.put("yarn.log.server.url", new SingleHostPropertyUpdater("HISTORYSERVER"));
+    propertyUpdaters.put("mapreduce.jobhistory.webapp.address", new SingleHostPropertyUpdater("HISTORYSERVER"));
+    propertyUpdaters.put("mapreduce.jobhistory.address", new SingleHostPropertyUpdater("HISTORYSERVER"));
+
+    // RESOURCEMANAGER
+    propertyUpdaters.put("yarn.resourcemanager.hostname", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+    propertyUpdaters.put("yarn.resourcemanager.resource-tracker.address", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+    propertyUpdaters.put("yarn.resourcemanager.webapp.address", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+    propertyUpdaters.put("yarn.resourcemanager.scheduler.address", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+    propertyUpdaters.put("yarn.resourcemanager.address", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+    propertyUpdaters.put("yarn.resourcemanager.admin.address", new SingleHostPropertyUpdater("RESOURCEMANAGER"));
+
+    // JOBTRACKER
+    propertyUpdaters.put("mapred.job.tracker", new SingleHostPropertyUpdater("JOBTRACKER"));
+    propertyUpdaters.put("mapred.job.tracker.http.address", new SingleHostPropertyUpdater("JOBTRACKER"));
+    propertyUpdaters.put("mapreduce.history.server.http.address", new SingleHostPropertyUpdater("JOBTRACKER"));
+
+    // HIVE_SERVER
+    propertyUpdaters.put("hive.metastore.uris", new SingleHostPropertyUpdater("HIVE_SERVER"));
+    propertyUpdaters.put("hive_ambari_host", new SingleHostPropertyUpdater("HIVE_SERVER"));
+    propertyUpdaters.put("javax.jdo.option.ConnectionURL",
+        new DBPropertyUpdater("MYSQL_SERVER", "hive-env", "hive_database"));
+
+    // OOZIE_SERVER
+    propertyUpdaters.put("oozie.base.url", new SingleHostPropertyUpdater("OOZIE_SERVER"));
+    propertyUpdaters.put("oozie_ambari_host", new SingleHostPropertyUpdater("OOZIE_SERVER"));
+
+    // ZOOKEEPER_SERVER
+    propertyUpdaters.put("hbase.zookeeper.quorum", new MultipleHostPropertyUpdater("ZOOKEEPER_SERVER"));
+    propertyUpdaters.put("templeton.zookeeper.hosts", new MultipleHostPropertyUpdater("ZOOKEEPER_SERVER"));
+
+    // STORM
+    propertyUpdaters.put("nimbus.host", new SingleHostPropertyUpdater("NIMBUS"));
+    propertyUpdaters.put("worker.childopts", new SingleHostPropertyUpdater("GANGLIA_SERVER"));
+    propertyUpdaters.put("supervisor.childopts", new SingleHostPropertyUpdater("GANGLIA_SERVER"));
+    propertyUpdaters.put("nimbus.childopts", new SingleHostPropertyUpdater("GANGLIA_SERVER"));
+    propertyUpdaters.put("storm.zookeeper.servers",
+      new YamlMultiValuePropertyDecorator(new MultipleHostPropertyUpdater("ZOOKEEPER_SERVER")));
+
+    // properties which need "m' appended.  Required due to AMBARI-4933
+    propertyUpdaters.put("namenode_heapsize", new MPropertyUpdater());
+    propertyUpdaters.put("namenode_opt_newsize", new MPropertyUpdater());
+    propertyUpdaters.put("namenode_opt_maxnewsize", new MPropertyUpdater());
+    propertyUpdaters.put("dtnode_heapsize", new MPropertyUpdater());
+    propertyUpdaters.put("jtnode_opt_newsize", new MPropertyUpdater());
+    propertyUpdaters.put("jtnode_opt_maxnewsize", new MPropertyUpdater());
+    propertyUpdaters.put("jtnode_heapsize", new MPropertyUpdater());
+    propertyUpdaters.put("hbase_master_heapsize", new MPropertyUpdater());
+    propertyUpdaters.put("hbase_regionserver_heapsize", new MPropertyUpdater());
+  }
+
+  /**
    * Register config groups for host group scoped configuration.
    * For each host group with configuration specified in the blueprint, a config group is created
    * and the hosts associated with the host group are assigned to the config group.
@@ -1058,20 +904,18 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    * @throws UnsupportedPropertyException   an invalid property is provided when creating a config group
    * @throws NoSuchParentResourceException  attempt to create a config group for a non-existing cluster
    */
-  private void registerConfigGroups(String clusterName, Map<String, HostGroupImpl> hostGroups, Stack stack) throws
+  private void registerConfigGroups(String clusterName, Map<String, HostGroup> hostGroups, Stack stack) throws
       ResourceAlreadyExistsException, SystemException,
       UnsupportedPropertyException, NoSuchParentResourceException {
 
-    for (HostGroupImpl group : hostGroups.values()) {
+    for (HostGroup group : hostGroups.values()) {
       HostGroupEntity entity = group.getEntity();
       Map<String, Map<String, Config>> groupConfigs = new HashMap<String, Map<String, Config>>();
-      
-      handleGlobalsBackwardsCompability(stack, group.getConfigurationProperties(), clusterName);
-      for (Map.Entry<String, Map<String, String>> entry: group.getConfigurationProperties().entrySet()) {
+      for (Map.Entry<String, Map<String, String>> entry: group.getConfigurations().entrySet()) {
         String type = entry.getKey();
         String service = stack.getServiceForConfigType(type);
         Config config = new ConfigImpl(type);
-        config.setTag(entity.getName());
+        config.setVersionTag(entity.getName());
         config.setProperties(entry.getValue());
         Map<String, Config> serviceConfigs = groupConfigs.get(service);
         if (serviceConfigs == null) {
@@ -1099,11 +943,11 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
    *
    * @param hostGroups map of host group name to host group
    */
-  private void validateHostMappings(Map<String, HostGroupImpl> hostGroups) {
+  private void validateHostMappings(Map<String, HostGroup> hostGroups) {
     Collection<String> mappedHosts = new HashSet<String>();
     Collection<String> flaggedHosts = new HashSet<String>();
 
-    for (HostGroupImpl hostgroup : hostGroups.values()) {
+    for (HostGroup hostgroup : hostGroups.values()) {
       for (String host : hostgroup.getHostInfo()) {
         if (mappedHosts.contains(host)) {
           flaggedHosts.add(host);
@@ -1120,18 +964,278 @@ public class ClusterResourceProvider extends BaseBlueprintProcessor {
     }
   }
 
+
   /**
-   * Determine whether or not the cluster resource identified
-   * by the given cluster name should be included based on the
-   * permissions granted to the current user.
-   *
-   * @param clusterName  the cluster name
-   * @param readOnly     indicate whether or not this is for a read only operation
-   *
-   * @return true if the cluster should be included based on the permissions of the current user
+   * Provides functionality to update a property value.
+   */
+  public interface PropertyUpdater {
+    /**
+     * Update a property value.
+     *
+     * @param hostGroups  host groups
+     * @param origValue   original value of property
+     *
+     * @return new property value
+     */
+    public String update(Map<String, HostGroup> hostGroups, String origValue);
+  }
+
+  /**
+   * Topology based updater which replaces the original host name of a property with the host name
+   * which runs the associated (master) component in the new cluster.
+   */
+  private class SingleHostPropertyUpdater implements PropertyUpdater {
+    /**
+     * Component name
+     */
+    private String component;
+
+    /**
+     * Constructor.
+     *
+     * @param component  component name associated with the property
+     */
+    public SingleHostPropertyUpdater(String component) {
+      this.component = component;
+    }
+
+    /**
+     * Update the property with the new host name which runs the associated component.
+     *
+     * @param hostGroups  host groups                 host groups
+     * @param origValue   original value of property  original property value
+     *
+     * @return updated property value with old host name replaced by new host name
+     */
+    public String update(Map<String, HostGroup> hostGroups, String origValue)  {
+      Collection<HostGroup> matchingGroups = getHostGroupsForComponent(component, hostGroups.values());
+      if (matchingGroups.size() == 1) {
+        return origValue.replace("localhost", matchingGroups.iterator().next().getHostInfo().iterator().next());
+      } else {
+        throw new IllegalArgumentException("Unable to update configuration property with topology information. " +
+            "Component '" + this.component + "' is not mapped to any host group or is mapped to multiple groups.");
+      }
+    }
+  }
+
+  /**
+   * Topology based updater which replaces the original host name of a database property with the host name
+   * where the DB is deployed in the new cluster.  If an existing database is specified, the original property
+   * value is returned.
    */
-  private boolean includeCluster(String clusterName, boolean readOnly) {
-    return getManagementController().getClusters().checkPermission(clusterName, readOnly);
+  private class DBPropertyUpdater extends SingleHostPropertyUpdater {
+    /**
+     * Property type (global, core-site ...) for property which is used to determine if DB is external.
+     */
+    private final String configPropertyType;
+
+    /**
+     * Name of property which is used to determine if DB is new or existing (exernal).
+     */
+    private final String conditionalPropertyName;
+
+    /**
+     * Constructor.
+     *
+     * @param component                component to get hot name if new DB
+     * @param configPropertyType       config type of property used to determine if DB is external
+     * @param conditionalPropertyName  name of property which is used to determine if DB is external
+     */
+    private DBPropertyUpdater(String component, String configPropertyType, String conditionalPropertyName) {
+      super(component);
+      this.configPropertyType = configPropertyType;
+      this.conditionalPropertyName = conditionalPropertyName;
+    }
+
+    /**
+     * If database is a new managed database, update the property with the new host name which
+     * runs the associated component.  If the database is external (non-managed), return the
+     * original value.
+     *
+     * @param hostGroups  host groups                 host groups
+     * @param origValue   original value of property  original property value
+     *
+     * @return updated property value with old host name replaced by new host name or original value
+     *         if the database is exernal
+     */
+    @Override
+    public String update(Map<String, HostGroup> hostGroups, String origValue) {
+      if (isDatabaseManaged()) {
+        return super.update(hostGroups, origValue);
+      } else {
+        return origValue;
+      }
+    }
+
+    /**
+     * Determine if database is managed, meaning that it is a component in the cluster topology.
+     *
+     * @return true if the DB is managed; false otherwise
+     */
+    //todo: use super.isDependencyManaged() and remove this method
+    private boolean isDatabaseManaged() {
+      // conditional property should always exist since it is required to be specified in the stack
+      return mapClusterConfigurations.get(configPropertyType).
+          get(conditionalPropertyName).startsWith("New");
+    }
+  }
+
+  /**
+   * Topology based updater which replaces original host names (possibly more than one) contained in a property
+   * value with the host names which runs the associated component in the new cluster.
+   */
+  private class MultipleHostPropertyUpdater implements PropertyUpdater {
+    /**
+     * Component name
+     */
+    private String component;
+
+    /**
+     * Separator for multiple property values
+     */
+    private Character separator = ',';
+
+    /**
+     * Constructor.
+     *
+     * @param component  component name associated with the property
+     */
+    public MultipleHostPropertyUpdater(String component) {
+      this.component = component;
+    }
+
+    /**
+     * Constructor with customized separator.
+     * @param component Component name
+     * @param separator separator character
+     */
+    public MultipleHostPropertyUpdater(String component, Character separator) {
+      this.component = component;
+      this.separator = separator;
+    }
+
+    //todo: specific to default values of EXACTLY 'localhost' or 'localhost:port'.
+    //todo: when blueprint contains source configurations, these props will contain actual host names, not localhost.
+    //todo: currently assuming that all hosts will share the same port
+    /**
+     * Update all host names included in the original property value with new host names which run the associated
+     * component.
+     *
+     * @param hostGroups  host groups                 host groups
+     * @param origValue   original value of property  original value
+     *
+     * @return updated property value with old host names replaced by new host names
+     */
+    public String update(Map<String, HostGroup> hostGroups, String origValue) {
+      Collection<HostGroup> matchingGroups = getHostGroupsForComponent(component, hostGroups.values());
+      boolean containsPort = origValue.contains(":");
+      String port = null;
+      if (containsPort) {
+        port = origValue.substring(origValue.indexOf(":") + 1);
+      }
+      StringBuilder sb = new StringBuilder();
+      boolean firstHost = true;
+      for (HostGroup group : matchingGroups) {
+        for (String host : group.getHostInfo()) {
+          if (!firstHost) {
+            sb.append(separator);
+          } else {
+            firstHost = false;
+          }
+          sb.append(host);
+          if (containsPort) {
+            sb.append(":");
+            sb.append(port);
+          }
+        }
+      }
+
+      return sb.toString();
+    }
+  }
+
+  /**
+   * Updater which appends "m" to the original property value.
+   * For example, "1024" would be updated to "1024m".
+   */
+  private class MPropertyUpdater implements PropertyUpdater {
+    /**
+     * Append 'm' to the original property value if it doesn't already exist.
+     *
+     * @param hostGroups  host groups                 host groups
+     * @param origValue   original value of property  original property value
+     *
+     * @return property with 'm' appended
+     */
+    public String update(Map<String, HostGroup> hostGroups, String origValue) {
+      return origValue.endsWith("m") ? origValue : origValue + 'm';
+    }
+  }
+
+  /**
+   * Class to facilitate special formatting needs of property values.
+   */
+  private abstract class AbstractPropertyValueDecorator implements PropertyUpdater {
+    PropertyUpdater propertyUpdater;
+
+    public AbstractPropertyValueDecorator(PropertyUpdater propertyUpdater) {
+      this.propertyUpdater = propertyUpdater;
+    }
+
+    /**
+     * Return decorated form of the updated input property value.
+     * @param hostGroupMap Map of host group name to HostGroup
+     * @param origValue   original value of property
+     *
+     * @return Formatted output string
+     */
+    @Override
+    public String update(Map<String, HostGroup> hostGroupMap, String origValue) {
+      return doFormat(propertyUpdater.update(hostGroupMap, origValue));
+    }
+
+    /**
+     * Transform input string to required output format.
+     * @param originalValue Original value of property
+     * @return Formatted output string
+     */
+    public abstract String doFormat(String originalValue);
+  }
+
+  /**
+   * Return properties of the form ['value']
+   */
+  private class YamlMultiValuePropertyDecorator extends AbstractPropertyValueDecorator {
+
+    public YamlMultiValuePropertyDecorator(PropertyUpdater propertyUpdater) {
+      super(propertyUpdater);
+    }
+
+    /**
+     * Format input String of the form, str1,str2 to ['str1','str2']
+     * @param origValue Input string
+     * @return Formatted string
+     */
+    @Override
+    public String doFormat(String origValue) {
+      StringBuilder sb = new StringBuilder();
+      if (origValue != null) {
+        sb.append("[");
+        boolean isFirst = true;
+        for (String value : origValue.split(",")) {
+          if (!isFirst) {
+            sb.append(",");
+          } else {
+            isFirst = false;
+          }
+          sb.append("'");
+          sb.append(value);
+          sb.append("'");
+        }
+        sb.append("]");
+      }
+      return sb.toString();
+    }
   }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
index 9a2be41..9653322 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java
@@ -485,7 +485,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
         }
         if (serviceName == null
             || serviceName.isEmpty()) {
-          throw new AmbariException("Could not find service for component"
+          throw new ObjectNotFoundException("Could not find service for component"
               + ", componentName=" + request.getComponentName()
               + ", clusterName=" + cluster.getClusterName()
               + ", stackInfo=" + stackId.getStackId());
@@ -835,6 +835,8 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
 
     // TODO additional validation?
 
+    // TODO if all components reach a common state, should service state be
+    // modified?
     Cluster cluster = clusters.getCluster(clusterNames.iterator().next());
 
     return getManagementController().createAndPersistStages(cluster, requestProperties, null, null, changedComps, changedScHosts,

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index c73a8d4..d455526 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -17,8 +17,6 @@
  */
 package org.apache.ambari.server.controller.internal;
 
-import com.google.common.collect.MapDifference;
-import com.google.common.collect.Maps;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.ClusterNotFoundException;
 import org.apache.ambari.server.ConfigGroupNotFoundException;
@@ -46,7 +44,6 @@ import org.apache.ambari.server.state.ConfigImpl;
 import org.apache.ambari.server.state.Host;
 import org.apache.ambari.server.state.configgroup.ConfigGroup;
 import org.apache.ambari.server.state.configgroup.ConfigGroupFactory;
-import org.apache.commons.lang.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -74,12 +71,8 @@ public class ConfigGroupResourceProvider extends
     .getPropertyId("ConfigGroup", "tag");
   protected static final String CONFIGGROUP_DESC_PROPERTY_ID = PropertyHelper
     .getPropertyId("ConfigGroup", "description");
-  protected static final String CONFIGGROUP_SCV_NOTE_ID = PropertyHelper
-      .getPropertyId("ConfigGroup", "service_config_version_note");
   protected static final String CONFIGGROUP_HOSTNAME_PROPERTY_ID =
     PropertyHelper.getPropertyId(null, "host_name");
-  protected static final String CONFIGGROUP_HOSTS_HOSTNAME_PROPERTY_ID =
-    PropertyHelper.getPropertyId("ConfigGroup", "hosts/host_name");
   public static final String CONFIGGROUP_HOSTS_PROPERTY_ID = PropertyHelper
     .getPropertyId("ConfigGroup", "hosts");
   public static final String CONFIGGROUP_CONFIGS_PROPERTY_ID =
@@ -140,10 +133,6 @@ public class ConfigGroupResourceProvider extends
     Set<String>   requestedIds = getRequestPropertyIds(request, predicate);
     Set<Resource> resources    = new HashSet<Resource>();
 
-    if (requestedIds.contains(CONFIGGROUP_HOSTS_HOSTNAME_PROPERTY_ID)) {
-      requestedIds.add(CONFIGGROUP_HOSTS_PROPERTY_ID);
-    }
-
     for (ConfigGroupResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.ConfigGroup);
 
@@ -217,20 +206,6 @@ public class ConfigGroupResourceProvider extends
     return getRequestStatus(null);
   }
 
-  @Override
-  public Set<String> checkPropertyIds(Set<String> propertyIds) {
-    //allow providing service_config_version_note, but we should not return it for config group
-    Set<String> unsupportedPropertyIds = super.checkPropertyIds(propertyIds);
-    for (Iterator<String> iterator = unsupportedPropertyIds.iterator(); iterator.hasNext(); ) {
-      String next = iterator.next();
-      next = PropertyHelper.getPropertyName(next);
-      if (next.equals("service_config_version_note") || next.equals("/service_config_version_note")) {
-        iterator.remove();
-      }
-    }
-    return unsupportedPropertyIds;
-  }
-
   /**
    * Create configuration group resources based on set of config group requests.
    *
@@ -481,12 +456,6 @@ public class ConfigGroupResourceProvider extends
         request.getTag(), request.getDescription(),
         request.getConfigs(), hosts);
 
-      String serviceName = null;
-      if (request.getConfigs() != null && !request.getConfigs().isEmpty()) {
-        serviceName = cluster.getServiceForConfigTypes(request.getConfigs().keySet());
-      }
-      configGroup.setServiceName(serviceName);
-
       // Persist before add, since id is auto-generated
       configLogger.info("Persisting new Config group"
         + ", clusterName = " + cluster.getClusterName()
@@ -496,13 +465,6 @@ public class ConfigGroupResourceProvider extends
 
       configGroup.persist();
       cluster.addConfigGroup(configGroup);
-      if (serviceName != null) {
-        cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(),
-          request.getServiceConfigVersionNote(), configGroup);
-      } else {
-        LOG.warn("Could not determine service name for config group {}, service config version not created",
-            configGroup.getId());
-      }
 
       ConfigGroupResponse response = new ConfigGroupResponse(configGroup
         .getId(), configGroup.getClusterName(), configGroup.getName(),
@@ -547,16 +509,6 @@ public class ConfigGroupResourceProvider extends
                                  + ", clusterName = " + request.getClusterName()
                                  + ", groupId = " + request.getId());
       }
-      String serviceName = configGroup.getServiceName();
-      String requestServiceName = cluster.getServiceForConfigTypes(request.getConfigs().keySet());
-      if (serviceName != null && requestServiceName !=null && !StringUtils.equals(serviceName, requestServiceName)) {
-        throw new IllegalArgumentException("Config group " + configGroup.getId() +
-            " is mapped to service " + serviceName + ", " +
-            "but request contain configs from service " + requestServiceName);
-      } else if (serviceName == null && requestServiceName != null) {
-        configGroup.setServiceName(requestServiceName);
-        serviceName = requestServiceName;
-      }
 
       // Update hosts
       Map<String, Host> hosts = new HashMap<String, Host>();
@@ -582,27 +534,20 @@ public class ConfigGroupResourceProvider extends
       configGroup.setDescription(request.getDescription());
       configGroup.setTag(request.getTag());
 
-      configLogger.info("Persisting updated Config group"
+      configLogger.info("Persisting updated Config group, "
         + ", clusterName = " + configGroup.getClusterName()
         + ", id = " + configGroup.getId()
         + ", tag = " + configGroup.getTag()
         + ", user = " + getManagementController().getAuthName());
 
       configGroup.persist();
-      if (serviceName != null) {
-        cluster.createServiceConfigVersion(serviceName, getManagementController().getAuthName(),
-          request.getServiceConfigVersionNote(), configGroup);
-      } else {
-        LOG.warn("Could not determine service name for config group {}, service config version not created",
-            configGroup.getId());
-      }
     }
 
     getManagementController().getConfigHelper().invalidateStaleConfigsCache();
   }
 
   @SuppressWarnings("unchecked")
-  ConfigGroupRequest getConfigGroupRequest(Map<String, Object> properties) {
+  private ConfigGroupRequest getConfigGroupRequest(Map<String, Object> properties) {
     Object groupIdObj = properties.get(CONFIGGROUP_ID_PROPERTY_ID);
     Long groupId = null;
     if (groupIdObj != null)  {
@@ -619,24 +564,17 @@ public class ConfigGroupResourceProvider extends
       null,
       null);
 
-    request.setServiceConfigVersionNote((String) properties.get(CONFIGGROUP_SCV_NOTE_ID));
-
     Map<String, Config> configurations = new HashMap<String, Config>();
     Set<String> hosts = new HashSet<String>();
 
-    String hostnameKey = CONFIGGROUP_HOSTNAME_PROPERTY_ID;
     Object hostObj = properties.get(CONFIGGROUP_HOSTS_PROPERTY_ID);
-    if (hostObj == null) {
-      hostnameKey = CONFIGGROUP_HOSTS_HOSTNAME_PROPERTY_ID;
-      hostObj = properties.get(CONFIGGROUP_HOSTS_HOSTNAME_PROPERTY_ID);
-    }
     if (hostObj != null) {
       if (hostObj instanceof HashSet<?>) {
         try {
           Set<Map<String, String>> hostsSet = (Set<Map<String, String>>) hostObj;
           for (Map<String, String> hostMap : hostsSet) {
-            if (hostMap.containsKey(hostnameKey)) {
-              String hostname = hostMap.get(hostnameKey);
+            if (hostMap.containsKey(CONFIGGROUP_HOSTNAME_PROPERTY_ID)) {
+              String hostname = hostMap.get(CONFIGGROUP_HOSTNAME_PROPERTY_ID);
               hosts.add(hostname);
             }
           }
@@ -661,31 +599,20 @@ public class ConfigGroupResourceProvider extends
             .CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
 
           Map<String, String> configProperties = new HashMap<String, String>();
-          Map<String, Map<String, String>> configAttributes = new HashMap<String, Map<String, String>>();
 
           for (Map.Entry<String, Object> entry : configMap.entrySet()) {
             String propertyCategory = PropertyHelper.getPropertyCategory(entry.getKey());
-            if (propertyCategory != null && entry.getValue() != null) {
-              if ("properties".equals(propertyCategory)) {
-                configProperties.put(PropertyHelper.getPropertyName(entry.getKey()),
-                    entry.getValue().toString());
-              } else if ("properties_attributes".equals(PropertyHelper.getPropertyCategory(propertyCategory))) {
-                String attributeName = PropertyHelper.getPropertyName(propertyCategory);
-                if (!configAttributes.containsKey(attributeName)) {
-                  configAttributes.put(attributeName, new HashMap<String, String>());
-                }
-                Map<String, String> attributeValues
-                    = configAttributes.get(attributeName);
-                attributeValues.put(PropertyHelper.getPropertyName(entry.getKey()),
-                    entry.getValue().toString());
-              }
+            if (propertyCategory != null
+                && propertyCategory.equals("properties")
+                  && null != entry.getValue()) {
+              configProperties.put(PropertyHelper.getPropertyName(entry.getKey()),
+                entry.getValue().toString());
             }
           }
 
           Config config = new ConfigImpl(type);
-          config.setTag(tag);
+          config.setVersionTag(tag);
           config.setProperties(configProperties);
-          config.setPropertiesAttributes(configAttributes);
 
           configurations.put(config.getType(), config);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
index 98d1a46..a478e21 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProvider.java
@@ -58,8 +58,6 @@ public class ConfigurationResourceProvider extends
     PropertyHelper.getPropertyId(null, "type");
   public static final String CONFIGURATION_CONFIG_TAG_PROPERTY_ID   =
     PropertyHelper.getPropertyId(null, "tag");
-  public static final String CONFIGURATION_CONFIG_VERSION_PROPERTY_ID   =
-    PropertyHelper.getPropertyId(null, "version");
 
 
   /**
@@ -145,7 +143,7 @@ public class ConfigurationResourceProvider extends
     final Set<ConfigurationRequest> requests = new HashSet<ConfigurationRequest>();
 
     for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
-      requests.add(getRequest(request, propertyMap));
+      requests.add(getRequest(propertyMap));
     }
 
     Set<ConfigurationResponse> responses = getResources(new Command<Set<ConfigurationResponse>>() {
@@ -161,7 +159,6 @@ public class ConfigurationResourceProvider extends
       resource.setProperty(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID, response.getClusterName());
       resource.setProperty(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID, response.getType());
       resource.setProperty(CONFIGURATION_CONFIG_TAG_PROPERTY_ID, response.getVersionTag());
-      resource.setProperty(CONFIGURATION_CONFIG_VERSION_PROPERTY_ID, response.getVersion());
 
       if (null != response.getConfigs() && response.getConfigs().size() > 0) {
         Map<String, String> configs = response.getConfigs();
@@ -245,19 +242,12 @@ public class ConfigurationResourceProvider extends
    *
    * @return a configuration request
    */
-  private ConfigurationRequest getRequest(Request request, Map<String, Object> properties) {
+  private ConfigurationRequest getRequest(Map<String, Object> properties) {
     String type = (String) properties.get(CONFIGURATION_CONFIG_TYPE_PROPERTY_ID);
     String tag  = (String) properties.get(CONFIGURATION_CONFIG_TAG_PROPERTY_ID);
 
-    ConfigurationRequest configRequest = new ConfigurationRequest(
+    return new ConfigurationRequest(
         (String) properties.get(CONFIGURATION_CLUSTER_NAME_PROPERTY_ID),
         type, tag, new HashMap<String, String>(), new HashMap<String, Map<String, String>>());
-
-    Set<String> requestedIds = request.getPropertyIds();
-    if (requestedIds.contains("properties") || requestedIds.contains("*")) {
-      configRequest.setIncludeProperties(true);
-    }
-
-    return configRequest;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerResourceProvider.java
deleted file mode 100644
index afb9ae9..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerResourceProvider.java
+++ /dev/null
@@ -1,282 +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.controller.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.ambari.server.AmbariException;
-import org.apache.ambari.server.controller.AmbariManagementController;
-import org.apache.ambari.server.controller.ControllerRequest;
-import org.apache.ambari.server.controller.ControllerResponse;
-import org.apache.ambari.server.controller.LdapSyncRequest;
-import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
-import org.apache.ambari.server.controller.spi.NoSuchResourceException;
-import org.apache.ambari.server.controller.spi.Predicate;
-import org.apache.ambari.server.controller.spi.Request;
-import org.apache.ambari.server.controller.spi.RequestStatus;
-import org.apache.ambari.server.controller.spi.Resource;
-import org.apache.ambari.server.controller.spi.ResourceAlreadyExistsException;
-import org.apache.ambari.server.controller.spi.SystemException;
-import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
-import org.apache.ambari.server.orm.entities.LdapSyncSpecEntity;
-import org.apache.ambari.server.security.ldap.LdapBatchDto;
-import org.apache.ambari.server.security.ldap.LdapGroupDto;
-import org.apache.ambari.server.security.ldap.LdapSyncDto;
-import org.apache.ambari.server.security.ldap.LdapUserDto;
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Resource provider for controller resource.
- */
-class ControllerResourceProvider extends AbstractControllerResourceProvider {
-
-  // ----- Property ID constants ---------------------------------------------
-
-  protected static final String CONTROLLER_NAME_PROPERTY_ID               = PropertyHelper.getPropertyId("Controllers", "name");
-  protected static final String CONTROLLER_LDAP_CONFIGURED_PROPERTY_ID    = PropertyHelper.getPropertyId("LDAP", "configured");
-  protected static final String CONTROLLER_LDAP_USERS_PROPERTY_ID         = PropertyHelper.getPropertyId("LDAP", "users");
-  protected static final String CONTROLLER_LDAP_GROUPS_PROPERTY_ID        = PropertyHelper.getPropertyId("LDAP", "groups");
-  protected static final String CONTROLLER_LDAP_SYNCED_USERS_PROPERTY_ID  = PropertyHelper.getPropertyId("LDAP", "synced_users");
-  protected static final String CONTROLLER_LDAP_SYNCED_GROUPS_PROPERTY_ID = PropertyHelper.getPropertyId("LDAP", "synced_groups");
-
-  protected static final String ALL_ENTRIES = "*";
-
-  private static Set<String> pkPropertyIds = new HashSet<String>(
-      Arrays.asList(new String[] { CONTROLLER_NAME_PROPERTY_ID }));
-
-  private static Map<String, ControllerResponse> controllers = new HashMap<String, ControllerResponse>() {
-    {
-      for (ControllerType type: ControllerType.values()) {
-        put(type.getName(), new ControllerResponse(type.getName()));
-      }
-    }
-  };
-
-  /**
-   * Create a new resource provider for the given management controller.
-   *
-   * @param propertyIds           the property ids
-   * @param keyPropertyIds        the key property ids
-   * @param managementController  the management controller
-   */
-  ControllerResourceProvider(Set<String> propertyIds,
-                       Map<Resource.Type, String> keyPropertyIds,
-                       AmbariManagementController managementController) {
-    super(propertyIds, keyPropertyIds, managementController);
-  }
-
-  @Override
-  public RequestStatus createResources(Request request)
-      throws SystemException,
-      UnsupportedPropertyException,
-      ResourceAlreadyExistsException,
-      NoSuchParentResourceException {
-    // controllers can't be dynamically created
-    return getRequestStatus(null);
-  }
-
-  @Override
-  public Set<Resource> getResources(Request request, Predicate predicate)
-      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
-    final Set<ControllerRequest> requests = new HashSet<ControllerRequest>();
-
-    if (predicate == null) {
-      requests.add(getRequest(null));
-    } else {
-      for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
-        requests.add(getRequest(propertyMap));
-      }
-    }
-
-    Set<ControllerResponse> responses = getResources(new Command<Set<ControllerResponse>>() {
-      @Override
-      public Set<ControllerResponse> invoke() throws AmbariException {
-        final Set<ControllerResponse> responses = new HashSet<ControllerResponse>();
-        for (ControllerRequest request: requests) {
-          if (request.getName() == null) {
-            responses.addAll(controllers.values());
-          } else {
-            if (controllers.containsKey(request.getName())) {
-              responses.add(controllers.get(request.getName()));
-            }
-          }
-        }
-        return responses;
-      }
-    });
-
-    Set<String>   requestedIds = getRequestPropertyIds(request, predicate);
-    Set<Resource> resources    = new HashSet<Resource>();
-
-    for (ControllerResponse controllerResponse : responses) {
-      ResourceImpl resource = new ResourceImpl(Resource.Type.Controller);
-
-      setResourceProperty(resource, CONTROLLER_NAME_PROPERTY_ID,
-          controllerResponse.getName(), requestedIds);
-
-      switch (ControllerType.getByName(controllerResponse.getName())) {
-      case LDAP:
-        final boolean ldapConfigured = getManagementController().checkLdapConfigured();
-        setResourceProperty(resource, CONTROLLER_LDAP_CONFIGURED_PROPERTY_ID,
-            ldapConfigured, requestedIds);
-        if (ldapConfigured) {
-          try {
-            final LdapSyncDto syncInfo = getManagementController().getLdapSyncInfo();
-
-            final List<String> allUsers = new ArrayList<String>();
-            final List<String> syncedUsers = new ArrayList<String>();
-            for (LdapUserDto user : syncInfo.getUsers()) {
-              allUsers.add(user.getUserName());
-              if (user.isSynced()) {
-                syncedUsers.add(user.getUserName());
-              }
-            }
-            setResourceProperty(resource, CONTROLLER_LDAP_USERS_PROPERTY_ID,
-                allUsers, requestedIds);
-            setResourceProperty(resource, CONTROLLER_LDAP_SYNCED_USERS_PROPERTY_ID,
-                syncedUsers, requestedIds);
-            final List<String> allGroups = new ArrayList<String>();
-            final List<String> syncedGroups = new ArrayList<String>();
-            for (LdapGroupDto group : syncInfo.getGroups()) {
-              allGroups.add(group.getGroupName());
-              if (group.isSynced()) {
-                syncedGroups.add(group.getGroupName());
-              }
-            }
-            setResourceProperty(resource, CONTROLLER_LDAP_GROUPS_PROPERTY_ID,
-                allGroups, requestedIds);
-            setResourceProperty(resource, CONTROLLER_LDAP_SYNCED_GROUPS_PROPERTY_ID,
-                syncedGroups, requestedIds);
-          } catch (AmbariException ex) {
-            throw new SystemException("Can't retrieve data from external LDAP server", ex);
-          }
-        }
-        break;
-      }
-
-      resources.add(resource);
-    }
-
-    return resources;
-  }
-
-  @Override
-  public RequestStatus updateResources(Request request, Predicate predicate)
-    throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-
-    final Set<ControllerRequest> requests = new HashSet<ControllerRequest>();
-
-    for (Map<String, Object> propertyMap : getPropertyMaps(request.getProperties().iterator().next(), predicate)) {
-      final ControllerRequest req = getRequest(propertyMap);
-      requests.add(req);
-    }
-
-    // one request per each controller
-    Set<Resource> resources = new HashSet<Resource>();
-    for (final ControllerRequest controllerRequest: requests) {
-      Resource resource = modifyResources(new Command<Resource>() {
-        @Override
-        public Resource invoke() throws AmbariException {
-          Resource resource = null;
-          switch (ControllerType.getByName(controllerRequest.getName())) {
-          case LDAP:
-            resource = new ResourceImpl(Resource.Type.Controller);
-            Set<String> users = null;
-            if (controllerRequest.getPropertyMap().containsKey(CONTROLLER_LDAP_SYNCED_USERS_PROPERTY_ID)) {
-              final String userCsv = (String) controllerRequest.getPropertyMap().get(CONTROLLER_LDAP_SYNCED_USERS_PROPERTY_ID);
-              if (!userCsv.trim().equals(ALL_ENTRIES)) {
-                users = new HashSet<String>();
-                for (String user: userCsv.split(",")) {
-                  if (StringUtils.isNotEmpty(user)) {
-                    users.add(user.toLowerCase());
-                  }
-                }
-              }
-            }
-            Set<String> groups = null;
-            if (controllerRequest.getPropertyMap().containsKey(CONTROLLER_LDAP_SYNCED_GROUPS_PROPERTY_ID)) {
-              final String groupCsv = (String) controllerRequest.getPropertyMap().get(CONTROLLER_LDAP_SYNCED_GROUPS_PROPERTY_ID);
-              if (!groupCsv.trim().equals(ALL_ENTRIES)) {
-                groups = new HashSet<String>();
-                for (String group : groupCsv.split(",")) {
-                  if (StringUtils.isNotEmpty(group)) {
-                    groups.add(group.toLowerCase());
-                  }
-                }
-              }
-            }
-            if (!getManagementController().isLdapSyncInProgress()) {
-
-              LdapSyncRequest userRequest = users == null ? new LdapSyncRequest(LdapSyncSpecEntity.SyncType.ALL) :
-                  new LdapSyncRequest(LdapSyncSpecEntity.SyncType.SPECIFIC, users);
-
-              LdapSyncRequest groupRequest = groups == null ? new LdapSyncRequest(LdapSyncSpecEntity.SyncType.ALL) :
-                  new LdapSyncRequest(LdapSyncSpecEntity.SyncType.SPECIFIC, groups);
-
-              LdapBatchDto syncInfo = getManagementController().synchronizeLdapUsersAndGroups(userRequest, groupRequest);
-              resource.setProperty("Sync/status", "successful");
-              resource.setProperty("Sync/summary/Users/created", syncInfo.getUsersToBeCreated().size());
-              resource.setProperty("Sync/summary/Users/updated", syncInfo.getUsersToBecomeLdap().size());
-              resource.setProperty("Sync/summary/Users/removed", syncInfo.getUsersToBeRemoved().size());
-              resource.setProperty("Sync/summary/Groups/created", syncInfo.getGroupsToBeCreated().size());
-              resource.setProperty("Sync/summary/Groups/updated", syncInfo.getGroupsToBecomeLdap().size());
-              resource.setProperty("Sync/summary/Groups/removed", syncInfo.getGroupsToBeRemoved().size());
-              resource.setProperty("Sync/summary/Memberships/created", syncInfo.getMembershipToAdd().size());
-              resource.setProperty("Sync/summary/Memberships/removed", syncInfo.getMembershipToRemove().size());
-            } else {
-              resource.setProperty("Sync/status", "not started");
-              resource.setProperty("Sync/summary", "Another sync is already running");
-            }
-            break;
-          }
-          return resource;
-        }
-      });
-      resources.add(resource);
-    }
-
-    return getRequestStatus(null, resources);
-  }
-
-  @Override
-  public RequestStatus deleteResources(Predicate predicate)
-      throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException {
-    // controllers can't be removed
-    return getRequestStatus(null);
-  }
-
-  @Override
-  protected Set<String> getPKPropertyIds() {
-    return pkPropertyIds;
-  }
-
-  private ControllerRequest getRequest(Map<String, Object> properties) {
-    if (properties == null) {
-      return new ControllerRequest(null, properties);
-    }
-    return new ControllerRequest((String) properties.get(CONTROLLER_NAME_PROPERTY_ID), properties);
-  }
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerType.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerType.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerType.java
deleted file mode 100644
index 82b6eac..0000000
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ControllerType.java
+++ /dev/null
@@ -1,65 +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.controller.internal;
-
-import org.apache.commons.lang.StringUtils;
-
-/**
- * Enumeration of internal controllers used via API.
- */
-public enum ControllerType {
-  LDAP("ldap");
-
-  /**
-   * Controller name.
-   */
-  private String name;
-
-  /**
-   * Constructor.
-   *
-   * @param name controller name
-   */
-  private ControllerType(String name) {
-    this.name = name;
-  }
-
-  /**
-   * Getter.
-   *
-   * @return controller name
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Returns corresponding controller type to given name.
-   *
-   * @param name controller name
-   * @return null if controller type was not found
-   */
-  public static ControllerType getByName(String name) {
-    for (ControllerType type : ControllerType.values()) {
-      if (StringUtils.equals(type.getName(), name)) {
-        return type;
-      }
-    }
-    return null;
-  }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
index ab89db2..fa1aa67 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/DefaultProviderModule.java
@@ -71,16 +71,6 @@ public class DefaultProviderModule extends AbstractProviderModule {
         return new StackDependencyResourceProvider(propertyIds, keyPropertyIds);
       case Permission:
         return new PermissionResourceProvider();
-      case AmbariPrivilege:
-        return new AmbariPrivilegeResourceProvider();
-      case ViewPrivilege:
-        return new ViewPrivilegeResourceProvider();
-      case ViewPermission:
-        return new ViewPermissionResourceProvider();
-      case ClusterPrivilege:
-        return new ClusterPrivilegeResourceProvider();
-      case LdapSyncEvent:
-        return new LdapSyncEventResourceProvider(managementController);
       default:
         return AbstractControllerResourceProvider.getResourceProvider(type, propertyIds,
             keyPropertyIds, managementController);

http://git-wip-us.apache.org/repos/asf/ambari/blob/7e28d1e3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
index 732203a..89d53ae 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostComponentResourceProvider.java
@@ -24,7 +24,6 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
-import com.google.inject.Injector;
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.configuration.ComponentSSLConfiguration;
 import org.apache.ambari.server.controller.AmbariManagementController;
@@ -81,10 +80,26 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
       = "HostRoles/maintenance_state";
   
   //Component name mappings
-  private final Map<String, PropertyProvider> HOST_COMPONENT_PROPERTIES_PROVIDER = new HashMap<String, PropertyProvider>();
+  private static final Map<String, PropertyProvider> HOST_COMPONENT_PROPERTIES_PROVIDER = new HashMap<String, PropertyProvider>();
   private static final int HOST_COMPONENT_HTTP_PROPERTY_REQUEST_CONNECT_TIMEOUT = 1500;   //milliseconds
   private static final int HOST_COMPONENT_HTTP_PROPERTY_REQUEST_READ_TIMEOUT = 10000;  //milliseconds
 
+  static {
+    ComponentSSLConfiguration configuration = ComponentSSLConfiguration.instance();
+    URLStreamProvider streamProvider = new URLStreamProvider(
+        HOST_COMPONENT_HTTP_PROPERTY_REQUEST_CONNECT_TIMEOUT,
+        HOST_COMPONENT_HTTP_PROPERTY_REQUEST_READ_TIMEOUT,
+        configuration.getTruststorePath(), configuration.getTruststorePassword(), configuration.getTruststoreType());
+
+    HOST_COMPONENT_PROPERTIES_PROVIDER.put(
+        "NAGIOS_SERVER",
+        new HttpProxyPropertyProvider(
+            streamProvider, configuration,
+            PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
+            PropertyHelper.getPropertyId("HostRoles", "host_name"),
+            PropertyHelper.getPropertyId("HostRoles", "component_name")));
+  }
+
   //Parameters from the predicate
   private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
       "params/run_smoke_test";
@@ -107,24 +122,8 @@ public class HostComponentResourceProvider extends AbstractControllerResourcePro
   @AssistedInject
   public HostComponentResourceProvider(@Assisted Set<String> propertyIds,
                                        @Assisted Map<Resource.Type, String> keyPropertyIds,
-                                       @Assisted AmbariManagementController managementController,
-                                       Injector injector) {
+                                       @Assisted AmbariManagementController managementController) {
     super(propertyIds, keyPropertyIds, managementController);
-    ComponentSSLConfiguration configuration = ComponentSSLConfiguration.instance();
-    URLStreamProvider streamProvider = new URLStreamProvider(
-            HOST_COMPONENT_HTTP_PROPERTY_REQUEST_CONNECT_TIMEOUT,
-            HOST_COMPONENT_HTTP_PROPERTY_REQUEST_READ_TIMEOUT,
-            configuration.getTruststorePath(), configuration.getTruststorePassword(), configuration.getTruststoreType());
-
-    HttpProxyPropertyProvider httpPropertyProvider = new HttpProxyPropertyProvider(streamProvider,
-            configuration, injector,
-            PropertyHelper.getPropertyId("HostRoles", "cluster_name"),
-            PropertyHelper.getPropertyId("HostRoles", "host_name"),
-            PropertyHelper.getPropertyId("HostRoles", "component_name"));
-
-    HOST_COMPONENT_PROPERTIES_PROVIDER.put("NAGIOS_SERVER", httpPropertyProvider);
-
-    HOST_COMPONENT_PROPERTIES_PROVIDER.put("RESOURCEMANAGER", httpPropertyProvider);
   }
 
   // ----- ResourceProvider ------------------------------------------------


Mime
View raw message