public Collection<String> getServicesForComponents(Collection<String> components) {
    Set<String> services = new HashSet<>();
    for (String component : components) {
      services.add(getServiceForComponent(component));
    }

    return services;
  }
Get the names of the services which contains the specified components.

@param components collection of components

@return collection of services which contain the specified components
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Extension.java