Java 类com.typesafe.config.ConfigParseOptions 实例源码

项目:streams-examples    文件:TwitterUserstreamElasticsearchIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/TwitterUserstreamElasticsearchIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(TwitterUserstreamElasticsearchConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  if(indicesExistsResponse.isExists()) {
    DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
    DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
    assertTrue(deleteIndexResponse.isAcknowledged());
  };

}
项目:streams-examples    文件:MongoElasticsearchSyncIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/MongoElasticsearchSyncIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertFalse(indicesExistsResponse.isExists());
}
项目:streams-examples    文件:HdfsElasticsearchIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/HdfsElasticsearchIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(HdfsElasticsearchConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  if(indicesExistsResponse.isExists()) {
    DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getDestination().getIndex());
    DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
    assertTrue(deleteIndexResponse.isAcknowledged());
  };
}
项目:streams-examples    文件:TwitterFollowNeo4jIT.java   
@BeforeClass
public void prepareTest() throws IOException {

  Config reference  = ConfigFactory.load();
  File conf = new File("target/test-classes/TwitterFollowNeo4jIT.conf");
  assertTrue(conf.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(TwitterFollowNeo4jConfiguration.class).detectConfiguration(typesafe);
  testClient = Neo4jBoltClient.getInstance(testConfiguration.getNeo4j());

  Session session = testClient.client().session();
  Transaction transaction = session.beginTransaction();
  transaction.run("MATCH ()-[r]-() DELETE r");
  transaction.run("MATCH (n) DETACH DELETE n");
  transaction.success();
  session.close();
}
项目:streams-examples    文件:TwitterHistoryElasticsearchIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/TwitterHistoryElasticsearchIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(TwitterHistoryElasticsearchConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  if(indicesExistsResponse.isExists()) {
    DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
    DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
    assertTrue(deleteIndexResponse.isAcknowledged());
  };
}
项目:oap    文件:HoconFactoryWithFallback.java   
@Override
   protected HoconTreeTraversingParser _createParser( Reader r, IOContext ctxt ) throws IOException {
      ConfigParseOptions options = ConfigParseOptions.defaults();
      Config config = ConfigFactory.parseReader( r, options );

      final Config unresolvedConfig = additinal
         .withFallback( config )
         .withFallback( ConfigFactory.systemProperties() );

//        log.trace( unresolvedConfig.root().render() );

      try {
         Config resolvedConfig = unresolvedConfig.resolve();
         return new HoconTreeTraversingParser( resolvedConfig.root(), _objectCodec );
      } catch( ConfigException e ) {
         log.error( unresolvedConfig.root().render() );
         throw e;
      }
   }
项目:swift-k    文件:SwiftConfig.java   
private static Config loadFromSearchPath(List<String> configSearchPath, String cmdLineConfig,
        ConfigParseOptions opt, List<String> loadedFiles, List<String> loadedFileIndices) {
    Config conf = null;

    int index = 1;
    for (String c : configSearchPath) {
        conf = loadOne(c, conf, opt);
        loadedFiles.add(c);
        loadedFileIndices.add(String.valueOf(index++));
    }

    if (cmdLineConfig != null) {
        conf = loadOne(cmdLineConfig, conf, opt);
        loadedFiles.add(cmdLineConfig);
        loadedFileIndices.add("R");
    }

    return conf;
}
项目:typesafeconfig-extensions    文件:JndiConfigSourceImpl.java   
@Override
public Config apply(Bindings bindings) {

    checkNotNull(bindings);

    JndiContext context = jndiContext();

    Binding<ConfigParseOptions> parseOptionsBinding =
        bindings.get(ConfigParseOptions.class);

    if (parseOptionsBinding.isPresent()) {
        context = context
            .withParseOptions(parseOptionsBinding.get());
    }

    return context.toConfig();
}
项目:director-azure-plugin    文件:AzurePluginConfigHelper.java   
/**
 * Helper to parse the specified configuration file from the classpath.
 *
 * @param configPath the path to the configuration file
 * @return the parsed configuration
 */
public static Config parseConfigFromClasspath(String configPath) throws IOException {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);
  return ConfigFactory.parseResourcesAnySyntax(AzureLauncher.class, configPath, options);
}
项目:director-azure-plugin    文件:AzurePluginConfigHelper.java   
/**
 * Helper to parse the specified configuration file.
 *
 * @param configFile the configuration file
 * @return the parsed configuration
 */
