当前位置: 首页>>代码示例>>Java>>正文


Java ConfigFactory.parseResources方法代码示例

本文整理汇总了Java中com.typesafe.config.ConfigFactory.parseResources方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory.parseResources方法的具体用法?Java ConfigFactory.parseResources怎么用?Java ConfigFactory.parseResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.typesafe.config.ConfigFactory的用法示例。


在下文中一共展示了ConfigFactory.parseResources方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    String dbCredsFile = System.getProperty("dbCredsFile");
    if (StringUtils.isEmpty(dbCredsFile)) {
        dbCredsFile = "postgresql-creds.properties";
    }

    return new ParamReader(
            ConfigFactory.parseResources(dbCredsFile),
            "postgresql",
            ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "POSTGRESQL",
                    "logicalSchemas.schema1", "schema1",
                    "logicalSchemas.schema2", "schema2"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:17,代码来源:PostgreSqlParamReader.java

示例2: XConfig

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
/**
 * Construct a config object using the provided configuration, falling back on the default
 * configuration values <a
 * href="https://github.com/Nordstrom/xrpc/blob/master/src/main/resources/com/nordstrom/xrpc/xrpc.conf">here</a>.
 */
public XConfig(Config configOverrides) {
  Config defaultConfig = ConfigFactory.parseResources(this.getClass(), "xrpc.conf");
  Config config = configOverrides.withFallback(defaultConfig);

  readerIdleTimeout = config.getInt("reader_idle_timeout_seconds");
  writerIdleTimeout = config.getInt("writer_idle_timeout_seconds");
  allIdleTimeout = config.getInt("all_idle_timeout_seconds");
  workerNameFormat = config.getString("worker_name_format");
  bossThreadCount = config.getInt("boss_thread_count");
  workerThreadCount = config.getInt("worker_thread_count");
  maxConnections = config.getInt("max_connections");
  rateLimiterPoolSize = config.getInt("rate_limiter_pool_size");
  softReqPerSec = config.getDouble("soft_req_per_sec");
  hardReqPerSec = config.getDouble("hard_req_per_sec");
  gloablSoftReqPerSec = config.getDouble("global_soft_req_per_sec");
  globalHardReqPerSec = config.getDouble("global_hard_req_per_sec");
  cert = config.getString("cert");
  key = config.getString("key");
  port = config.getInt("server.port");
  slf4jReporter = config.getBoolean("slf4j_reporter");
  jmxReporter = config.getBoolean("jmx_reporter");
  consoleReporter = config.getBoolean("console_reporter");
  slf4jReporterPollingRate = config.getInt("slf4j_reporter_polling_rate");
  consoleReporterPollingRate = config.getInt("console_reporter_polling_rate");

  enableWhiteList = config.getBoolean("enable_white_list");
  enableBlackList = config.getBoolean("enable_black_list");

  ipBlackList =
      ImmutableSet.<String>builder().addAll(config.getStringList("ip_black_list")).build();
  ipWhiteList =
      ImmutableSet.<String>builder().addAll(config.getStringList("ip_white_list")).build();

  populateClientOverrideList(config.getObjectList("req_per_second_override"));
}
 
开发者ID:Nordstrom,项目名称:xrpc,代码行数:41,代码来源:XConfig.java

示例3: buildConfigIfAbsent

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
private Config buildConfigIfAbsent(Config currentConfig) {
    if (currentConfig != null) return currentConfig;

    if (getClass().getClassLoader().getResource(resourcePath) != null) {
        return ConfigFactory.parseResources(resourcePath);
    }

    logger.debug("Missing configuration resource at path: {}, ignore flag set to: {}", resourcePath, ignoreMissingResource);

    if (ignoreMissingResource) {
        return ConfigFactory.empty();
    }

    throw new IllegalStateException("Missing required configuration resource at path: " + resourcePath);
}
 
开发者ID:conf4j,项目名称:conf4j,代码行数:16,代码来源:ClasspathConfigurationSource.java

示例4: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    String dbCredsFile = System.getProperty("dbCredsFile");
    if (StringUtils.isEmpty(dbCredsFile)) {
        dbCredsFile = "mssql-creds.properties";
    }

    return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
            "mssql", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "MSSQL",
                    "logicalSchemas.schema1", "oats"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:14,代码来源:MsSqlParamReader.java

示例5: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    return new ParamReader(ConfigFactory.parseResources("db2-creds.properties"), "db2", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
            "sysattrs.type", "DB2",
            "sysattrs.autoReorgEnabled", "true",
            "sysattrs.metadataLineReaderVersion", "3",
            "logicalSchemas.schema1", "DEPLOY_TRACKER"
    )));
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:9,代码来源:Db2ParamReader.java

