private void initProviderMaps() throws SystemException {

    jmxPortMap.clear();
    clusterHostComponentMap = new HashMap<>();
    clusterGangliaCollectorMap = new HashMap<>();
    boolean hasMetricCollector = false;

    Map<String, Cluster> clusterMap = clusters.getClusters();
    if (MapUtils.isEmpty(clusterMap)) {
      return;
    }

    for (Cluster cluster : clusterMap.values()) {
      hasMetricCollector = false;
      String clusterName = cluster.getClusterName();
      Map<String, String> hostComponentMap = clusterHostComponentMap.get(clusterName);

      if (hostComponentMap == null) {
        hostComponentMap = new HashMap<>();
        clusterHostComponentMap.put(clusterName, hostComponentMap);
      }

      List<ServiceComponentHost> serviceComponentHosts = cluster.getServiceComponentHosts();
      if (!CollectionUtils.isEmpty(serviceComponentHosts)) {
        for (ServiceComponentHost sch : serviceComponentHosts) {
          String componentName = sch.getServiceComponentName();
          String hostName = sch.getHostName();

          hostComponentMap.put(componentName, hostName);

          // record the Ganglia server for the current cluster
          if (componentName.equals(GANGLIA_SERVER)) {
            clusterGangliaCollectorMap.put(clusterName, hostName);
          }
          if (componentName.equals(METRIC_SERVER)) {
            //  If current collector host is null or if the host or the host component not live
            //  Update clusterMetricCollectorMap.
            metricsCollectorHAManager.addCollectorHost(clusterName, hostName);
            hasMetricCollector = true;
          }
        }
      }
      if (!hasMetricCollector) {
        checkAndAddExternalCollectorHosts(clusterName);
      }
    }
  }
Post process property value. If value has one ore some substrings
started with "${" and ended with "}" these substrings will replace
with properties from current propertiesMap. It is doing recursively.

@param key        - properties name
@param value      - properties value
@param properties - map with properties
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AbstractProviderModule.java