Example usage for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration

List of usage examples for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration

Introduction

In this page you can find the example usage for org.apache.commons.configuration PropertiesConfiguration PropertiesConfiguration.

Prototype

public PropertiesConfiguration(URL url) throws ConfigurationException 

Source Link

Document

Creates and loads the extended properties from the specified URL.

Usage

From source file:club.jmint.crossing.config.ConfigWizard.java

public static Configuration loadPropertiesConfigFile(String file) {

    Configuration config = null;/* w w w.  j a v a  2  s.  co m*/
    try {
        config = new PropertiesConfiguration(file);
    } catch (ConfigurationException e) {
        CrossLog.printStackTrace(e);
    }

    return config;
}

From source file:com.cisco.oss.foundation.http.apache.test.JavaClientSample.java

@BeforeClass
public static void init() {
    try {//w  w  w  . j  a va 2 s . c  o  m
        propsConfiguration = new PropertiesConfiguration(
                TestApacheClient.class.getResource("/config.properties"));
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:edu.harvard.i2b2.fhir.core.CoreConfig.java

private static void init() throws ConfigurationException {
    config = new CompositeConfiguration();
    config.addConfiguration(new SystemConfiguration());
    config.addConfiguration(new PropertiesConfiguration("application.properties"));

    resourceCategoriesList = config.getString("resourceCategoriesList");
    labsPath = config.getString("labsPath");
    medicationsPath = config.getString("medicationsPath");
    diagnosesPath = config.getString("diagnosesPath");
    reportsPath = config.getString("reportsPath");

    logger.info("initialized:" + toStaticString());

}

From source file:eu.optimis.service_manager.rest.util.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile)
        throws ConfigurationException, Exception {
    String filePath = null;/*from w  w  w .j  ava2s . com*/
    PropertiesConfiguration config = null;
    filePath = getConfigFilePath(configFile);
    config = new PropertiesConfiguration(filePath);
    return config;
}

From source file:eu.optimis.sm.gui.utils.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;// ww  w.j a v  a  2 s  .c o m
    PropertiesConfiguration config = null;

    try {
        filePath = getFilePath(configFile);
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException ex) {
        log.error("Error reading " + filePath + " configuration file: " + ex.getMessage());
        log.error(ex.getMessage());
    }
    return config;
}

From source file:fr.jetoile.hadoopunit.component.MongoDbBootstrapTest.java

@BeforeClass
public static void setUp() throws Exception {
    HadoopBootstrap.INSTANCE.startAll();

    try {//from w w  w  .j a  v  a 2  s.  com
        configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE);
    } catch (ConfigurationException e) {
        throw new BootstrapException("bad config", e);
    }
}

From source file:com.app.configuration.StormConfiguration.java

private StormConfiguration() {
    try {//from w  w  w. ja  va2s .  c  o m
        this.config = new PropertiesConfiguration(this.getClass().getResource("/m.storm.properties"));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:com.flexilogix.Properties.java

private Properties() {
    try {/*from   ww  w  . jav  a 2  s  .  c om*/
        this.config = new PropertiesConfiguration(this.getClass().getResource("/rts.spark.properties"));
    } catch (Exception ex) {
        LOGGER.fatal("Could not load configuration", ex);
        LOGGER.trace(null, ex);
    }
}

From source file:eu.planetdata.srbench.oracle.Utility.java

public static TimestampedRelation importRelation(String filename, Logger logger) {
    try {/* w  w  w  . j a v a  2 s  .c  o  m*/
        TimestampedRelation ret;
        Configuration relationImporter = new PropertiesConfiguration(filename);

        ret = new TimestampedRelation();
        ret.setComputationTimestamp(relationImporter.getLong("timestamp"));

        for (String s : relationImporter.getStringArray("sensor")) {
            TimestampedRelationElement tre = new TimestampedRelationElement();
            tre.add("sensor", new URIImpl(s));
            //FIXME: should import the element timestamp!
            tre.setTimestamp(relationImporter.getLong("timestamp"));
            ret.addElement(tre);
        }
        return ret;
    } catch (ConfigurationException e) {
        logger.error("Error while reading the configuration file", e);
        fail();
    }
    return null;
}

From source file:com.algoTrader.util.ConfigurationUtil.java

public static Configuration getBaseConfig() {

    if (baseConfig == null) {
        baseConfig = new CompositeConfiguration();

        baseConfig.addConfiguration(new SystemConfiguration());
        try {//  w  ww.ja v  a 2s  .c om
            baseConfig.addConfiguration(new PropertiesConfiguration(baseFileName));
        } catch (ConfigurationException e) {
            logger.error("error loading base.properties", e);
        }
    }
    return baseConfig;
}