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


Java Configuration.getString方法代码示例

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


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

示例1: fetchDebeziumConfig

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
/**
 * Get DebeziumSource configuration.
 *
 * @param debeziumConf An empty {@code SourceConfig}
 * @throws BiremeException miss some required configuration
 */
protected void fetchDebeziumConfig(SourceConfig debeziumConf) throws BiremeException {
  Configuration subConfig = new SubsetConfiguration(config, debeziumConf.name, ".");

  String prefix = subConfig.getString("namespace");
  if (prefix == null) {
    String messages = "Please designate your namespace.";
    logger.fatal(messages);
    throw new BiremeException(messages);
  }

  debeziumConf.type = SourceType.DEBEZIUM;
  debeziumConf.server = subConfig.getString("kafka.server");
  debeziumConf.topic = prefix;
  debeziumConf.groupID = subConfig.getString("kafka.groupid", "bireme");

  if (debeziumConf.server == null) {
    String message = "Please designate server for " + debeziumConf.name + ".";
    logger.fatal(message);
    throw new BiremeException(message);
  }
}
 
开发者ID:HashDataInc,项目名称:bireme,代码行数:28,代码来源:Config.java

示例2: testGet

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
@Test
public void testGet() throws Exception {

    // Proxy (Invoke to initialize delegate)
    Configuration c = target.get();
    String version = c.getString(KEY);

    // Same proxy, same delegate.
    assertSame(target.get(), c);
    assertEquals(c.getString(KEY), version);

    // Same proxy, new delegate.
    target.clear();
    assertSame(target.get(), c);
    assertEquals(c.getString(KEY), version);

}
 
开发者ID:after-the-sunrise,项目名称:cryptotrader,代码行数:18,代码来源:ConfigurationProviderImplTest.java

示例3: getName

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
private static String getName(Configuration _config)
{
	String result = "";
	if (_config == null)
		return result;
	if (_config.getBoolean("wrapper.service", false))
		result += "Service ";
	String name = _config.getString("wrapper.console.title");
	if (name == null)
		name = _config.getString("wrapper.ntservice.name");
	if (name == null)
		name = _config.getString("wrapper.image");
	if (name == null)
		name = _config.getString("wrapper.groovy");
	if (name == null)
		name = _config.getString("wrapper.java.app.mainclass");
	if (name == null)
		name = _config.getString("wrapper.java.app.jar");
	if (name == null)
		name = "";
	result += name;
	return result;

}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:25,代码来源:TrayIconMain.java

示例4: connectionConfig

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
/**
 * Get the connection configuration to database.
 *
 * @param prefix "target" database
 * @throws BiremeException when url of database is null
 */
protected void connectionConfig(String prefix) throws BiremeException {
  Configuration subConfig = new SubsetConfiguration(config, "target", ".");
  targetDatabase = new ConnectionConfig();

  targetDatabase.jdbcUrl = subConfig.getString("url");
  targetDatabase.user = subConfig.getString("user");
  targetDatabase.passwd = subConfig.getString("passwd");

  if (targetDatabase.jdbcUrl == null) {
    String message = "Please designate url for target Database.";
    throw new BiremeException(message);
  }
}
 
开发者ID:HashDataInc,项目名称:bireme,代码行数:20,代码来源:Config.java

示例5: fetchTableMap

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
private HashMap<String, String> fetchTableMap(String dataSource)
    throws ConfigurationException, BiremeException {
  Configurations configs = new Configurations();
  Configuration tableConfig = null;

  tableConfig = configs.properties(new File(DEFAULT_TABLEMAP_DIR + dataSource + ".properties"));

  String originTable, mappedTable;
  HashMap<String, String> localTableMap = new HashMap<String, String>();
  Iterator<String> tables = tableConfig.getKeys();

  while (tables.hasNext()) {
    originTable = tables.next();
    mappedTable = tableConfig.getString(originTable);

    if (originTable.split("\\.").length != 2 || mappedTable.split("\\.").length != 2) {
      String message = "Wrong format: " + originTable + ", " + mappedTable;
      logger.fatal(message);
      throw new BiremeException(message);
    }

    localTableMap.put(dataSource + "." + originTable, mappedTable);

    if (!tableMap.values().contains(mappedTable)) {
      loadersCount++;
    }
    tableMap.put(dataSource + "." + originTable, mappedTable);
  }

  return localTableMap;
}
 
开发者ID:HashDataInc,项目名称:bireme,代码行数:32,代码来源:Config.java

示例6: getStyleForMapFromProperties

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
/**
 *
 * @return
 */
public static StyleList getStyleForMapFromProperties() {
    StyleList style = null;
    try {
        final Configuration config = FILE_BASED_CONFIGURATION_BUILDER.getConfiguration();
        final String styleName = config.getString(PropertyList.STYLE.toString());
        style = StyleList.valueOf(styleName);
    } catch (ConfigurationException cex) {
        LOGGER.error("\n" + cex.getCause());
        cex.printStackTrace();
    }
    return style;
}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:17,代码来源:PropertiesHelper.java

示例7: getVideoFolderFromProperties

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
public static String getVideoFolderFromProperties() {
    String videoFolder = null;
    try {
        final Configuration config = FILE_BASED_CONFIGURATION_BUILDER.getConfiguration();
        videoFolder = config.getString(PropertyList.VIDEO_FOLDER.toString());
    } catch (ConfigurationException cex) {
        LOGGER.error("\n" + cex.getCause());
        cex.printStackTrace();
    }
    return videoFolder;
}
 
开发者ID:Evegen55,项目名称:main_carauto_board,代码行数:12,代码来源:PropertiesHelper.java