static Config parseConfigFromFile(File configFile) throws IOException {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);
  return ConfigFactory.parseFileAnySyntax(configFile, options);
}
项目:director-aws-plugin    文件:AWSLauncher.java   
/**
 * Parses the specified configuration file.
 *
 * @param configFile the configuration file
 * @return the parsed configuration
 */
private static Config parseConfigFile(File configFile) {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);

  return ConfigFactory.parseFileAnySyntax(configFile, options);
}
项目:gconf    文件:ConfigFactory.java   
public Config parseResources(String resourceBasename, ConfigParseOptions options) {
    if (isNull(this.from)) {
        return parseResourcesAnySyntax(resourceBasename, options);
    }
    return parseFileAnySyntax(new File(from.getAbsolutePath() + separator + resourceBasename), options);

}
项目:gconf    文件:InjectorBuilder.java   
private Config getConfig(ConfigFactory configFactory, ConfigParseOptions parseOptions, BindConfig bindConfig) {
    Config config = configFactory.parseResources(bindConfig.value(), parseOptions);
    if (!bindConfig.path().isEmpty()) {
        config = config.getConfig(bindConfig.path());
    }
    if (bindConfig.resolve()) {
        config = config.resolve();
    }
    return config;
}
项目:gconf    文件:InjectorBuilderTest.java   
@Before
public void initializeMock() {
    when(configFactory.parseResources(arg.capture(), any(ConfigParseOptions.class)))
            .thenReturn(config);
    virtualBeanFactory = new VirtualBeanFactory(beanValidator);
    injectorBuilder = new InjectorBuilder(configFactory, virtualBeanFactory);
}
项目:gconf    文件:ConfigurationListenerTest.java   
@Before
public void initializeMock() {
    virtualBeanFactory = new VirtualBeanFactory(beanValidator);
    injectorBuilder = new InjectorBuilder(configFactory, virtualBeanFactory);
    when(configFactory.parseResources(anyString(), any(ConfigParseOptions.class)))
            .thenReturn(config);
}
项目:streams-examples    文件:ElasticsearchReindexParentIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/ElasticsearchReindexParentIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertTrue(indicesExistsResponse.isExists());

  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getSource().getIndexes().get(0))
      .setTypes(testConfiguration.getSource().getTypes().get(0));
  SearchResponse countResponse = countRequest.execute().actionGet();

  count = (int)countResponse.getHits().getTotalHits();

  PutIndexTemplateRequestBuilder putTemplateRequestBuilder = testClient.admin().indices().preparePutTemplate("mappings");
  URL templateURL = ElasticsearchParentChildWriterIT.class.getResource("/ActivityChildObjectParent.json");
  ObjectNode template = MAPPER.readValue(templateURL, ObjectNode.class);
  String templateSource = MAPPER.writeValueAsString(template);
  putTemplateRequestBuilder.setSource(templateSource);

  testClient.admin().indices().putTemplate(putTemplateRequestBuilder.request()).actionGet();

  assertThat(count, not(0));

}
项目:streams-examples    文件:ElasticsearchReindexIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/ElasticsearchReindexIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertThat(indicesExistsResponse.isExists(), is(true));

  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getSource().getIndexes().get(0))
      .setTypes(testConfiguration.getSource().getTypes().get(0));
  SearchResponse countResponse = countRequest.execute().actionGet();

  count = (int)countResponse.getHits().getTotalHits();

  assertThat(count, not(0));

}
项目:streams-examples    文件:ElasticsearchReindexChildIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/ElasticsearchReindexChildIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertThat(indicesExistsResponse.isExists(), is(true));

  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getSource().getIndexes().get(0))
      .setTypes(testConfiguration.getSource().getTypes().get(0));
  SearchResponse countResponse = countRequest.execute().actionGet();

  count = (int)countResponse.getHits().getTotalHits();

  assertNotEquals(count, 0);

}
项目:streams-examples    文件:ElasticsearchHdfsIT.java   
@BeforeClass
public void prepareTest() throws Exception {

  Config reference  = ConfigFactory.load();
  File conf_file = new File("target/test-classes/ElasticsearchHdfsIT.conf");
  assert(conf_file.exists());
  Config testResourceConfig  = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
  Config typesafe  = testResourceConfig.withFallback(reference).resolve();
  testConfiguration = new ComponentConfigurator<>(ElasticsearchHdfsConfiguration.class).detectConfiguration(typesafe);
  testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();

  ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
  ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
  assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);

  IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
  IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
  assertThat(indicesExistsResponse.isExists(), is(true));

  SearchRequestBuilder countRequest = testClient
      .prepareSearch(testConfiguration.getSource().getIndexes().get(0))
      .setTypes(testConfiguration.getSource().getTypes().get(0));
  SearchResponse countResponse = countRequest.execute().actionGet();

  count = (int)countResponse.getHits().getTotalHits();

  assertNotEquals(count, 0);
}
项目:director-spi-tck    文件:Runner.java   
private static Config parseConfigFile(File configFile) {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);

  return ConfigFactory.parseFileAnySyntax(configFile, options);
}
项目:director-google-plugin    文件:GoogleLauncher.java   
/**
 * Parses the specified configuration file from the classpath.
 *
 * @param configPath the path to the configuration file
 * @return the parsed configuration
 */
