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


Java XMLConfiguration.getInt方法代码示例

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


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

示例1: reloadConfigurationInner

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
@Override
protected synchronized void reloadConfigurationInner() throws IOException {
    try {
        config = new XMLConfiguration();
        config.setDelimiterParsingDisabled(true);
        config.load(getConfigFile());
        this.inventoryRmiServicePort = config.getInt(INVENTORY_RMI_SERVICE_PORT);
        log().info("reload finished.");
    } catch (ConfigurationException e) {
        log().error(e.getMessage(), e);
        throw new IOException("failed to reload config: " + FILE_NAME);
    }
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:14,代码来源:MplsNmsConfiguration.java

示例2: init

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
 * Creates the configuration object form the {@value #CONFIG_FILE} file.
 */
@PostConstruct
public void init() {
    try {
        config = new XMLConfiguration(CONFIG_FILE);
        certificateCheckThreshold = config.getInt(CERTIFICATE_CHECK_THRESHOLD);
        certificateCheckSchedule = readSchedule(config.subset(CERTIFICATE_CHECK_SCHEDULE));
    } catch (ConfigurationException e) {
        logger.error("There was a problem with loading the configuration.", e);
        throw new WrdzConfigurationError(e);
    }
}
 
开发者ID:psnc-dl,项目名称:darceo,代码行数:15,代码来源:ZuConfiguration.java

示例3: initialize

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
/**
   * implements the initialize method of the SimulatorEngine
   * 
   * @param controller 
   *          the SimulatorController
   * @param propFile
   *          the path and name of the configuration file
   * @throws SimulatorServerException
   */
public void initialize(SimulatorController controller, String propFile
        ) throws SimulatorServerException {
   // TODO: adjust to xml properties file, move configuration from constructor to initialization.
   this.controller = controller;

     // load properties
     URL url = ResourceLocator.getURL(propFile, defaultPropFile, this.getClass());
     try {
        config = new XMLConfiguration(url);
     } catch (ConfigurationException ce) {
        throw new SimulatorServerException("SimulatorClient configuration file not found.");
     }

     // check properties
     if (!config.containsKey("host")) {
        throw new SimulatorServerException("Property 'host' not found.");
     }
     if (!config.containsKey("port")) {
        throw new SimulatorServerException("Property 'port' not found.");
     }
     if (!config.containsKey("timeout")) {
        throw new SimulatorServerException("Property 'timeout' not found.");
     }
     if (!config.containsKey("waittime")) {
        throw new SimulatorServerException("Property 'waittime' not found.");
     }
     
     // get properties
     host = config.getString("host");
     try {
        port = config.getInt("port");
        timeout = config.getInt("timeout");
        waittime = config.getInt("waittime");
     } catch (NumberFormatException e) {
        throw new SimulatorServerException("Properties 'port', 'timeout' and 'waittime' must be numbers");
     }
     
     tryToConnect();
}
 
开发者ID:Fosstrak,项目名称:fosstrak-hal,代码行数:49,代码来源:SimulatorClient.java

示例4: getParameterValue

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public static Object getParameterValue(XMLConfiguration config, int currentRule, int currentParameter, String parameterType) throws Exception {
		String key = "AccessControlRules.AccessControlRule(" + 
			currentRule + ").Parameters.Parameter(" + currentParameter + ")[@value]";
		Object parameterValue;
		if("String".equalsIgnoreCase(parameterType)) {
			parameterValue = config.getString(key);
		} else if("StringArray".equalsIgnoreCase(parameterType)) {
			parameterValue = config.getStringArray(key);
		} else if("Boolean".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getBoolean(key);
		} else if("Byte".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getByte(key);
		} else if("Int".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getInt(key);
		} else if("Long".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getLong(key);
		} else if("Float".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getFloat(key);
		} else if("Double".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getDouble(key);
		} else if("BigDecimal".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getBigDecimal(key);
		} else if("BigInteger".equalsIgnoreCase(parameterType)){ 
			parameterValue = config.getBigInteger(key);
		} else if("Date".equalsIgnoreCase(parameterType)){
			parameterValue = java.text.DateFormat.getDateInstance().parse(config.getString(key));
		} else if("Time".equalsIgnoreCase(parameterType)){
			java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("h:mm a");
			parameterValue = sdf.parseObject(config.getString(key)); 
//			parameterValue = java.text.DateFormat.getTimeInstance().parse(config.getString(key));
		}		
		//add timestamp. check for other stuff.
		else {
			throw new IllegalArgumentException("Unable to load the key \"" + key 
					+ "\", because " + "the type \"" + parameterType + 
					"\" was not recognized." );
		}
		return parameterValue;
	}
 
开发者ID:abimael93,项目名称:owasp-esapi-java,代码行数:40,代码来源:ACRParameterLoaderHelper.java

示例5: WorkloadSetup

import org.apache.commons.configuration.XMLConfiguration; //导入方法依赖的package包/类
public WorkloadSetup(XMLConfiguration xmlConfig){
    this.xmlConfig = xmlConfig;
    this.targetTPS = xmlConfig.getInt("target_TPS");
}
 
开发者ID:faclc4,项目名称:HTAPBench,代码行数:5,代码来源:WorkloadSetup.java


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