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

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

Introduction

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

Prototype

public XMLConfiguration() 

Source Link

Document

Creates a new instance of XMLConfiguration.

Usage

From source file:org.apache.james.server.core.configuration.FileConfigurationProvider.java

public static XMLConfiguration getConfig(InputStream configStream) throws ConfigurationException {
    PropertiesConfiguration.setDefaultListDelimiter(SEMICOLON);
    XMLConfiguration config = new XMLConfiguration();
    config.setDelimiterParsingDisabled(true);
    config.setAttributeSplittingDisabled(true);
    config.load(configStream);//from w w  w  . j a  v  a  2s .c o m
    return config;
}

From source file:org.apache.james.utils.FileConfigurationProvider.java

private XMLConfiguration getConfig(InputStream configStream) throws ConfigurationException {
    XMLConfiguration config = new XMLConfiguration();
    config.setDelimiterParsingDisabled(true);
    config.setAttributeSplittingDisabled(true);
    config.load(configStream);/*from   w w  w.  j av a2s.  c  o  m*/
    return config;
}

From source file:org.apache.maven.doxia.module.fo.FoConfiguration.java

/**
 * Constructor.// w w  w .  j  a v a 2  s.c  om
 */
public FoConfiguration() {
    this.config = new XMLConfiguration();

    // necessary because some attributes contain commas:
    config.setDelimiterParsingDisabled(true);

    loadDefaultConfig();
}

From source file:org.apache.metron.helpers.topology.SettingsLoader.java

public static Map<String, JSONObject> loadRegexAlerts(String config_path)
        throws ConfigurationException, ParseException {
    XMLConfiguration alert_rules = new XMLConfiguration();
    alert_rules.setDelimiterParsingDisabled(true);
    alert_rules.load(config_path);/*ww  w . ja v a2 s  . co  m*/

    //int number_of_rules = alert_rules.getList("rule.pattern").size();

    String[] patterns = alert_rules.getStringArray("rule.pattern");
    String[] alerts = alert_rules.getStringArray("rule.alert");

    JSONParser pr = new JSONParser();
    Map<String, JSONObject> rules = new HashMap<String, JSONObject>();

    for (int i = 0; i < patterns.length; i++)
        rules.put(patterns[i], (JSONObject) pr.parse(alerts[i]));

    return rules;
}

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  ava2 s. com

    //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.apache.qpid.server.configuration.VirtualHostConfigurationTest.java

@Override
public void setUp() throws Exception {
    super.setUp();
    BrokerTestHelper.setUp();//from w ww . j av a  2  s. c  o  m
    _configXml = new XMLConfiguration();
    _configXml.addProperty("virtualhosts.virtualhost(-1).name", getName());
    _configXml.addProperty("virtualhosts.virtualhost(-1)." + getName() + ".store.class",
            TestableMemoryMessageStore.class.getName());
    _virtualHostRegistry = new VirtualHostRegistry();
    _broker = mock(Broker.class);
    when(_broker.getAttribute(Broker.HOUSEKEEPING_CHECK_PERIOD)).thenReturn(30000l);
}

From source file:org.apache.qpid.server.queue.AMQQueueFactoryTest.java

@Override
public void setUp() throws Exception {
    super.setUp();

    BrokerTestHelper.setUp();//  w w w  .  jav a  2s  .c om
    XMLConfiguration configXml = new XMLConfiguration();
    configXml.addProperty("store.class", TestableMemoryMessageStore.class.getName());

    Broker broker = BrokerTestHelper.createBrokerMock();
    if (getName().equals("testDeadLetterQueueDoesNotInheritDLQorMDCSettings")) {
        when(broker.getAttribute(Broker.MAXIMUM_DELIVERY_ATTEMPTS)).thenReturn(5);
        when(broker.getAttribute(Broker.DEAD_LETTER_QUEUE_ENABLED)).thenReturn(true);
    }

    _virtualHost = BrokerTestHelper
            .createVirtualHost(new VirtualHostConfiguration(getName(), configXml, broker));

    _queueRegistry = _virtualHost.getQueueRegistry();

}

From source file:org.apache.qpid.server.store.berkeleydb.BDBHAMessageStoreTest.java

public void setUp() throws Exception {
    super.setUp();

    _workDir = TMP_FOLDER + File.separator + getName();
    _host = InetAddress.getByName("localhost").getHostAddress();
    _groupName = "group" + getName();
    _masterPort = -1;/*  w w  w  .  jav  a 2s  .  c  om*/

    FileUtils.delete(new File(_workDir), true);
    _configXml = new XMLConfiguration();

    BrokerTestHelper.setUp();
}

From source file:org.apache.qpid.server.store.MessageStoreQuotaEventsTestBase.java

@Override
public void setUp() throws Exception {
    super.setUp();

    _storeLocation = new File(new File(TMP_FOLDER), getTestName());
    FileUtils.delete(_storeLocation, true);

    XMLConfiguration config = new XMLConfiguration();
    config.addProperty("environment-path", _storeLocation.getAbsolutePath());
    applyStoreSpecificConfiguration(config);

    _store = createStore();/*from  w w w.  j  ava2s.  c o m*/
    _store.configureConfigStore("test", null, config);

    _transactionResource = UUID.randomUUID();
    _events = new ArrayList<Event>();
    _store.addEventListener(this, Event.PERSISTENT_MESSAGE_SIZE_OVERFULL,
            Event.PERSISTENT_MESSAGE_SIZE_UNDERFULL);
}

From source file:org.apache.qpid.systest.rest.VirtualHostRestTest.java

private XMLConfiguration createAndSaveVirtualHostConfiguration(String hostName, File configFile,
        String storeLocation) throws ConfigurationException {
    XMLConfiguration testConfiguration = new XMLConfiguration();
    testConfiguration.setProperty("virtualhosts.virtualhost." + hostName + ".store.class",
            getTestProfileMessageStoreClassName());
    testConfiguration.setProperty("virtualhosts.virtualhost." + hostName + ".store.environment-path",
            storeLocation);/*from   www. ja v a  2 s . c  o  m*/
    testConfiguration.save(configFile);
    return testConfiguration;
}