Example usage for org.apache.commons.configuration CompositeConfiguration setListDelimiter

List of usage examples for org.apache.commons.configuration CompositeConfiguration setListDelimiter

Introduction

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

Prototype

public void setListDelimiter(char listDelimiter) 

Source Link

Document

Sets the character that is used as list delimiter.

Usage

From source file:velo.common.SysConf.java

/**
 * Returns a Configuration object for managing system configuration properties
 * @return Configuration object//from ww  w. j  a  v  a  2s .c o m
 */
public static Configuration getSysConf() {
    if (staticConfig == null) {
        try {
            System.out.println("(!)Factoring Global Configuration Object...");
            //URL iniConf = SysConf.class.getClassLoader().getResource(veloINIConfFileName);
            //URL xmlConf = SysConf.class.getClassLoader().getResource(veloXMLConfFileName);

            //String xmlConfFile = System.getProperty("veloSysDir") + "/conf/" + veloXMLConfFileName;
            //String iniConfFile = System.getProperty("veloSysDir") + "/conf/" + veloINIConfFileName;

            /*
            if ( (iniConf == null) || (xmlConf == null) ) {
                System.err.println("Could not load configuration files, dying...");
                return null;
            }
             */

            //01-jul-07(Asaf), Removed root conf, it is just another file that is accessible by the user and is not neccessary
            //Only got two conf files, added them by code
            //factory = new ConfigurationFactory(sysconf.getFile());
            //Configuration config = factory.getConfiguration();

            CompositeConfiguration config = new CompositeConfiguration();
            config.setDelimiterParsingDisabled(true);
            config.setListDelimiter("|".charAt(0));
            config.setDelimiter("|".charAt(0));

            //for tests
            //config.addConfiguration(new PropertiesConfiguration("c:/temp/velo/velo_sys/conf/velo_config.ini"));
            //config.addConfiguration(new XMLConfiguration("c:/temp/velo/velo_sys/conf/velo_config.xml"));

            String iniConfFile = getVeloINIConfFileName();
            String xmlConfFile = getVeloXMLConfFileName();
            String xmlConfExtFile = getVeloExtXMLConfFileName();

            config.addConfiguration(new PropertiesConfiguration(iniConfFile));
            XMLConfiguration xmlConf = new XMLConfiguration(xmlConfFile);
            XMLConfiguration xmlExtConf = new XMLConfiguration(xmlConfExtFile);
            xmlConf.setDelimiterParsingDisabled(true);
            xmlConf.setListDelimiter("|".charAt(0));
            xmlConf.setDelimiter("|".charAt(0));

            xmlExtConf.setDelimiterParsingDisabled(true);
            xmlExtConf.setListDelimiter("|".charAt(0));
            xmlExtConf.setDelimiter("|".charAt(0));

            config.addConfiguration(xmlConf);
            config.addConfiguration(xmlExtConf);

            //TODO: Fix this for JBOSS
            //config.addConfiguration(new PropertiesConfiguration(iniConf.getFile()));
            //config.addConfiguration(new XMLConfiguration(xmlConf.getFile()));

            return config;
        } catch (ConfigurationException ce) {
            System.out.println("Could not read ROOT configuration file due to: " + ce.getMessage());
            return null;
        }
    }

    return staticConfig;

}