private static Config parseConfigFromClasspath(String configPath) {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);

  return ConfigFactory.parseResourcesAnySyntax(GoogleLauncher.class, configPath, options);
}
项目:director-google-plugin    文件:GoogleLauncher.java   
/**
 * Parses the specified configuration file.
 *
 * @param configFile the configuration file
 * @return the parsed configuration
 */
private static Config parseConfigFromFile(File configFile) {
  ConfigParseOptions options = ConfigParseOptions.defaults()
      .setSyntax(ConfigSyntax.CONF)
      .setAllowMissing(false);

  return ConfigFactory.parseFileAnySyntax(configFile, options);
}
项目:oap    文件:HoconFactoryWithSystemProperties.java   
@Override
    protected HoconTreeTraversingParser _createParser( Reader r, IOContext ctxt ) throws IOException {
        final ConfigParseOptions options = ConfigParseOptions.defaults();
        final Config config = ConfigFactory.parseReader( r, options );

        final Config unresolvedConfig = config.withFallback( ConfigFactory.systemProperties() );
//        log.trace( unresolvedConfig.root().render() );
        try {
            final Config resolvedConfig = unresolvedConfig.resolve();
            return new HoconTreeTraversingParser( resolvedConfig.root(), _objectCodec );
        } catch( ConfigException e ) {
            log.error( unresolvedConfig.root().render() );
            throw e;
        }
    }