示例6: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    String dbCredsFile = System.getProperty("dbCredsFile");
    if (StringUtils.isEmpty(dbCredsFile)) {
        dbCredsFile = "oracle-creds.properties";
    }

    return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
            "oracle", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "ORACLE",
                    "logicalSchemas.schema1", "schema1",
                    "logicalSchemas.schema2", "schema2"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:15,代码来源:OracleParamReader.java

示例7: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    String dbCredsFile = System.getProperty("dbCredsFile");
    if (StringUtils.isEmpty(dbCredsFile)) {
        dbCredsFile = "sybasease-creds.properties";
    }

    return new ParamReader(ConfigFactory.parseResources(dbCredsFile),
            "sybasease", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "SYBASE_ASE",
                    "logicalSchemas.schema1", "oats"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:14,代码来源:AseParamReader.java

示例8: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    return new ParamReader(ConfigFactory.parseResources("h2-creds.properties"),
            "h2", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "H2",
                    "logicalSchemas.schema1", "SCHEMA1",
                    "logicalSchemas.schema2", "SCHEMA2"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:10,代码来源:H2ParamReader.java

示例9: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    return new ParamReader(ConfigFactory.parseResources("sybaseiq-creds.properties"),
            "sybaseiq", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "SYBASE_IQ",
                    "logicalSchemas.schema1", "deploytest01"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:9,代码来源:SybaseIqParamReader.java

示例10: getParamReader

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static ParamReader getParamReader() {
    return new ParamReader(ConfigFactory.parseResources("hsql-creds.properties"),
            "hsql", ConfigFactory.parseMap(Maps.mutable.<String, Object>of(
                    "sysattrs.type", "HSQL",
                    "logicalSchemas.schema1", "SCHEMA1",
                    "logicalSchemas.schema2", "SCHEMA2"
            ))
    );
}
 
开发者ID:goldmansachs,项目名称:obevo,代码行数:10,代码来源:HsqlParamReader.java

示例11: SystemProperties

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public SystemProperties(String configResource) {
    this(ConfigFactory.parseResources(configResource));
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:4,代码来源:SystemProperties.java

示例12: main

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String[] args) {
    // {{start:resource}}
    Config defaultConfig = ConfigFactory.parseResources("defaults.conf");
    // {{end:resource}}

    // {{start:fallback}}
    Config fallbackConfig = ConfigFactory.parseResources("overrides.conf")
                                         .withFallback(defaultConfig)
                                         .resolve();
    // {{end:fallback}}

    // {{start:text}}
    log.info("name: {}", defaultConfig.getString("conf.name"));
    log.info("name: {}", fallbackConfig.getString("conf.name"));
    log.info("title: {}", defaultConfig.getString("conf.title"));
    log.info("title: {}", fallbackConfig.getString("conf.title"));
    // {{end:text}}

    // {{start:resolved}}
    log.info("combined: {}", fallbackConfig.getString("conf.combined"));
    // {{end:resolved}}

    // {{start:durations}}
    log.info("redis.ttl minutes: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.MINUTES));
    log.info("redis.ttl seconds: {}", fallbackConfig.getDuration("redis.ttl", TimeUnit.SECONDS));
    // {{end:durations}}

    // {{start:memorySize}}
    // Any path in the configuration can be treated as a separate Config object.
    Config uploadService = fallbackConfig.getConfig("uploadService");
    log.info("maxChunkSize bytes: {}", uploadService.getMemorySize("maxChunkSize").toBytes());
    log.info("maxFileSize bytes: {}", uploadService.getMemorySize("maxFileSize").toBytes());
    // {{end:memorySize}}

    // {{start:whitelist}}
    List<Integer> whiteList = fallbackConfig.getIntList("conf.nested.whitelistIds");
    log.info("whitelist: {}", whiteList);
    List<String> whiteListStrings = fallbackConfig.getStringList("conf.nested.whitelistIds");
    log.info("whitelist as Strings: {}", whiteListStrings);
    // {{end:whitelist}}


    // {{start:booleans}}
    log.info("yes: {}", fallbackConfig.getBoolean("featureFlags.featureA"));
    log.info("true: {}", fallbackConfig.getBoolean("featureFlags.featureB"));
    // {{end:booleans}}
}
 
开发者ID:StubbornJava,项目名称:StubbornJava,代码行数:48,代码来源:TypesafeConfigExamples.java

示例13: read

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config read() {
    return ConfigFactory.parseResources("application.conf");

}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:6,代码来源:RemoteRpcProviderConfigTest.java


注:本文中的com.typesafe.config.ConfigFactory.parseResources方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。