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.impetus.kundera.ycsb.YCSBBaseTest.java

/**
 * @throws java.lang.Exception//from  ww  w  . ja v  a2s.c o m
 */
protected void setUp() throws Exception {
    propsFileName = System.getProperty("fileName");
    // System.out.println(propsFileName);
    config = new PropertiesConfiguration(propsFileName);
    ycsbJarLocation = config.getString("ycsbjar.location");
    workLoadPackage = config.getString("workload.dir", "src/main/resources/workloads");
}

From source file:com.chicm.cmraft.common.CmRaftConfiguration.java

public CmRaftConfiguration() throws ConfigurationException {
    conf = new PropertiesConfiguration("cmraft.properties");

}

From source file:fr.dudie.acrachilisync.utils.AcraToChiliprojectSyncHandlerTest.java

@BeforeClass
public static void setup() throws ConfigurationException {

    final Configuration config = new PropertiesConfiguration("acrachilisync.properties");
    ConfigurationManager.getInstance(config);
}

From source file:net.orpiske.ssps.common.repository.RepositorySettings.java

/**
 * Initializes the configuration object/*from  w w  w. j  av  a2s .c om*/
 * 
 * @throws SspsException if the configuration file is not found, if the configuration
 * file is not parseable or if unable to create directories
 */
public static void initConfiguration() throws SspsException {

    String repositoryPath = RepositoryUtils.getUserRepository();
    String path = repositoryPath + File.separator + "repositories.conf";

    if (config == null) {

        File file = new File(path);

        if (!file.exists()) {

            try {
                if (!file.getParentFile().mkdirs()) {
                    throw new SspsException("Unable to create parent directories");
                }

                if (!file.createNewFile()) {
                    throw new SspsException("Unable to create repository settings file");
                }
            } catch (IOException e) {
                e.printStackTrace();
            }

            try {
                config = new PropertiesConfiguration(path);
            } catch (ConfigurationException e) {
                throw new SspsException("Unable to load repository configuration: " + e.getMessage(), e);
            }

            try {
                config.save();
            } catch (ConfigurationException e) {
                throw new SspsException("Unable to save repository configuration: " + e.getMessage(), e);
            }
        } else {
            try {
                config = new PropertiesConfiguration(path);
            } catch (ConfigurationException e) {
                throw new SspsException("Unable to load repository configuration: " + e.getMessage(), e);
            }
        }

    }
}

From source file:com.dal.a.ui.DalAppConsole.java

public DalAppConsole() {
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setDefaultLookAndFeelDecorated(true);

    try {//from w  w  w  . j a  v  a 2s .  co m
        config = new PropertiesConfiguration(CONFIG_FILE);
    } catch (ConfigurationException theX) {
        LOG.error("Config Failure", theX);
        throw new RuntimeException("Error reading in configuration", theX);
    }

    coreInit();
    coreSetup();
    init();
    setup();
    coreCleanup();
}

From source file:de.l3s.dlg.ncbikraken.Configuration.java

/**
 * The hidden constructor for this utility class.
 * @throws ConfigurationException /* w w w .  j av a 2  s . c  o  m*/
 */
public void init(String configFile) throws ConfigurationException {
    this.config = new PropertiesConfiguration(configFile);
}

From source file:com.dhenton9000.phantom.js.PhantomJSBase.java

public PhantomJSBase(int portNumber, String appContextStr) {

    port = portNumber;//from   ww  w  . j  a  v a2s . c o  m
    appContext = appContextStr;
    LOG.debug("using properties file");
    try {
        config = new PropertiesConfiguration("env.properties");
        LOG.debug("reading config in " + this.getClass().getName());
        driver = configureDriver(getConfig());

        this.automation = new GenericAutomationRepository(driver, getConfig());
    } catch (ConfigurationException | IOException ex) {
        throw new RuntimeException(ex);

    }
}

From source file:com.liferay.sync.engine.util.PropsUtil.java

private PropsUtil() {
    try {/*from w w  w. j  a v a2  s. com*/
        Configuration configuration = new PropertiesConfiguration("sync.properties");

        _compositeConfiguration.addConfiguration(configuration);
    } catch (ConfigurationException ce) {
        _logger.error("Unable to initialize", ce);
    }
}

From source file:com.trivago.mail.pigeon.configuration.Settings.java

public static Settings create(String fileName, boolean nocache) {
    log.trace("Settings instance requested");
    if (fileName == null && instance != null && !nocache) {
        log.trace("Returning cached instance");
        return instance;
    } else if (fileName == null && instance == null) {
        log.trace("Requesting ENV PIDGEON_CONFIG as path to properties as fileName was null");

        String propertyFileName = System.getenv("PIDGEON_CONFIG");

        if (propertyFileName == null || propertyFileName.equals("")) {
            log.warn(/*from   w  w w  . j  a  v  a2 s  .  c  om*/
                    "ENV is empty and no filename was given -> no config properties found! Using configuration.properties");
        }

        URL resource = Thread.currentThread().getContextClassLoader().getResource("configuration.properties");
        propertyFileName = resource.toExternalForm();
        instance = new Settings();

        try {
            instance.setConfiguration(new PropertiesConfiguration(propertyFileName));
        } catch (ConfigurationException e) {
            log.error(e);
            throw new ConfigurationRuntimeException(e);
        }
    } else if (fileName != null && instance == null) {
        log.trace("Requesting file properties from " + fileName);
        instance = new Settings();

        try {
            instance.setConfiguration(new PropertiesConfiguration(fileName));
        } catch (ConfigurationException e) {
            log.error(e);
            throw new ConfigurationRuntimeException(e);
        }
    }
    return instance;
}

From source file:ai.grakn.factory.TitanHadoopInternalFactory.java

private static Configuration buildConfig(String name, String pathToConfig) {
    try {//from www.j  a  va2  s. co m
        PropertiesConfiguration properties = new PropertiesConfiguration(new File(pathToConfig));
        properties.setProperty(CLUSTER_KEYSPACE, name);
        properties.setProperty(INPUT_KEYSPACE, name);
        return properties;
    } catch (ConfigurationException e) {
        throw new IllegalArgumentException(ErrorMessage.INVALID_PATH_TO_CONFIG.getMessage(pathToConfig), e);
    }
}