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

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

Introduction

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

Prototype

public Configuration subset(String prefix) 

Source Link

Usage

From source file:org.apache.qpid.server.configuration.plugins.AbstractConfigurationTest.java

@Override
public void setUp() throws Exception {
    // Test does not directly use the AppRegistry but the configured broker
    // is required for the correct ConfigurationPlugin processing
    super.setUp();
    XMLConfiguration xmlconfig = new XMLConfiguration();
    xmlconfig.addProperty("base.element[@property]", "property");
    xmlconfig.addProperty("base.element.name", "name");
    // We make these strings as that is how they will be read from the file.
    xmlconfig.addProperty("base.element.positiveLong", String.valueOf(POSITIVE_LONG));
    xmlconfig.addProperty("base.element.negativeLong", String.valueOf(NEGATIVE_LONG));
    xmlconfig.addProperty("base.element.boolean", String.valueOf(true));
    xmlconfig.addProperty("base.element.double", String.valueOf(DOUBLE));
    for (int i = 0; i < LIST_SIZE; i++) {
        xmlconfig.addProperty("base.element.list", i);
    }/*from   w ww .  j a v  a  2  s  .  c  o  m*/

    //Use a composite configuration as this is what our broker code uses.
    CompositeConfiguration composite = new CompositeConfiguration();
    composite.addConfiguration(xmlconfig);

    _plugin = new TestConfigPlugin();

    try {
        _plugin.setConfiguration("base.element", composite.subset("base.element"));
    } catch (ConfigurationException e) {
        e.printStackTrace();
        fail(e.toString());
    }

}

From source file:org.rzo.yajsw.wrapper.FileUtils.java

/**
 * The main method.//w w  w  . j  a v  a 2 s.c  o m
 * 
 * @param args
 *            the arguments
 */
public static void main(String[] args) {
    try {
        // String
        // fileName=FilenameUtils.separatorsToSystem("C:\\init\\MOBILEguard\\yajsw/lib/jvmstat/*.jar");
        // System.out.println("FileName: "+fileName);
        CompositeConfiguration compConfig = new CompositeConfiguration();
        AbstractConfiguration configuraton = new BaseConfiguration();
        compConfig.addConfiguration(new EnvironmentConfiguration());
        configuraton.setProperty("wrapper.java.classpath.1", "${VERSANT_ROOT}/lib/jvi.*jar");
        configuraton.setProperty("wrapper.java.classpath.2", "${GROOVY_HOME}/lib/*.jar");
        compConfig.addConfiguration(configuraton);
        System.out.println("Configuration: " + ConfigurationConverter.getProperties(compConfig));
        System.out
                .println("subset: " + ConfigurationConverter.getProperties(compConfig.subset("wrapper.java")));

        // Collection files=FileUtils.getFiles("../..",
        // "C:/versant/7_0_1/lib/jvi*.jar");
        // Collection collection=
        // org.apache.commons.io.FileUtils.listFiles(new File("C:/"),
        // new WildcardFileFilter("jvi*.jar"), new
        // WildcardFileFilter("*jar"));
        // File[] files= new
        // File("C:").listFiles((FilenameFilter)FileFilterUtils.nameFileFilter("C:/versant/7_0_1/lib/jvi*.jar"));

        //         
        // FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar");
        // System.out.println("FileList="+
        // FileUtils.getFiles("C:/versant/7_0_1/lib/", "jvi*.jar"));
        // java.util.Arrays.asList(files));
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}

From source file:org.wso2.andes.configuration.qpid.plugins.ConfigurationPluginTest.java

@Override
public void setUp() throws Exception {
    // Test does not directly use the AppRegistry but the configured broker
    // is required for the correct ConfigurationPlugin processing
    super.setUp();
    XMLConfiguration xmlconfig = new XMLConfiguration();
    xmlconfig.addProperty("base.element[@property]", "property");
    xmlconfig.addProperty("base.element.name", "name");
    // We make these strings as that is how they will be read from the file.
    xmlconfig.addProperty("base.element.positiveLong", String.valueOf(POSITIVE_LONG));
    xmlconfig.addProperty("base.element.negativeLong", String.valueOf(NEGATIVE_LONG));
    xmlconfig.addProperty("base.element.boolean", String.valueOf(true));
    xmlconfig.addProperty("base.element.double", String.valueOf(DOUBLE));
    for (int i = 0; i < LIST_SIZE; i++) {
        xmlconfig.addProperty("base.element.list", i);
    }//from www  . j av  a  2 s . c  o m

    //Use a composite configuration as this is what our broker code uses.
    CompositeConfiguration composite = new CompositeConfiguration();
    composite.addConfiguration(xmlconfig);

    _plugin = new ConfigPlugin();

    try {
        _plugin.setConfiguration("base.element", composite.subset("base.element"));
    } catch (ConfigurationException e) {
        e.printStackTrace();
        fail(e.toString());
    }

}