public Map<String, Map<String, String>> getDefaultProperties(StackId stack, String serviceName)
      throws AmbariException {
    Map<String, Map<String, String>> defaultPropertiesByType = new HashMap<>();

    // populate the stack (non-service related) properties first
    Set<org.apache.ambari.server.state.PropertyInfo> stackConfigurationProperties = ambariMetaInfo.getStackProperties(
        stack.getStackName(), stack.getStackVersion());

    for (PropertyInfo stackDefaultProperty : stackConfigurationProperties) {
      String type = ConfigHelper.fileNameToConfigType(stackDefaultProperty.getFilename());

      if (!defaultPropertiesByType.containsKey(type)) {
        defaultPropertiesByType.put(type, new HashMap<>());
      }

      defaultPropertiesByType.get(type).put(stackDefaultProperty.getName(),
          stackDefaultProperty.getValue());
    }

    // for every installed service, populate the default service properties
    Set<org.apache.ambari.server.state.PropertyInfo> serviceConfigurationProperties = ambariMetaInfo.getServiceProperties(
        stack.getStackName(), stack.getStackVersion(), serviceName);

    // !!! use new stack as the basis
    for (PropertyInfo serviceDefaultProperty : serviceConfigurationProperties) {
      String type = ConfigHelper.fileNameToConfigType(serviceDefaultProperty.getFilename());

      if (!defaultPropertiesByType.containsKey(type)) {
        defaultPropertiesByType.put(type, new HashMap<>());
      }

      defaultPropertiesByType.get(type).put(serviceDefaultProperty.getName(),
          serviceDefaultProperty.getValue());
    }

    return defaultPropertiesByType;
  }
@param stack
         the stack to pull stack-values from (not {@code null})
@param serviceName
         the service name {@code null}).
@return a mapping of configuration type to map of key/value pairs for the
        default configurations.
@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/state/ConfigHelper.java