private void processPropertyDependencies() {

    // Stack-definition has 'depends-on' relationship specified.
    // We have a map to construct the 'depended-by' relationship.
    Map<PropertyDependencyInfo, Set<PropertyDependencyInfo>> dependedByMap =
      new HashMap<>();

    // Go through all service-configs and gather the reversed 'depended-by'
    // relationship into map. Since we do not have the reverse {@link PropertyInfo},
    // we have to loop through service-configs again later.
    for (ServiceModule serviceModule : serviceModules.values()) {

      Map<String, Map<String, String>> componentRefreshCommandsMap = new HashMap();

      for (PropertyInfo pi : serviceModule.getModuleInfo().getProperties()) {

        for (PropertyDependencyInfo pdi : pi.getDependsOnProperties()) {
          String type = ConfigHelper.fileNameToConfigType(pi.getFilename());
          String name = pi.getName();
          PropertyDependencyInfo propertyDependency =
            new PropertyDependencyInfo(type, name);
          if (dependedByMap.keySet().contains(pdi)) {
            dependedByMap.get(pdi).add(propertyDependency);
          } else {
            Set<PropertyDependencyInfo> newDependenciesSet =
              new HashSet<>();
            newDependenciesSet.add(propertyDependency);
            dependedByMap.put(pdi, newDependenciesSet);
          }
        }

        // set refresh commands
        if (pi.getSupportedRefreshCommands() != null && pi.getSupportedRefreshCommands().size() > 0) {
          String type = ConfigHelper.fileNameToConfigType(pi.getFilename());
          String propertyName = type + "/" + pi.getName();

          Map<String, String> refreshCommandPropertyMap = componentRefreshCommandsMap.get(propertyName);

          for (RefreshCommand refreshCommand : pi.getSupportedRefreshCommands()) {
            String componentName = refreshCommand.getComponentName();
            if (refreshCommandPropertyMap == null) {
              refreshCommandPropertyMap = new HashMap<>();
              componentRefreshCommandsMap.put(propertyName, refreshCommandPropertyMap);
            }
            refreshCommandPropertyMap.put(componentName, refreshCommand.getCommand());
          }

        }

      }

      stackInfo.getRefreshCommandConfiguration().addRefreshCommands(componentRefreshCommandsMap);
    }

    // Go through all service-configs again and set their 'depended-by' if necessary.
    for (ServiceModule serviceModule : serviceModules.values()) {
      addDependedByProperties(dependedByMap, serviceModule.getModuleInfo().getProperties());
    }
    // Go through all stack-configs again and set their 'depended-by' if necessary.
    addDependedByProperties(dependedByMap, stackInfo.getProperties());
  }
Process <depends-on></depends-on> properties
ambari-server/src/main/java/org/apache/ambari/server/stack/StackModule.java