private void setServiceNameIfAbsent(final ServiceComponentRequest request,
                                      final Cluster cluster,
                                      final AmbariMetaInfo ambariMetaInfo) throws AmbariException {
    if (StringUtils.isEmpty(request.getServiceName())) {

      String componentName = request.getComponentName();

      String serviceName = getManagementController().findServiceName(cluster, componentName);

      debug("Looking up service name for component, componentName={}, serviceName={}", componentName, serviceName);

      if (StringUtils.isEmpty(serviceName)) {
        throw new AmbariException("Could not find service for component"
                + ", componentName=" + request.getComponentName()
                + ", clusterName=" + cluster.getClusterName());
      }
      request.setServiceName(serviceName);
    }
  }
Get a component request object from a map of property values.

@param properties  the predicate

@return the component request object
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ComponentResourceProvider.java