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

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

Introduction

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

Prototype

BaseConfiguration

Source Link

Usage

From source file:nl.salp.warcraft4j.config.Warcraft4jConfigBuilder.java

/**
 * Build a PropertyWarcraft4jConfig instance from the builder values.
 *
 * @return The PropertyWarcraft4jConfig instance.
 *
 * @throws Warcraft4jConfigException When the configuration values were invalid.
 *//*from ww  w  .  j  a  va 2  s  .  com*/
public PropertyWarcraft4jConfig build() throws Warcraft4jConfigException {
    Configuration config = new BaseConfiguration();
    config.addProperty(PropertyWarcraft4jConfig.ONLINE_KEY, online);
    config.addProperty(PropertyWarcraft4jConfig.WOW_DIR_KEY, wowDir);
    config.addProperty(PropertyWarcraft4jConfig.CACHE_KEY, caching);
    config.addProperty(PropertyWarcraft4jConfig.CACHE_DIR_KEY, cacheDir);
    config.addProperty(PropertyWarcraft4jConfig.LOCALE_KEY, locale);
    config.addProperty(PropertyWarcraft4jConfig.REGION_KEY, region);
    config.addProperty(PropertyWarcraft4jConfig.BRANCH_KEY, branch);
    return new PropertyWarcraft4jConfig(config);
}

From source file:org.ambraproject.service.xml.XMLServiceTest.java

@BeforeClass
protected void setUp() throws Exception {

    DocumentBuilderFactory documentBuilderfactory = DocumentBuilderFactory
            .newInstance("org.apache.xerces.jaxp.DocumentBuilderFactoryImpl", getClass().getClassLoader());
    documentBuilderfactory.setNamespaceAware(true);
    documentBuilderfactory.setValidating(false);
    documentBuilderfactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
    Map<String, String> xmlFactoryProperties = new HashMap<String, String>();
    xmlFactoryProperties.put("javax.xml.transform.TransformerFactory", "net.sf.saxon.TransformerFactoryImpl");
    xmlFactoryProperties.put("javax.xml.transform.Transformer", "net.sf.saxon.Controller");

    XMLUnit.setControlDocumentBuilderFactory(documentBuilderfactory);
    XMLUnit.setTestDocumentBuilderFactory(documentBuilderfactory);
    XMLUnit.setIgnoreComments(true);//www  .  j  ava2s  . co  m
    XMLUnit.setIgnoreWhitespace(true);
    XMLUnit.setIgnoreAttributeOrder(true);
    XMLUnit.setTransformerFactory("net.sf.saxon.TransformerFactoryImpl");
    XMLUnit.setXSLTVersion("2.0");

    Configuration configiration = new BaseConfiguration();
    configiration.setProperty("ambra.platform.appContext", "test-context");

}

From source file:org.ambud.marauder.sink.MarauderTitanSink.java

@Override
public void configure(Context context) {
    Configuration conf = new BaseConfiguration();
    conf.setProperty("storage.backend", "hbase");
    conf.setProperty("storage.hostname", context.getString("servers", "192.168.1.20"));
    //      conf.setProperty("storage.index.t.backend", "lucene");
    //      conf.setProperty("storage.index.t.directory", "/tmp/index");
    conf.setProperty("storage.batch-loading", "true");
    batchSize = context.getInteger("batchSize", 1000);
    g = TitanFactory.open(conf);//from ww w.j ava 2 s.c  o  m
    g.makeKey("t").dataType(String.class).indexed(Vertex.class).make();
    g.makeKey("o").dataType(Integer.class).indexed(Vertex.class).make();
    g.makeKey("s").dataType(Long.class).indexed(Vertex.class).make();
    g.makeKey("n").dataType(String.class).indexed(Vertex.class).make();
    g.makeLabel("dil").unidirected().manyToMany().make();
    g.makeLabel("sil").unidirected().manyToMany().make();
    g.makeLabel("dpl").unidirected().manyToMany().make();
    g.makeLabel("spl").unidirected().manyToMany().make();
    g.makeLabel("isl").unidirected().manyToMany().make();
    g.makeLabel("hl").unidirected().manyToMany().make();
    g.makeLabel("evl").unidirected().manyToMany().make();
    g.makeLabel("il").unidirected().manyToMany().make();
    g.makeLabel("tl").unidirected().manyToMany().make();
    g.makeLabel("gil").unidirected().manyToMany().make();
    g.commit();
}

From source file:org.apache.archiva.configuration.DefaultArchivaConfiguration.java

