List of usage examples for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration
public PropertiesConfiguration(URL url) throws ConfigurationException
From source file:de.textmining.nerdle.database.DBSingleton.java
private void config(String path) throws ConfigurationException { EtmPoint point = etmMonitor.createPoint("DBSingleton:config"); PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(path); String jdbc = propertiesConfiguration.getString("jdbc"); Set<String> dbIds = new TreeSet<>(); Iterator keys = propertiesConfiguration.getKeys("db"); while (keys.hasNext()) { String key = (String) keys.next(); String[] split = key.split("\\."); dbIds.add(split[0] + "." + split[1]); }/* w w w .j a v a 2 s . co m*/ connections = new HashMap<>(); for (String dbId : dbIds) { String dbName = propertiesConfiguration.getString(dbId + "." + "name"); String dbPath = propertiesConfiguration.getString(dbId + "." + "path"); connections.put(dbName, new DBConnection(jdbc + dbPath + ";ACCESS_MODE_DATA=r")); } point.collect(); }
From source file:com.technophobia.substeps.model.Configuration.java
private void initialise() { final String resourceBundleName = resourceBundleName(); final URL customPropsUrl = Configuration.class.getResource(resourceBundleName); if (customPropsUrl != null) { try {/* ww w . ja v a 2 s. co m*/ final PropertiesConfiguration customProps = new PropertiesConfiguration(customPropsUrl); combinedConfig.addConfiguration(customProps, "customProps"); } catch (final ConfigurationException e) { logger.error("error loading custom properties", e); } } }
From source file:edu.harvard.i2b2.fhir.server.ServerConfigs.java
public ServerConfigs() { if (configC == null) { try {// w ww .j a v a 2s. c o m configC = new CompositeConfiguration(); configC.addConfiguration(new SystemConfiguration()); if (ServerConfigs.class.getResourceAsStream("/confidential.properties") != null) { logger.info("using confidential.properties"); configC.addConfiguration(new PropertiesConfiguration("confidential.properties")); } else { logger.info("using application.properties"); configC.addConfiguration(new PropertiesConfiguration("/application.properties")); } openAccess = Boolean.parseBoolean(GetString(ConfigParameter.openAccess)); maxQueryThreads = Integer.parseInt(GetString(ConfigParameter.maxQueryThreads)); logger.info("initialized:" + configC.toString()); /* * logger.info("initialized:" + "\ni2b2Url:" + i2b2Url + * "\ndemoAccessToken:" + openAccessToken + "\n openAccess:" + * openAccess + "\nmaxQueryThreads" + maxQueryThreads + * "\ndemoConfidentialClientId:" + demoConfidentialClientId + * "\ndemoConfidentialClientSecret" + * demoConfidentialClientSecret); */ } catch (Exception e) { logger.error(e.getMessage(), e); } } }
From source file:edu.wright.daselab.linkgen.ConfigurationLoader.java
public final Configuration getConfig(String filePath) throws FileException { //at this point, we haven't loaded the path of log4j.properties file, so ignore any logger errors. org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF); Configuration config = null;/*from w w w . ja v a 2 s . co m*/ String message = ""; try { File configFile = new File(filePath); // outside the jar file if (!configFile.exists()) { message = ErrorCodes.Error.CONFIG_FILE_NOT_EXISTS.toString() + "FAILED - " + configFile; Monitor.error(message); throw new FileNotFoundException(message); } config = new PropertiesConfiguration(configFile); if (config.isEmpty()) { message = ErrorCodes.Error.CONFIG_FILE_EMPTY.toString(); Monitor.error(message); throw new FileException(message); } } catch (Exception e) { message = ErrorCodes.Error.CONFIG_FILE_LOAD_ERROR.toString(); Monitor.error(message); throw new FileException(message); } return (Configuration) config; }
From source file:es.bsc.servicess.ide.IDEProperties.java
/** Constructor * @param pathToConfigFile Path top the ide properties file * @throws ConfigurationException// www . j a v a2 s. co m */ public IDEProperties(String pathToConfigFile) throws ConfigurationException { config = new PropertiesConfiguration(pathToConfigFile); }
From source file:de.textmining.nerdle.database.MVSingleton.java
private void config(String path) throws ConfigurationException { EtmPoint point = etmMonitor.createPoint("MVSingleton:config"); PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration(path); Set<String> mvIds = new TreeSet<>(); Iterator keys = propertiesConfiguration.getKeys("mv"); while (keys.hasNext()) { String key = (String) keys.next(); String[] split = key.split("\\."); mvIds.add(split[0] + "." + split[1]); }//from w w w .j av a 2s . c o m connections = new HashMap<>(); for (String dbId : mvIds) { String mvName = propertiesConfiguration.getString(dbId + "." + "name"); String mvPath = propertiesConfiguration.getString(dbId + "." + "path"); MVStore s = new MVStore.Builder().fileName(mvPath).readOnly().open(); connections.put(mvName, new MVConnection(s)); } point.collect(); }
From source file:fr.jetoile.hadoopunit.component.MongoDbBootstrap.java
private void loadConfig() throws BootstrapException { try {/*from w w w . ja va 2 s.c o m*/ configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE); } catch (ConfigurationException e) { throw new BootstrapException("bad config", e); } port = configuration.getInt(HadoopUnitConfig.MONGO_PORT_KEY); ip = configuration.getString(HadoopUnitConfig.MONGO_IP_KEY); }
From source file:com.lazerycode.selenium.filedownloader.FileUploaderTest.java
public FileUploaderTest() { LOG.debug("using properties file"); try {//from w ww .jav a 2 s .com config = new PropertiesConfiguration("env.properties"); LOG.debug("reading config in " + this.getClass().getName()); } catch (ConfigurationException ex) { LOG.info("did not find env.properties file"); } driver = new HtmlUnitDriver(); this.automation = new GenericAutomationRepository(driver, config); }
From source file:edu.harvard.i2b2.fhir.server.config.ServerConfigs.java
public ServerConfigs() { if (configC == null) { try {/*from w w w .j av a2s . com*/ configC = new CompositeConfiguration(); configC.addConfiguration(new JNDIConfiguration()); configC.addConfiguration(new SystemConfiguration()); if (ServerConfigs.class.getResourceAsStream("/confidential.properties") != null) { logger.info("using confidential.properties"); configC.addConfiguration(new PropertiesConfiguration("confidential.properties")); } else { logger.info("using application.properties"); configC.addConfiguration(new PropertiesConfiguration("/application.properties")); } String jndiI2b2Url = configC.getString("java:global/i2b2Url"); if (jndiI2b2Url != null) { configC.setProperty("i2b2Url", jndiI2b2Url); } logger.info("initialized: ava:global/i2b2Url=" + jndiI2b2Url); logger.info("initialized: i2b2Url=" + configC.getString("i2b2Url")); openAccess = Boolean.parseBoolean(GetString(ConfigParameter.openAccess)); maxQueryThreads = Integer.parseInt(GetString(ConfigParameter.maxQueryThreads)); logger.info("initialized:" + configC.toString()); /* * logger.info("initialized:" + "\ni2b2Url:" + i2b2Url + * "\ndemoAccessToken:" + openAccessToken + "\n openAccess:" + * openAccess + "\nmaxQueryThreads" + maxQueryThreads + * "\ndemoConfidentialClientId:" + demoConfidentialClientId + * "\ndemoConfidentialClientSecret" + * demoConfidentialClientSecret); */ } catch (Exception e) { logger.error(e.getMessage(), e); } } }
From source file:edu.iw.mace.environment.Settings.java
/** * Constructor/*from w ww. j av a2 s . c o m*/ */ public Settings() throws FactoryException, MaceException { try { config = new PropertiesConfiguration(PROPERTIES_FILE); } catch (ConfigurationException e) { log.error(e.fillInStackTrace()); } config.setAutoSave(true); initProperties(); }