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


Java HierarchicalConfiguration.getInt方法代碼示例

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


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

示例1: load

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Loads and parse CME MDP Configuration.
 *
 * @param uri URI to CME MDP Configuration (config.xml, usually available on CME FTP)
 * @throws ConfigurationException if failed to parse configuration file
 * @throws MalformedURLException  if URI to Configuration is malformed
 */
private void load(final URI uri) throws ConfigurationException, MalformedURLException {
    // todo: if to implement the same via standard JAXB then dep to apache commons configuration will be not required
    final XMLConfiguration configuration = new XMLConfiguration();
    configuration.setDelimiterParsingDisabled(true);
    configuration.load(uri.toURL());
    for (final HierarchicalConfiguration channelCfg : configuration.configurationsAt("channel")) {
        final ChannelCfg channel = new ChannelCfg(channelCfg.getString("[@id]"), channelCfg.getString("[@label]"));

        for (final HierarchicalConfiguration connCfg : channelCfg.configurationsAt("connections.connection")) {
            final String id = connCfg.getString("[@id]");
            final FeedType type = FeedType.valueOf(connCfg.getString("type[@feed-type]"));
            final TransportProtocol protocol = TransportProtocol.valueOf(connCfg.getString("protocol").substring(0, 3));
            final Feed feed = Feed.valueOf(connCfg.getString("feed"));
            final String ip = connCfg.getString("ip");
            final int port = connCfg.getInt("port");
            final List<String> hostIPs = Arrays.asList(connCfg.getStringArray("host-ip"));

            final ConnectionCfg connection = new ConnectionCfg(feed, id, type, protocol, ip, hostIPs, port);
            channel.addConnection(connection);
            connCfgs.put(connection.getId(), connection);
        }
        channelCfgs.put(channel.getId(), channel);
    }
}
 
開發者ID:epam,項目名稱:java-cme-mdp3-handler,代碼行數:32,代碼來源:Configuration.java

示例2: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
    StringBuilder sb = new StringBuilder();
    String name = configuration.getString("name");
    if ( name == null ) sb.append("store name is not defined ");
    String path = configuration.getString("path","data");
    String filename = configuration.getString("filename", name);
    boolean delay = configuration.getBoolean("delay", true);
    int mode = configuration.getInt("mode", 0);
    int freq = configuration.getInt("freq", this.freq == 0 ? 1 : this.freq );
    int batchSize = configuration.getInt("batchSize", 10);
    String logPath = configuration.getString("logPath","log");
    List<String> replicaUrl = configuration.getList("replicaUrl");
    long replciaTimeout = configuration.getLong("replicaTimeout", 60000);
    if (replicaUrl == null ) sb.append("no replicaUrl is defined");
    boolean sorted = configuration.getBoolean("sorted", false);
    if ( sb.length() > 0 ) {
        throw new RuntimeException("error on buildStoreConfig "+sb.toString());
    }
    else {
        StoreConfig storeConfig = new StoreConfig(name, path, freq, replicaUrl, batchSize, delay, mode, sorted);
        storeConfig.setGetTriggerName( configuration.getString("getTrigger"));
        storeConfig.setPutTriggerName( configuration.getString("putTrigger"));
        storeConfig.setDeleteTriggerName( configuration.getString("deleteTrigger"));
        storeConfig.setUseMaxCache(configuration.getBoolean("useMaxCache", false));
        storeConfig.setMaxCacheMemory(configuration.getInt("maxCacheMemory", 20000));
        storeConfig.setUseLRU(configuration.getBoolean("useLRU", false));
        storeConfig.setLogPath( logPath);
        storeConfig.setReplicaTimeout( replciaTimeout);
        //add pstReplicaURl
        storeConfig.setPstReplicaUrl( configuration.getList("pstReplicaUrl"));
        storeConfig.setSerializeClass(configuration.getString("serializeClass"));
        return storeConfig ;
    }

}
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:36,代碼來源:BuildRemoteConfig.java