项目:swift-k    文件:SwiftConfig.java   
public static SwiftConfig load(String cmdLineConfig, List<String> configSearchPath, Map<String, Object> cmdLineOptions) {
    List<String> loadedFiles = new ArrayList<String>();
    List<String> loadedFileIndices = new ArrayList<String>();

    ConfigParseOptions opt = ConfigParseOptions.defaults();
    opt = opt.setIncluder(new IncluderWrapper(opt.getIncluder(), loadedFiles, loadedFileIndices)).
        setSyntax(ConfigSyntax.CONF).setAllowMissing(false);

    Config conf;

    if (configSearchPath == null) {
        String envSearchPath = System.getenv("SWIFT_CONF_PATH");
        if (envSearchPath != null) {
            configSearchPath = splitConfigSearchPath(envSearchPath);
        }
    }
    if (configSearchPath == null) {
        conf = loadNormal(cmdLineConfig, opt, loadedFiles, loadedFileIndices);
    }
    else {
        conf = loadFromSearchPath(configSearchPath, cmdLineConfig, opt, 
            loadedFiles, loadedFileIndices);
    }

    if (cmdLineOptions != null) {
        Config oconf = ConfigFactory.parseMap(cmdLineOptions, "<Command Line>");
        conf = oconf.withFallback(conf);
        loadedFiles.add("<Command Line>");
        loadedFileIndices.add("C");
    }

    conf = conf.resolveWith(getSubstitutions());
    ConfigTree<ValueLocationPair> out = SCHEMA.validate(conf);
    SwiftConfig sc = new SwiftConfig(loadedFiles, loadedFileIndices);
    sc.build(out);
    return sc;
}
项目:swift-k    文件:SwiftConfig.java   
private static Config loadNormal(String cmdLineConfig, ConfigParseOptions opt, 
        List<String> loadedFiles, List<String> loadedFileIndices) {
    Config conf;

    conf = loadOne(DIST_CONF, null, opt);
    loadedFiles.add(DIST_CONF);
    loadedFileIndices.add("D");

    if (SITE_CONF != null) {
        conf = loadOne(SITE_CONF, conf, opt);
        loadedFiles.add(SITE_CONF);
        loadedFileIndices.add("S");
    }

    if (USER_CONF != null) {
        conf = loadOne(USER_CONF, conf, opt);
        loadedFiles.add(USER_CONF);
        loadedFileIndices.add("U");
    }

    if (cmdLineConfig == null) {
        File runConf = new File("swift.conf");
        if (runConf.exists()) {
            conf = loadOne(runConf.getPath(), conf, opt);
            loadedFiles.add(runConf.getPath());
            loadedFileIndices.add("R");
        }
    }

    if (cmdLineConfig != null) {
        conf = loadOne(cmdLineConfig, conf, opt);
        loadedFiles.add(cmdLineConfig);
        loadedFileIndices.add("R");
    }

    return conf;
}
项目:swift-k    文件:SwiftConfig.java   
private static Config loadOne(String fileName, Config conf, ConfigParseOptions opt) {
    File f = new File(fileName);
    Config nconf = ConfigFactory.parseFile(f, opt);
    if (conf == null) {
        return nconf;
    }
    else {
        return nconf.withFallback(conf);
    }
}
项目:incubator-gobblin    文件:PullFileLoader.java   
private Config loadHoconConfigAtPath(Path path) throws IOException {
  try (InputStream is = fs.open(path);
      Reader reader = new InputStreamReader(is, Charsets.UTF_8)) {
      return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY,
          PathUtils.getPathWithoutSchemeAndAuthority(path).toString()))
          .withFallback(ConfigFactory.parseReader(reader, ConfigParseOptions.defaults().setSyntax(ConfigSyntax.CONF)));
  }
}
项目:incubator-gobblin    文件:PullFileLoader.java   
private Config loadHoconConfigWithFallback(Path path, Config fallback) throws IOException {
  try (InputStream is = fs.open(path);
       Reader reader = new InputStreamReader(is, Charsets.UTF_8)) {
    return ConfigFactory.parseMap(ImmutableMap.of(ConfigurationKeys.JOB_CONFIG_FILE_PATH_KEY,
        PathUtils.getPathWithoutSchemeAndAuthority(path).toString()))
        .withFallback(ConfigFactory.parseReader(reader, ConfigParseOptions.defaults().setSyntax(ConfigSyntax.CONF)))
        .withFallback(fallback);
  }
}
项目:typesafeconfig-extensions    文件:NoContext.java   
NoContext(
    OptionalJndiOriginDescription originDescription,
    ConfigParseOptions parseOptions
) {
    this.originDescription = checkNotNull(originDescription);
    this.parseOptions = checkNotNull(parseOptions);
}
项目:typesafeconfig-extensions    文件:NoContext.java   
@Override
public JndiContext withParseOptions(ConfigParseOptions parseOptions) {

    return new NoContext(
        originDescription,
        checkNotNull(parseOptions)
    );
}
项目:typesafeconfig-extensions    文件:ContextWrapper.java   
ContextWrapper(javax.naming.Context jndiContext) {

        this(
            checkNotNull(jndiContext),
            noOriginDescription(),
            ConfigParseOptions.defaults()
        );
    }
