// Path: provider/src/main/java/com/cloudera/director/aws/common/PropertyResolvers.java
// public final class PropertyResolvers {
// 
//   private static final String BUILT_IN_NAME = "built-in";
//   private static final String CUSTOM_NAME_PREFIX = "custom";
// 
//   private PropertyResolvers() {
//   }
// 
//   /**
//    * Creates a new property resolver with no properties.
//    *
//    * @return new property resolver
//    */
//   public static PropertyResolver newEmptyPropertyResolver() {
//     return new PropertySourcesPropertyResolver(new MutablePropertySources());
//   }
// 
//   /**
//    * Creates a new property resolver that gets properties from the given map.
//    *
//    * @param m property map
//    * @return new property resolver
//    * @throws NullPointerException if the map is null
//    */
//   public static PropertyResolver newMapPropertyResolver(Map<String, String> m) {
//     checkNotNull(m, "map is null");
//     MutablePropertySources sources = new MutablePropertySources();
//     sources.addFirst(new MapPropertySource("map",
//         ImmutableMap.copyOf(m)));
//     return new PropertySourcesPropertyResolver(sources);
//   }
// 
//   /**
//    * Creates a property resolver that pulls from multiple property resource
//    * locations. The first "built-in" location must be successfully loaded, but
//    * all other "custom" locations may fail to load.
//    *
//    * @param builtInResourceLocation lowest precedence, required resource
//    *                                location for properties
//    * @param customResourceLocations additional resource locations for
//    *                                properties, in increasing order of precedence
//    * @return new property resolver
//    * @throws IOException          if the built-in resource location could not be loaded
//    * @throws NullPointerException if any resource location is null
//    */
//   public static PropertyResolver newMultiResourcePropertyResolver(String builtInResourceLocation,
//       String... customResourceLocations)
//       throws IOException {
//     return newMultiResourcePropertyResolver(true, builtInResourceLocation,
//         customResourceLocations);
//   }
// 
//   /**
//    * Creates a property resolver that pulls from multiple property resource
//    * locations. The first "built-in" location must be successfully loaded, but
//    * all other "custom" locations must load only if {code}allowMissing{code} is
//    * false.
//    *
//    * @param allowMissing            true to allow custom resource locations to fail to load
//    * @param builtInResourceLocation lowest precedence, required resource
//    *                                location for properties
//    * @param customResourceLocations additional resource locations for
//    *                                properties, in increasing order of precedence
//    * @return new property resolver
//    * @throws IOException          if the built-in resource location could not be loaded,
//    *                              or if {code}allowMissing{code} is false and any custom resource location
//    *                              fails to load
//    * @throws NullPointerException if any resource location is null
//    */
//   public static PropertyResolver newMultiResourcePropertyResolver(boolean allowMissing,
//       String builtInResourceLocation,
//       String... customResourceLocations)
//       throws IOException {
//     MutablePropertySources sources = new MutablePropertySources();
//     checkNotNull(builtInResourceLocation, "builtInResourceLocation is null");
//     sources.addLast(buildPropertySource(BUILT_IN_NAME, builtInResourceLocation,
//         false));
//     String lastname = BUILT_IN_NAME;
//     int customCtr = 1;
//     for (String loc : customResourceLocations) {
//       checkNotNull(loc, "customResourceLocations[" + (customCtr - 1) +
//           "] is null");
//       String thisname = CUSTOM_NAME_PREFIX + customCtr++;
//       PropertySource source = buildPropertySource(thisname, loc, allowMissing);
//       if (source != null) {
//         sources.addBefore(lastname, source);
//         lastname = thisname;
//       }
//     }
// 
//     return new PropertySourcesPropertyResolver(sources);
//   }
// 
//   private static PropertySource buildPropertySource(String name, String loc,
//       boolean allowMissing)
//       throws IOException {
//     try {
//       return new ResourcePropertySource(name, loc,
//           PropertyResolvers.class.getClassLoader());
//     } catch (IOException e) {
//       if (allowMissing) {
//         return null;
//       }
//       throw new IOException("Unable to load " + name +
//           " properties from " + loc, e);
//     }
//   }
// 
// }


