private void parseComponents(String service) throws AmbariException{
    Collection<String> componentSet = new HashSet<>();

    Set<StackServiceComponentResponse> components = controller.getStackComponents(
        Collections.singleton(new StackServiceComponentRequest(name, version, service, null)));

    // stack service components
    for (StackServiceComponentResponse component : components) {
      String componentName = component.getComponentName();
      componentSet.add(componentName);
      componentService.put(componentName, service);
      String cardinality = component.getCardinality();
      if (cardinality != null) {
        cardinalityRequirements.put(componentName, cardinality);
      }
      AutoDeployInfo autoDeploy = component.getAutoDeploy();
      if (autoDeploy != null) {
        componentAutoDeployInfo.put(componentName, autoDeploy);
      }

      // populate component dependencies
      //todo: remove usage of AmbariMetaInfo
      Collection<DependencyInfo> componentDependencies = controller.getAmbariMetaInfo().getComponentDependencies(
          name, version, service, componentName);

      if (componentDependencies != null && ! componentDependencies.isEmpty()) {
        dependencies.put(componentName, componentDependencies);
      }
      if (component.isMaster()) {
        masterComponents.add(componentName);
      }
    }
    serviceComponents.put(service, componentSet);
  }
Parse components for the specified service from the stack definition.

@param service  service name

@throws AmbariException an exception occurred getting components from the stack definition
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/Stack.java