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


Java ConfigFactory.parseFile方法代码示例

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


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

示例1: buildConfigIfAbsent

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

    File configFile = new File(filePath);
    if (configFile.exists()) {
        return ConfigFactory.parseFile(configFile);
    }

    logger.debug("Missing configuration file at path: {}, ignore flag set to: {}", filePath, ignoreMissingFile);

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

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

示例2: main

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String []args) {
    Config config = ConfigFactory.parseFile(new File("config/model/fm.conf"));
    RandomParams randomParams = new RandomParams(config, "");
    RandomParamsUtils randomParamsUtils = new RandomParamsUtils(randomParams);

    System.out.println("normal sample:");
    for (int i = 0; i < 50; i++) {
        System.out.println(randomParamsUtils.next());
    }

    System.out.println("uniform sample:");
    for (int i = 0; i < 50000; i++) {
        double r = randomParamsUtils.next();
        if (r < -0.01 || r > 0.01) {
            System.out.println("error");
            break;
        }
    }
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:20,代码来源:RandomParamsUtils.java

示例3: parse

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static Config parse(File configFile) {
    Config config = null;

    if (configFile.exists() && configFile.canRead()) {
        config = ConfigFactory.parseFile(configFile);

        if (config.isEmpty()) {
            throw new Error("Empty configuration!");
        }
    } else {
        throw new Error("Configuration file " + configFile + " does not exist or is not readable!");
    }

    return config;
}
 
开发者ID:DevOpsStudio,项目名称:Re-Collector,代码行数:16,代码来源:ConfigurationParser.java

示例4: getTrainDataPath

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public String getTrainDataPath() {
    String configRealPath = (new File(configFile).exists()) ? configFile : configPath;
    File realFile = new File(configRealPath);
    CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath);
    Config config = ConfigFactory.parseFile(realFile);
    config = updateConfigWithCustom(config);
    return config.getString("data.train.data_path");
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:9,代码来源:TrainWorker.java

示例5: initActorSystem

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public void initActorSystem(File file, String akkaName, String configName) {
    logger.debug("init Actor System start: akkaName=" + akkaName + " configName:" + configName);
    Config cg = ConfigFactory.parseFile(file);

    cg.withFallback(ConfigFactory.defaultReference(Thread.currentThread().getContextClassLoader()));
    Config config = ConfigFactory.load(cg).getConfig(configName);
    system = ActorSystem.create(akkaName, config);
    inbox = Inbox.create(system);
    logger.debug("init Actor System end");
}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:11,代码来源:AkkaBootService.java

示例6: retrieveModuleConfigs

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Map<String, ModuleConfig.Builder> retrieveModuleConfigs(final Configuration configuration) {
    final File moduleShardsFile = new File(moduleShardsConfigPath);
    final File modulesFile = new File(modulesConfigPath);

    Config moduleShardsConfig = null;
    if (moduleShardsFile.exists()) {
        LOG.info("module shards config file exists - reading config from it");
        moduleShardsConfig = ConfigFactory.parseFile(moduleShardsFile);
    } else {
        LOG.warn("module shards configuration read from resource");
        moduleShardsConfig = ConfigFactory.load(moduleShardsConfigPath);
    }

    Config modulesConfig = null;
    if (modulesFile.exists()) {
        LOG.info("modules config file exists - reading config from it");
        modulesConfig = ConfigFactory.parseFile(modulesFile);
    } else {
        LOG.warn("modules configuration read from resource");
        modulesConfig = ConfigFactory.load(modulesConfigPath);
    }

    final Map<String, ModuleConfig.Builder> moduleConfigMap = readModuleShardsConfig(moduleShardsConfig);
    readModulesConfig(modulesConfig, moduleConfigMap, configuration);

    return moduleConfigMap;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:29,代码来源:FileModuleShardConfigProvider.java

示例7: read

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
@Override
public Config read() {
    File customConfigFile = new File(CUSTOM_AKKA_CONF_PATH);
    Preconditions.checkState(customConfigFile.exists(), "%s is missing", customConfigFile);

    File factoryConfigFile = new File(FACTORY_AKKA_CONF_PATH);
    if (factoryConfigFile.exists()) {
        return ConfigFactory.parseFile(customConfigFile).withFallback(ConfigFactory.parseFile(factoryConfigFile));
    }

    return ConfigFactory.parseFile(customConfigFile);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:13,代码来源:FileAkkaConfigurationReader.java

示例8: getURI

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public String getURI() {
    String configRealPath = (new File(configFile).exists()) ? configFile : configPath;
    File realFile = new File(configRealPath);
    CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath);
    Config config = ConfigFactory.parseFile(realFile);
    config = updateConfigWithCustom(config);
    return config.getString("fs_scheme");
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:9,代码来源:TrainWorker.java

示例9: OnlinePredictor

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public OnlinePredictor(String configPath) throws Exception {
    config = ConfigFactory.parseFile(new File(configPath));

    LOG.info("load config from file, config_path:" + configPath + ", existed:" + new File(configPath).exists());
    String uri = config.getString("fs_scheme");
    fs = FileSystemFactory.createFileSystem(new URI(uri));

}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:9,代码来源:OnlinePredictor.java

示例10: AgentConfig

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public AgentConfig(final File configFile) {
    requireNonNull(configFile);

    Config agentConfig = ConfigFactory.parseFile(configFile);
    clusterConfig = agentConfig.getConfig(AGENT_CLUSTER_TAG);
}
 
开发者ID:florentw,项目名称:bench,代码行数:7,代码来源:AgentConfig.java

示例11: SystemProperties

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

示例12: main

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String []args) {
    Config config = ConfigFactory.parseFile(new File("config/model/linear.conf"));
    System.out.println(CommonParams.loadParams(config));
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:5,代码来源:CommonParams.java

示例13: main

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String []args) {
    Config config = ConfigFactory.parseFile(new File("config/model/linear.conf"));
    LossParams params = new LossParams(config, "");
    System.out.println(params.toString());
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:6,代码来源:LossParams.java

示例14: main

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public static void main(String []args) {
    Config config = ConfigFactory.parseFile(new File("config/model/linear.conf"));
    TransformParams params = new TransformParams(config, "feature.");
    System.out.println(params.toString());
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:6,代码来源:TransformParams.java

示例15: AppConfig

import com.typesafe.config.ConfigFactory; //导入方法依赖的package包/类
public AppConfig(String path)
{
	File file = new File(path);
	_config = ConfigFactory.parseFile(file);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:6,代码来源:AppConfig.java


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