http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/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 aaf4656..4a71107 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
@@ -25,6 +25,7 @@ import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -76,48 +77,42 @@ import com.google.inject.assistedinject.AssistedInject;
  * Resource provider for host component resources.
  */
 public class HostComponentResourceProvider extends 
AbstractControllerResourceProvider {
+  public static final String RESPONSE_KEY = "HostRoles";
+  public static final String ALL_PROPERTIES = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "*";
 
   // ----- Property ID constants ---------------------------------------------
 
   // Host Components
-  public static final String HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "cluster_name");
-  public static final String HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "service_name");
-  public static final String HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "component_name");
-  public static final String HOST_COMPONENT_DISPLAY_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "display_name");
-  public static final String HOST_COMPONENT_HOST_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "host_name");
-  public static final String HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "public_host_name");
-  public static final String HOST_COMPONENT_STATE_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "state");
-  public static final String HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "desired_state");
-  public static final String HOST_COMPONENT_VERSION_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "version");
-  public static final String HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "desired_stack_id");
-  public static final String HOST_COMPONENT_DESIRED_REPOSITORY_VERSION
-    = PropertyHelper.getPropertyId("HostRoles", "desired_repository_version");
-  public static final String HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "actual_configs");
-  public static final String HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "stale_configs");
-  public static final String HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID
-      = PropertyHelper.getPropertyId("HostRoles", "desired_admin_state");
-  public static final String HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID
-      = "HostRoles/maintenance_state";
-  public static final String HOST_COMPONENT_UPGRADE_STATE_PROPERTY_ID = 
"HostRoles/upgrade_state";
+  public static final String HOST_COMPONENT_CLUSTER_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "cluster_id";
+  public static final String HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "cluster_name";
+  public static final String HOST_COMPONENT_SERVICE_GROUP_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_group_id";
+  public static final String HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_group_name";
+  public static final String HOST_COMPONENT_SERVICE_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_id";
+  public static final String HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_name";
+  public static final String HOST_COMPONENT_SERVICE_DISPLAY_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_display_name";
+  public static final String HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "id";
+  public static final String HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "component_name";
+  public static final String HOST_COMPONENT_DISPLAY_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "display_name";
+  public static final String HOST_COMPONENT_HOST_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "host_name";
+  public static final String HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "public_host_name";
+  public static final String HOST_COMPONENT_STATE_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "state";
+  public static final String HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "desired_state";
+  public static final String HOST_COMPONENT_VERSION_PROPERTY_ID = RESPONSE_KEY 
+ PropertyHelper.EXTERNAL_PATH_SEP + "version";
+  public static final String HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "desired_stack_id";
+  public static final String HOST_COMPONENT_DESIRED_REPOSITORY_VERSION = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "desired_repository_version";
+  public static final String HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "actual_configs";
+  public static final String HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "stale_configs";
+  public static final String HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "desired_admin_state";
+  public static final String HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "maintenance_state";
+  public static final String HOST_COMPONENT_UPGRADE_STATE_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "upgrade_state";
 
   //Parameters from the predicate
   private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID = 
"params/run_smoke_test";
   private static Set<String> pkPropertyIds =
     new HashSet<>(Arrays.asList(new String[]{
       HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID,
-      HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID,
+      HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID,
+      HOST_COMPONENT_SERVICE_DISPLAY_NAME_PROPERTY_ID,
       HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID,
       HOST_COMPONENT_HOST_NAME_PROPERTY_ID}));
 
@@ -164,16 +159,47 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
       requests.add(changeRequest(propertyMap));
     }
 
-    createResources(new Command<Void>() {
+    Set<ServiceComponentHostResponse> createSvcHostCmpnt = null;
+    createSvcHostCmpnt = createResources(new 
Command<Set<ServiceComponentHostResponse>>() {
       @Override
-      public Void invoke() throws AmbariException, AuthorizationException {
-        getManagementController().createHostComponents(requests);
-        return null;
+      public Set<ServiceComponentHostResponse> invoke() throws 
AmbariException, AuthorizationException {
+        return getManagementController().createHostComponents(requests);
       }
     });
 
-    notifyCreate(Resource.Type.HostComponent, request);
-
+    Set<Resource> associatedResources = new HashSet<>();
+    if (createSvcHostCmpnt != null) {
+      Iterator<ServiceComponentHostResponse> itr = 
createSvcHostCmpnt.iterator();
+      while (itr.hasNext()) {
+        ServiceComponentHostResponse response = itr.next();
+        notifyCreate(Resource.Type.HostComponent, request);
+        Resource resource = new ResourceImpl(Resource.Type.HostComponent);
+        resource.setProperty(HOST_COMPONENT_CLUSTER_ID_PROPERTY_ID, 
response.getClusterId());
+        resource.setProperty(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID, 
response.getClusterName());
+        resource.setProperty(HOST_COMPONENT_SERVICE_GROUP_ID_PROPERTY_ID, 
response.getServiceGroupId());
+        resource.setProperty(HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID, 
response.getServiceGroupName());
+        resource.setProperty(HOST_COMPONENT_SERVICE_ID_PROPERTY_ID, 
response.getServiceId());
+        resource.setProperty(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID, 
response.getServiceName());
+        resource.setProperty(HOST_COMPONENT_SERVICE_DISPLAY_NAME_PROPERTY_ID, 
response.getServiceDisplayName());
+        resource.setProperty(HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID, 
response.getHostComponentId());
+        resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, 
response.getComponentName());
+        resource.setProperty(HOST_COMPONENT_DISPLAY_NAME_PROPERTY_ID, 
response.getDisplayName());
+        resource.setProperty(HOST_COMPONENT_HOST_NAME_PROPERTY_ID, 
response.getHostname());
+        resource.setProperty(HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID, 
response.getPublicHostname());
+        resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, 
response.getLiveState());
+        resource.setProperty(HOST_COMPONENT_VERSION_PROPERTY_ID, 
response.getVersion());
+        resource.setProperty(HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID, 
response.getDesiredStackVersion());
+        resource.setProperty(HOST_COMPONENT_DESIRED_REPOSITORY_VERSION, 
response.getDesiredRepositoryVersion());
+        resource.setProperty(HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID, 
response.getActualConfigs());
+        resource.setProperty(HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID, 
response.isStaleConfig());
+        resource.setProperty(HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID, 
response.getAdminState());
+        resource.setProperty(HOST_COMPONENT_MAINTENANCE_STATE_PROPERTY_ID, 
response.getMaintenanceState());
+        resource.setProperty(HOST_COMPONENT_UPGRADE_STATE_PROPERTY_ID, 
response.getUpgradeState());
+
+        associatedResources.add(resource);
+      }
+      return getRequestStatus(null, associatedResources);
+    }
     return getRequestStatus(null);
   }
 
@@ -220,34 +246,26 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
 
     for (ServiceComponentHostResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.HostComponent);
