class AgentProviderService extends AbstractProviderService implements
    ProviderCore,
    AgentKeys,
    SliderKeys, AgentRestOperations {

  protected void dereferenceAllConfigs(Map<String, Map<String, String>> configurations) {
    Map<String, String> allConfigs = new HashMap<String, String>();
    String lookupFormat = "${@//site/%s/%s}";
    for (String configType : configurations.keySet()) {
      Map<String, String> configBucket = configurations.get(configType);
      for (String configName : configBucket.keySet()) {
        allConfigs.put(String.format(lookupFormat, configType, configName), configBucket.get(configName));
      }
    }

    boolean finished = false;
    while (!finished) {
      finished = true;
      for (Map.Entry<String, String> entry : allConfigs.entrySet()) {
        String configValue = entry.getValue();
        for (Map.Entry<String, String> lookUpEntry : allConfigs.entrySet()) {
          String lookUpValue = lookUpEntry.getValue();
          if (lookUpValue.contains("${@//site/")) {
            continue;
          }
          String lookUpKey = lookUpEntry.getKey();
          if (configValue != null && configValue.contains(lookUpKey)) {
            configValue = configValue.replace(lookUpKey, lookUpValue);
          }
        }
        if (!configValue.equals(entry.getValue())) {
          finished = false;
          allConfigs.put(entry.getKey(), configValue);
        }
      }
    }

    for (String configType : configurations.keySet()) {
      Map<String, String> configBucket = configurations.get(configType);
      for (Map.Entry<String, String> entry: configBucket.entrySet()) {
        String configName = entry.getKey();
        String configValue = entry.getValue();
        for (Map.Entry<String, String> lookUpEntry : allConfigs.entrySet()) {
          String lookUpValue = lookUpEntry.getValue();
          if (lookUpValue.contains("${@//site/")) {
            continue;
          }
          String lookUpKey = lookUpEntry.getKey();
          if (configValue != null && configValue.contains(lookUpKey)) {
            configValue = configValue.replace(lookUpKey, lookUpValue);
          }
        }
        configBucket.put(configName, configValue);
      }
    }
  }

  public  AgentProviderService();

}