Example usage for org.apache.commons.configuration XMLConfiguration load

List of usage examples for org.apache.commons.configuration XMLConfiguration load

Introduction

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

Prototype

private void load(InputSource source) throws ConfigurationException 

Source Link

Document

Loads a configuration file from the specified input source.

Usage

From source file:uk.ac.ebi.fg.biostudies.app.ApplicationPreferences.java

private void load() {
    // todo: what to do if file is not there? must be a clear error message + shutdown
    InputStream prefsStream = null;
    try {/*from ww  w .  java  2s .  c  om*/
        XMLConfiguration.setDefaultListDelimiter('\uffff');
        XMLConfiguration xmlConfig = new XMLConfiguration();

        prefsStream = Application.getInstance().getResource("/WEB-INF/classes/" + prefsFileName + ".xml")
                .openStream();
        xmlConfig.load(prefsStream);

        prefs = xmlConfig;
    } catch (Exception x) {
        logger.error("Caught an exception:", x);
    } finally {
        if (null != prefsStream) {
            try {
                prefsStream.close();
            } catch (IOException x) {
                logger.error("Caught an exception:", x);
            }
        }
    }
}