ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [03/50] [abbrv] ambari git commit: AMBARI-20940 - Propagate Component versions and states to Service (jonathanhurley)
Date Wed, 31 May 2017 20:12:34 GMT
AMBARI-20940 - Propagate Component versions and states to Service (jonathanhurley)


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

Branch: refs/heads/trunk
Commit: f65692a32d95e200624fa9d7dfb9ee7a1b00cb29
Parents: 8782cf6
Author: Jonathan Hurley <jhurley@hortonworks.com>
Authored: Fri May 5 10:22:16 2017 -0400
Committer: Jonathan Hurley <jhurley@hortonworks.com>
Committed: Fri May 5 13:34:59 2017 -0400

----------------------------------------------------------------------
 .../alerts/ComponentVersionAlertRunnable.java   |  2 +-
 .../AmbariManagementControllerImpl.java         | 10 +--
 .../controller/ResourceProviderFactory.java     |  8 +-
 .../controller/ServiceComponentResponse.java    | 41 ++++-----
 .../server/controller/ServiceResponse.java      | 34 ++++---
 .../AbstractControllerResourceProvider.java     | 22 ++++-
 .../internal/ComponentResourceProvider.java     | 54 +++++++++--
 .../internal/ServiceResourceProvider.java       | 91 +++++++++++++------
 .../controller/utilities/PropertyHelper.java    |  8 ++
 .../PrepareDisableKerberosServerAction.java     |  2 +-
 .../server/state/RepositoryVersionState.java    | 56 ++++++++++--
 .../org/apache/ambari/server/state/Service.java |  8 +-
 .../ambari/server/state/ServiceComponent.java   |  2 +-
 .../server/state/ServiceComponentImpl.java      | 18 ++--
 .../apache/ambari/server/state/ServiceImpl.java | 39 +++++---
 .../svccomphost/ServiceComponentHostImpl.java   | 10 +--
 .../src/main/resources/key_properties.json      | 10 ---
 .../src/main/resources/properties.json          | 38 --------
 .../ComponentVersionAlertRunnableTest.java      |  2 +-
 .../resources/BaseResourceDefinitionTest.java   | 11 +--
 .../AmbariManagementControllerImplTest.java     |  6 +-
 .../AmbariManagementControllerTest.java         | 16 ++--
 .../AbstractControllerResourceProviderTest.java | 27 ++----
 .../internal/AbstractResourceProviderTest.java  | 19 ++--
 .../internal/ComponentResourceProviderTest.java | 94 ++++++++------------
 .../internal/JMXHostProviderTest.java           |  6 +-
 .../controller/internal/RequestImplTest.java    | 28 +++++-
 .../internal/ServiceResourceProviderTest.java   | 46 ++++------
 .../UpgradeResourceProviderHDP22Test.java       |  8 +-
 .../internal/UpgradeResourceProviderTest.java   |  8 +-
 .../server/state/ServiceComponentTest.java      | 33 ++++---
 .../apache/ambari/server/state/ServiceTest.java |  8 +-
 .../svccomphost/ServiceComponentHostTest.java   |  4 +-
 33 files changed, 417 insertions(+), 352 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java b/ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java
index d275eb2..ec5c85e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnable.java
@@ -111,7 +111,7 @@ public class ComponentVersionAlertRunnable extends AlertRunnable {
         ServiceComponent serviceComponent = service.getServiceComponent(hostComponent.getServiceComponentName());
 
         RepositoryVersionEntity desiredRepositoryVersion = service.getDesiredRepositoryVersion();
-        StackId desiredStackId = serviceComponent.getDesiredStackVersion();
+        StackId desiredStackId = serviceComponent.getDesiredStackId();
         String desiredVersion = desiredRepositoryVersion.getVersion();
 
         final ComponentInfo componentInfo;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 67ae5d5..e2bd50f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -2070,7 +2070,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
         changedComponentCount.get(serviceName).keySet()) {
         ServiceComponent sc = cluster.getService(serviceName).
           getServiceComponent(componentName);
-        StackId stackId = sc.getDesiredStackVersion();
+        StackId stackId = sc.getDesiredStackId();
         ComponentInfo compInfo = ambariMetaInfo.getComponent(
           stackId.getStackName(), stackId.getStackVersion(), serviceName,
           componentName);
@@ -2782,7 +2782,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                     event = new ServiceComponentHostInstallEvent(
                         scHost.getServiceComponentName(), scHost.getHostName(),
                         nowTimestamp,
-                        serviceComponent.getDesiredStackVersion().getStackId());
+                        serviceComponent.getDesiredStackId().getStackId());
                   }
                 } else if (oldSchState == State.STARTED
                       // TODO: oldSchState == State.INSTALLED is always false, looks like a bug
@@ -2796,7 +2796,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                   roleCommand = RoleCommand.UPGRADE;
                   event = new ServiceComponentHostUpgradeEvent(
                       scHost.getServiceComponentName(), scHost.getHostName(),
-                      nowTimestamp, serviceComponent.getDesiredStackVersion().getStackId());
+                      nowTimestamp, serviceComponent.getDesiredStackId().getStackId());
                 } else {
                   throw new AmbariException("Invalid transition for"
                       + " servicecomponenthost"
@@ -2810,7 +2810,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
                 }
                 break;
               case STARTED:
-                StackId stackId = serviceComponent.getDesiredStackVersion();
+                StackId stackId = serviceComponent.getDesiredStackId();
                 ComponentInfo compInfo = ambariMetaInfo.getComponent(
                     stackId.getStackName(), stackId.getStackVersion(), scHost.getServiceName(),
                     scHost.getServiceComponentName());
@@ -3865,7 +3865,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
      * that has client component is in maintenance state
      */
 
-    StackId stackId = service.getDesiredStackVersion();
+    StackId stackId = service.getDesiredStackId();
     ComponentInfo compInfo =
         ambariMetaInfo.getService(stackId.getStackName(),
             stackId.getStackVersion(), service.getName()).getClientComponent();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
index 2ab69cb..175c6b5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ResourceProviderFactory.java
@@ -41,14 +41,10 @@ public interface ResourceProviderFactory {
       AmbariManagementController managementController);
 
   @Named("service")
-  ResourceProvider getServiceResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController);
+  ResourceProvider getServiceResourceProvider(AmbariManagementController managementController);
 
   @Named("component")
