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

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

Introduction

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

Prototype

public List getList(String key, List defaultValue) 

Source Link

Usage

From source file:org.apache.whirr.service.elasticsearch.ElasticSearchConfigurationBuilder.java

/**
 * Use the native EC2 discovery module on AWS
 *//*  w  w w  .  j av a 2  s  .com*/
private static void addDefaultsForEC2(ClusterSpec spec, CompositeConfiguration config) {
    config.addProperty("es.discovery.type", "ec2");
    if (!config.containsKey("es.cloud.aws.access_key")) {
        config.addProperty("es.cloud.aws.access_key", spec.getIdentity());
    }
    if (!config.containsKey("es.cloud.aws.secret_key")) {
        config.addProperty("es.cloud.aws.secret_key", spec.getCredential());
    }
    if (!config.getList("es.plugins", Lists.newLinkedList())
            .contains("elasticsearch/elasticsearch-cloud-aws/1.5.0")) {
        config.addProperty("es.plugins", "elasticsearch/elasticsearch-cloud-aws/1.5.0");
    }
}

From source file:org.xwiki.rendering.test.cts.TestDataParser.java

/**
 * Parse Test configuration by looking for a {@code config.properties} file in the Syntax directory.
 *
 * @param syntaxDirectory the syntax directory under which to look for the configuration file
 * @param ctsRootPackageName the root of the CTS resources
 * @param classLoader the class loader from which the test configuration is read from
 * @return the configuration//from  w ww  .  j  a  va  2  s.co m
 * @throws Exception in case of error while reading test configuration
 */
public TestDataConfiguration parseTestConfiguration(String syntaxDirectory, String ctsRootPackageName,
        ClassLoader classLoader) throws Exception {
    TestDataConfiguration configuration = new TestDataConfiguration();

    CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
    addConfigurationData(compositeConfiguration, ctsRootPackageName, classLoader);
    addConfigurationData(compositeConfiguration, syntaxDirectory, classLoader);

    // TODO: Remove these unsafe casts, need to find out how to do that nicely...
    configuration.notApplicableTests = (List<String>) (List<?>) compositeConfiguration
            .getList("notApplicableTests", Collections.emptyList());
    configuration.failingTests = (List<String>) (List<?>) compositeConfiguration.getList("failingTests",
            Collections.emptyList());
    configuration.testDescriptions = compositeConfiguration.getProperties("testDescriptions", new Properties());
    configuration.inheritSyntax = compositeConfiguration.getString("inheritSyntax");

    return configuration;
}