Java 类io.dropwizard.configuration.ConfigurationSourceProvider 实例源码

项目:Mastering-Mesos    文件:MergingSourceProviderTest.java   
private ConfigurationSourceProvider buildConfigurationSourceProvider(String baseFilename) {
    final Class<?> klass = getClass();

    return new MergingSourceProvider(new ConfigurationSourceProvider() {
        @Override
        public InputStream open(String path) throws IOException {
            final InputStream stream = klass.getResourceAsStream(path);
            if (stream == null) {
                throw new FileNotFoundException("File " + path + " not found in test resources directory");
            }
            return stream;
        }
    }, baseFilename, objectMapper, YAML_FACTORY);
}
项目:Singularity    文件:MergingSourceProviderTest.java   
private ConfigurationSourceProvider buildConfigurationSourceProvider(String baseFilename) {
    final Class<?> klass = getClass();

    return new MergingSourceProvider(new ConfigurationSourceProvider() {
        @Override
        public InputStream open(String path) throws IOException {
            final InputStream stream = klass.getResourceAsStream(path);
            if (stream == null) {
                throw new FileNotFoundException("File " + path + " not found in test resources directory");
            }
            return stream;
        }
    }, baseFilename, objectMapper, YAML_FACTORY);
}
项目:Baragon    文件:MergingConfigProviderTest.java   
private ConfigurationSourceProvider buildConfigSourceProvider(String baseFileName) {
  final Class<?> klass = this.getClass();

  return new MergingConfigProvider(new ConfigurationSourceProvider() {
    @Override
    public InputStream open(String path) throws IOException {
      InputStream inputStream = klass.getResourceAsStream(path);
      if (inputStream == null) {
        throw new FileNotFoundException(String.format("File %s not found in test resources directory", path));
      } else {
        return inputStream;
      }
    }
  }, baseFileName, objectMapper, YAML_FACTORY);
}
项目:Mastering-Mesos    文件:MergingSourceProvider.java   
public MergingSourceProvider(ConfigurationSourceProvider delegate, String defaultConfigurationPath, ObjectMapper objectMapper, YAMLFactory yamlFactory) {
    this.delegate = delegate;
    this.defaultConfigurationPath = defaultConfigurationPath;
    this.objectMapper = objectMapper;
    this.yamlFactory = yamlFactory;
}
项目:Singularity    文件:MergingSourceProvider.java   
public MergingSourceProvider(ConfigurationSourceProvider delegate, String defaultConfigurationPath, ObjectMapper objectMapper, YAMLFactory yamlFactory) {
    this.delegate = delegate;
    this.defaultConfigurationPath = defaultConfigurationPath;
    this.objectMapper = objectMapper;
    this.yamlFactory = yamlFactory;
}
项目:Baragon    文件:MergingConfigProvider.java   
public MergingConfigProvider(ConfigurationSourceProvider delegate, String defaultConfigPath, ObjectMapper objectMapper, YAMLFactory yamlFactory) {
  this.delegate = delegate;
  this.defaultConfigPath = defaultConfigPath;
  this.objectMapper = objectMapper;
  this.yamlFactory = yamlFactory;
}
项目:dropwizard-config-importable    文件:ImportableConfigurationFactory.java   
/**
 * Loads, parses, binds, and validates a configuration object.
 *
 * @param provider the provider to to use for reading configuration files
 * @param path     the path of the configuration file
 * @return a validated configuration object
 * @throws IOException            if there is an error reading the file
 * @throws ConfigurationException if there is an error parsing or validating the file
 */
public T build(ConfigurationSourceProvider provider, String path)
    throws IOException, ConfigurationException
{
    return build(loadConfiguration(provider, path), path);
}