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:com.bluescopesteel.foldermonitor.config.ConfigManager.java

public synchronized static Configuration getConfig() {
    if (config == null) {
        try {/*from www .  j a  v  a2s.c  om*/
            log.info("Creating new configuration object");
            config = new CompositeConfiguration();
            config.addConfiguration(new PropertiesConfiguration("default.properties"));
            try {
                config.addConfiguration(new PropertiesConfiguration("config.properties"));
            } catch (ConfigurationException ex) {
                log.info("No installed configuration file found");
            }
            config.addConfiguration(new SystemConfiguration());
        } catch (ConfigurationException ex) {
            log.error("Error creating configuration", ex);
        }
    }

    return config;
}

From source file:com.homesoft.component.report.configuration.GlobalConfig.java

public GlobalConfig() {
    try {//ww w  .  j av  a2s .  c  om
        config = new PropertiesConfiguration("report-config.properties");
    } catch (Exception e) {
        throw new IllegalStateException("configuration error", e);
    }
}

From source file:de.sub.goobi.config.ConfigMain.java

private static PropertiesConfiguration getConfig() {
    if (config == null) {
        synchronized (ConfigMain.class) {
            PropertiesConfiguration initialized = config;
            if (initialized == null) {
                PropertiesConfiguration.setDefaultListDelimiter('&');
                try {
                    initialized = new PropertiesConfiguration(FileNames.CONFIG_FILE);
                } catch (ConfigurationException e) {
                    if (myLogger.isEnabledFor(Level.WARN)) {
                        myLogger.warn("Loading of " + FileNames.CONFIG_FILE
                                + " failed. Trying to start with empty configuration.", e);
                    }// w w w.  j  a  va  2s .  co  m
                    initialized = new PropertiesConfiguration();
                }
                initialized.setListDelimiter('&');
                initialized.setReloadingStrategy(new FileChangedReloadingStrategy());
                config = initialized;
            }
        }
    }
    return config;
}

From source file:eu.optimis.serviceproviderriskassessmenttool.core.configration.ConfigManager.java

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

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

    return config;
}

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

@BeforeClass
public static void setup() throws Exception {
    try {/*from  w w  w .  j  a  v a2s.c  om*/
        configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE);
    } catch (ConfigurationException e) {
        throw new BootstrapException("bad config", e);
    }

    HadoopBootstrap.INSTANCE.startAll();

}

From source file:eu.optimis.infrastructureproviderriskassessmenttool.core.configration.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;/* ww w.j a  v  a2 s.  co  m*/
    PropertiesConfiguration config = null;

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

    return config;
}

From source file:ch.bfh.iam.oauth.init.Config.java

protected void initialize() throws ConfigurationException {
    if (!isInitilized) {
        URL url = Config.class.getResource("/properties/authorization-server.properties");
        config = new PropertiesConfiguration(url.getFile());
        isInitilized = true;//from  w w  w.  jav  a  2 s. com
    }
}

From source file:net.emotivecloud.scheduler.drp4one.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;/*from   www  . ja  v  a 2s. co  m*/
    PropertiesConfiguration config = null;

    try {
        filePath = getConfigFilePath(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:eu.optimis.ics.core.util.PropertiesReader.java

/**
 * Gets the properties configuration//ww  w  . j a  va  2  s  . c om
 * @param configFile the properties file
 * @return an object
 */
public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {

    String filePath = null;
    PropertiesConfiguration config = null;

    try {
        filePath = getConfigFilePath(configFile);
        config = new PropertiesConfiguration(filePath);
    } catch (ConfigurationException ex) {
        log.error(
                "ics.core.util.PropertiesReader.getPropertiesConfiguration(): Error reading configuration file "
                        + filePath + ex.getMessage());
        //ex.printStackTrace();
    }

    return config;
}

From source file:com.dhenton9000.testng.env.ReadEnvTest.java

@Test
public void testEnvFile() throws ConfigurationException {

    PropertiesConfiguration config = new PropertiesConfiguration("env.properties");
    assertNotNull(config);/*  w  w  w.  ja  va 2 s  .  co m*/
    LOG.info("ENVIRONMENT @@@@ " + config.getString("env"));

}