示例3: buildStoreConfig

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
private StoreConfig buildStoreConfig(HierarchicalConfiguration configuration) {
        StringBuilder sb = new StringBuilder();
        String name = configuration.getString("name");
        if ( name == null ) sb.append("store name is not defined ");
        String path = configuration.getString("path","data");
        String filename = configuration.getString("filename", name);
        boolean delay = configuration.getBoolean("delayWrite", true);
        int mode = configuration.getInt("mode", 0);
        int delayThread = configuration.getInt("delayThread", 2);
        String serializeClass = configuration.getString("serializer", "com.sm.localstore.impl.HessianSerializer");
        String blockSizeClass = configuration.getString("blockSize");
        BlockSize blockSize = null;
        if ( blockSizeClass != null ) {
            try {
                blockSize = (BlockSize) Class.forName(blockSizeClass).newInstance();
            } catch (Exception ex) {
                sb.append(("unable to load "+blockSizeClass+" "+ex.getMessage()));
            }
        }
        boolean useCache = configuration.getBoolean("useCache", false);
        long maxCache = configuration.getLong("maxCache", 1000 * 1000 * 1000L);
        String logPath = configuration.getString("logPath", "log");
        String replicaUrl = configuration.getString("replicaUrl");
        String purgeClass = configuration.getString("purgeClass");
        if ( sb.length() > 0 ) {
            throw new RuntimeException("error on buildStoreConfig "+sb.toString());
        }
        else {
            StoreConfig storeConfig = new StoreConfig(name, path, 10, null );
            storeConfig.setDelay( delay);
            storeConfig.setDelayThread(delayThread);
            storeConfig.setLogPath( logPath);
            storeConfig.setBlockSize( blockSize);
            storeConfig.setPurgeClass(purgeClass);
//            return new StoreConfig(name, path, filename, delay, mode, writeThread, useCache, maxCache, maxCache,
//                    logPath, serializeClass, blockSize, replicaUrl);
            return storeConfig;
        }
    }
 
開發者ID:viant,項目名稱:CacheStore,代碼行數:40,代碼來源:BuildStoreConfig.java

示例4: readIntermediateGMLFile

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public void readIntermediateGMLFile() throws IOException{
	XMLConfiguration configuration = getConfiguration();
	try {
		configuration.load(new File(_intermediateGMLInputFile));
		System.out.println("reading the partitioned gml information from " + _intermediateGMLInputFile);
	} catch (ConfigurationException e) {
		throw new RuntimeException(e);
	}

	List<HierarchicalConfiguration> subConfigurationCollection;
	int partitionId;
	List<Object> instanceObjectCollection;
	List<Path> instancePaths;
	subConfigurationCollection = configuration.configurationsAt("partition");
	for(HierarchicalConfiguration subConfig : subConfigurationCollection){
		partitionId = subConfig.getInt("[@id]");
		_partitionedTemplates.put(partitionId, Paths.get(subConfig.getString("template")));

		instanceObjectCollection = subConfig.getList("instances.instance");
		instancePaths = new LinkedList<>();
		for(Object instanceObj : instanceObjectCollection){
			instancePaths.add(Paths.get(instanceObj.toString()));
		}

		_partitionedInstances.put(partitionId, instancePaths);
	}
}
 
開發者ID:dream-lab,項目名稱:goffish_v2,代碼行數:28,代碼來源:GMLPartitionBuilder.java

示例5: configureBolts

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
/**
 * Gets a topology builder and set of storm bolt configurations. Initializes the bolts and sets them with the
 * topology builder.
 *
 * @param builder   storm topology builder
 * @param boltsConf component configurations
 * @param spout     type of storm component being added (spout/bolt)
 * @throws ConfigurationException
 */
void configureBolts(TopologyBuilder builder, SubnodeConfiguration boltsConf, String spout)
    throws ConfigurationException {

  String prevComponent = spout;
  // bolts subscribe to other bolts by number
  HashMap<Integer, String> boltNumberToId = new HashMap<>();

  List<HierarchicalConfiguration> bolts = boltsConf.configurationsAt(BOLT);
  for (HierarchicalConfiguration bolt : bolts) {
    String boltType = bolt.getString(TYPE);
    Configuration boltConf = bolt.configurationAt(CONF);
    int boltNum = bolt.getInt(NUMBER_ATTRIBUTE);

    String boltId = String.format("%02d_%s", boltNum, boltType);
    boltNumberToId.put(boltNum, boltId);
    String subscribingToComponent = getSubscribingToComponent(prevComponent, boltNumberToId, boltConf);
    logger.info("{} subscribing to {}", boltId, subscribingToComponent);

    IComponent baseComponent = buildComponent(boltType, boltConf);

    StormParallelismConfig stormParallelismConfig = getStormParallelismConfig(boltConf);
    BoltDeclarer declarer = buildBoltDeclarer(builder, stormParallelismConfig, boltId, baseComponent);

    configureTickFrequency(boltConf, declarer);

    configureStreamGrouping(subscribingToComponent, boltConf, declarer);

    prevComponent = boltId;

    boltNum++;
  }
}
 
開發者ID:boozallen,項目名稱:cognition,代碼行數:42,代碼來源:ConfigurableIngestTopology.java

