private void parseConfigurations(StackServiceResponse stackService) throws AmbariException {
    String service = stackService.getServiceName();
    Map<String, Map<String, ConfigProperty>> mapServiceConfig = new HashMap<>();
    Map<String, Map<String, ConfigProperty>> mapRequiredServiceConfig = new HashMap<>();


    serviceConfigurations.put(service, mapServiceConfig);
    requiredServiceConfigurations.put(service, mapRequiredServiceConfig);

    Set<StackConfigurationResponse> serviceConfigs = controller.getStackConfigurations(
        Collections.singleton(new StackConfigurationRequest(name, version, service, null)));
    Set<StackConfigurationResponse> stackLevelConfigs = controller.getStackLevelConfigurations(
        Collections.singleton(new StackLevelConfigurationRequest(name, version, null)));
    serviceConfigs.addAll(stackLevelConfigs);

    // shouldn't have any required properties in stack level configuration
    for (StackConfigurationResponse config : serviceConfigs) {
      ConfigProperty configProperty = new ConfigProperty(config);
      String type = configProperty.getType();

      Map<String, ConfigProperty> mapTypeConfig = mapServiceConfig.get(type);
      if (mapTypeConfig == null) {
        mapTypeConfig = new HashMap<>();
        mapServiceConfig.put(type, mapTypeConfig);
      }

      mapTypeConfig.put(config.getPropertyName(), configProperty);
      if (config.isRequired()) {
        Map<String, ConfigProperty> requiredTypeConfig = mapRequiredServiceConfig.get(type);
        if (requiredTypeConfig == null) {
          requiredTypeConfig = new HashMap<>();
          mapRequiredServiceConfig.put(type, requiredTypeConfig);
        }
        requiredTypeConfig.put(config.getPropertyName(), configProperty);
      }
    }

    // So far we added only config types that have properties defined
    // in stack service definition. Since there might be config types
    // with no properties defined we need to add those separately
    Set<String> configTypes = stackService.getConfigTypes().keySet();
    for (String configType: configTypes) {
      if (!mapServiceConfig.containsKey(configType)) {
        mapServiceConfig.put(configType, Collections.emptyMap());
      }
    }
  }
Parse configurations for the specified service from the stack definition.

@param stackService  service to parse the stack configuration for

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