當前位置: 首頁>>代碼示例>>Java>>正文


Java Config.hasPath方法代碼示例

本文整理匯總了Java中com.typesafe.config.Config.hasPath方法的典型用法代碼示例。如果您正苦於以下問題:Java Config.hasPath方法的具體用法?Java Config.hasPath怎麽用?Java Config.hasPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.typesafe.config.Config的用法示例。


在下文中一共展示了Config.hasPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: TestActorWriter

import com.typesafe.config.Config; //導入方法依賴的package包/類
public TestActorWriter(final ActorKey actorKey, final Sender sender, final Config config) {
    super(actorKey, sender, config);

    if (config.hasPath(INIT_FILE_CONFIG)) {
        String initFileName = getConfig().getString(INIT_FILE_CONFIG);
        try {
            log.info("{} writing RDV file {} ms", this, initFileName);
            writeFile(initFileName, OK);
        } catch (IrrecoverableException e) {
            log.info("{} Error while init", this, e);
            Throwables.propagate(e);
        }
    }

    if (config.hasPath(SUICIDE_AFTER_MS)) {
        long sleepTime = getConfig().getLong(SUICIDE_AFTER_MS);
        sleepUninterruptibly(sleepTime, TimeUnit.MILLISECONDS);
        log.info("{} committing suicide after {} ms", this, sleepTime);
        System.exit(0);
    }
}
 
開發者ID:florentw,項目名稱:bench,代碼行數:22,代碼來源:TestActorWriter.java

示例2: getSourceEncodings

import com.typesafe.config.Config; //導入方法依賴的package包/類
private ImmutableMap<String, String> getSourceEncodings(Config metadataConfig) {
    if (metadataConfig.hasPath("sourceEncodings")) {
        Config sourceEncodings = metadataConfig.getConfig("sourceEncodings");

        MutableMap<String, String> encodingsMap = Maps.mutable.empty();
        for (String encoding : sourceEncodings.root().keySet()) {
            String fileList = sourceEncodings.getString(encoding);
            for (String file : fileList.split(",")) {
                encodingsMap.put(file, encoding);
            }
        }

        return encodingsMap.toImmutable();
    }
    return Maps.immutable.empty();
}
 
開發者ID:goldmansachs,項目名稱:obevo,代碼行數:17,代碼來源:PackageMetadataReader.java

示例3: GrapheneRESTServer

import com.typesafe.config.Config; //導入方法依賴的package包/類
GrapheneRESTServer() {

		Config config = ConfigFactory.load()
			.withFallback(ConfigFactory.load("reference"))
			.withFallback(ConfigFactory.load("application"));

		log.debug("initializing Graphene");
		Graphene graphene = new Graphene(config);
		log.debug("Graphene initialized");

		ResourceConfig rc = generateResourceConfig(config, graphene);

		String uri = "http://" + config.getString("graphene.server.host-name");
		uri += config.hasPath("graphene.server.port") ? ":" + config.getInt("graphene.server.port") : "";
		uri += "/";
		uri += config.hasPath("graphene.server.path") ? config.getString("graphene.server.path") : "";

		log.info("Server will run at: '{}'", uri);

		server = JettyHttpContainerFactory.createServer(
				URI.create(uri),
				rc,
				false);

		log.info("Server successfully initialized, waiting for start.");
	}
 
開發者ID:Lambda-3,項目名稱:Graphene,代碼行數:27,代碼來源:GrapheneRESTServer.java

示例4: WindowsEventlogInputConfiguration