示例6: initialize

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
public void initialize() throws Exception {
		
		try {
			log.info("Configuration loading started!!!");
			xmlConfig.load(CONFIG_FILENAME);
			
			final List<HierarchicalConfiguration> cses = xmlConfig.configurationsAt("remoteCSEs.remoteCSE");
			if(cses instanceof Collection)
			{
				for(final HierarchicalConfiguration cse : cses) {
					CSEQoSConfig cfg = new CSEQoSConfig(cse.getString("cseId"),
							cse.getString("cseName"), 
							cse.getString("cseHost"), 
							cse.getInt("maxTPS"));					
					cseQoSMap.put(cse.getString("cseId"), cfg);
					log.info("CSE Config:"+cfg.toString());
					
					
//					this.addRemoteCSEList(new RemoteCSEInfo("/" + cse.getString("cseId"),   // blocked in 2017-11-30
					this.addRemoteCSEList(new RemoteCSEInfo(cse.getString("cseId"),			// added in 2017-11-30 to register remoteCSE in incse.xml
//							"/" + cse.getString("cseName"), cse.getString("poa")));
//					this.addRemoteCSEList(new RemoteCSEInfo("/" + cse.getString("cseName"),
							"/" + cse.getString("cseName"), cse.getString("poa")));
				}
			}

			log.info("Configuration loading succeeded!!!");

		} catch (Exception e) {

			log.error("Exception during Configuration loading!!!", e);
			
		}
		// remoteCSE 목록 추가
//		this.addRemoteCSEList(new RemoteCSEInfo("herit-cse", "http://166.104.112.34:8080"));
		//this.addRemoteCSEList(new RemoteCSEInfo("//in-cse", "http://217.167.116.81:8080"));

//		String databasehaot = xmlConfig.getString("database.host");	//DATABASE_HOST;
//		int dbport = xmlConfig.getInt("database.port");	//DATABASE_PORT;
//		String dbname = xmlConfig.getString("database.dbname");	//DATABASE_NAME;
//		String dbuser = xmlConfig.getString("database.user");	//DATABASE_USER;
//		String dbpwd = xmlConfig.getString("database.password");	//DATABASE_PASSWD;
//		String basename = xmlConfig.getString("cse.baseName");	//CSEBASE_NAME;
//		String rid = xmlConfig.getString("cse.resourceId");	//CSEBASE_RID;
//		String chost = xmlConfig.getString("cse.host");	//HOST_NAME;
//		int cmdTimeout = xmlConfig.getInt("cmdh.commandTimeout");
//		int cmdExpireInterval = xmlConfig.getInt("cmdh.commandExpireTimerInterval");
//		
//		String dmaddr = xmlConfig.getString("dms.hitdm.address");	// "http://10.101.101.107:8888";
//		int httpPort = xmlConfig.getInt("cse.httpPort");	// 8080;
//		int restPort = xmlConfig.getInt("cse.restPort");	//8081;
		
	}
 
開發者ID:iotoasis,項目名稱:SI,代碼行數:54,代碼來源:CfgManager.java

示例7: testConfigureBolts

import org.apache.commons.configuration.HierarchicalConfiguration; //導入方法依賴的package包/類
@Test
public void testConfigureBolts(
    @Injectable TopologyBuilder builder,
    @Injectable SubnodeConfiguration boltsConf,
    @Injectable HierarchicalConfiguration bolt,
    @Injectable SubnodeConfiguration boltConf,
    @Injectable IComponent baseComponent,
    @Injectable StormParallelismConfig stormParallelismConfig,
    @Injectable BoltDeclarer declarer) throws Exception {

  List<HierarchicalConfiguration> bolts = Arrays.asList(bolt);
  String spout = "spout_id";

  new Expectations(topology) {{
    boltsConf.configurationsAt(BOLT);
    result = bolts;

    bolt.getString(TYPE);
    result = "bolt_type";
    bolt.configurationAt(CONF);
    result = boltConf;
    bolt.getInt(NUMBER_ATTRIBUTE);
    result = 0;
    topology.getSubscribingToComponent(spout, (HashMap<Integer, String>) any, boltConf);
    result = spout;

    topology.buildComponent("bolt_type", boltConf);
    result = baseComponent;

    topology.getStormParallelismConfig(boltConf);
    result = stormParallelismConfig;
    topology.buildBoltDeclarer(builder, stormParallelismConfig, "00_bolt_type", baseComponent);
    result = declarer;

    topology.configureTickFrequency(boltConf, declarer);

    topology.configureStreamGrouping(spout, boltConf, declarer);

  }};

  topology.configureBolts(builder, boltsConf, spout);
}
 
開發者ID:boozallen,項目名稱:cognition,代碼行數:43,代碼來源:ConfigurableIngestTopologyTest.java


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