Java源码示例:io.dropwizard.configuration.ConfigurationSourceProvider

示例1
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
  );
}
 
示例2
public MergingSourceProvider(
  ConfigurationSourceProvider delegate,
  String defaultConfigurationPath,
  ObjectMapper objectMapper,
  YAMLFactory yamlFactory
) {
  this.delegate = delegate;
  this.defaultConfigurationPath = defaultConfigurationPath;
  this.objectMapper = objectMapper;
  this.yamlFactory = yamlFactory;
}
 
示例3
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);
}
 
示例4
@Override
public VerifyServiceProviderConfiguration build(ConfigurationSourceProvider provider, String path) throws IOException {
    return createComplianceToolModeConfiguration();
}
 
示例5
public MergingConfigProvider(ConfigurationSourceProvider delegate, String defaultConfigPath, ObjectMapper objectMapper, YAMLFactory yamlFactory) {
  this.delegate = delegate;
  this.defaultConfigPath = defaultConfigPath;
  this.objectMapper = objectMapper;
  this.yamlFactory = yamlFactory;
}