项目:typesafeconfig-extensions    文件:ContextWrapper.java   
ContextWrapper(
    javax.naming.Context jndiContext,
    OptionalJndiOriginDescription originDescription,
    ConfigParseOptions parseOptions
) {
    this.jndiContext = checkNotNull(jndiContext);
    this.originDescription = checkNotNull(originDescription);
    this.parseOptions = checkNotNull(parseOptions);
}
项目:typesafeconfig-extensions    文件:ContextWrapper.java   
@Override
public JndiContext withParseOptions(ConfigParseOptions parseOptions) {

    return new ContextWrapper(
        jndiContext,
        originDescription,
        checkNotNull(parseOptions)
    );
}
项目:typesafeconfig-extensions    文件:ContextWrapper.java   
ConfigParseOptions getParseOptions() {

        if (originDescription.isPresent()) {
            return parseOptions.setOriginDescription(originDescription.get());
        } else {
            return parseOptions;
        }
    }
项目:typesafeconfig-extensions    文件:JndiContexts.java   
public static JndiContext noContext() {

        return new NoContext(
            noOriginDescription(),
            ConfigParseOptions.defaults()
        );
    }
项目:typesafeconfig-extensions    文件:ClasspathResourceConfigSource.java   
@Override
public Config load(Bindings bindings) {

    checkNotNull(bindings);

    Binding<ClassLoader> loader = bindings.get(ClassLoader.class);

    Binding<ConfigParseOptions> parseOptions =
        bindings.get(ConfigParseOptions.class);

    if (loader.isPresent() && parseOptions.isPresent()) {

        return parseResourcesAnySyntax(
            loader.get(),
            resourceBasename,
            parseOptions.get()
        );
    }

    if (loader.isPresent()) {

        return parseResourcesAnySyntax(
            loader.get(),
            resourceBasename
        );
    }

    if (parseOptions.isPresent()) {

        return parseResourcesAnySyntax(
            resourceBasename,
            parseOptions.get()
        );
    }

    return parseResourcesAnySyntax(resourceBasename);
}
项目:typesafeconfig-extensions    文件:FileConfigSource.java   
private ConfigParseOptions configParseOptions(Bindings bindings) {

        Binding<ConfigParseOptions> configParseOptionsBinding =
            bindings.get(ConfigParseOptions.class);

        if (configParseOptionsBinding.isPresent()) {
            return configParseOptionsBinding.get();
        } else {
            return ConfigParseOptions.defaults();
        }
    }
项目:typesafeconfig-extensions    文件:StringConfigSource.java   
@Override
public Config load(Bindings bindings) {

    checkNotNull(bindings);

    Binding<ConfigParseOptions> parseOptions =
        bindings.get(ConfigParseOptions.class);

    if (parseOptions.isPresent()) {
        return parseString(configString, parseOptions.get());
    }

    return parseString(configString);
}
项目:dtmlibs    文件:HoconDataSource.java   
@NotNull
public ConfigParseOptions getParseOptions() {
    return builder.getParseOptions();
}
项目:dtmlibs    文件:HoconDataSource.java   
@NotNull
public Builder setParseOptions(@NotNull ConfigParseOptions options) {
    builder.setParseOptions(options);
    return this;
}