Java Code Examples for org.apache.commons.configuration.HierarchicalConfiguration#getInt()
The following examples show how to use
org.apache.commons.configuration.HierarchicalConfiguration#getInt() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NTGClientSettings.java From sailfish-core with Apache License 2.0 | 6 votes |
@Override public void load( HierarchicalConfiguration config ) { this.connectTimeout = config.getInt("connectTimeout", 30000); this.loginTimeout = config.getInt("loginTimeout", 30000); this.logoutTimeout = config.getInt("logoutTimeout", 5000); this.heartbeatTimeout = config.getInt("heartbeatTimeout", 30000); this.maxMissedHeartbeats = config.getInt("maxMissedHeartbeats", 5); this.serverPort = config.getInt( "serverPort", 8181); this.serverIP= config.getString("serverIP", "127.0.0.1"); this.reconnectAttempts = config.getInt("reconnectAttempts", 10); this.login = config.getString( "login", "user"); this.password= config.getString("password", "password"); this.newPassword = config.getString("newPassword", null); this.messageVersion = config.getByte("messageVersion", (byte)1 ); //this.dictionaryPath = config.getString("dictionaryPath"); this.lowlevelService = config.getBoolean("lowlevelService"); this.autosendHeartbeat = config.getBoolean("autosendHeartBeat"); try { this.dictionaryName = SailfishURI.parse(config.getString("dictionaryName")); } catch(SailfishURIException e) { throw new EPSCommonException(e); } }
Example 2
Source File: Configuration.java From java-cme-mdp3-handler with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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); } }
Example 3
Source File: CustomPayloadsParam.java From zap-extensions with Apache License 2.0 | 6 votes |
private void loadPayloadsFromConfig(HierarchicalConfiguration rootConfig) { List<HierarchicalConfiguration> categories = rootConfig.configurationsAt(ALL_CATEGORIES_KEY); payloadCategories = new HashMap<>(); for (HierarchicalConfiguration category : categories) { List<HierarchicalConfiguration> fields = category.configurationsAt("payloads.payload"); String cat = category.getString(CATEGORY_NAME_KEY); List<CustomPayload> payloads = new ArrayList<>(); for (HierarchicalConfiguration sub : fields) { int id = sub.getInt(PAYLOAD_ID_KEY); boolean isEnabled = sub.getBoolean(PAYLOAD_ENABLED_KEY); String payload = sub.getString(PAYLOAD_KEY, ""); payloads.add(new CustomPayload(id, isEnabled, cat, payload)); } payloadCategories.put(cat, new PayloadCategory(cat, Collections.emptyList(), payloads)); } }
Example 4
Source File: NettyClientSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration cfg) { super.load(cfg); this.idleTimeout = cfg.getInt("idleTimeout"); try { this.dictionaryName = SailfishURI.parse(cfg.getString("dictionaryName")); } catch(SailfishURIException e) { throw new ServiceException(e); } }
Example 5
Source File: CleanupConfiguration.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration config) { reports = config.getBoolean(REPORTS, false); matrices = config.getBoolean(MATRICES, false); messages = config.getBoolean(MESSAGES, false); events = config.getBoolean(EVENTS, false); trafficDump = config.getBoolean(TRAFFIC_DUMP, false); logs = config.getBoolean(LOGS, false); ml = config.getBoolean(ML, false); autoclean = config.getBoolean(AUTOCLEAN, false); cleanOlderThanDays = config.getInt(CLEAN_OLDER_THAN_DAYS, 1); }
Example 6
Source File: EnvironmentSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
private void loadScriptRunSettings(HierarchicalConfiguration config) { notificationIfServicesNotStarted = config.getBoolean(NOTIFICATION_IF_SOME_SERVICES_NOT_STARTED, false); failUnexpected = config.getString(FAIL_UNEXPECTED_KEY, "N"); matrixCompilerPriority = config.getInt(MATRIX_COMPILER_PRIORITY, Thread.NORM_PRIORITY); reportOutputFormat = ReportOutputFormat.parse(config.getString(REPORT_OUTPUT_FORMAT, ReportOutputFormat.ZIP_FILES.getName())); excludedMessages = parseSet(config, EXCLUDED_MESSAGES_FROM_REPORT, IDictionaryValidator.NAME_REGEX, excludedMessages); relevantMessagesSortingMode = RelevantMessagesSortingMode.parse(config.getString(RELEVANT_MESSAGES_SORTING_MODE, RelevantMessagesSortingMode.ARRIVAL_TIME.getName())); verificationLimit = config.getInt(VERIFICATION_LIMIT, 200); }
Example 7
Source File: TCPIPSettingsServer.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration config) { this.host = config.getString( "host" ); this.port = config.getInt( "port" ); this.codecClassName = config.getString( "codecClass" ); this.storeMessages = config.getBoolean( "storeMessages" ); }
Example 8
Source File: TCPIPSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration config) { this.host = config.getString( "host" ); this.port = config.getInt( "port" ); this.codecClassName = config.getString( "codecClass" ); this.storeMessages = config.getBoolean( "storeMessages" ); }
Example 9
Source File: TCPIPProxySettings.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration config) { this.host = config.getString("host"); this.port = config.getInt("port"); this.listenPort = config.getInt("listenPort"); this.codecClassName = config.getString("codecClass"); this.timeout = config.getLong("timeout"); }
Example 10
Source File: ITCHServerSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load(HierarchicalConfiguration config) { this.realTimeChannelAddress = config.getString("realTimeChannelAddress"); this.realTimeChannelPort = config.getInt("realTimeChannelPort"); this.heartBeatTimeout = config.getInt("heartBeatTimeout"); try { this.dictionaryName = SailfishURI.parse(config.getString("dictionaryName")); } catch(SailfishURIException e) { throw new EPSCommonException(e); } }
Example 11
Source File: NTGServerSettings.java From sailfish-core with Apache License 2.0 | 5 votes |
@Override public void load( HierarchicalConfiguration config ) { this.heartbeatTimeout = config.getInt("heartbeatTimeout", 30000); this.maxMissedHeartbeats = config.getInt("maxMissedHeartbeats", 5); this.serverPort = config.getInt( "serverPort", 8181); this.serverIP = config.getString("serverIP", "127.0.0.1 "); this.sendDelay = config.getInt("sendDelay", 16 ); try { this.dictionaryName = SailfishURI.parse(config.getString("dictionaryName")); } catch(SailfishURIException e) { throw new EPSCommonException(e); } this.defaultStrategy = NTGServerStrategy.valueOf( config.getString("defaultStrategy", NTGServerStrategy.UnconditionalFill.toString())); Object strategyColl = config.getProperty( "strategies.strategy.instrumentID" ); if(strategyColl instanceof Collection<?>) { strategy = new HashMap<>(); for(int i = 0 ; i < ((Collection<?>) strategyColl).size(); i++) { String symbol = config.getString(String.format( "strategies.strategy(%d).instrumentID", i)); String strategyValueString = config.getString(String.format( "strategies.strategy(%d).strategyValue", i)); NTGServerStrategy strategyValue = Enum.valueOf(NTGServerStrategy.class, strategyValueString); if(!strategy.containsKey( symbol )) { strategy.put( symbol, strategyValue ); } } } }
Example 12
Source File: ConfigurableIngestTopology.java From cognition with Apache License 2.0 | 5 votes |
/** * 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++; } }
Example 13
Source File: CfgManager.java From SI with BSD 2-Clause "Simplified" License | 4 votes |
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; }
Example 14
Source File: ConfigurableIngestTopologyTest.java From cognition with Apache License 2.0 | 4 votes |
@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); }
Example 15
Source File: CfgManager.java From SI with BSD 2-Clause "Simplified" License | 4 votes |
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; }