private Registry createDefaultConfigurationFile() throws RegistryException {
    // TODO: may not be needed under commons-configuration 1.4 - check

    String contents = "<configuration />";

    String fileLocation = userConfigFilename;

    if (!writeFile("user configuration", userConfigFilename, contents)) {
        fileLocation = altConfigFilename;
        if (!writeFile("alternative configuration", altConfigFilename, contents)) {
            throw new RegistryException("Unable to create configuration file in either user ["
                    + userConfigFilename + "] or alternative [" + altConfigFilename
                    + "] locations on disk, usually happens when not allowed to write to those locations.");
        }/* w  w  w.  jav  a2s. c  om*/
    }

    // olamy hackish I know :-)
    contents = "<configuration><xml fileName=\"" + fileLocation
            + "\" config-forceCreate=\"true\" config-name=\"org.apache.archiva.user\"/>" + "</configuration>";

    ((CommonsConfigurationRegistry) registry).setProperties(contents);

    registry.initialize();

    for (RegistryListener regListener : registryListeners) {
        addRegistryChangeListener(regListener);
    }

    triggerEvent(ConfigurationEvent.SAVED);

    Registry section = registry.getSection(KEY + ".user");
    return section == null ? new CommonsConfigurationRegistry(new BaseConfiguration()) : section;
}

From source file:org.apache.falcon.metadata.MetadataMappingService.java

public static Configuration getConfiguration() {
    Configuration graphConfig = new BaseConfiguration();

    Properties configProperties = StartupProperties.get();
    for (Map.Entry entry : configProperties.entrySet()) {
        String name = (String) entry.getKey();
        if (name.startsWith(FALCON_PREFIX)) {
            String value = (String) entry.getValue();
            name = name.substring(FALCON_PREFIX.length());
            graphConfig.setProperty(name, value);
        }//from w w w .j av  a  2 s  . co m
    }

    return graphConfig;
}

From source file:org.apache.james.jmap.methods.integration.SpamAssassinModule.java

private MailetConfigImpl spamAssassinMailetConfig() {
    BaseConfiguration baseConfiguration = new BaseConfiguration();
    Host host = Host.from(spamAssassinExtension.getSpamAssassin().getIp(),
            spamAssassinExtension.getSpamAssassin().getBindingPort());
    baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_HOST,
            host.getHostName());//  www  .  j  ava2 s  .  co m
    baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_PORT, host.getPort());

    MailetConfigImpl mailetConfig = new MailetConfigImpl();
    mailetConfig.setConfiguration(baseConfiguration);
    return mailetConfig;
}

From source file:org.apache.marmotta.platform.backend.titan.TitanStoreProvider.java

/**
 * Create a TitanGraph from the configuration
 *
 * @return TitanGraph//from   w  w w  . ja v a  2  s  .  c  o  m
 */
public TitanGraph createTitanGraph() {
    Configuration conf = new BaseConfiguration();
    List<String> titanConf = configurationService.listConfigurationKeys("titan");
    for (String key : titanConf) {
        String titanKey = key.replaceFirst("^titan\\.", "");
        conf.setProperty(titanKey, configurationService.getStringConfiguration(key));
    }

    return TitanFactory.open(conf);
}

From source file:org.apache.metron.pcapservice.ConfigurationUtil.java

/**
 * Loads configuration resources //w  w  w.j a v a2 s  .  co m
 * @return Configuration
 */
public synchronized static Configuration getConfiguration() {
    if (propConfiguration == null) {
        propConfiguration = new BaseConfiguration();
    }
    return propConfiguration;
}

From source file:org.apache.servicecomb.loadbalance.filter.TestInstancePropertyDiscoveryFilter.java

@BeforeClass
public static void beforeCls() {
    AbstractConfiguration configuration = new BaseConfiguration();
    configuration.addProperty("servicecomb.loadbalance.test.flowsplitFilter.policy",
            "org.apache.servicecomb.loadbalance.filter.SimpleFlowsplitFilter");
    configuration.addProperty("servicecomb.loadbalance.test.flowsplitFilter.options.tag0", "value0");
}

From source file:org.apache.tinkerpop.gremlin.AbstractGraphProvider.java

@Override
public Configuration newGraphConfiguration(final String graphName, final Class<?> test,
        final String testMethodName, final Map<String, Object> configurationOverrides,
        final LoadGraphWith.GraphData loadGraphWith) {
    final Configuration conf = new BaseConfiguration();
    getBaseConfiguration(graphName, test, testMethodName, loadGraphWith).entrySet().stream()
            .forEach(e -> conf.setProperty(e.getKey(), e.getValue()));

    // assign overrides but don't allow gremlin.graph setting to be overridden.  the test suite should
    // not be able to override that.
    configurationOverrides.entrySet().stream().filter(c -> !c.getKey().equals(Graph.GRAPH))
            .forEach(e -> conf.setProperty(e.getKey(), e.getValue()));
    return conf;//www  . jav  a  2  s  . co m
}