-      setResourceProperty(resource, HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID,
-              response.getClusterName(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID,
-              response.getServiceName(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID,
-              response.getComponentName(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_DISPLAY_NAME_PROPERTY_ID,
-              response.getDisplayName(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_HOST_NAME_PROPERTY_ID,
-              response.getHostname(), requestedIds);
-      setResourceProperty(resource, 
HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID,
-          response.getPublicHostname(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_STATE_PROPERTY_ID,
-              response.getLiveState(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID,
-              response.getDesiredState(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_VERSION_PROPERTY_ID, 
response.getVersion(),
-          requestedIds);
-      setResourceProperty(resource, 
HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID,
-              response.getDesiredStackVersion(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID,
-              response.getActualConfigs(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID,
-              response.isStaleConfig(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_UPGRADE_STATE_PROPERTY_ID,
-              response.getUpgradeState(), requestedIds);
-      setResourceProperty(resource, HOST_COMPONENT_DESIRED_REPOSITORY_VERSION,
-          response.getDesiredRepositoryVersion(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID, 
response.getClusterName(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_CLUSTER_ID_PROPERTY_ID, 
response.getClusterId(), requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_SERVICE_GROUP_ID_PROPERTY_ID, response.getServiceGroupId(), 
requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID, response.getServiceGroupName(), 
requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_SERVICE_ID_PROPERTY_ID, 
response.getServiceId(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID, 
response.getServiceName(), requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_SERVICE_DISPLAY_NAME_PROPERTY_ID, 
response.getServiceDisplayName(), requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_HOST_COMPONENT_ID_PROPERTY_ID, response.getHostComponentId(), 
requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, 
response.getComponentName(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_DISPLAY_NAME_PROPERTY_ID, 
response.getDisplayName(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_HOST_NAME_PROPERTY_ID, 
response.getHostname(), requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_PUBLIC_HOST_NAME_PROPERTY_ID, response.getPublicHostname(), 
requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_STATE_PROPERTY_ID, 
response.getLiveState(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_DESIRED_STATE_PROPERTY_ID, 
response.getDesiredState(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_VERSION_PROPERTY_ID, 
response.getVersion(), requestedIds);
+      setResourceProperty(resource, 
HOST_COMPONENT_DESIRED_STACK_ID_PROPERTY_ID, response.getDesiredStackVersion(), 
requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_ACTUAL_CONFIGS_PROPERTY_ID, 
response.getActualConfigs(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_STALE_CONFIGS_PROPERTY_ID, 
response.isStaleConfig(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_UPGRADE_STATE_PROPERTY_ID, 
response.getUpgradeState(), requestedIds);
+      setResourceProperty(resource, HOST_COMPONENT_DESIRED_REPOSITORY_VERSION, 
response.getDesiredRepositoryVersion(), requestedIds);
 
       if (response.getAdminState() != null) {
         setResourceProperty(resource, 
HOST_COMPONENT_DESIRED_ADMIN_STATE_PROPERTY_ID,
@@ -292,18 +310,22 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
   protected RequestStatus deleteResourcesAuthorized(Request request, Predicate 
predicate)
       throws SystemException, UnsupportedPropertyException, 
NoSuchResourceException, NoSuchParentResourceException {
     final Set<ServiceComponentHostRequest> requests = new HashSet<>();
+    DeleteStatusMetaData deleteStatusMetaData = null;
     for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
       requests.add(changeRequest(propertyMap));
     }
-    DeleteStatusMetaData deleteStatusMetaData = modifyResources(new 
Command<DeleteStatusMetaData>() {
+    deleteStatusMetaData = modifyResources(new Command<DeleteStatusMetaData>() 
{
       @Override
       public DeleteStatusMetaData invoke() throws AmbariException, 
AuthorizationException {
-        return getManagementController().deleteHostComponents(requests);
+        getManagementController().deleteHostComponents(requests);
+        return new DeleteStatusMetaData();
       }
     });
 
     notifyDelete(Resource.Type.HostComponent, predicate);
-
+    for(ServiceComponentHostRequest svcCmpntHostReq : requests) {
+      deleteStatusMetaData.addDeletedKey("component_name: 
"+svcCmpntHostReq.getComponentName());
+    }
     return getRequestStatus(null, null, deleteStatusMetaData);
   }
 
@@ -498,12 +520,12 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
         }
       }
 
-      if (StringUtils.isEmpty(request.getServiceName())) {
-        
request.setServiceName(getManagementController().findServiceName(cluster, 
request.getComponentName()));
+      if (StringUtils.isEmpty(request.getServiceDisplayName())) {
+        
request.setServiceDisplayName(getManagementController().findService(cluster, 
request.getComponentName()));
       }
 
       ServiceComponent sc = getServiceComponent(
-          request.getClusterName(), request.getServiceName(), 
request.getComponentName());
+          request.getClusterName(), request.getServiceGroupName(), 
request.getServiceDisplayName(), request.getComponentName());
 
       logRequestInfo("Received a updateHostComponent request", request);
 
@@ -525,10 +547,10 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
         requestClusters.put(request.getClusterName(), clusterServices);
       }
 
-      Map<String, Set<String>> serviceComponents = 
clusterServices.get(request.getServiceName());
+      Map<String, Set<String>> serviceComponents = 
clusterServices.get(request.getServiceDisplayName());
       if (serviceComponents == null) {
         serviceComponents = new HashMap<>();
-        clusterServices.put(request.getServiceName(), serviceComponents);
+        clusterServices.put(request.getServiceDisplayName(), 
serviceComponents);
       }
 
       Set<String> componentHosts = 
serviceComponents.get(request.getComponentName());
@@ -671,6 +693,7 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
   private ServiceComponentHostRequest getRequest(Map<String, Object> 
properties) {
     ServiceComponentHostRequest serviceComponentHostRequest = new 
ServiceComponentHostRequest(
         (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID),
+        (String) properties.get(HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID),
         (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
         (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
         (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
@@ -708,7 +731,8 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
   private ServiceComponentHostRequest changeRequest(Map<String, Object> 
properties) {
     ServiceComponentHostRequest serviceComponentHostRequest = new 
ServiceComponentHostRequest(
             (String) properties.get(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID),
-            (String) properties.get(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID),
+            (String) 
properties.get(HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID),
+            (String) 
properties.get(HOST_COMPONENT_SERVICE_DISPLAY_NAME_PROPERTY_ID),
             (String) properties.get(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID),
             (String) properties.get(HOST_COMPONENT_HOST_NAME_PROPERTY_ID),
             (String) properties.get(HOST_COMPONENT_STATE_PROPERTY_ID));
@@ -878,7 +902,7 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
     return false;
   }
 
-  private ServiceComponent getServiceComponent(String clusterName, String 
serviceName, String componentName)
+  private ServiceComponent getServiceComponent(String clusterName, String 
ServiceGroupName, String serviceName, String componentName)
       throws AmbariException {
 
     Clusters clusters = getManagementController().getClusters();
@@ -925,10 +949,12 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
    * @param request  the request to log
    */
   private void logRequestInfo(String msg, ServiceComponentHostRequest request) 
{
-    LOG.info("{}, clusterName={}, serviceName={}, componentName={}, 
hostname={}, request={}",
+    LOG.info("{}, clusterName={}, serviceGroupName={}, serviceName={}, 
serviceDisplayName={}, componentName={}, hostname={}, request={}",
         msg,
         request.getClusterName(),
-        request.getServiceName(),
+        request.getServiceGroupName(),
+        request.getServiceDisplayName(),
+        request.getServiceDisplayName(),
         request.getComponentName(),
         request.getHostname(),
         request);
@@ -946,7 +972,9 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
 
     sb.append(msg)
       .append(", clusterName=").append(request.getClusterName())
-      .append(", serviceName=").append(request.getServiceName())
+      .append(", serviceGroupName=").append(request.getServiceGroupName())
+      .append(", serviceName=").append(request.getServiceDisplayName())
+      .append(", serviceDisplayName=").append(request.getServiceDisplayName())
       .append(", componentName=").append(request.getComponentName())
       .append(", hostname=").append(request.getHostname())
       .append(", currentState=").append(oldState == null ? "null" : oldState)
@@ -1017,13 +1045,15 @@ public class HostComponentResourceProvider extends 
AbstractControllerResourcePro
           AmbariManagementController managementController = 
getManagementController();
           String clusterName = (String) 
resource.getPropertyValue(HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID);
           String serviceName = (String) 
resource.getPropertyValue(HOST_COMPONENT_SERVICE_NAME_PROPERTY_ID);
+          String serviceGroupName = (String) 
resource.getPropertyValue(HOST_COMPONENT_SERVICE_GROUP_NAME_PROPERTY_ID);
           if (StringUtils.isEmpty(serviceName)) {
             Cluster cluster = 
managementController.getClusters().getCluster(clusterName);
-            serviceName = managementController.findServiceName(cluster, 
componentName);
+            serviceName = managementController.findService(cluster, 
componentName);
+            //TODO : What if SG name is empty.
           }
 
           ServiceComponent sc = getServiceComponent((String) 
resource.getPropertyValue(
-              HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID), serviceName, 
componentName);
+              HOST_COMPONENT_CLUSTER_NAME_PROPERTY_ID), serviceGroupName, 
serviceName, componentName);
           isClient = sc.isClientComponent();
         }
       } catch (AmbariException e) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
index 01e0aac..d07890d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostResourceProvider.java
@@ -920,6 +920,7 @@ public class HostResourceProvider extends 
AbstractControllerResourceProvider {
         List<ServiceComponentHost> list = 
cluster.getServiceComponentHosts(hostname);
         for (ServiceComponentHost sch : list) {
           ServiceComponentHostRequest schr = new 
ServiceComponentHostRequest(cluster.getClusterName(),
+                                                                             
sch.getServiceGroupName(),
                                                                              
sch.getServiceName(),
                                                                              
sch.getServiceComponentName(),
                                                                              
sch.getHostName(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
index f94b979..ed30efe 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStatusHelper.java
@@ -27,7 +27,10 @@ import org.apache.ambari.server.controller.HostRequest;
 import org.apache.ambari.server.controller.HostResponse;
 import org.apache.ambari.server.controller.ServiceComponentHostRequest;
 import org.apache.ambari.server.controller.ServiceComponentHostResponse;
+import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.HostState;
+import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.State;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -47,9 +50,12 @@ public class HostStatusHelper {
     ServiceComponentHostResponse componentHostResponse;
 
     try {
+      Clusters clusters = managementController.getClusters();
+      Cluster cluster = clusters.getCluster(clusterName);
+      Service s = cluster.getService(serviceName);
       ServiceComponentHostRequest componentRequest =
-        new ServiceComponentHostRequest(clusterName, serviceName,
-          componentName, hostName, null);
+        new ServiceComponentHostRequest(clusterName, s.getServiceGroupName(), 
serviceName, componentName, hostName,
+                null);
 
       Set<ServiceComponentHostResponse> hostComponents =
         
managementController.getHostComponents(Collections.singleton(componentRequest));

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/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 89f75f3..47b468c 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
@@ -71,6 +71,7 @@ import org.apache.ambari.server.state.MaintenanceState;
 import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.ServiceComponent;
 import org.apache.ambari.server.state.ServiceComponentHost;
+import org.apache.ambari.server.state.ServiceGroup;
 import org.apache.ambari.server.state.ServiceInfo;
 import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.State;
@@ -86,34 +87,24 @@ 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");
-
-  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_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_ID_PROPERTY_ID = 
PropertyHelper.getPropertyId(
-      "ServiceInfo", "desired_repository_version_id");
-
-  protected static final String SERVICE_REPOSITORY_STATE = 
"ServiceInfo/repository_state";
+  public static final String RESPONSE_KEY = "ServiceInfo";
+  public static final String ALL_PROPERTIES = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "*";
+
+  public static final String SERVICE_CLUSTER_ID_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "cluster_id";
+  public static final String SERVICE_CLUSTER_NAME_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "cluster_name";
+  public static final String SERVICE_SERVICE_GROUP_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_group_id";
+  public static final String SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_group_name";
+  public static final String SERVICE_SERVICE_ID_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "service_id";
+  public static final String SERVICE_SERVICE_NAME_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "service_name";
+  public static final String SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "service_display_name";
+  public static final String SERVICE_SERVICE_STATE_PROPERTY_ID = RESPONSE_KEY 
+ PropertyHelper.EXTERNAL_PATH_SEP + "state";
+  public static final String SERVICE_MAINTENANCE_STATE_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "maintenance_state";
+  public static final String SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "credential_store_supported";
+  public static final String SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + "credential_store_enabled";
+  public static final String SERVICE_ATTRIBUTES_PROPERTY_ID = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "attributes";
+  public static final String SERVICE_DESIRED_STACK_PROPERTY_ID = RESPONSE_KEY 
+ PropertyHelper.EXTERNAL_PATH_SEP + "desired_stack";
+  public static final String SERVICE_DESIRED_REPO_VERSION_ID_PROPERTY_ID = 
RESPONSE_KEY + PropertyHelper.EXTERNAL_PATH_SEP + 
"desired_repository_version_id";
+  protected static final String SERVICE_REPOSITORY_STATE = RESPONSE_KEY + 
PropertyHelper.EXTERNAL_PATH_SEP + "repository_state";
 
   //Parameters from the predicate
   private static final String QUERY_PARAMETERS_RUN_SMOKE_TEST_ID = 
"params/run_smoke_test";
@@ -123,7 +114,8 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
   private static Set<String> pkPropertyIds =
     new HashSet<>(Arrays.asList(new String[]{
       SERVICE_CLUSTER_NAME_PROPERTY_ID,
-      SERVICE_SERVICE_NAME_PROPERTY_ID}));
+      SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID,
+      SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID}));
 
   /**
    * The property ids for an service resource.
@@ -137,8 +129,13 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
   static {
     // properties
+    PROPERTY_IDS.add(SERVICE_CLUSTER_ID_PROPERTY_ID);
     PROPERTY_IDS.add(SERVICE_CLUSTER_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_GROUP_ID_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_ID_PROPERTY_ID);
     PROPERTY_IDS.add(SERVICE_SERVICE_NAME_PROPERTY_ID);
+    PROPERTY_IDS.add(SERVICE_SERVICE_DISPLAY_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);
@@ -153,7 +150,8 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     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.Service, 
SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID);
+    KEY_PROPERTY_IDS.put(Resource.Type.ServiceGroup, 
SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID);
     KEY_PROPERTY_IDS.put(Resource.Type.Cluster, 
SERVICE_CLUSTER_NAME_PROPERTY_ID);
   }
 
@@ -204,15 +202,39 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     for (Map<String, Object> propertyMap : request.getProperties()) {
       requests.add(getRequest(propertyMap));
     }
-    createResources(new Command<Void>() {
+    Set<ServiceResponse> createServices = null;
+    createServices = createResources(new Command<Set<ServiceResponse>>() {
       @Override
-      public Void invoke() throws AmbariException, AuthorizationException {
-        createServices(requests);
-        return null;
+      public Set<ServiceResponse> invoke() throws AmbariException, 
AuthorizationException {
+        return createServices(requests);
       }
     });
-    notifyCreate(Resource.Type.Service, request);
-
+    Set<Resource> associatedResources = new HashSet<>();
+    if (createServices != null) {
+      Iterator<ServiceResponse> itr = createServices.iterator();
+      while (itr.hasNext()) {
+        ServiceResponse response = itr.next();
+        notifyCreate(Resource.Type.Service, request);
+        Resource resource = new ResourceImpl(Resource.Type.Service);
+        resource.setProperty(SERVICE_CLUSTER_ID_PROPERTY_ID, 
response.getClusterId());
+        resource.setProperty(SERVICE_CLUSTER_NAME_PROPERTY_ID, 
response.getClusterName());
+        resource.setProperty(SERVICE_SERVICE_GROUP_ID_PROPERTY_ID, 
response.getServiceGroupId());
+        resource.setProperty(SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID, 
response.getServiceGroupName());
+        resource.setProperty(SERVICE_SERVICE_ID_PROPERTY_ID, 
response.getServiceId());
+        resource.setProperty(SERVICE_SERVICE_NAME_PROPERTY_ID, 
response.getServiceName());
+        resource.setProperty(SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID, 
response.getServiceDisplayName());
+        resource.setProperty(SERVICE_SERVICE_STATE_PROPERTY_ID, 
response.getDesiredState());
+        resource.setProperty(SERVICE_MAINTENANCE_STATE_PROPERTY_ID, 
response.getMaintenanceState());
+        resource.setProperty(SERVICE_DESIRED_REPO_VERSION_ID_PROPERTY_ID, 
response.getDesiredRepositoryVersion());
+        resource.setProperty(SERVICE_DESIRED_STACK_PROPERTY_ID, 
response.getDesiredStackId());
+        resource.setProperty(SERVICE_REPOSITORY_STATE, 
response.getRepositoryVersionState());
+        resource.setProperty(SERVICE_CREDENTIAL_STORE_SUPPORTED_PROPERTY_ID, 
response.isCredentialStoreSupported());
+        resource.setProperty(SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID, 
response.isCredentialStoreEnabled());
+
+        associatedResources.add(resource);
+      }
+      return getRequestStatus(null, associatedResources);
+    }
     return getRequestStatus(null);
   }
 
@@ -238,10 +260,20 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
     for (ServiceResponse response : responses) {
       Resource resource = new ResourceImpl(Resource.Type.Service);
+      setResourceProperty(resource, SERVICE_CLUSTER_ID_PROPERTY_ID,
+          response.getClusterId(), requestedIds);
       setResourceProperty(resource, SERVICE_CLUSTER_NAME_PROPERTY_ID,
-          response.getClusterName(), requestedIds);
+        response.getClusterName(), requestedIds);
+      setResourceProperty(resource, SERVICE_SERVICE_GROUP_ID_PROPERTY_ID,
+        response.getServiceGroupId(), requestedIds);
+      setResourceProperty(resource, SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID,
+        response.getServiceGroupName(), requestedIds);
+      setResourceProperty(resource, SERVICE_SERVICE_ID_PROPERTY_ID,
+        response.getServiceId(), requestedIds);
       setResourceProperty(resource, SERVICE_SERVICE_NAME_PROPERTY_ID,
           response.getServiceName(), requestedIds);
+      setResourceProperty(resource, SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID,
+        response.getServiceDisplayName(), requestedIds);
       setResourceProperty(resource, SERVICE_SERVICE_STATE_PROPERTY_ID,
           calculateServiceState(response.getClusterName(), 
response.getServiceName()),
           requestedIds);
@@ -302,18 +334,24 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
       throws SystemException, UnsupportedPropertyException, 
NoSuchResourceException, NoSuchParentResourceException {
 
     final Set<ServiceRequest> requests = new HashSet<>();
+    DeleteStatusMetaData deleteStatusMetaData = null;
+
     for (Map<String, Object> propertyMap : getPropertyMaps(predicate)) {
       requests.add(getRequest(propertyMap));
     }
-    RequestStatusResponse response = modifyResources(new 
Command<RequestStatusResponse>() {
+    deleteStatusMetaData = modifyResources(new Command<DeleteStatusMetaData>() 
{
       @Override
-      public RequestStatusResponse invoke() throws AmbariException, 
AuthorizationException {
-        return deleteServices(requests);
+      public DeleteStatusMetaData invoke() throws AmbariException, 
AuthorizationException {
+        deleteServices(requests);
+        return new DeleteStatusMetaData();
       }
     });
 
     notifyDelete(Resource.Type.Service, predicate);
-    return getRequestStatus(response);
+    for(ServiceRequest serviceReq : requests) {
+      deleteStatusMetaData.addDeletedKey("service_name: 
"+serviceReq.getServiceDisplayName());
+    }
+    return getRequestStatus(null, null, deleteStatusMetaData);
   }
 
   @Override
@@ -391,7 +429,9 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
     ServiceRequest svcRequest = new ServiceRequest(
         (String) properties.get(SERVICE_CLUSTER_NAME_PROPERTY_ID),
+        (String) properties.get(SERVICE_SERVICE_GROUP_NAME_PROPERTY_ID),
         (String) properties.get(SERVICE_SERVICE_NAME_PROPERTY_ID),
+        (String) properties.get(SERVICE_SERVICE_DISPLAY_NAME_PROPERTY_ID),
         null == desiredRepoId ? null : Long.valueOf(desiredRepoId),
         (String) properties.get(SERVICE_SERVICE_STATE_PROPERTY_ID),
         (String) properties.get(SERVICE_CREDENTIAL_STORE_ENABLED_PROPERTY_ID));
@@ -410,19 +450,25 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
   }
 
   // Create services from the given request.
-  public void createServices(Set<ServiceRequest> requests)
+  public Set<ServiceResponse> createServices(Set<ServiceRequest> requests)
       throws AmbariException, AuthorizationException {
 
     if (requests.isEmpty()) {
       LOG.warn("Received an empty requests set");
-      return;
+      return null;
     }
     Clusters clusters = getManagementController().getClusters();
     // do all validation checks
     validateCreateRequests(requests, clusters);
 
+    Set<ServiceResponse> createdServices = new HashSet<>();
     for (ServiceRequest request : requests) {
       Cluster cluster = clusters.getCluster(request.getClusterName());
+      ServiceGroup sg = cluster.getServiceGroup(request.getServiceGroupName());
+
+      if(StringUtils.isBlank(request.getServiceDisplayName())) {
+        request.setServiceDisplayName(request.getServiceName());
+      }
 
       RepositoryVersionEntity repositoryVersion = 
request.getResolvedRepository();
 
@@ -430,8 +476,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
         throw new AmbariException("Could not find any repository on the 
request.");
       }
 
-      Service s = cluster.addService(request.getServiceName(), 
repositoryVersion);
-
+      Service s = cluster.addService(sg, request.getServiceName(), 
request.getServiceDisplayName(), repositoryVersion);
       /*
        * Get the credential_store_supported field only from the stack 
definition.
        * Not possible to update the value through a request.
@@ -439,13 +484,13 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
       StackId stackId = repositoryVersion.getStackId();
       AmbariMetaInfo ambariMetaInfo = 
getManagementController().getAmbariMetaInfo();
       ServiceInfo serviceInfo = 
ambariMetaInfo.getService(stackId.getStackName(),
-          stackId.getStackVersion(), request.getServiceName());
+          stackId.getStackVersion(), request.getServiceDisplayName());
 
       boolean credentialStoreSupported = 
serviceInfo.isCredentialStoreSupported();
       boolean credentialStoreRequired = 
serviceInfo.isCredentialStoreRequired();
 
       LOG.info("Service: {}, credential_store_supported = {} and 
credential_store_required = {} from stack definition",
-               request.getServiceName(), credentialStoreSupported, 
credentialStoreRequired);
+               request.getServiceDisplayName(), credentialStoreSupported, 
credentialStoreRequired);
       /*
        * If request does not have credential_store_enabled field,
        * then get the default from the stack definition.
@@ -456,19 +501,21 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
         s.setCredentialStoreEnabled(enableCredStore);
         LOG.info("Service: {}, credential_store_enabled = {} from request and 
resulting" +
                  " credential store enabled status is = {}",
-                 request.getServiceName(), credentialStoreEnabled, 
enableCredStore);
+                 request.getServiceDisplayName(), credentialStoreEnabled, 
enableCredStore);
       } else {
         boolean enableCredStore = credentialStoreSupported &&
                                   (credentialStoreRequired || 
serviceInfo.isCredentialStoreEnabled());
         s.setCredentialStoreEnabled(enableCredStore);
         LOG.info("Service: {}, credential_store_enabled = {} from stack 
definition and resulting" +
                  " credential store enabled status is = {}",
-                 s.getName(), serviceInfo.isCredentialStoreEnabled(), 
enableCredStore);
+                 s.getServiceDisplayName(), 
serviceInfo.isCredentialStoreEnabled(), enableCredStore);
       }
 
       // Initialize service widgets
       getManagementController().initializeWidgetsAndLayouts(cluster, s);
+      createdServices.add(s.convertToResponse());
     }
+    return createdServices;
   }
 
   // Get services from the given set of requests.
@@ -492,24 +539,23 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
   // Get services from the given request.
   private Set<ServiceResponse> getServices(ServiceRequest request)
       throws AmbariException {
-    if (request.getClusterName() == null
-        || request.getClusterName().isEmpty()) {
+    if (request.getClusterName() == null) {
       throw new AmbariException("Invalid arguments, cluster name"
           + " cannot be null");
     }
     Clusters clusters    = getManagementController().getClusters();
-    String   clusterName = request.getClusterName();
+    String clusterId = request.getClusterName();
 
     final Cluster cluster;
     try {
-      cluster = clusters.getCluster(clusterName);
+      cluster = clusters.getCluster(clusterId);
     } catch (ObjectNotFoundException e) {
       throw new ParentObjectNotFoundException("Parent Cluster resource doesn't 
exist", e);
     }
 
     Set<ServiceResponse> response = new HashSet<>();
-    if (request.getServiceName() != null) {
-      Service s = cluster.getService(request.getServiceName());
+    if (request.getServiceDisplayName() != null) {
+      Service s = cluster.getService(request.getServiceDisplayName());
       response.add(s.convertToResponse());
       return response;
     }
@@ -519,11 +565,11 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     boolean checkDesiredState = false;
     State desiredStateToCheck = null;
     if (request.getDesiredState() != null
-        && !request.getDesiredState().isEmpty()) {
+            && !request.getDesiredState().isEmpty()) {
       desiredStateToCheck = State.valueOf(request.getDesiredState());
       if (!desiredStateToCheck.isValidDesiredState()) {
         throw new IllegalArgumentException("Invalid arguments, invalid desired"
-            + " state, desiredState=" + desiredStateToCheck);
+                + " state, desiredState=" + desiredStateToCheck);
       }
       checkDesiredState = true;
     }
@@ -534,7 +580,21 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
         // skip non matching state
         continue;
       }
-      response.add(s.convertToResponse());
+      ServiceResponse serviceResponse = s.convertToResponse();
+      // TODO: Open it when we dont want to support queries for servies and 
components at cluster level.
+      // UI as of now makes that calls for optimizations purposes.
+      /*
+      // Check if the received response for service's servicegroup is same as 
passed-in servicegroup name.
+      String retrivedSvcGrp = serviceResponse.getServiceGroupName();
+      if (retrivedSvcGrp == null) {
+        throw new NullPointerException("'ServiceGroupName' : null in cluster : 
" + cluster.getClusterName() +
+                " for retrieved Service : "+s.getServiceDisplayName());
+      }
+      if (!retrivedSvcGrp.equals(request.getServiceGroupName())) {
+        throw new ServiceNotFoundException(cluster.getClusterName(), 
s.getServiceDisplayName());
+      }
+      */
+      response.add(serviceResponse);
     }
     return response;
   }
@@ -560,7 +620,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     Collection<ServiceComponentHost> ignoredScHosts =
       new ArrayList<>();
 
-    Set<String> clusterNames = new HashSet<>();
+    Set<String> clusterIds = new HashSet<>();
     Map<String, Set<String>> serviceNames = new HashMap<>();
     Set<State> seenNewStates = new HashSet<>();
     Map<Service, Boolean> serviceCredentialStoreEnabledMap = new HashMap<>();
@@ -585,20 +645,20 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     for (ServiceRequest request : requests) {
       if (request.getClusterName() == null
           || request.getClusterName().isEmpty()
-          || request.getServiceName() == null
-          || request.getServiceName().isEmpty()) {
+          || request.getServiceDisplayName() == null
+          || request.getServiceDisplayName().isEmpty()) {
         throw new IllegalArgumentException("Invalid arguments, cluster name"
-            + " and service name should be provided to update services");
+            + " and/or service display name should be provided to update 
services");
       }
 
       LOG.info("Received a updateService request"
           + ", clusterName=" + request.getClusterName()
-          + ", serviceName=" + request.getServiceName()
+          + ", serviceName=" + request.getServiceDisplayName()
           + ", request=" + request);
 
-      clusterNames.add(request.getClusterName());
+      clusterIds.add(request.getClusterName());
 
-      if (clusterNames.size() > 1) {
+      if (clusterIds.size() > 1) {
         throw new IllegalArgumentException("Updates to multiple clusters is 
not"
             + " supported");
       }
@@ -608,15 +668,15 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
       }
 
       if (serviceNames.get(request.getClusterName())
-          .contains(request.getServiceName())) {
+          .contains(request.getServiceDisplayName())) {
         // TODO throw single exception
         throw new IllegalArgumentException("Invalid request contains duplicate"
             + " service names");
       }
-      serviceNames.get(request.getClusterName()).add(request.getServiceName());
+      
serviceNames.get(request.getClusterName()).add(request.getServiceDisplayName());
 
       Cluster cluster = clusters.getCluster(request.getClusterName());
-      Service s = cluster.getService(request.getServiceName());
+      Service s = cluster.getService(request.getServiceDisplayName());
       State oldState = s.getDesiredState();
       State newState = null;
       if (request.getDesiredState() != null) {
@@ -664,7 +724,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
                                              "as it is required by the 
service. Service=" + s.getName());
         }
         serviceCredentialStoreEnabledMap.put(s, credentialStoreEnabled);
-        LOG.info("Service: {}, credential_store_enabled from request: {}", 
request.getServiceName(),
+        LOG.info("Service: {}, credential_store_enabled from request: {}", 
request.getServiceDisplayName(),
             credentialStoreEnabled);
       }
 
@@ -675,8 +735,8 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
       if (newState == null) {
         if (LOG.isDebugEnabled()) {
-          LOG.debug("Nothing to do for new updateService request, 
clusterName={}, serviceName={}, newDesiredState=null",
-            request.getClusterName(), request.getServiceName());
+          LOG.debug("Nothing to do for new updateService request, 
clusterId={}, serviceName={}, newDesiredState=null",
+            request.getClusterName(), request.getServiceDisplayName());
         }
         continue;
       }
@@ -753,7 +813,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     }
 
 
-    Cluster cluster = clusters.getCluster(clusterNames.iterator().next());
+    Cluster cluster = clusters.getCluster(clusterIds.iterator().next());
 
     return controller.addStages(requestStages, cluster, requestProperties,
       null, changedServices, changedComps, changedScHosts,
@@ -883,7 +943,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     Set<Service> removable = new HashSet<>();
 
     for (ServiceRequest serviceRequest : request) {
-      if (StringUtils.isEmpty(serviceRequest.getClusterName()) || 
StringUtils.isEmpty(serviceRequest.getServiceName())) {
+      if (StringUtils.isEmpty(serviceRequest.getClusterName()) || 
StringUtils.isEmpty(serviceRequest.getServiceDisplayName())) {
         // FIXME throw correct error
         throw new AmbariException("invalid arguments");
       } else {
@@ -894,7 +954,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
         Service service = clusters.getCluster(
             serviceRequest.getClusterName()).getService(
-                serviceRequest.getServiceName());
+          serviceRequest.getServiceDisplayName());
 
         //
         // Run through the list of service component hosts. If all host 
components are in removable state,
@@ -908,7 +968,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
           for (Map.Entry<String, ServiceComponentHost> entry : 
schHostMap.entrySet()) {
             ServiceComponentHost sch = entry.getValue();
             if (!sch.canBeRemoved()) {
-              String msg = "Cannot remove " + serviceRequest.getClusterName() 
+ "/" + serviceRequest.getServiceName() +
+              String msg = "Cannot remove " + serviceRequest.getClusterName() 
+ "/" + serviceRequest.getServiceDisplayName() +
                       ". " + sch.getServiceComponentName() + "on " + 
sch.getHost() + " is in " +
                       String.valueOf(sch.getDesiredState()) + " state.";
               LOG.error(msg);
@@ -919,7 +979,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
 
         if (!isServiceRemovable) {
           throw new AmbariException ("Cannot remove " +
-                  serviceRequest.getClusterName() + "/" + 
serviceRequest.getServiceName() +
+                  serviceRequest.getClusterName() + "/" + 
serviceRequest.getServiceDisplayName() +
                     ". " + "One or more host components are in a non-removable 
state.");
         }
 
@@ -1012,33 +1072,37 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
           throws AuthorizationException, AmbariException {
 
     AmbariMetaInfo ambariMetaInfo = 
getManagementController().getAmbariMetaInfo();
-    Map<String, Set<String>> serviceNames = new HashMap<>();
+    Map<String, Set<String>> serviceDisplayNames = new HashMap<>();
     Set<String> duplicates = new HashSet<>();
 
     for (ServiceRequest request : requests) {
       final String clusterName = request.getClusterName();
+      final String serviceGroupName = request.getServiceGroupName();
       final String serviceName = request.getServiceName();
-      Validate.notEmpty(clusterName, "Cluster name should be provided when 
creating a service");
+      final String serviceDisplayName = request.getServiceDisplayName();
+      Validate.notNull(clusterName, "Cluster name should be provided when 
creating a service");
+      Validate.notNull(serviceGroupName, "Service group name should be 
provided when creating a service");
       Validate.notEmpty(serviceName, "Service name should be provided when 
creating a service");
+      Validate.notEmpty(serviceDisplayName, "Service display name should be 
provided when creating a service");
 
       if (LOG.isDebugEnabled()) {
-        LOG.debug("Received a createService request, clusterName={}, 
serviceName={}, request={}", clusterName, serviceName, request);
+        LOG.debug("Received a createService request, clusterId={}, 
serviceName={}, request={}", clusterName, serviceName, request);
       }
 
       if(!AuthorizationHelper.isAuthorized(ResourceType.CLUSTER, 
getClusterResourceId(clusterName), 
RoleAuthorization.SERVICE_ADD_DELETE_SERVICES)) {
         throw new AuthorizationException("The user is not authorized to create 
services");
       }
 
-      if (!serviceNames.containsKey(clusterName)) {
-        serviceNames.put(clusterName, new HashSet<String>());
+      if (!serviceDisplayNames.containsKey(clusterName)) {
+        serviceDisplayNames.put(clusterName, new HashSet<String>());
       }
 
-      if (serviceNames.get(clusterName).contains(serviceName)) {
+      if (serviceDisplayNames.get(clusterName).contains(serviceDisplayName)) {
         // throw error later for dup
-        duplicates.add(serviceName);
+        duplicates.add(serviceDisplayName);
         continue;
       }
-      serviceNames.get(clusterName).add(serviceName);
+      serviceDisplayNames.get(clusterName).add(serviceDisplayName);
 
       if (StringUtils.isNotEmpty(request.getDesiredState())) {
         State state = State.valueOf(request.getDesiredState());
@@ -1056,10 +1120,10 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
         throw new ParentObjectNotFoundException("Attempted to add a service to 
a cluster which doesn't exist", e);
       }
       try {
-        Service s = cluster.getService(serviceName);
+        Service s = cluster.getService(serviceDisplayName);
         if (s != null) {
           // throw error later for dup
-          duplicates.add(serviceName);
+          duplicates.add(serviceDisplayName);
           continue;
         }
       } catch (ServiceNotFoundException e) {
@@ -1108,25 +1172,25 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
       request.setResolvedRepository(repositoryVersion);
 
       if (!ambariMetaInfo.isValidService(stackId.getStackName(),
-              stackId.getStackVersion(), request.getServiceName())) {
-        throw new IllegalArgumentException("Unsupported or invalid service in 
stack, clusterName=" + clusterName
-                + ", serviceName=" + serviceName + ", stackInfo=" + 
stackId.getStackId());
+              stackId.getStackVersion(), request.getServiceDisplayName())) {
+        throw new IllegalArgumentException("Unsupported or invalid service in 
stack, clusterId=" + clusterName
+                + ", serviceDisplayName=" + serviceDisplayName + ", 
stackInfo=" + stackId.getStackId());
       }
 
       // validate the credential store input provided
       ServiceInfo serviceInfo = 
ambariMetaInfo.getService(stackId.getStackName(),
-          stackId.getStackVersion(), request.getServiceName());
+          stackId.getStackVersion(), request.getServiceDisplayName());
 
       if (StringUtils.isNotEmpty(request.getCredentialStoreEnabled())) {
         boolean credentialStoreEnabled = 
Boolean.parseBoolean(request.getCredentialStoreEnabled());
         if (!serviceInfo.isCredentialStoreSupported() && 
credentialStoreEnabled) {
           throw new IllegalArgumentException("Invalid arguments, cannot enable 
credential store " +
-              "as it is not supported by the service. Service=" + 
request.getServiceName());
+              "as it is not supported by the service. Service=" + 
request.getServiceDisplayName());
         }
       }
     }
     // ensure only a single cluster update
-    if (serviceNames.size() != 1) {
+    if (serviceDisplayNames.size() != 1) {
       throw new IllegalArgumentException("Invalid arguments, updates allowed"
               + "on only one cluster at a time");
     }
@@ -1135,7 +1199,7 @@ public class ServiceResourceProvider extends 
AbstractControllerResourceProvider
     if (!duplicates.isEmpty()) {
       String clusterName = requests.iterator().next().getClusterName();
       String msg = "Attempted to create a service which already exists: "
-              + ", clusterName=" + clusterName  + " serviceName=" + 
StringUtils.join(duplicates, ",");
+              + ", clusterName=" + clusterName  + " serviceDisplayName=" + 
StringUtils.join(duplicates, ",");
 
       throw new DuplicateResourceException(msg);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
index 64261b3..0cd55c3 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java
@@ -188,7 +188,7 @@ public class LoggingSearchPropertyProvider implements 
PropertyProvider {
     try {
       AmbariMetaInfo metaInfo = controller.getAmbariMetaInfo();
       Cluster cluster = controller.getClusters().getCluster(clusterName);
-      String serviceName = controller.findServiceName(cluster, componentName);
+      String serviceName = controller.findService(cluster, componentName);
       Service service = cluster.getService(serviceName);
       StackId stackId = service.getDesiredStackId();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
index 95352bf..93baefe 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/DatabaseChecker.java
@@ -87,8 +87,9 @@ public class DatabaseChecker {
         if (serviceDesiredStateEntity == null) {
           checkPassed = false;
           LOG.error(String.format("ServiceDesiredStateEntity is null for " +
-              "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s ",
-            clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName()));
+              "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceDisplayName=%s, serviceName=%s ",
+            clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceDisplayName(),
+            clusterServiceEntity.getServiceName()));
         }
         Collection<ServiceComponentDesiredStateEntity> scDesiredStateEntities =
           clusterServiceEntity.getServiceComponentDesiredStateEntities();
@@ -96,8 +97,9 @@ public class DatabaseChecker {
           scDesiredStateEntities.isEmpty()) {
           checkPassed = false;
           LOG.error(String.format("serviceComponentDesiredStateEntities is 
null or empty for " +
-              "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s ",
-            clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName()));
+              "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceDisplayName=%s, serviceName=%s ",
+              clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceDisplayName(),
+              clusterServiceEntity.getServiceName()));
         } else {
           for (ServiceComponentDesiredStateEntity scDesiredStateEnity : 
scDesiredStateEntities) {
 
@@ -108,7 +110,7 @@ public class DatabaseChecker {
 
             ComponentInfo componentInfo = ambariMetaInfo.getComponent(
               stackId.getStackName(), stackId.getStackVersion(),
-              scDesiredStateEnity.getServiceName(), 
scDesiredStateEnity.getComponentName());
+              clusterServiceEntity.getServiceName(), 
scDesiredStateEnity.getComponentName());
 
             boolean zeroCardinality = componentInfo.getCardinality() == null
               || componentInfo.getCardinality().startsWith("0")
@@ -119,25 +121,29 @@ public class DatabaseChecker {
             if (schDesiredStateEntities == null) {
               componentCheckFailed = true;
               LOG.error(String.format("hostComponentDesiredStateEntities is 
null for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), 
scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
+                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, serviceDisplayName=%s, componentName=%s ",
+                clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName(), 
clusterServiceEntity.getServiceDisplayName(),
+                scDesiredStateEnity.getComponentName()));
             } else if (!zeroCardinality && schDesiredStateEntities.isEmpty()) {
               componentCheckFailed = true;
               LOG.error(String.format("hostComponentDesiredStateEntities is 
empty for " +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), 
scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
+                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, serviceDisplayName=%s, componentName=%s ",
+                clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName(), 
clusterServiceEntity.getServiceDisplayName(),
+                scDesiredStateEnity.getComponentName()));
             }
 
             if (schStateEntities == null) {
               componentCheckFailed = true;
               LOG.error(String.format("hostComponentStateEntities is null for 
" +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), 
scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
+                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, serviceDisplayName=%s, componentName=%s ",
+                clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName(), 
clusterServiceEntity.getServiceDisplayName(),
+                scDesiredStateEnity.getComponentName()));
             } else if (!zeroCardinality && schStateEntities.isEmpty()) {
               componentCheckFailed = true;
               LOG.error(String.format("hostComponentStateEntities is empty for 
" +
-                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, componentName=%s ",
-                clusterEntity.getClusterName(), 
scDesiredStateEnity.getServiceName(), scDesiredStateEnity.getComponentName()));
+                  "ServiceComponentDesiredStateEntity, clusterName=%s, 
serviceName=%s, serviceDisplayName=%s, componentName=%s ",
+                clusterEntity.getClusterName(), 
clusterServiceEntity.getServiceName(), 
clusterServiceEntity.getServiceDisplayName(),
+                scDesiredStateEnity.getComponentName()));
             }
 
             if (!componentCheckFailed &&
@@ -145,8 +151,8 @@ public class DatabaseChecker {
               checkPassed = false;
               LOG.error(String.format("HostComponentStateEntities and 
HostComponentDesiredStateEntities " +
                   "tables must contain equal number of rows mapped to 
ServiceComponentDesiredStateEntity, " +
-                  "(clusterName=%s, serviceName=%s, componentName=%s) ", 
clusterEntity.getClusterName(),
-                scDesiredStateEnity.getServiceName(), 
scDesiredStateEnity.getComponentName()));
+                  "(clusterName=%s, serviceName=%s, serviceDisplayName=%s, 
componentName=%s) ", clusterEntity.getClusterName(),
+                clusterServiceEntity.getServiceName(), 
clusterServiceEntity.getServiceDisplayName(), 
scDesiredStateEnity.getComponentName()));
             }
             checkPassed = checkPassed && !componentCheckFailed;
           }
@@ -225,25 +231,26 @@ public class DatabaseChecker {
           for (ClusterServiceEntity clusterServiceEntity : 
clusterServiceEntities) {
             if (!State.INIT.equals(
                 
clusterServiceEntity.getServiceDesiredStateEntity().getDesiredState())) {
-              String serviceName = clusterServiceEntity.getServiceName();
+              String serviceDisplayName = 
clusterServiceEntity.getServiceDisplayName();
+              Long serviceGroupId = clusterServiceEntity.getServiceGroupId();
               ServiceInfo serviceInfo = 
ambariMetaInfo.getService(stack.getName(),
-                  stack.getVersion(), serviceName);
+                  stack.getVersion(), serviceDisplayName);
 
               for (String configTypeName : 
serviceInfo.getConfigTypeAttributes().keySet()) {
                 if (selectedCountForType.get(configTypeName) == null) {
                   checkPassed = false;
                   LOG.error("Configuration {} is missing for service {}", 
configTypeName,
-                      serviceName);
+                    serviceDisplayName);
                 } else {
                   // Check that for each config type exactly one is selected
                   if (selectedCountForType.get(configTypeName) == 0) {
                     checkPassed = false;
                     LOG.error("Configuration {} has no enabled entries for 
service {}",
-                        configTypeName, serviceName);
+                        configTypeName, serviceDisplayName);
                   } else if (selectedCountForType.get(configTypeName) > 1) {
                     checkPassed = false;
                     LOG.error("Configuration {} has more than 1 enabled entry 
for service {}",
-                        configTypeName, serviceName);
+                        configTypeName, serviceDisplayName);
                   }
                 }
               }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
index 5e02a64..603e650 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/DefaultServiceCalculatedState.java
@@ -88,7 +88,7 @@ public class DefaultServiceCalculatedState implements 
ServiceCalculatedState {
           AmbariMetaInfo ambariMetaInfo = 
managementControllerProvider.get().getAmbariMetaInfo();
           StackId stackId = service.getDesiredStackId();
 
-          ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+          ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
             serviceName, null, null, null);
 
           Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
index ca4fe6e..604fa42 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/FlumeServiceCalculatedState.java
@@ -26,6 +26,7 @@ import org.apache.ambari.server.StaticallyInject;
 import org.apache.ambari.server.controller.ServiceComponentHostRequest;
 import org.apache.ambari.server.controller.ServiceComponentHostResponse;
 import org.apache.ambari.server.state.Cluster;
+import org.apache.ambari.server.state.Service;
 import org.apache.ambari.server.state.State;
 
 /**
@@ -45,8 +46,8 @@ public final class FlumeServiceCalculatedState extends 
DefaultServiceCalculatedS
     try {
       Cluster cluster = getCluster(clusterName);
       if (cluster != null && managementControllerProvider != null) {
-
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        Service service = cluster.getService(serviceName);
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
index eac0dce..765e6fc 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HBaseServiceCalculatedState.java
@@ -49,7 +49,7 @@ public final class HBaseServiceCalculatedState extends 
DefaultServiceCalculatedS
         Service service = cluster.getService(serviceName);
         StackId stackId = service.getDesiredStackId();
 
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
index 7bbad2a..704b4b9 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HDFSServiceCalculatedState.java
@@ -49,7 +49,7 @@ public final class HDFSServiceCalculatedState extends 
DefaultServiceCalculatedSt
         Service service = cluster.getService(serviceName);
         StackId stackId = service.getDesiredStackId();
 
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
index 77e44a5..5e23f0b 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/HiveServiceCalculatedState.java
@@ -50,7 +50,7 @@ public final class HiveServiceCalculatedState extends 
DefaultServiceCalculatedSt
         StackId stackId = service.getDesiredStackId();
 
 
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
index 1803f70..6c5eab4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/OozieServiceCalculatedState.java
@@ -49,8 +49,7 @@ public final class OozieServiceCalculatedState extends 
DefaultServiceCalculatedS
         Service service = cluster.getService(serviceName);
         StackId stackId = service.getDesiredStackId();
 
-
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
index 2f1619f..2fd99e4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/state/YARNServiceCalculatedState.java
@@ -50,7 +50,7 @@ public final class YARNServiceCalculatedState extends 
DefaultServiceCalculatedSt
         StackId stackId = service.getDesiredStackId();
 
 
-        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName,
+        ServiceComponentHostRequest request = new 
ServiceComponentHostRequest(clusterName, service.getServiceGroupName(),
           serviceName, null, null, null);
 
         Set<ServiceComponentHostResponse> hostComponentResponses =

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentInstalledEvent.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentInstalledEvent.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentInstalledEvent.java
index 0ba4ac2..8c2e6d4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentInstalledEvent.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentInstalledEvent.java
@@ -36,12 +36,11 @@ public class ServiceComponentInstalledEvent extends 
ServiceEvent {
    * @param componentName
    * @param hostName
    */
-  public ServiceComponentInstalledEvent(long clusterId, String stackName,
-      String stackVersion, String serviceName, String componentName,
-      String hostName, boolean recoveryEnabled) {
-    super(AmbariEventType.SERVICE_COMPONENT_INSTALL_SUCCESS, clusterId,
-        stackName,
-        stackVersion, serviceName);
+  public ServiceComponentInstalledEvent(long clusterId, String stackName, 
String stackVersion, String serviceName,
+                                        String serviceDisplayName, String 
serviceGroupName, String componentName,
+                                        String hostName, boolean 
recoveryEnabled) {
+    super(AmbariEventType.SERVICE_COMPONENT_INSTALL_SUCCESS, clusterId, 
stackName,
+          stackVersion, serviceName, serviceDisplayName, serviceGroupName);
 
     m_componentName = componentName;
     m_hostName = hostName;
@@ -73,6 +72,8 @@ public class ServiceComponentInstalledEvent extends 
ServiceEvent {
     buffer.append(", stackName=").append(m_stackName);
     buffer.append(", stackVersion=").append(m_stackVersion);
     buffer.append(", serviceName=").append(m_serviceName);
+    buffer.append(", serviceDisplayName=").append(m_serviceDisplayName);
+    buffer.append(", serviceGroupName=").append(m_serviceGroupName);
     buffer.append(", componentName=").append(m_componentName);
     buffer.append(", hostName=").append(m_hostName);
     buffer.append(", recoveryEnabled=").append(m_recoveryEnabled);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentUninstalledEvent.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentUninstalledEvent.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentUninstalledEvent.java
index 8acc401..803770d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentUninstalledEvent.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceComponentUninstalledEvent.java
@@ -38,12 +38,11 @@ public class ServiceComponentUninstalledEvent extends 
ServiceEvent {
    * @param componentName
    * @param hostName
    */
-  public ServiceComponentUninstalledEvent(long clusterId, String stackName,
-      String stackVersion, String serviceName, String componentName,
-      String hostName, boolean recoveryEnabled) {
+  public ServiceComponentUninstalledEvent(long clusterId, String stackName, 
String stackVersion, String serviceName,
+                                          String serviceDisplayName, String 
serviceGroupName, String componentName,
+                                          String hostName, boolean 
recoveryEnabled) {
     super(AmbariEventType.SERVICE_COMPONENT_UNINSTALLED_SUCCESS, clusterId,
-        stackName,
-        stackVersion, serviceName);
+      stackName, stackVersion, serviceName, serviceDisplayName, 
serviceGroupName);
 
     m_componentName = componentName;
     m_hostName = hostName;
@@ -81,6 +80,8 @@ public class ServiceComponentUninstalledEvent extends 
ServiceEvent {
     buffer.append(", stackName=").append(m_stackName);
     buffer.append(", stackVersion=").append(m_stackVersion);
     buffer.append(", serviceName=").append(m_serviceName);
+    buffer.append(", serviceDisplayName=").append(m_serviceDisplayName);
+    buffer.append(", serviceGroupName=").append(m_serviceGroupName);
     buffer.append(", componentName=").append(m_componentName);
     buffer.append(", hostName=").append(m_hostName);
     buffer.append(", recoveryEnabled=").append(m_recoveryEnabled);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceEvent.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceEvent.java 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceEvent.java
index 08f739e..622c9d7 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceEvent.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceEvent.java
@@ -29,6 +29,16 @@ public abstract class ServiceEvent extends ClusterEvent {
   protected final String m_serviceName;
 
   /**
+   * The name of the real service.
+   */
+  protected final String m_serviceDisplayName;
+
+  /**
+   * The name of the service group.
+   */
+  protected final String m_serviceGroupName;
+
+  /**
    * The name of the services' stack.
    */
   protected final String m_stackName;
@@ -44,12 +54,14 @@ public abstract class ServiceEvent extends ClusterEvent {
    * @param eventType
    * @param clusterId
    */
-  public ServiceEvent(AmbariEventType eventType, long clusterId,
-      String stackName, String stackVersion, String serviceName) {
+  public ServiceEvent(AmbariEventType eventType, long clusterId, String 
stackName, String stackVersion,
+                      String serviceName, String serviceDisplayName, String 
serviceGroupName) {
     super(eventType, clusterId);
     m_stackName = stackName;
     m_stackVersion = stackVersion;
     m_serviceName = serviceName;
+    m_serviceDisplayName = serviceDisplayName;
+    m_serviceGroupName = serviceGroupName;
   }
 
   /**
@@ -60,6 +72,16 @@ public abstract class ServiceEvent extends ClusterEvent {
   }
 
   /**
+   * @return the serviceDisplayName (never {@code null}).
+   */
+  public String getServiceDisplayName() { return m_serviceDisplayName; }
+
+  /**
+   * @return the service group name (never {@code null}).
+   */
+  public String getServiceGroupName() { return m_serviceGroupName; }
+
+  /**
    * @return the stackName (never {@code null}).
    */
   public String getStackName() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceInstalledEvent.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceInstalledEvent.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceInstalledEvent.java
index 1f341d9..c7c7dd4 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceInstalledEvent.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceInstalledEvent.java
@@ -29,11 +29,13 @@ public class ServiceInstalledEvent extends ServiceEvent {
    * @param stackName
    * @param stackVersion
    * @param serviceName
+   * @param serviceDisplayName
+   * @param serviceGroupName
    */
-  public ServiceInstalledEvent(long clusterId, String stackName,
-      String stackVersion, String serviceName) {
+  public ServiceInstalledEvent(long clusterId, String stackName, String 
stackVersion, String serviceName,
+                               String serviceDisplayName, String 
serviceGroupName) {
     super(AmbariEventType.SERVICE_INSTALL_SUCCESS, clusterId, stackName,
-        stackVersion, serviceName);
+        stackVersion, serviceName, serviceDisplayName, serviceGroupName);
   }
 
   /**
@@ -46,6 +48,8 @@ public class ServiceInstalledEvent extends ServiceEvent {
     buffer.append(", stackName=").append(m_stackName);
     buffer.append(", stackVersion=").append(m_stackVersion);
     buffer.append(", serviceName=").append(m_serviceName);
+    buffer.append(", serviceDisplayName=").append(m_serviceDisplayName);
+    buffer.append(", serviceGroupName=").append(m_serviceGroupName);
     buffer.append("}");
     return buffer.toString();
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f3520c09/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceRemovedEvent.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceRemovedEvent.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceRemovedEvent.java
index de96342..a8de84d 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceRemovedEvent.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/events/ServiceRemovedEvent.java
@@ -30,10 +30,10 @@ import 
org.apache.ambari.server.serveraction.kerberos.Component;
 public class ServiceRemovedEvent extends ServiceEvent {
   private final List<Component> components;
 
-  public ServiceRemovedEvent(long clusterId, String stackName,
-                             String stackVersion, String serviceName, 
List<Component> components) {
+  public ServiceRemovedEvent(long clusterId, String stackName, String 
stackVersion, String serviceName,
+                             String serviceDisplayName, String 
serviceGroupName, List<Component> components) {
     super(AmbariEventType.SERVICE_REMOVED_SUCCESS, clusterId, stackName,
-      stackVersion, serviceName);
+      stackVersion, serviceName, serviceDisplayName, serviceGroupName);
     this.components = components;
   }
 
@@ -47,6 +47,8 @@ public class ServiceRemovedEvent extends ServiceEvent {
     buffer.append(", stackName=").append(m_stackName);
     buffer.append(", stackVersion=").append(m_stackVersion);
     buffer.append(", serviceName=").append(m_serviceName);
+    buffer.append(", serviceDisplayName=").append(m_serviceDisplayName);
+    buffer.append(", serviceGroupName=").append(m_serviceGroupName);
     buffer.append("}");
     return buffer.toString();
   }

Reply via email to