import com.typesafe.config.Config; //導入方法依賴的package包/類
@Inject
public WindowsEventlogInputConfiguration(@Assisted String id,
                                         @Assisted Config config,
                                         WindowsEventlogInput.Factory inputFactory) {
    super(id, config);
    this.inputFactory = inputFactory;

    if (config.hasPath("source-name")) {
        this.sourceName = config.getString("source-name");
    } else {
        this.sourceName = "Application";
    }

    if (config.hasPath("poll-interval")) {
        this.pollInterval = config.getDuration("poll-interval", TimeUnit.MILLISECONDS);
    } else {
        this.pollInterval = 1000L;
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:20,代碼來源:WindowsEventlogInputConfiguration.java

示例5: readMainNamespaces

import com.typesafe.config.Config; //導入方法依賴的package包/類
private void readMainNamespaces(Stargraph core, String dbId) {
    mainNamespaces = new LinkedHashSet<>();
    Config kbConfig = core.getKBConfig(dbId);
    if (kbConfig.hasPath("namespaces")) {
        Config nsConfig = core.getKBConfig(dbId).getConfig("namespaces");
        mainNamespaces.addAll(nsConfig.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList()));
        logger.info(marker, "Main Namespaces: {}", mainNamespaces);
    }
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:10,代碼來源:Namespace.java

示例6: prepareCreate

import com.typesafe.config.Config; //導入方法依賴的package包/類
CreateIndexRequestBuilder prepareCreate() {
    logger.info(marker, "Creating {}", kbId);
    Config mappingCfg = getTypeCfg().getConfig("elastic.mapping");
    // Search for matching mapping definition, fallback to the dynamic _default_.
    String targetType = mappingCfg.hasPath(kbId.getType()) ? kbId.getType() : "_default_";
    Config mapping = mappingCfg.withOnlyPath(targetType);
    CreateIndexRequestBuilder builder = client.admin().indices().prepareCreate(getIndexName());
    return builder.addMapping(targetType, mapping.root().unwrapped());
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:10,代碼來源:ElasticClient.java

示例7: getHDTPath

import com.typesafe.config.Config; //導入方法依賴的package包/類
private Path getHDTPath(String dbId) throws IOException {

        Config mainConfig = core.getConfig();
        String dataDir = mainConfig.getString("data.root-dir");
        Path defaultPath = Paths.get(dataDir, dbId, "facts", "triples.hdt");

        final String cfgPath = "triple-store.hdt.file";
        Config cfg = core.getKBConfig(dbId);

        if (cfg.hasPath(cfgPath)) {
            String hdtFileName = cfg.getString(cfgPath);

            if (hdtFileName == null || hdtFileName.isEmpty()) {
                throw new StarGraphException("Invalid configuration at '" + cfgPath + "'");
            }

            if (hdtFileName.startsWith("http://") && defaultPath.toFile().exists()) {
                return defaultPath;
            }

            // It's an absolute path to file
            if (Paths.get(hdtFileName).isAbsolute()) {
                return Paths.get(hdtFileName);
            }

            // It's relative to the 'facts' dir
            if (!hdtFileName.startsWith("http://")) {
                return Paths.get(dataDir, dbId, "facts", hdtFileName);
            }

            // copy remote to default file location
            download(hdtFileName, defaultPath.toFile());
            return defaultPath;
        }
        else {
            // default attempt when not explicit configured
            return defaultPath;
        }
    }
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:40,代碼來源:HDTModelFactory.java

示例8: heartbeatInterval

import com.typesafe.config.Config; //導入方法依賴的package包/類
private int heartbeatInterval(Config config) {
    if (config.hasPath(heartbeatIntervalParameter)) {
        return config.getInt(heartbeatIntervalParameter);
    } else {
        return defaultHeartbeatInterval;
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:8,代碼來源:HeartbeatService.java

示例9: MetricServiceConfiguration

import com.typesafe.config.Config; //導入方法依賴的package包/類
@Inject
public MetricServiceConfiguration(Config config) {
    if (config.hasPath("metrics")) {
        final Config metrics = config.getConfig("metrics");

        this.enableLog = metrics.hasPath("enable-logging") && metrics.getBoolean("enable-logging");

        if (metrics.hasPath("log-duration")) {
            this.reportDuration = new Duration(metrics.getDuration("log-duration", TimeUnit.MILLISECONDS));
        }
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:13,代碼來源:MetricServiceConfiguration.java

示例10: OutputConfiguration

import com.typesafe.config.Config; //導入方法依賴的package包/類
public OutputConfiguration(String id, Config config) {
    this.id = id;

    if (config.hasPath("inputs")) {
        this.inputs = Sets.newHashSet(Splitter.on(",").omitEmptyStrings().trimResults().split(config.getString("inputs")));
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:8,代碼來源:OutputConfiguration.java

示例11: getGameConfiguration

import com.typesafe.config.Config; //導入方法依賴的package包/類
Config getGameConfiguration() {

            Config referenceConfig = cfg();

            Config customConfig = ConfigFactory.parseMap(builderConfig).withFallback(referenceConfig);
            Map<String, Object> executableConfig = new HashMap<>();


            if (!customConfig.hasPath(GAME_EXE_PATH)) {
                executableConfig.put(GAME_EXE_PATH, findExecutablePath().toString());
            } else {
                executableConfig.put(GAME_EXE_PATH, customConfig.getString(GAME_EXE_PATH));
            }

            Path executablePath = Paths.get((String) executableConfig.get(GAME_EXE_PATH));
            String baseBuild = toNewestBaseBuild().apply(executablePath.resolve(VERSIONS_DIR));
            Path buildPath = executablePath.resolve(Paths.get(VERSIONS_DIR, baseBuild));
            String exeFile = toNewestExeFile().apply(buildPath);

            executableConfig.put(GAME_EXE_BUILD, baseBuild);
            executableConfig.put(GAME_EXE_FILE, exeFile);
            executableConfig.put(GAME_EXE_IS_64, exeFile.contains(X64_SUFFIX));

            if (!customConfig.hasPath(GAME_EXE_DATA_VER)) {
                Optional<GameVersion> gameVersion = Versions.versionFor(
                        Integer.parseInt(baseBuild.replaceFirst(BUILD_PREFIX, "")));
                gameVersion.ifPresent(ver -> executableConfig.put(GAME_EXE_DATA_VER, ver.getDataHash()));
            }

            Config gameConfig = ConfigFactory.parseMap(executableConfig).withFallback(customConfig);
            gameConfig.checkValid(referenceConfig);

            return gameConfig;
        }
 
開發者ID:ocraft,項目名稱:ocraft-s2client,代碼行數:35,代碼來源:S2Controller.java

示例12: MessageBufferConfiguration

import com.typesafe.config.Config; //導入方法依賴的package包/類
@Inject
public MessageBufferConfiguration(Config config) {
    if (config.hasPath("message-buffer-size")) {
        this.size = config.getInt("message-buffer-size");
    } else {
        this.size = SIZE;
    }
}
 
開發者ID:DevOpsStudio,項目名稱:Re-Collector,代碼行數:9,代碼來源:MessageBufferConfiguration.java

示例13: getRpcModules

import com.typesafe.config.Config; //導入方法依賴的package包/類
public List<ModuleDescription> getRpcModules() {
    if (this.moduleDescriptions != null) {
        return this.moduleDescriptions;
    }

    List<ModuleDescription> modules = new ArrayList<>();

    if (!configFromFiles.hasPath("rpc.modules")) {
        return modules;
    }

    List<? extends ConfigObject> list = configFromFiles.getObjectList("rpc.modules");

    for (ConfigObject configObject : list) {
        Config configElement = configObject.toConfig();
        String name = configElement.getString("name");
        String version = configElement.getString("version");
        boolean enabled = configElement.getBoolean("enabled");
        List<String> enabledMethods = null;
        List<String> disabledMethods = null;

        if (configElement.hasPath("methods.enabled")) {
            enabledMethods = configElement.getStringList("methods.enabled");
        }

        if (configElement.hasPath("methods.disabled")) {
            disabledMethods = configElement.getStringList("methods.disabled");
        }

        modules.add(new ModuleDescription(name, version, enabled, enabledMethods, disabledMethods));
    }

    this.moduleDescriptions = modules;

    return modules;
}
 
開發者ID:rsksmart,項目名稱:rskj,代碼行數:37,代碼來源:RskSystemProperties.java

示例14: BaseProcessor

import com.typesafe.config.Config; //導入方法依賴的package包/類
public BaseProcessor(Config config) {
    this.config = config;
    if (!config.hasPath(getName())) {
        throw new StarGraphException("Configuration name mismatch.");
    }
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:7,代碼來源:BaseProcessor.java

示例15: useIndex

import com.typesafe.config.Config; //導入方法依賴的package包/類
private boolean useIndex(String id) {
    Config tripleStoreCfg = core.getKBConfig(id).getConfig("triple-store");
    return tripleStoreCfg.hasPath("hdt.use-index") && tripleStoreCfg.getBoolean("hdt.use-index");
}
 
開發者ID:Lambda-3,項目名稱:Stargraph,代碼行數:5,代碼來源:HDTModelFactory.java


注:本文中的com.typesafe.config.Config.hasPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。