public Map<String, KerberosConfigurationDescriptor> getConfigurations(boolean includeInherited) {
    if (includeInherited) {
      Map<String, KerberosConfigurationDescriptor> mergedConfigurations = new TreeMap<>();
      List<Map<String, KerberosConfigurationDescriptor>> configurationSets = new ArrayList<>();
      AbstractKerberosDescriptor currentDescriptor = this;

      // Walk up the hierarchy and collect the configuration sets.
      while (currentDescriptor != null) {
        if (currentDescriptor.isContainer()) {
          Map<String, KerberosConfigurationDescriptor> configurations = ((AbstractKerberosDescriptorContainer) currentDescriptor).getConfigurations();

          if (configurations != null) {
            configurationSets.add(configurations);
          }
        }

        currentDescriptor = currentDescriptor.getParent();
      }

      // Reverse the collection so that we can merge from top to bottom
      Collections.reverse(configurationSets);

      for (Map<String, KerberosConfigurationDescriptor> map : configurationSets) {
        for (Map.Entry<String, KerberosConfigurationDescriptor> entry : map.entrySet()) {
          // For each configuration type, copy it and determine if an entry exists or not.
          // ** If one exists, merge the current data into the existing data (potentially
          //    overwriting values).
          // ** If one does not exist, simply add a copy of the current one to the Map
          String currentType = entry.getKey();
          KerberosConfigurationDescriptor currentConfiguration = entry.getValue();

          if (currentConfiguration != null) {
            KerberosConfigurationDescriptor detachedConfiguration = new KerberosConfigurationDescriptor(currentConfiguration.toMap());
            KerberosConfigurationDescriptor mergedConfiguration = mergedConfigurations.get(entry.getKey());

            if (mergedConfiguration == null) {
              mergedConfigurations.put(currentType, detachedConfiguration);
            } else {
              mergedConfiguration.update(detachedConfiguration);
            }
          }
        }
      }

      return mergedConfigurations;
    } else {
      return configurations;
    }
  }
Returns a Map of KerberosConfigurationDescriptors contained within this
AbstractKerberosDescriptorContainer.
<p/>
If includeInherited is true, the Map will contain "detached" KerberosConfigurationDescriptor
instances, but the data will be merged with all relevant KerberosConfigurationDescriptors within
the hierarchy.  Data higher in the hierarchy (the service level is higher in the hierarchy than
the component level) will be overwritten by data lower in the hierarchy.
<p/>
If includeInherited is false, the Map will consist of attached (non-merged)
KerberosConfigurationDescriptors. This data is not manipulated by merging with data within the
KerberosDescriptor hierarchy and therefore it may be missing data, however this Map is of
"attached" descriptors, so changes will be reflected within the KerberosDescriptor
hierarchy.

@param includeInherited a Boolean value indicating whether to include configuration within the
                        KerberosDescriptor hierarchy (true) or not (false)
@return a Map of Strings to KerberosConfigurationDescriptors, where the key is the type
(core-site, etc...)
ambari-server/src/main/java/org/apache/ambari/server/state/kerberos/AbstractKerberosDescriptorContainer.java