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:loc.zenoss.util.DeviceFactory.java

private DeviceFactory() {
    try {/*from   www.ja  v  a2 s .  c  om*/
        config = new PropertiesConfiguration("devices.properties");
    } catch (ConfigurationException ex) {
        Logger.getLogger(DeviceFactory.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:eu.optimis.ecoefficiencytool.core.tools.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;//from  w  w w. j  av a2s . c o  m
    PropertiesConfiguration config = null;

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

    return config;
}

From source file:eu.optimis.ip.gui.client.resources.ConfigManager.java

public static PropertiesConfiguration getPropertiesConfiguration(String configFile) {
    String filePath = null;//  w w  w  .  j a v a2  s  . co 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.OozieBootstrapTest.java

@BeforeClass
public static void setup() throws BootstrapException {

    try {// w ww.  j  a  v a2 s.  c  o m
        configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE);
    } catch (ConfigurationException e) {
        throw new BootstrapException("bad config", e);
    }

    HadoopBootstrap.INSTANCE.startAll();

}

From source file:com.dhenton9000.selenium.generic.AppspotTestBase.java

public AppspotTestBase() {
    Configuration config = null;/*from  w w w .ja va  2 s .  c o  m*/
    LOG.debug("using properties file");
    try {
        config = new PropertiesConfiguration("env.properties");
        LOG.debug("reading config in " + this.getClass().getName());
    } catch (ConfigurationException ex) {
        LOG.info("did not find env.properties file");
    }

    appspotRepository = new AppspotRepository(config);
}

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

@BeforeClass
public static void setup() throws BootstrapException {
    HadoopBootstrap.INSTANCE.startAll();

    try {/* w w w  .j  av a2  s . c om*/
        configuration = new PropertiesConfiguration(HadoopUnitConfig.DEFAULT_PROPS_FILE);
    } catch (ConfigurationException e) {
        throw new BootstrapException("bad config", e);
    }

}

From source file:com.jorge.propiedades.CorreoConfiguracion.java

public CorreoConfiguracion() {
    try {//from  w  w  w . j a  va  2s.co  m
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/Correo.properties");
        if (config.getProperty("correo.correo") == null) {
            config.setProperty("correo.correo", "jorjoluiso@gmail.com");
            config.save();
        }
        if (config.getProperty("correo.clave") == null) {
            config.setProperty("correo.clave", "suclave");
            config.save();
        }
        correo = (String) config.getProperty("correo.correo");
        clave = (String) config.getProperty("correo.clave");
    } catch (ConfigurationException ex) {
        Logger.getLogger(CorreoConfiguracion.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:com.keybox.service.mail.MailConfigLoader.java

/**
 * Constructor for MailConfigLoader/*from  ww w.  j  a va  2s  .  com*/
 *  
 * @param mailfile Filename from the Mail-Properties in resources
 */
public MailConfigLoader(String mailfile) {
    try {
        mailprop = new PropertiesConfiguration(
                MailConfigLoader.class.getClassLoader().getResource(mailfile).getPath());
        default_mailprop = new PropertiesConfiguration(
                MailConfigLoader.class.getClassLoader().getResource("mail.properties").getPath());
    } catch (ConfigurationException e) {
        e.printStackTrace();
    }
}

From source file:TestExtractor.java

@Test
public void TestConf() {

    try {//from  ww w . j  a  va  2 s.com

        Configuration conf = new PropertiesConfiguration(
                System.getProperty("user.dir") + "/src/test/resources/xwiki.cfg");

        int ldapPort = conf.getInt("xwiki.authentication.ldap.port", 389);

        String tmpldap_server = conf
                .getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_server");
        //String tmpldap_base_DN = conf.getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_base_DN");
        String tmpBinDN = conf.getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_bind_DN");
        String tmpldap_bind_pass = conf
                .getString("xwiki.authentication.trustedldap.remoteUserMapping.ldap_bind_pass");
        String[] ldap_server = StringUtils.split(tmpldap_server, "|");
        //String[] ldap_base_DN = StringUtils.split(tmpldap_base_DN,"|");
        String[] BinDN = StringUtils.split(tmpBinDN, "|");
        String[] ldap_bind_pass = StringUtils.split(tmpldap_bind_pass, "|");
        //assertTrue(ldap_server.length == ldap_base_DN.length);
        assertTrue(BinDN.length == ldap_bind_pass.length);
        assertTrue(ldap_server.length == ldap_bind_pass.length);
        assertTrue(ldap_server.length == 6);
        assertTrue(ldapPort == 389);

        String className = conf.getString("xwiki.authentication.ldap.ssl.secure_provider",
                "com.sun.net.ssl.internal.ssl.Provider");
        assertEquals(className, "com.sun.net.ssl.internal.ssl.Provider");
        assertEquals(conf.getInt("xwiki.authentication.ldap.timeout", 500), 500);
        assertEquals(conf.getInt("xwiki.authentication.ldap.maxresults", 10), 10);
    } catch (ConfigurationException ex) {
        Logger.getLogger(TestExtractor.class.getName()).log(Level.SEVERE, null, ex);
        fail(ex.getLocalizedMessage());
    }

}

From source file:com.jorge.propiedades.General.java

public General() {
    try {/*from ww w.j ava  2s .co m*/
        PropertiesConfiguration config = new PropertiesConfiguration("./quijotelu/General.properties");
        if (config.getProperty("general.BaseDatos") == null) {
            /*
             Conexin con base de datos:
             oracle, sqlserver
             */
            config.setProperty("general.BaseDatos", "oracle");
            config.save();
        }
        if (config.getProperty("general.Publicidad") == null) {
            config.setProperty("general.Publicidad", "si");
            config.save();
        }
        if (config.getProperty("general.Nombre") == null) {
            config.setProperty("general.Nombre", "QuijoteLu");
            config.save();
        }
        BaseDatos = (String) config.getProperty("general.BaseDatos");
        Publicidad = (String) config.getProperty("general.Publicidad");
        Nombre = (String) config.getProperty("general.Nombre");

    } catch (ConfigurationException ex) {
        Logger.getLogger(General.class.getName()).log(Level.SEVERE, null, ex);
    }
}