-  ResourceProvider getComponentResourceProvider(Set<String> propertyIds,
-      Map<Type, String> keyPropertyIds,
-      AmbariManagementController managementController);
+  ResourceProvider getComponentResourceProvider(AmbariManagementController managementController);
 
   @Named("member")
   ResourceProvider getMemberResourceProvider(Set<String> propertyIds,

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
index 16f724f..177c8ab 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceComponentResponse.java
@@ -22,6 +22,7 @@ package org.apache.ambari.server.controller;
 import java.util.Map;
 
 import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.StackId;
 
 public class ServiceComponentResponse {
 
@@ -30,7 +31,7 @@ public class ServiceComponentResponse {
   private String serviceName;
   private String componentName;
   private String displayName;
-  private String desiredStackVersion;
+  private String desiredStackId;
   private String desiredState;
   private String category;
   private Map<String, Integer> serviceComponentStateCount;
@@ -38,22 +39,17 @@ public class ServiceComponentResponse {
   private String desiredVersion;
   private RepositoryVersionState repoState;
 
-  public ServiceComponentResponse(Long clusterId, String clusterName,
-                                  String serviceName,
-                                  String componentName,
-                                  String desiredStackVersion,
-                                  String desiredState,
-                                  Map<String, Integer> serviceComponentStateCount,
-                                  boolean recoveryEnabled,
-                                  String displayName,
-                                  String desiredVersion,
-                                  RepositoryVersionState repoState) {
+  public ServiceComponentResponse(Long clusterId, String clusterName, String serviceName,
+      String componentName, StackId desiredStackId, String desiredState,
+      Map<String, Integer> serviceComponentStateCount, boolean recoveryEnabled, String displayName,
+      String desiredVersion, RepositoryVersionState repoState) {
+
     this.clusterId = clusterId;
     this.clusterName = clusterName;
     this.serviceName = serviceName;
     this.componentName = componentName;
     this.displayName = displayName;
-    this.desiredStackVersion = desiredStackVersion;
+    this.desiredStackId = desiredStackId.getStackId();
     this.desiredState = desiredState;
     this.serviceComponentStateCount = serviceComponentStateCount;
     this.recoveryEnabled = recoveryEnabled;
@@ -139,17 +135,12 @@ public class ServiceComponentResponse {
   }
 
   /**
+   * Gets the desired stack ID.
+   *
    * @return the desiredStackVersion
    */
-  public String getDesiredStackVersion() {
-    return desiredStackVersion;
-  }
-
-  /**
-   * @param desiredStackVersion the desiredStackVersion to set
-   */
-  public void setDesiredStackVersion(String desiredStackVersion) {
-    this.desiredStackVersion = desiredStackVersion;
+  public String getDesiredStackId() {
+    return desiredStackId;
   }
 
   /**
@@ -211,8 +202,12 @@ public class ServiceComponentResponse {
 
   @Override
   public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
+    if (this == o) {
+      return true;
+    }
+    if (o == null || getClass() != o.getClass()) {
+      return false;
+    }
 
     ServiceComponentResponse that =
         (ServiceComponentResponse) o;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
index e67d124f..a16b688 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/ServiceResponse.java
@@ -18,26 +18,31 @@
 
 package org.apache.ambari.server.controller;
 
+import org.apache.ambari.server.state.RepositoryVersionState;
+import org.apache.ambari.server.state.StackId;
 
 public class ServiceResponse {
 
   private Long clusterId;
   private String clusterName;
   private String serviceName;
-  private String desiredStackVersion;
+  private StackId desiredStackId;
   private String desiredRepositoryVersion;
+  private RepositoryVersionState repositoryVersionState;
   private String desiredState;
   private String maintenanceState;
   private boolean credentialStoreSupported;
   private boolean credentialStoreEnabled;
 
   public ServiceResponse(Long clusterId, String clusterName, String serviceName,
-      String desiredStackVersion, String desiredRepositoryVersion, String desiredState,
+      StackId desiredStackId, String desiredRepositoryVersion,
+      RepositoryVersionState repositoryVersionState, String desiredState,
       boolean credentialStoreSupported, boolean credentialStoreEnabled) {
     this.clusterId = clusterId;
     this.clusterName = clusterName;
     this.serviceName = serviceName;
-    setDesiredStackVersion(desiredStackVersion);
+    this.desiredStackId = desiredStackId;
+    this.repositoryVersionState = repositoryVersionState;
     setDesiredState(desiredState);
     this.desiredRepositoryVersion = desiredRepositoryVersion;
     this.credentialStoreSupported = credentialStoreSupported;
@@ -103,17 +108,10 @@ public class ServiceResponse {
   }
 
   /**
-   * @return the desiredStackVersion
+   * @return the desired stack ID.
    */
-  public String getDesiredStackVersion() {
-    return desiredStackVersion;
-  }
-
-  /**
-   * @param desiredStackVersion the desiredStackVersion to set
-   */
-  public void setDesiredStackVersion(String desiredStackVersion) {
-    this.desiredStackVersion = desiredStackVersion;
+  public String getDesiredStackId() {
+    return desiredStackId.getStackId();
   }
 
   /**
@@ -125,6 +123,16 @@ public class ServiceResponse {
     return desiredRepositoryVersion;
   }
 
+  /**
+   * Gets the calculated repository version state from the components of this
+   * service.
+   *
+   * @return the desired repository version state
+   */
+  public RepositoryVersionState getRepositoryVersionState() {
+    return repositoryVersionState;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
index b26814a..a27a5d0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProvider.java
@@ -27,6 +27,7 @@ import org.apache.ambari.server.controller.ResourceProviderFactory;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
 import org.apache.ambari.server.controller.utilities.ClusterControllerHelper;
+import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.state.Cluster;
 
 /**
@@ -57,6 +58,23 @@ public abstract class AbstractControllerResourceProvider extends AbstractAuthori
     this.managementController = managementController;
   }
 
+  /**
+   * 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
+   */
+  protected AbstractControllerResourceProvider(Resource.Type type, Set<String> propertyIds,
+      Map<Resource.Type, String> keyPropertyIds, AmbariManagementController managementController) {
+    this(propertyIds, keyPropertyIds, managementController);
+    PropertyHelper.setPropertyIds(type, propertyIds);
+    PropertyHelper.setKeyPropertyIds(type, keyPropertyIds);
+  }
+
   public static void init(ResourceProviderFactory factory) {
     resourceProviderFactory = factory;
   }
@@ -130,9 +148,9 @@ public abstract class AbstractControllerResourceProvider extends AbstractAuthori
       case Cluster:
         return new ClusterResourceProvider(managementController);
       case Service:
-        return resourceProviderFactory.getServiceResourceProvider(propertyIds, keyPropertyIds, managementController);
+        return resourceProviderFactory.getServiceResourceProvider(managementController);
       case Component:
-        return resourceProviderFactory.getComponentResourceProvider(propertyIds, keyPropertyIds, managementController);
+        return resourceProviderFactory.getComponentResourceProvider(managementController);
       case Host:
         return resourceProviderFactory.getHostResourceProvider(propertyIds, keyPropertyIds, managementController);
       case HostComponent:

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/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 3f4e7c2..24ef41a 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
@@ -89,6 +89,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
   protected static final String COMPONENT_UNKNOWN_COUNT_PROPERTY_ID   = "ServiceComponentInfo/unknown_count";
   protected static final String COMPONENT_INSTALL_FAILED_COUNT_PROPERTY_ID = "ServiceComponentInfo/install_failed_count";
   protected static final String COMPONENT_RECOVERY_ENABLED_ID         = "ServiceComponentInfo/recovery_enabled";
+  protected static final String COMPONENT_DESIRED_STACK               = "ServiceComponentInfo/desired_stack";
   protected static final String COMPONENT_DESIRED_VERSION             = "ServiceComponentInfo/desired_version";
   protected static final String COMPONENT_REPOSITORY_STATE            = "ServiceComponentInfo/repository_state";
 
@@ -102,6 +103,44 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
           COMPONENT_SERVICE_NAME_PROPERTY_ID,
           COMPONENT_COMPONENT_NAME_PROPERTY_ID);
 
+  /**
+   * The property ids for an servce resource.
+   */
+  private static final Set<String> PROPERTY_IDS = new HashSet<>();
+
+  /**
+   * The key property ids for an service resource.
+   */
+  private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<>();
+
+  static {
+    // properties
+    PROPERTY_IDS.add(COMPONENT_CLUSTER_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_SERVICE_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_DISPLAY_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_STATE_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_CATEGORY_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_TOTAL_COUNT_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_STARTED_COUNT_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_INSTALLED_COUNT_PROPERTY_ID);
+
+    PROPERTY_IDS.add(COMPONENT_INIT_COUNT_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_UNKNOWN_COUNT_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_INSTALL_FAILED_COUNT_PROPERTY_ID);
+    PROPERTY_IDS.add(COMPONENT_RECOVERY_ENABLED_ID);
+    PROPERTY_IDS.add(COMPONENT_DESIRED_STACK);
+    PROPERTY_IDS.add(COMPONENT_DESIRED_VERSION);
+    PROPERTY_IDS.add(COMPONENT_REPOSITORY_STATE);
+
+    PROPERTY_IDS.add(QUERY_PARAMETERS_RUN_SMOKE_TEST_ID);
+
+    // keys
+    KEY_PROPERTY_IDS.put(Resource.Type.Component, COMPONENT_COMPONENT_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.Service, COMPONENT_SERVICE_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.Cluster, COMPONENT_CLUSTER_NAME_PROPERTY_ID);
+  }
+
   private MaintenanceStateHelper maintenanceStateHelper;
 
   // ----- Constructors ----------------------------------------------------
@@ -109,16 +148,12 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
   /**
    * 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
    */
   @AssistedInject
-  ComponentResourceProvider(@Assisted Set<String> propertyIds,
-                            @Assisted Map<Resource.Type, String> keyPropertyIds,
-                            @Assisted AmbariManagementController managementController,
-                            MaintenanceStateHelper maintenanceStateHelper) {
-    super(propertyIds, keyPropertyIds, managementController);
+  ComponentResourceProvider(@Assisted AmbariManagementController managementController,
+      MaintenanceStateHelper maintenanceStateHelper) {
+    super(Resource.Type.Component, PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
     this.maintenanceStateHelper = maintenanceStateHelper;
 
     setRequiredCreateAuthorizations(EnumSet.of(RoleAuthorization.SERVICE_ADD_DELETE_SERVICES, RoleAuthorization.HOST_ADD_DELETE_COMPONENTS));
@@ -189,6 +224,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
       setResourceProperty(resource, COMPONENT_INIT_COUNT_PROPERTY_ID, response.getServiceComponentStateCount().get("initCount"), requestedIds);
       setResourceProperty(resource, COMPONENT_UNKNOWN_COUNT_PROPERTY_ID, response.getServiceComponentStateCount().get("unknownCount"), requestedIds);
       setResourceProperty(resource, COMPONENT_RECOVERY_ENABLED_ID, String.valueOf(response.isRecoveryEnabled()), requestedIds);
+      setResourceProperty(resource, COMPONENT_DESIRED_STACK, response.getDesiredStackId(), requestedIds);
       setResourceProperty(resource, COMPONENT_DESIRED_VERSION, response.getDesiredVersion(), requestedIds);
       setResourceProperty(resource, COMPONENT_REPOSITORY_STATE, response.getRepositoryState(), requestedIds);
 
@@ -327,7 +363,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
         // Expected
       }
 
-      StackId stackId = s.getDesiredStackVersion();
+      StackId stackId = s.getDesiredStackId();
       if (!ambariMetaInfo.isValidServiceComponent(stackId.getStackName(),
           stackId.getStackVersion(), s.getName(), request.getComponentName())) {
         throw new IllegalArgumentException("Unsupported or invalid component"
@@ -370,7 +406,7 @@ public class ComponentResourceProvider extends AbstractControllerResourceProvide
         sc.setRecoveryEnabled(recoveryEnabled);
         LOG.info("Component: {}, recovery_enabled from request: {}", request.getComponentName(), recoveryEnabled);
       } else {
-        StackId stackId = s.getDesiredStackVersion();
+        StackId stackId = s.getDesiredStackId();
         ComponentInfo componentInfo = ambariMetaInfo.getComponent(stackId.getStackName(),
                 stackId.getStackVersion(), s.getName(), request.getComponentName());
         if (componentInfo == null) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
index 9cbcea6..c611037 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ServiceResourceProvider.java
@@ -85,40 +85,76 @@ import com.google.inject.assistedinject.AssistedInject;
  * Resource provider for service resources.
  */
 public class ServiceResourceProvider extends AbstractControllerResourceProvider {
+  public static final String SERVICE_CLUSTER_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "cluster_name");
 
+  public static final String SERVICE_SERVICE_NAME_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "service_name");
 
-  // ----- Property ID constants ---------------------------------------------
+  public static final String SERVICE_SERVICE_STATE_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "state");
 
-  // Services
-  public static final String SERVICE_CLUSTER_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "cluster_name");
-  public static final String SERVICE_SERVICE_NAME_PROPERTY_ID    = PropertyHelper.getPropertyId("ServiceInfo", "service_name");
-  public static final String SERVICE_SERVICE_STATE_PROPERTY_ID   = PropertyHelper.getPropertyId("ServiceInfo", "state");
-  public static final String SERVICE_MAINTENANCE_STATE_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "maintenance_state");
-  public static final String SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID =
-    PropertyHelper.getPropertyId("ServiceInfo", "credential_store_supported");
-  public static final String SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID =
-    PropertyHelper.getPropertyId("ServiceInfo", "credential_store_enabled");
+  public static final String SERVICE_MAINTENANCE_STATE_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "maintenance_state");
 
-  public static final String SERVICE_ATTRIBUTES_PROPERTY_ID = PropertyHelper.getPropertyId("Services", "attributes");
+  public static final String SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "credential_store_supported");
 
-  public static final String SERVICE_DESIRED_STACK_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "desired_stack");
-  public static final String SERVICE_DESIRED_REPO_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId("ServiceInfo", "desired_repository_version");
+  public static final String SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "credential_store_enabled");
 
-  //Parameters from the predicate
-  private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID =
-    "params/run_smoke_test";
+  public static final String SERVICE_ATTRIBUTES_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "Services", "attributes");
+
+  public static final String SERVICE_DESIRED_STACK_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "desired_stack");
+
+  public static final String SERVICE_DESIRED_REPO_VERSION_PROPERTY_ID = PropertyHelper.getPropertyId(
+      "ServiceInfo", "desired_repository_version");
 
-  private static final String QUERY_PARAMETERS_RECONFIGURE_CLIENT =
-    "params/reconfigure_client";
+  protected static final String SERVICE_REPOSITORY_STATE = "ServiceInfo/repository_state";
 
-  private static final String QUERY_PARAMETERS_START_DEPENDENCIES =
-    "params/start_dependencies";
+  //Parameters from the predicate
+  private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID = "params/run_smoke_test";
+  private static final String QUERY_PARAMETERS_RECONFIGURE_CLIENT = "params/reconfigure_client";
+  private static final String QUERY_PARAMETERS_START_DEPENDENCIES = "params/start_dependencies";
 
   private static Set<String> pkPropertyIds =
     new HashSet<>(Arrays.asList(new String[]{
       SERVICE_CLUSTER_NAME_PROPERTY_ID,
       SERVICE_SERVICE_NAME_PROPERTY_ID}));
 
+  /**
+   * The property ids for an service resource.
+   */
+  private static final Set<String> PROPERTY_IDS = new HashSet<>();
+
+  /**
+   * The key property ids for an service resource.
+   */
+  private static final Map<Resource.Type, String> KEY_PROPERTY_IDS = new HashMap<>();
+
+  static {
+    // properties
+    PROPERTY_IDS.add(SERVICE_CLUSTER_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_STATE_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_MAINTENANCE_STATE_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_ATTRIBUTES_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_DESIRED_STACK_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_DESIRED_REPO_VERSION_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_REPOSITORY_STATE);
+
+    PROPERTY_IDS.add(QUERY_PARAMETERS_RUN_SMOKE_TEST_ID);
+    PROPERTY_IDS.add(QUERY_PARAMETERS_RECONFIGURE_CLIENT);
+    PROPERTY_IDS.add(QUERY_PARAMETERS_START_DEPENDENCIES);
+
+    // keys
+    KEY_PROPERTY_IDS.put(Resource.Type.Service, SERVICE_SERVICE_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.Cluster, SERVICE_CLUSTER_NAME_PROPERTY_ID);
+  }
 
   private MaintenanceStateHelper maintenanceStateHelper;
 
@@ -138,16 +174,13 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
   /**
    * 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
    */
   @AssistedInject
-  public ServiceResourceProvider(@Assisted Set<String> propertyIds,
-      @Assisted Map<Resource.Type, String> keyPropertyIds,
+  public ServiceResourceProvider(
       @Assisted AmbariManagementController managementController,
       MaintenanceStateHelper maintenanceStateHelper, RepositoryVersionDAO repositoryVersionDAO) {
-    super(propertyIds, keyPropertyIds, managementController);
+    super(Resource.Type.Service, PROPERTY_IDS, KEY_PROPERTY_IDS, managementController);
     this.maintenanceStateHelper = maintenanceStateHelper;
     this.repositoryVersionDAO = repositoryVersionDAO;
 
@@ -219,11 +252,14 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
           String.valueOf(response.isCredentialStoreEnabled()), requestedIds);
 
       setResourceProperty(resource, SERVICE_DESIRED_STACK_PROPERTY_ID,
-          response.getDesiredStackVersion(), requestedIds);
+          response.getDesiredStackId(), requestedIds);
 
       setResourceProperty(resource, SERVICE_DESIRED_REPO_VERSION_PROPERTY_ID,
           response.getDesiredRepositoryVersion(), requestedIds);
 
+      setResourceProperty(resource, SERVICE_REPOSITORY_STATE,
+          response.getRepositoryVersionState(), requestedIds);
+
       Map<String, Object> serviceSpecificProperties = getServiceSpecificProperties(
           response.getClusterName(), response.getServiceName(), requestedIds);
 
@@ -548,8 +584,6 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
 
     // We don't expect batch requests for different clusters, that's why
     // nothing bad should happen if value is overwritten few times
-    String maintenanceCluster = null;
-
     for (ServiceRequest request : requests) {
       if (request.getClusterName() == null
           || request.getClusterName().isEmpty()
@@ -608,7 +642,6 @@ public class ServiceResourceProvider extends AbstractControllerResourceProvider
               "maintenance state to one of " + EnumSet.of(MaintenanceState.OFF, MaintenanceState.ON));
           } else {
             s.setMaintenanceState(newMaint);
-            maintenanceCluster = cluster.getClusterName();
           }
         }
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
index c747a33..f868e86 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/PropertyHelper.java
@@ -115,6 +115,10 @@ public class PropertyHelper {
     return propertyIds == null ? Collections.<String>emptySet() : propertyIds;
   }
 
+  public static void setPropertyIds(Resource.Type resourceType, Set<String> propertyIds) {
+    PROPERTY_IDS.put(resourceType.getInternalType(), propertyIds);
+  }
+
   /**
    * Extract the set of property ids from a component PropertyInfo map.
    *
@@ -147,6 +151,10 @@ public class PropertyHelper {
     return KEY_PROPERTY_IDS.get(resourceType.getInternalType());
   }
 
+  public static void setKeyPropertyIds(Resource.Type resourceType, Map<Resource.Type, String> keyPropertyKeys) {
+    KEY_PROPERTY_IDS.put(resourceType.getInternalType(), keyPropertyKeys);
+  }
+
   /**
    * Helper to get a property name from a string.
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
index 3087379..c85d58f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/serveraction/kerberos/PrepareDisableKerberosServerAction.java
@@ -179,7 +179,7 @@ public class PrepareDisableKerberosServerAction extends AbstractPrepareKerberosS
 
           if (!visitedServices.contains(serviceName)) {
             ServiceComponent serviceComponent = sch.getServiceComponent();
-            StackId stackVersion = serviceComponent.getDesiredStackVersion();
+            StackId stackVersion = serviceComponent.getDesiredStackId();
 
             visitedServices.add(serviceName);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java
index e02e422..11ea512 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java
@@ -18,6 +18,8 @@
 
 package org.apache.ambari.server.state;
 
+import java.util.List;
+
 /**
  * There must be exactly one repository version that is in a CURRENT state for a particular cluster or host.
  * There may be 0 or more repository versions in an INSTALLED or INSTALLING state.
@@ -69,31 +71,71 @@ public enum RepositoryVersionState {
    * when creating a cluster using a specific version.  Transition occurs naturally as
    * hosts report CURRENT.
    */
-  INIT,
+  INIT(2),
 
   /**
    * Repository version is not required
    */
-  NOT_REQUIRED,
+  NOT_REQUIRED(1),
+
   /**
    * Repository version that is in the process of being installed.
    */
-  INSTALLING,
+  INSTALLING(3),
+
   /**
    * Repository version that is installed and supported but not the active version.
    */
-  INSTALLED,
+  INSTALLED(2),
+
   /**
    * Repository version that during the install process failed to install some components.
    */
-  INSTALL_FAILED,
+  INSTALL_FAILED(5),
+
   /**
    * Repository version that is installed for some components but not for all.
    */
-  OUT_OF_SYNC,
+  OUT_OF_SYNC(4),
+
   /**
    * Repository version that is installed and supported and is the active version.
    */
-  CURRENT,
+  CURRENT(0);
+
+  private final int weight;
+
+  /**
+   * Constructor.
+   *
+   * @param weight
+   *          the weight of the state.
+   */
+  private RepositoryVersionState(int weight) {
+    this.weight = weight;
+  }
+
+  /**
+   * Gets a single representation of the repository state based on the supplied
+   * states.
+   *
+   * @param states
+   *          the states to calculate the aggregate for.
+   * @return the "heaviest" state.
+   */
+  public static RepositoryVersionState getAggregateState(List<RepositoryVersionState> states) {
+    if (null == states || states.isEmpty()) {
+      return INIT;
+    }
+
+    RepositoryVersionState heaviestState = states.get(0);
+    for (RepositoryVersionState state : states) {
+      if (state.weight > heaviestState.weight) {
+        heaviestState = state;
+      }
+    }
+
+    return heaviestState;
+  }
 
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
index 7849463..aa0203b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/Service.java
@@ -65,7 +65,7 @@ public interface Service {
    */
   void setSecurityState(SecurityState securityState) throws AmbariException;
 
-  StackId getDesiredStackVersion();
+  StackId getDesiredStackId();
 
   ServiceResponse convertToResponse();
 
@@ -148,6 +148,12 @@ public interface Service {
    */
   void setDesiredRepositoryVersion(RepositoryVersionEntity desiredRepositoryVersion);
 
+  /**
+   * Gets the repository for the desired version of this service by consulting
+   * the repository states of all known components.
+   */
+  RepositoryVersionState getRepositoryState();
+
   enum Type {
     HDFS,
     GLUSTERFS,

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
index 80b4470..57bd8b2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponent.java
@@ -59,7 +59,7 @@ public interface ServiceComponent {
    */
   RepositoryVersionEntity getDesiredRepositoryVersion();
 
-  StackId getDesiredStackVersion();
+  StackId getDesiredStackId();
 
   String getDesiredVersion();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 1f9dc5b..3c8ef35 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -136,7 +136,7 @@ public class ServiceComponentImpl implements ServiceComponent {
 
   @Override
   public void updateComponentInfo() throws AmbariException {
-    StackId stackId = service.getDesiredStackVersion();
+    StackId stackId = service.getDesiredStackId();
     try {
       ComponentInfo compInfo = ambariMetaInfo.getComponent(stackId.getStackName(),
           stackId.getStackVersion(), service.getName(), componentName);
@@ -378,7 +378,7 @@ public class ServiceComponentImpl implements ServiceComponent {
   }
 
   @Override
-  public StackId getDesiredStackVersion() {
+  public StackId getDesiredStackId() {
     ServiceComponentDesiredStateEntity desiredStateEntity = serviceComponentDesiredStateDAO.findById(
         desiredStateEntityId);
 
@@ -429,11 +429,15 @@ public class ServiceComponentImpl implements ServiceComponent {
   @Override
   public ServiceComponentResponse convertToResponse() {
     Cluster cluster = service.getCluster();
+    RepositoryVersionEntity repositoryVersionEntity = getDesiredRepositoryVersion();
+    StackId desiredStackId = repositoryVersionEntity.getStackId();
+
     ServiceComponentResponse r = new ServiceComponentResponse(getClusterId(),
         cluster.getClusterName(), service.getName(), getName(),
-        getDesiredStackVersion().getStackId(), getDesiredState().toString(),
+        desiredStackId, getDesiredState().toString(),
         getServiceComponentStateCount(), isRecoveryEnabled(), displayName,
-        getDesiredVersion(), getRepositoryState());
+        repositoryVersionEntity.getVersion(), getRepositoryState());
+
     return r;
   }
 
@@ -450,7 +454,7 @@ public class ServiceComponentImpl implements ServiceComponent {
       .append(", clusterName=").append(service.getCluster().getClusterName())
       .append(", clusterId=").append(service.getCluster().getClusterId())
       .append(", serviceName=").append(service.getName())
-      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredStackVersion=").append(getDesiredStackId())
       .append(", desiredState=").append(getDesiredState())
       .append(", hostcomponents=[ ");
     boolean first = true;
@@ -656,7 +660,7 @@ public class ServiceComponentImpl implements ServiceComponent {
 
     if (null == componentVersion) {
       RepositoryVersionEntity repoVersion = repoVersionDAO.findByStackAndVersion(
-          getDesiredStackVersion(), reportedVersion);
+          getDesiredStackId(), reportedVersion);
 
       if (null != repoVersion) {
         componentVersion = new ServiceComponentVersionEntity();
@@ -674,7 +678,7 @@ public class ServiceComponentImpl implements ServiceComponent {
 
       } else {
         LOG.warn("There is no repository available for stack {}, version {}",
-            getDesiredStackVersion(), reportedVersion);
+            getDesiredStackId(), reportedVersion);
       }
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index 4e50153..6bb0ffb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -18,6 +18,7 @@
 
 package org.apache.ambari.server.state;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -169,7 +170,7 @@ public class ServiceImpl implements Service {
       }
     }
 
-    StackId stackId = getDesiredStackVersion();
+    StackId stackId = getDesiredStackId();
     ServiceInfo sInfo = ambariMetaInfo.getService(stackId.getStackName(),
         stackId.getStackVersion(), getName());
     isClientOnlyService = sInfo.isClientOnlyService();
@@ -305,7 +306,7 @@ public class ServiceImpl implements Service {
    * {@inheritDoc}
    */
   @Override
-  public StackId getDesiredStackVersion() {
+  public StackId getDesiredStackId() {
     ServiceDesiredStateEntity serviceDesiredStateEntity = getServiceDesiredStateEntity();
     StackEntity desiredStackEntity = serviceDesiredStateEntity.getDesiredStack();
     return new StackId(desiredStackEntity);
@@ -336,12 +337,31 @@ public class ServiceImpl implements Service {
     }
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public RepositoryVersionState getRepositoryState() {
+    if (components.isEmpty()) {
+      return RepositoryVersionState.INIT;
+    }
+
+    List<RepositoryVersionState> states = new ArrayList<>();
+    for( ServiceComponent component : components.values() ){
+      states.add(component.getRepositoryState());
+    }
+
+    return RepositoryVersionState.getAggregateState(states);
+  }
+
   @Override
   public ServiceResponse convertToResponse() {
+    RepositoryVersionEntity desiredRespositoryVersion = getDesiredRepositoryVersion();
+    StackId desiredStackId = desiredRespositoryVersion.getStackId();
+
     ServiceResponse r = new ServiceResponse(cluster.getClusterId(), cluster.getClusterName(),
-        getName(), getDesiredStackVersion().getStackId(),
-        getDesiredRepositoryVersion().getVersion(), getDesiredState().toString(),
-        isCredentialStoreSupported(), isCredentialStoreEnabled());
+        getName(), desiredStackId, desiredRespositoryVersion.getVersion(), getRepositoryState(),
+        getDesiredState().toString(), isCredentialStoreSupported(), isCredentialStoreEnabled());
 
     r.setMaintenanceState(getMaintenanceState().name());
     return r;
@@ -427,7 +447,7 @@ public class ServiceImpl implements Service {
     sb.append("Service={ serviceName=").append(getName())
       .append(", clusterName=").append(cluster.getClusterName())
       .append(", clusterId=").append(cluster.getClusterId())
-      .append(", desiredStackVersion=").append(getDesiredStackVersion())
+      .append(", desiredStackVersion=").append(getDesiredStackId())
       .append(", desiredState=").append(getDesiredState())
       .append(", components=[ ");
     boolean first = true;
@@ -589,12 +609,7 @@ public class ServiceImpl implements Service {
   @Transactional
   protected void removeEntities() throws AmbariException {
     serviceDesiredStateDAO.removeByPK(serviceDesiredStateEntityPK);
-
-    ClusterServiceEntityPK pk = new ClusterServiceEntityPK();
-    pk.setClusterId(getClusterId());
-    pk.setServiceName(getName());
-
-    clusterServiceDAO.removeByPK(pk);
+    clusterServiceDAO.removeByPK(serviceEntityPK);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index a0d7352..056959e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -769,7 +769,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
       throw new RuntimeException(e);
     }
 
-    StackId stackId = serviceComponent.getDesiredStackVersion();
+    StackId stackId = serviceComponent.getDesiredStackId();
     StackEntity stackEntity = stackDAO.find(stackId.getStackName(),
         stackId.getStackVersion());
 
@@ -1195,13 +1195,13 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
     String publicHostName = hostEntity.getPublicHostName();
     String state = getState().toString();
     String desiredState = (hostComponentDesiredStateEntity == null) ? null : hostComponentDesiredStateEntity.getDesiredState().toString();
-    String desiredStackId = serviceComponent.getDesiredStackVersion().getStackId();
+    String desiredStackId = serviceComponent.getDesiredStackId().getStackId();
     HostComponentAdminState componentAdminState = getComponentAdminStateFromDesiredStateEntity(hostComponentDesiredStateEntity);
     UpgradeState upgradeState = hostComponentStateEntity.getUpgradeState();
 
     String displayName = null;
     try {
-      StackId stackVersion = serviceComponent.getDesiredStackVersion();
+      StackId stackVersion = serviceComponent.getDesiredStackId();
       ComponentInfo compInfo = ambariMetaInfo.getComponent(stackVersion.getStackName(),
               stackVersion.getStackVersion(), serviceName, serviceComponentName);
       displayName = compInfo.getDisplayName();
@@ -1246,7 +1246,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
     .append(", serviceName=")
     .append(serviceComponent.getServiceName())
     .append(", desiredStackVersion=")
-    .append(serviceComponent.getDesiredStackVersion())
+    .append(serviceComponent.getDesiredStackId())
     .append(", desiredState=")
     .append(getDesiredState())
     .append(", version=")
@@ -1311,7 +1311,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost {
     // completed, but only if it was persisted
     if (fireRemovalEvent) {
       long clusterId = getClusterId();
-      StackId stackId = serviceComponent.getDesiredStackVersion();
+      StackId stackId = serviceComponent.getDesiredStackId();
       String stackVersion = stackId.getStackVersion();
       String stackName = stackId.getStackName();
       String serviceName = getServiceName();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/resources/key_properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/key_properties.json b/ambari-server/src/main/resources/key_properties.json
index df2006a..5d76062 100644
--- a/ambari-server/src/main/resources/key_properties.json
+++ b/ambari-server/src/main/resources/key_properties.json
@@ -2,20 +2,10 @@
   "Cluster": {
     "Cluster": "Clusters/cluster_name"
   },
-  "Service": {
-    "Cluster": "ServiceInfo/cluster_name",
-    "Service": "ServiceInfo/service_name"
-  },
   "Host": {
     "Cluster": "Hosts/cluster_name",
     "Host": "Hosts/host_name"
   },
-  "Component": {
-    "Cluster": "ServiceComponentInfo/cluster_name",
-    "Service": "ServiceComponentInfo/service_name",
-    "Component": "ServiceComponentInfo/component_name",
-    "HostComponent": "ServiceComponentInfo/component_name"
-  },
   "HostComponent": {
     "Cluster": "HostRoles/cluster_name",
     "Host": "HostRoles/host_name",

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index c3b0f68..ed94f44 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -12,23 +12,6 @@
         "Clusters/health_report",
         "_"
     ],
-    "Service":[
-        "ServiceInfo/service_name",
-        "ServiceInfo/cluster_name",
-        "ServiceInfo/desired_stack",
-        "ServiceInfo/desired_repository_version",
-        "ServiceInfo/state",
-        "ServiceInfo/maintenance_state",
-        "ServiceInfo/credential_store_supported",
-        "ServiceInfo/credential_store_enabled",
-        "Services/description",
-        "Services/display_name",
-        "Services/attributes",
-        "params/run_smoke_test",
-        "params/reconfigure_client",
-        "params/start_dependencies",
-        "_"
-    ],
     "Host":[
         "Hosts/cluster_name",
         "Hosts/host_name",
@@ -55,27 +38,6 @@
         "Hosts/recovery_summary",
         "_"
     ],
-    "Component":[
-        "ServiceComponentInfo/service_name",
-        "ServiceComponentInfo/component_name",
-        "ServiceComponentInfo/cluster_name",
-        "ServiceComponentInfo/display_name",
-        "ServiceComponentInfo/state",
-        "ServiceComponentInfo/display_name",
-        "ServiceComponentInfo/description",
-        "ServiceComponentInfo/category",
-        "ServiceComponentInfo/total_count",
-        "ServiceComponentInfo/started_count",
-        "ServiceComponentInfo/installed_count",
-        "ServiceComponentInfo/install_failed_count",
-        "ServiceComponentInfo/init_count",
-        "ServiceComponentInfo/unknown_count",
-        "ServiceComponentInfo/recovery_enabled",
-        "ServiceComponentInfo/desired_version",
-        "ServiceComponentInfo/repository_state",
-        "params/run_smoke_test",
-        "_"
-    ],
     "HostComponent":[
         "HostRoles/role_id",
         "HostRoles/cluster_name",

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java b/ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java
index 7ba5bc0..b361418 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/alerts/ComponentVersionAlertRunnableTest.java
@@ -149,7 +149,7 @@ public class ComponentVersionAlertRunnableTest extends EasyMockSupport {
     expect(service.getDesiredRepositoryVersion()).andReturn(repositoryVersionEntity).atLeastOnce();
 
     ServiceComponent serviceComponent = createNiceMock(ServiceComponent.class);
-    expect(serviceComponent.getDesiredStackVersion()).andReturn(m_desidredStackId).atLeastOnce();
+    expect(serviceComponent.getDesiredStackId()).andReturn(m_desidredStackId).atLeastOnce();
     expect(service.getServiceComponent(EasyMock.anyString())).andReturn(serviceComponent).atLeastOnce();
 
     // components

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/api/resources/BaseResourceDefinitionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/resources/BaseResourceDefinitionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/resources/BaseResourceDefinitionTest.java
index 8bbd49a..5564957 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/resources/BaseResourceDefinitionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/resources/BaseResourceDefinitionTest.java
@@ -34,7 +34,6 @@ 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.api.handlers.BaseManagementHandler;
@@ -50,12 +49,10 @@ import org.apache.ambari.server.controller.internal.ResourceImpl;
 import org.apache.ambari.server.controller.internal.ServiceResourceProvider;
 import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.ResourceProvider;
-import org.apache.ambari.server.controller.utilities.PropertyHelper;
 import org.apache.ambari.server.events.publishers.AmbariEventPublisher;
 import org.apache.ambari.server.orm.dao.RepositoryVersionDAO;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.view.ViewRegistry;
-import org.easymock.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -98,13 +95,11 @@ public class BaseResourceDefinitionTest {
     expect(maintenanceStateHelper.isOperationAllowed(anyObject(Resource.Type.class),
             anyObject(Service.class))).andReturn(true).anyTimes();
 
-    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(
-        PropertyHelper.getPropertyIds(Resource.Type.Service),
-        PropertyHelper.getKeyPropertyIds(Resource.Type.Service), managementController,
+    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(managementController,
         maintenanceStateHelper, repositoryVersionDAO);
 
-    expect(factory.getServiceResourceProvider(EasyMock.<Set<String>>anyObject(),
-        EasyMock.<Map<Resource.Type, String>>anyObject(),
+    expect(
+        factory.getServiceResourceProvider(
         anyObject(AmbariManagementController.class))).andReturn(serviceResourceProvider);
 
     AbstractControllerResourceProvider.init(factory);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
index f35122a..f5848f4 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java
@@ -343,7 +343,7 @@ public class AmbariManagementControllerImplTest {
 
     expect(service.getName()).andReturn("service");
     expect(service.getServiceComponent("component")).andReturn(component);
-    expect(service.getDesiredStackVersion()).andReturn(stackId);
+    expect(service.getDesiredStackId()).andReturn(stackId);
     expect(stackId.getStackName()).andReturn("stack");
     expect(stackId.getStackVersion()).andReturn("1.0");
 
@@ -377,7 +377,7 @@ public class AmbariManagementControllerImplTest {
     expect(service.getName()).andReturn("service");
     expect(service.getServiceComponent("component")).andThrow(
       new ServiceComponentNotFoundException("cluster", "service", "component"));
-    expect(service.getDesiredStackVersion()).andReturn(stackId);
+    expect(service.getDesiredStackId()).andReturn(stackId);
     expect(stackId.getStackName()).andReturn("stack");
     expect(stackId.getStackVersion()).andReturn("1.0");
     Map<String, ServiceComponent> componentsMap = new HashMap<>();
@@ -415,7 +415,7 @@ public class AmbariManagementControllerImplTest {
     ServiceComponent component2 = createNiceMock(ServiceComponent.class);
 
     expect(service.getName()).andReturn("service");
-    expect(service.getDesiredStackVersion()).andReturn(stackId);
+    expect(service.getDesiredStackId()).andReturn(stackId);
     expect(stackId.getStackName()).andReturn("stack");
     expect(stackId.getStackVersion()).andReturn("1.0");
     Map<String, ServiceComponent> componentsMap = new HashMap<>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
index 38e6a22..1899b3a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java
@@ -752,7 +752,7 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals(serviceName, resp.getServiceName());
     Assert.assertEquals(cluster1, resp.getClusterName());
     Assert.assertEquals(State.INIT.toString(), resp.getDesiredState());
-    Assert.assertEquals("HDP-0.2", resp.getDesiredStackVersion());
+    Assert.assertEquals("HDP-0.2", resp.getDesiredStackId());
   }
 
   @Test
@@ -896,7 +896,7 @@ public class AmbariManagementControllerTest {
     for (ServiceResponse svc : response) {
       Assert.assertTrue(svc.getServiceName().equals(serviceName)
           || svc.getServiceName().equals(serviceName2));
-      Assert.assertEquals("HDP-0.2", svc.getDesiredStackVersion());
+      Assert.assertEquals("HDP-0.2", svc.getDesiredStackId());
       Assert.assertEquals(State.INIT.toString(), svc.getDesiredState());
     }
   }
@@ -2339,12 +2339,10 @@ public class AmbariManagementControllerTest {
     ServiceResponse resp1 = resp.iterator().next();
 
     Assert.assertEquals(s1.getClusterId(), resp1.getClusterId().longValue());
-    Assert.assertEquals(s1.getCluster().getClusterName(),
-        resp1.getClusterName());
+    Assert.assertEquals(s1.getCluster().getClusterName(), resp1.getClusterName());
     Assert.assertEquals(s1.getName(), resp1.getServiceName());
-    Assert.assertEquals("HDP-0.1", s1.getDesiredStackVersion().getStackId());
-    Assert.assertEquals(s1.getDesiredStackVersion().getStackId(),
-        resp1.getDesiredStackVersion());
+    Assert.assertEquals("HDP-0.1", s1.getDesiredStackId().getStackId());
+    Assert.assertEquals(s1.getDesiredStackId().getStackId(), resp1.getDesiredStackId());
     Assert.assertEquals(State.INSTALLED.toString(), resp1.getDesiredState());
 
   }
@@ -2458,7 +2456,7 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals(c1.getClusterName(), resp.getClusterName());
     Assert.assertEquals(sc1.getName(), resp.getComponentName());
     Assert.assertEquals(s1.getName(), resp.getServiceName());
-    Assert.assertEquals("HDP-0.2", resp.getDesiredStackVersion());
+    Assert.assertEquals("HDP-0.2", resp.getDesiredStackId());
     Assert.assertEquals(sc1.getDesiredState().toString(),
         resp.getDesiredState());
     Assert.assertEquals(c1.getClusterId(), resp.getClusterId().longValue());
@@ -2628,7 +2626,7 @@ public class AmbariManagementControllerTest {
     Assert.assertEquals(sch1.getState().toString(),
         resp.getLiveState());
     Assert.assertEquals(repositoryVersion.getStackId(),
-        sch1.getServiceComponent().getDesiredStackVersion());
+        sch1.getServiceComponent().getDesiredStackId());
     Assert.assertNotNull(resp.getActualConfigs());
     Assert.assertEquals(1, resp.getActualConfigs().size());
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProviderTest.java
index 35ce868..f473aeb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractControllerResourceProviderTest.java
@@ -25,11 +25,6 @@ import static org.easymock.EasyMock.replay;
 import static org.easymock.EasyMock.verify;
 import static org.junit.Assert.assertEquals;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
 import org.apache.ambari.server.controller.AmbariManagementController;
 import org.apache.ambari.server.controller.MaintenanceStateHelper;
 import org.apache.ambari.server.controller.ResourceProviderFactory;
@@ -46,17 +41,6 @@ import junit.framework.Assert;
 public class AbstractControllerResourceProviderTest {
   @Test
   public void testGetResourceProvider() throws Exception {
-    Set<String> propertyIds = new HashSet<>();
-    propertyIds.add("foo");
-    propertyIds.add("cat1/foo");
-    propertyIds.add("cat2/bar");
-    propertyIds.add("cat2/baz");
-    propertyIds.add("cat3/sub1/bam");
-    propertyIds.add("cat4/sub2/sub3/bat");
-    propertyIds.add("cat5/subcat5/map");
-
-    Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
 
     ResourceProviderFactory factory = createMock(ResourceProviderFactory.class);
@@ -64,10 +48,11 @@ public class AbstractControllerResourceProviderTest {
     MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
     RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
 
-    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(propertyIds,
-        keyPropertyIds, managementController, maintenanceStateHelper, repositoryVersionDAO);
+    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(managementController,
+        maintenanceStateHelper, repositoryVersionDAO);
 
-    expect(factory.getServiceResourceProvider(propertyIds, keyPropertyIds, managementController)).andReturn(serviceResourceProvider);
+    expect(factory.getServiceResourceProvider(managementController)).andReturn(
+        serviceResourceProvider);
 
     AbstractControllerResourceProvider.init(factory);
 
@@ -76,8 +61,8 @@ public class AbstractControllerResourceProviderTest {
     AbstractResourceProvider provider =
         (AbstractResourceProvider) AbstractControllerResourceProvider.getResourceProvider(
             Resource.Type.Service,
-            propertyIds,
-            keyPropertyIds,
+            null,
+            null,
             managementController);
 
     Assert.assertTrue(provider instanceof ServiceResourceProvider);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java
index 8f0a6bb..c3b879b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java
@@ -79,12 +79,9 @@ public class AbstractResourceProviderTest {
     Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
 
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
-    MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
-    RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
-    replay(maintenanceStateHelper, repositoryVersionDAO);
 
-    AbstractResourceProvider provider = new ServiceResourceProvider(propertyIds, keyPropertyIds,
-        managementController, maintenanceStateHelper, repositoryVersionDAO);
+    AbstractResourceProvider provider = new HostComponentProcessResourceProvider(propertyIds,
+        keyPropertyIds, managementController);
 
     Set<String> unsupported = provider.checkPropertyIds(Collections.singleton("foo"));
     Assert.assertTrue(unsupported.isEmpty());
@@ -115,15 +112,13 @@ public class AbstractResourceProviderTest {
     propertyIds.add("cat3/sub1/bam");
     propertyIds.add("cat4/sub2/sub3/bat");
 
-    Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
-
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
     MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
     RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
     replay(maintenanceStateHelper, repositoryVersionDAO);
 
-    AbstractResourceProvider provider = new ServiceResourceProvider(propertyIds, keyPropertyIds,
-        managementController, maintenanceStateHelper, repositoryVersionDAO);
+    AbstractResourceProvider provider = new HostComponentProcessResourceProvider(propertyIds,
+        keyPropertyIds, managementController);
 
     Set<String> supportedPropertyIds = provider.getPropertyIds();
     Assert.assertTrue(supportedPropertyIds.containsAll(propertyIds));
@@ -131,15 +126,13 @@ public class AbstractResourceProviderTest {
 
   @Test
   public void testGetRequestStatus() {
-    Set<String> propertyIds = new HashSet<>();
-    Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
     AmbariManagementController managementController = createMock(AmbariManagementController.class);
     MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class);
     RepositoryVersionDAO repositoryVersionDAO = createNiceMock(RepositoryVersionDAO.class);
     replay(maintenanceStateHelper, repositoryVersionDAO);
 
-    AbstractResourceProvider provider = new ServiceResourceProvider(propertyIds, keyPropertyIds,
-        managementController, maintenanceStateHelper, repositoryVersionDAO);
+    AbstractResourceProvider provider = new ServiceResourceProvider(managementController,
+        maintenanceStateHelper, repositoryVersionDAO);
 
     RequestStatus status = provider.getRequestStatus(null);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
index d1705d8..03e3e66 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ComponentResourceProviderTest.java
@@ -75,7 +75,6 @@ import org.apache.ambari.server.state.ServiceComponentFactory;
 import org.apache.ambari.server.state.ServiceComponentHost;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
-import org.apache.log4j.Logger;
 import org.easymock.Capture;
 import org.easymock.EasyMock;
 import org.junit.Assert;
@@ -91,8 +90,6 @@ import com.google.inject.Injector;
  * Tests for the component resource provider.
  */
 public class ComponentResourceProviderTest {
-  private static final Logger LOG = Logger.getLogger(ComponentResourceProviderTest.class);
-
   private static final long CLUSTER_ID = 100;
   private static final String CLUSTER_NAME = "Cluster100";
   private static final String SERVICE_NAME = "Service100";
@@ -141,7 +138,7 @@ public class ComponentResourceProviderTest {
     expect(cluster.getService("Service100")).andReturn(service).anyTimes();
     expect(cluster.getClusterId()).andReturn(2L).anyTimes();
 
-    expect(service.getDesiredStackVersion()).andReturn(stackId).anyTimes();
+    expect(service.getDesiredStackId()).andReturn(stackId).anyTimes();
     expect(service.getName()).andReturn("Service100").anyTimes();
 
     expect(stackId.getStackName()).andReturn("HDP").anyTimes();
@@ -161,9 +158,8 @@ public class ComponentResourceProviderTest {
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
-        managementController, maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     // add the property map to a set for the request.  add more maps for multiple creates
     Set<Map<String, Object>> propertySet = new LinkedHashSet<>();
@@ -215,7 +211,7 @@ public class ComponentResourceProviderTest {
     ServiceComponent serviceComponent1 = createNiceMock(ServiceComponent.class);
     ServiceComponent serviceComponent2 = createNiceMock(ServiceComponent.class);
     ServiceComponent serviceComponent3 = createNiceMock(ServiceComponent.class);
-    StackId stackId = createNiceMock(StackId.class);
+    StackId stackId = new StackId("FOO-1.0");
     final ComponentInfo componentInfo1 = createNiceMock(ComponentInfo.class);
     final ComponentInfo componentInfo2 = createNiceMock(ComponentInfo.class);
     Map <String, Integer> serviceComponentStateCountMap = new HashMap<>();
@@ -245,33 +241,34 @@ public class ComponentResourceProviderTest {
     expect(service.getServiceComponents()).andReturn(serviceComponentMap).anyTimes();
 
     expect(serviceComponent1.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component100", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component100", stackId, "", serviceComponentStateCountMap,
               true /* recovery enabled */, "Component100 Client", null, null));
     expect(serviceComponent2.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", stackId, "", serviceComponentStateCountMap,
               false /* recovery not enabled */, "Component101 Client", null, null));
     expect(serviceComponent3.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", stackId, "", serviceComponentStateCountMap,
               true /* recovery enabled */, "Component102 Client", "1.1", RepositoryVersionState.CURRENT));
 
-    expect(ambariMetaInfo.getComponent(null, null, null, "Component100")).andReturn(componentInfo1);
-    expect(ambariMetaInfo.getComponent(null, null, null, "Component101")).andReturn(componentInfo2);
-    expect(ambariMetaInfo.getComponent(null, null, null, "Component102")).andReturn(componentInfo1);
+    expect(ambariMetaInfo.getComponent("FOO", "1.0", null, "Component100")).andReturn(
+        componentInfo1);
+    expect(ambariMetaInfo.getComponent("FOO", "1.0", null, "Component101")).andReturn(
+        componentInfo2);
+    expect(ambariMetaInfo.getComponent("FOO", "1.0", null, "Component102")).andReturn(
+        componentInfo1);
 
     expect(componentInfo1.getCategory()).andReturn("MASTER").anyTimes();
     expect(componentInfo2.getCategory()).andReturn("SLAVE").anyTimes();
 
     // replay
     replay(managementController, clusters, cluster, ambariMetaInfo, service,
-      serviceComponent1, serviceComponent2, serviceComponent3, stackId,
+        serviceComponent1, serviceComponent2, serviceComponent3,
       componentInfo1, componentInfo2);
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(
-        PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
-        managementController, maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     Set<String> propertyIds = new HashSet<>();
 
@@ -333,9 +330,8 @@ public class ComponentResourceProviderTest {
     }
 
     // verify
-    verify(managementController, clusters, cluster, ambariMetaInfo, service,
-      serviceComponent1, serviceComponent2, serviceComponent3, stackId,
-      componentInfo1, componentInfo2);
+    verify(managementController, clusters, cluster, ambariMetaInfo, service, serviceComponent1,
+        serviceComponent2, serviceComponent3, componentInfo1, componentInfo2);
   }
 
   @Test
@@ -371,7 +367,7 @@ public class ComponentResourceProviderTest {
     ServiceComponent serviceComponent3 = createNiceMock(ServiceComponent.class);
     ServiceComponentHost serviceComponentHost = createNiceMock(ServiceComponentHost.class);
     RequestStatusResponse requestStatusResponse = createNiceMock(RequestStatusResponse.class);
-    StackId stackId = createNiceMock(StackId.class);
+    StackId stackId = new StackId("stackName-1");
 
     Map<String, ServiceComponent> serviceComponentMap = new HashMap<>();
     serviceComponentMap.put("Component101", serviceComponent1);
@@ -392,8 +388,6 @@ public class ComponentResourceProviderTest {
     expect(managementController.getEffectiveMaintenanceState(
         capture(EasyMock.<ServiceComponentHost>newCapture()))).andReturn(MaintenanceState.OFF).anyTimes();
 
-    expect(stackId.getStackName()).andReturn("stackName").anyTimes();
-    expect(stackId.getStackVersion()).andReturn("1").anyTimes();
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
     expect(cluster.getDesiredStackVersion()).andReturn(stackId);
 
@@ -420,13 +414,13 @@ public class ComponentResourceProviderTest {
     expect(component3Info.getCategory()).andReturn(null);
 
     expect(serviceComponent1.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", stackId, "", serviceComponentStateCountMap,
               false /* recovery not enabled */, "Component101 Client", null, null));
     expect(serviceComponent2.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component102", stackId, "", serviceComponentStateCountMap,
               false /* recovery not enabled */, "Component102 Client", null, null));
     expect(serviceComponent3.convertToResponse()).andReturn(
-      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component103", null, "", serviceComponentStateCountMap,
+      new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component103", stackId, "", serviceComponentStateCountMap,
               false /* recovery not enabled */, "Component103 Client", null, null));
     expect(serviceComponent1.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
     expect(serviceComponent2.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
@@ -460,14 +454,12 @@ public class ComponentResourceProviderTest {
     // replay
     replay(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
         component2Info, component3Info, serviceComponent1, serviceComponent2, serviceComponent3,
-        serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
+        serviceComponentHost, requestStatusResponse, maintenanceStateHelper);
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(
-        PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
-        managementController, maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     Map<String, Object> properties = new LinkedHashMap<>();
 
@@ -486,7 +478,7 @@ public class ComponentResourceProviderTest {
     // verify
     verify(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
         component2Info, component3Info, serviceComponent1, serviceComponent2, serviceComponent3,
-        serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
+        serviceComponentHost, requestStatusResponse, maintenanceStateHelper);
   }
 
   @Test
@@ -551,10 +543,8 @@ public class ComponentResourceProviderTest {
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(
-                PropertyHelper.getPropertyIds(type),
-                PropertyHelper.getKeyPropertyIds(type),
-                managementController, maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();
 
@@ -608,10 +598,8 @@ public class ComponentResourceProviderTest {
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(
-                PropertyHelper.getPropertyIds(type),
-                PropertyHelper.getKeyPropertyIds(type),
-                managementController,maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     AbstractResourceProviderTest.TestObserver observer = new AbstractResourceProviderTest.TestObserver();
 
@@ -691,7 +679,7 @@ public class ComponentResourceProviderTest {
     ServiceComponent serviceComponent1 = createMock(ServiceComponent.class);
     ServiceComponentHost serviceComponentHost = createMock(ServiceComponentHost.class);
     RequestStatusResponse requestStatusResponse = createNiceMock(RequestStatusResponse.class);
-    StackId stackId = createMock(StackId.class);
+    StackId stackId = new StackId("stackName-1");
 
     Map<String, ServiceComponent> serviceComponentMap = new HashMap<>();
     serviceComponentMap.put("Component101", serviceComponent1);
@@ -711,9 +699,6 @@ public class ComponentResourceProviderTest {
     expect(managementController.getEffectiveMaintenanceState(
         capture(EasyMock.<ServiceComponentHost>newCapture()))).andReturn(MaintenanceState.OFF).anyTimes();
 
-    expect(stackId.getStackName()).andReturn("stackName").anyTimes();
-    expect(stackId.getStackVersion()).andReturn("1").anyTimes();
-
     expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
 
     expect(cluster.getDesiredStackVersion()).andReturn(stackId);
@@ -736,7 +721,7 @@ public class ComponentResourceProviderTest {
     expect(component1Info.getCategory()).andReturn(null);
 
     expect(serviceComponent1.convertToResponse()).andReturn(
-        new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", null, "", serviceComponentStateCountMap,
+        new ServiceComponentResponse(100L, "Cluster100", "Service100", "Component101", stackId, "", serviceComponentStateCountMap,
             false /* recovery not enabled */, "Component101 Client", null, null));
     expect(serviceComponent1.getDesiredState()).andReturn(State.INSTALLED).anyTimes();
 
@@ -764,14 +749,12 @@ public class ComponentResourceProviderTest {
 
     // replay
     replay(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
-        serviceComponent1, serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
+        serviceComponent1, serviceComponentHost, requestStatusResponse, maintenanceStateHelper);
 
     SecurityContextHolder.getContext().setAuthentication(authentication);
 
-    ResourceProvider provider = new ComponentResourceProvider(
-        PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
-        managementController, maintenanceStateHelper);
+    ResourceProvider provider = new ComponentResourceProvider(managementController,
+        maintenanceStateHelper);
 
     Map<String, Object> properties = new LinkedHashMap<>();
 
@@ -787,7 +770,7 @@ public class ComponentResourceProviderTest {
 
     // verify
     verify(managementController, clusters, cluster, ambariMetaInfo, service, component1Info,
-        serviceComponent1, serviceComponentHost, requestStatusResponse, stackId, maintenanceStateHelper);
+        serviceComponent1, serviceComponentHost, requestStatusResponse, maintenanceStateHelper);
   }
 
   @Test
@@ -937,10 +920,7 @@ public class ComponentResourceProviderTest {
             anyObject(ServiceComponentHost.class))).andReturn(true).anyTimes();
     replay(maintenanceStateHelper);
 
-    return new ComponentResourceProvider(
-        PropertyHelper.getPropertyIds(type),
-        PropertyHelper.getKeyPropertyIds(type),
-        managementController, maintenanceStateHelper);
+    return new ComponentResourceProvider(managementController, maintenanceStateHelper);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/f65692a3/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
index 9486f9d..c49ff51 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/JMXHostProviderTest.java
@@ -664,10 +664,8 @@ public class JMXHostProviderTest {
       replay(maintenanceStateHelper, injector);
     }
 
-    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(
-        PropertyHelper.getPropertyIds(Resource.Type.Service),
-        PropertyHelper.getKeyPropertyIds(Resource.Type.Service), controller, maintenanceStateHelper,
-        repositoryVersionDAO);
+    ResourceProvider serviceResourceProvider = new ServiceResourceProvider(controller,
+        maintenanceStateHelper, repositoryVersionDAO);
 
     ResourceProvider hostCompResourceProvider = new
       HostComponentResourceProvider(PropertyHelper.getPropertyIds(Resource


Mime
View raw message