import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.PropertyResolver;
import static com.google.common.base.Preconditions.checkArgument;
import com.cloudera.director.aws.common.PropertyResolvers;
import com.cloudera.director.spi.v2.model.ConfigurationProperty;
import com.cloudera.director.spi.v2.model.Configured;
import com.cloudera.director.spi.v2.model.LocalizationContext;
import com.cloudera.director.spi.v2.model.util.ChildLocalizationContext;
import com.cloudera.director.spi.v2.model.util.SimpleConfiguration;
import com.cloudera.director.spi.v2.model.util.SimpleConfigurationPropertyBuilder;
import com.google.common.base.Function;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.util.Map;
    }

    File getCustomEndpointsFile(String customEndpointsPath) {
      File customEndpointsPathFile = new File(customEndpointsPath);
      return customEndpointsPathFile.isAbsolute() ?
          customEndpointsPathFile :
          new File(configurationDirectory, customEndpointsPath);
    }

    public void setCustomEndpointsPath(String customEndpointsPath) {
      if (customEndpointsPath != null) {
        LOG.info("Overriding customEndpointsPath={} (default {})",
            customEndpointsPath, DEFAULT_CUSTOM_ENDPOINTS_PATH);
        checkArgument(getCustomEndpointsFile(customEndpointsPath).exists(),
            "Custom RDS endpoints path " +
                customEndpointsPath + " does not exist");
        this.customEndpointsPath = customEndpointsPath;
      }
    }
  }

  public static class RDSEndpointsConfig {

    public static final String BUILT_IN_LOCATION =
        "classpath:/com/cloudera/director/aws/rds/endpoints.properties";

    protected RDSEndpointsConfigProperties rdsEndpointsConfigProperties;

    public PropertyResolver rdsEndpointsResolver() {
      try {
// Path: provider/src/main/java/com/cloudera/director/aws/common/PropertyResolvers.java
// public final class PropertyResolvers {
// 
//   private static final String BUILT_IN_NAME = "built-in";
//   private static final String CUSTOM_NAME_PREFIX = "custom";
// 
//   private PropertyResolvers() {
//   }
// 
//   /**
//    * Creates a new property resolver with no properties.
//    *
//    * @return new property resolver
//    */
//   public static PropertyResolver newEmptyPropertyResolver() {
//     return new PropertySourcesPropertyResolver(new MutablePropertySources());
//   }
// 
//   /**
//    * Creates a new property resolver that gets properties from the given map.
//    *
//    * @param m property map
//    * @return new property resolver
//    * @throws NullPointerException if the map is null
//    */
//   public static PropertyResolver newMapPropertyResolver(Map<String, String> m) {
//     checkNotNull(m, "map is null");
//     MutablePropertySources sources = new MutablePropertySources();
//     sources.addFirst(new MapPropertySource("map",
//         ImmutableMap.copyOf(m)));
//     return new PropertySourcesPropertyResolver(sources);
//   }
// 
//   /**
//    * Creates a property resolver that pulls from multiple property resource
//    * locations. The first "built-in" location must be successfully loaded, but
//    * all other "custom" locations may fail to load.
//    *
//    * @param builtInResourceLocation lowest precedence, required resource
//    *                                location for properties
//    * @param customResourceLocations additional resource locations for
//    *                                properties, in increasing order of precedence
//    * @return new property resolver
//    * @throws IOException          if the built-in resource location could not be loaded
//    * @throws NullPointerException if any resource location is null
//    */
//   public static PropertyResolver newMultiResourcePropertyResolver(String builtInResourceLocation,
//       String... customResourceLocations)
//       throws IOException {
//     return newMultiResourcePropertyResolver(true, builtInResourceLocation,
//         customResourceLocations);
//   }
// 
//   /**
//    * Creates a property resolver that pulls from multiple property resource
//    * locations. The first "built-in" location must be successfully loaded, but
//    * all other "custom" locations must load only if {code}allowMissing{code} is
//    * false.
//    *
//    * @param allowMissing            true to allow custom resource locations to fail to load
//    * @param builtInResourceLocation lowest precedence, required resource
//    *                                location for properties
//    * @param customResourceLocations additional resource locations for
//    *                                properties, in increasing order of precedence
//    * @return new property resolver
//    * @throws IOException          if the built-in resource location could not be loaded,
//    *                              or if {code}allowMissing{code} is false and any custom resource location
//    *                              fails to load
//    * @throws NullPointerException if any resource location is null
//    */
//   public static PropertyResolver newMultiResourcePropertyResolver(boolean allowMissing,
//       String builtInResourceLocation,
//       String... customResourceLocations)
//       throws IOException {
//     MutablePropertySources sources = new MutablePropertySources();
//     checkNotNull(builtInResourceLocation, "builtInResourceLocation is null");
//     sources.addLast(buildPropertySource(BUILT_IN_NAME, builtInResourceLocation,
//         false));
//     String lastname = BUILT_IN_NAME;
//     int customCtr = 1;
//     for (String loc : customResourceLocations) {
//       checkNotNull(loc, "customResourceLocations[" + (customCtr - 1) +
//           "] is null");
//       String thisname = CUSTOM_NAME_PREFIX + customCtr++;
//       PropertySource source = buildPropertySource(thisname, loc, allowMissing);
//       if (source != null) {
//         sources.addBefore(lastname, source);
//         lastname = thisname;
//       }
//     }
// 
//     return new PropertySourcesPropertyResolver(sources);
//   }
// 
//   private static PropertySource buildPropertySource(String name, String loc,
//       boolean allowMissing)
//       throws IOException {
//     try {
//       return new ResourcePropertySource(name, loc,
//           PropertyResolvers.class.getClassLoader());
//     } catch (IOException e) {
//       if (allowMissing) {
//         return null;
//       }
//       throw new IOException("Unable to load " + name +
//           " properties from " + loc, e);
//     }
//   }
// 
// }


// Path: provider/src/main/java/com/cloudera/director/aws/rds/RDSEndpoints.java
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.PropertyResolver;
import static com.google.common.base.Preconditions.checkArgument;
import com.cloudera.director.aws.common.PropertyResolvers;
import com.cloudera.director.spi.v2.model.ConfigurationProperty;
import com.cloudera.director.spi.v2.model.Configured;
import com.cloudera.director.spi.v2.model.LocalizationContext;
import com.cloudera.director.spi.v2.model.util.ChildLocalizationContext;
import com.cloudera.director.spi.v2.model.util.SimpleConfiguration;
import com.cloudera.director.spi.v2.model.util.SimpleConfigurationPropertyBuilder;
import com.google.common.base.Function;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.util.Map;

    }

    File getCustomEndpointsFile(String customEndpointsPath) {
      File customEndpointsPathFile = new File(customEndpointsPath);
      return customEndpointsPathFile.isAbsolute() ?
          customEndpointsPathFile :
          new File(configurationDirectory, customEndpointsPath);
    }

    public void setCustomEndpointsPath(String customEndpointsPath) {
      if (customEndpointsPath != null) {
        LOG.info("Overriding customEndpointsPath={} (default {})",
            customEndpointsPath, DEFAULT_CUSTOM_ENDPOINTS_PATH);
        checkArgument(getCustomEndpointsFile(customEndpointsPath).exists(),
            "Custom RDS endpoints path " +
                customEndpointsPath + " does not exist");
        this.customEndpointsPath = customEndpointsPath;
      }
    }
  }

  public static class RDSEndpointsConfig {

    public static final String BUILT_IN_LOCATION =
        "classpath:/com/cloudera/director/aws/rds/endpoints.properties";

    protected RDSEndpointsConfigProperties rdsEndpointsConfigProperties;

    public PropertyResolver rdsEndpointsResolver() {
      try {
        return PropertyResolvers.newMultiResourcePropertyResolver(