private static Map<String, Set<String>> createServiceComponentMap(Cluster cluster) {
    Map<String, Set<String>> serviceComponentMap = new HashMap<>();
    for (Map.Entry<String, Service> e : cluster.getServices().entrySet()) {
      serviceComponentMap.put(e.getKey(), ImmutableSet.copyOf(e.getValue().getServiceComponents().keySet()));
    }
    return serviceComponentMap;
  }
Creates the service, component and host component resources for the request.
ambari-server/src/main/java/org/apache/ambari/server/topology/addservice/AddServiceOrchestrator.java