示例8: SolverFactory

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
private SolverFactory() {
	Configuration configuration = null;

	try {
		String baseDir = System.getProperty("user.dir");
		FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
			    new FileBasedConfigurationBuilder<PropertiesConfiguration>(PropertiesConfiguration.class)
			    .configure(new Parameters().properties()
			        .setFileName(String.format("%s%s%s", baseDir, File.separator, PROPERTY_FILE)));
		configuration = builder.getConfiguration();
	} catch (Exception ce) {
		//log.error("There went something wrong while reading the clingo configuration. Using Default configruation.", ce);
	}

	if (configuration!=null) {
		clingoParameters = getClingoParameters(configuration);
		clingoExec = configuration.getString("clingo.exec", "clingo.exe");
	} else {
		//defaults
		if (OsUtils.isUnix())
			clingoExec = "clingo";
		else if (OsUtils.isWindows())
			clingoExec = "clingo.exe";

		clingoParameters = new String[] {"--warn=no-atom-undefined", "--quiet=0,2,2", "--verbose=0", "--project"};
	}
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:28,代码来源:SolverFactory.java

示例9: getClingoParameters

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
private String[] getClingoParameters(Configuration _configuration) {
	String warnValue = _configuration.getString("clingo.clasp.warn","no-atom-undefined");
	String warnOption = String.format("--warn=%s", warnValue);

	String quietValue = _configuration.getString("clingo.clasp.quiet", "0,2,2");
	String quietOption = String.format("--quiet=%s", quietValue);

	Integer verboseValue = _configuration.getInteger("clingo.clasp.verbose", 0);
	String verboseOption = String.format("--verbose=%s", verboseValue);

	return new String[] {warnOption, quietOption, verboseOption};
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:13,代码来源:SolverFactory.java

示例10: stopIfRunning

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
private static void stopIfRunning(Configuration conf)
{
	int pid = -1;
	String file = conf.getString("wrapper.runtime.pidfile");
	if (file != null)
	{
		File f = new File(file);
		BufferedReader b = null;
		if (f.exists())
			try
			{
				b = new BufferedReader(new FileReader(f));
				pid = Integer.parseInt(b.readLine());
			}
			catch (Exception ex)
			{
				ex.printStackTrace();
			}
		if (b != null)
			try
			{
				b.close();
			}
			catch (IOException e)
			{
				e.printStackTrace();
			}

		if (pid == -1)
			return;

		Process p = OperatingSystem.instance().processManagerInstance()
				.getProcess(pid);
		if (p == null)
			return;

		String cmd = p.getCommand();
		if (cmd == null)
			return;

		String image = conf.getString("wrapper.image", null);
		if (!cmd.contains(image))
			return;

		int timeout = conf.getInt("wrapper.shutdown.timeout",
				Constants.DEFAULT_SHUTDOWN_TIMEOUT) * 1000;
		System.out.println("process with pid " + pid + " and cmd " + cmd
				+ " is still running,stopping process with timeout of "
				+ timeout + "ms");
		sleep(3000);
		p.stop(timeout, 999);
		sleep(2000);
	}
}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:55,代码来源:RuntimeJavaMain.java

示例11: getServiceFailureActions

import org.apache.commons.configuration2.Configuration; //导入方法依赖的package包/类
public static Object getServiceFailureActions(Configuration config)
{
	String cmd = config.getString(
			"wrapper.ntservice.failure_actions.command", null);
	List<Object> actions = config.getList(
			"wrapper.ntservice.failure_actions.actions", null);
	List<Object> actionsDelay = config.getList(
			"wrapper.ntservice.failure_actions.actions_delay",
			new ArrayList());
	if (actions == null)
		return null;

	SC_ACTION[] scActions = (SC_ACTION[]) new SC_ACTION().toArray(actions
			.size());
	int i = 0;
	int lastDelay = 0;
	for (Object action : actions)
	{
		// scActions[i] = new SC_ACTION();
		if ("NONE".equals(action))
		{
			scActions[i].Type = Advapi32.SC_ACTION_NONE;
		}
		else if ("REBOOT".equals(action))
		{
			scActions[i].Type = Advapi32.SC_ACTION_REBOOT;
		}
		else if ("RESTART".equals(action))
		{
			scActions[i].Type = Advapi32.SC_ACTION_RESTART;
		}
		else if ("COMMAND".equals(action))
		{
			scActions[i].Type = Advapi32.SC_ACTION_RUN_COMMAND;
		}
		else
		{
			System.out.println("ERROR: unknown failure action : " + action);
			System.out.println("Aborting setting failure actions");
			return null;
		}
		if (actionsDelay.size() > i)
			try
			{
				Object d = actionsDelay.get(i);
				lastDelay = Integer.parseInt((String) d);
			}
			catch (Exception ex)
			{
				System.out
						.println("Error: failure actions delay is not a number.");
			}
		scActions[i].Delay = lastDelay;
		i++;
	}

	SERVICE_FAILURE_ACTIONS result = new SERVICE_FAILURE_ACTIONS();
	result.dwResetPeriod = config.getInt(
			"wrapper.ntservice.failure_actions.reset_period", 0);
	result.lpCommand = config.getString(
			"wrapper.ntservice.failure_actions.command", "");
	result.lpRebootMsg = config.getString(
			"wrapper.ntservice.failure_actions.reboot_msg", null);
	result.cActions = scActions.length;
	scActions[0].autoWrite();
	result.lpsaActions = scActions[0].getPointer();
	result.write();
	// for (int z = 0; z<result.cActions*scActions[0].size(); z++)
	// {
	// System.out.print(z + ": ");
	// System.out.println(Integer.toHexString(result.lpsaActions.getByte(z)));
	// }
	return result;

}
 
开发者ID:yajsw,项目名称:yajsw,代码行数:76,代码来源:WindowsXPService.java


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