Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.XMLConfiguration


    private ConfigurationPlugin getPlainDatabaseConfig() throws ConfigurationException
    {
        final ConfigurationPlugin config = new PrincipalDatabaseAuthenticationManager.PrincipalDatabaseAuthenticationManagerConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();
        xmlconfig.addProperty("pd-auth-manager.principal-database.class", PlainPasswordFilePrincipalDatabase.class.getName());

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);
        config.setConfiguration("security", xmlconfig);
View Full Code Here


    private ConfigurationPlugin getConfig(final String clazz, final String argName, final String argValue) throws Exception
    {
        final ConfigurationPlugin config = new PrincipalDatabaseAuthenticationManager.PrincipalDatabaseAuthenticationManagerConfiguration();

        XMLConfiguration xmlconfig = new XMLConfiguration();
        xmlconfig.addProperty("pd-auth-manager.principal-database.class", clazz);

        if (argName != null)
        {
            xmlconfig.addProperty("pd-auth-manager.principal-database.attributes.attribute.name", argName);
            xmlconfig.addProperty("pd-auth-manager.principal-database.attributes.attribute.value", argValue);
        }

        // Create a CompositeConfiguration as this is what the broker uses
        CompositeConfiguration composite = new CompositeConfiguration();
        composite.addConfiguration(xmlconfig);
View Full Code Here

    }

    public void modifyClusterNodeBdbAddress(int brokerPortNumberToBeMoved, int newBdbPort)
    {
        final BrokerConfigHolder brokerConfigHolder = _brokerConfigurations.get(brokerPortNumberToBeMoved);
        final XMLConfiguration virtualHostConfig = brokerConfigHolder.getTestVirtualhosts();

        final String configKey = getConfigKey("highAvailability.nodeHostPort");
        final String oldBdbHostPort = virtualHostConfig.getString(configKey);

        final String[] oldHostAndPort = StringUtils.split(oldBdbHostPort, ":");
        final String oldHost = oldHostAndPort[0];

        final String newBdbHostPort = oldHost + ":" + newBdbPort;

        virtualHostConfig.setProperty(configKey, newBdbHostPort);
        collectConfig(brokerPortNumberToBeMoved, brokerConfigHolder.getTestConfiguration(), virtualHostConfig);
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception
    {
        super.setUp();
        _serverConfig = new ServerConfiguration(new XMLConfiguration());
        ApplicationRegistry.initialise(new TestApplicationRegistry(_serverConfig));
        _address = new InetSocketAddress("127.0.0.1", 65535);
    }
View Full Code Here

        buf.write("</firewall>");
        buf.close();

        // Configure plugin
        FirewallConfiguration config = new FirewallConfiguration();
        config.setConfiguration("", new XMLConfiguration(confFile));
        Firewall plugin = new Firewall();
        plugin.configure(config);
        return plugin;
    }
View Full Code Here

    new Plotter(problem,bestSolution).plot("output/solution.png", "solution");
  }

  private static AlgorithmConfig getAlgorithmConfig() {
    AlgorithmConfig config = new AlgorithmConfig();
    XMLConfiguration xmlConfig = config.getXMLConfiguration();
    xmlConfig.setProperty("iterations", 2000);
    xmlConfig.setProperty("construction.insertion[@name]","bestInsertion");
   
    xmlConfig.setProperty("strategy.memory", 1);
    String searchStrategy = "strategy.searchStrategies.searchStrategy";
   
    xmlConfig.setProperty(searchStrategy + "(0).selector[@name]","selectBest");
    xmlConfig.setProperty(searchStrategy + "(0).acceptor[@name]","acceptNewRemoveWorst");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0)[@name]","ruin_and_recreate");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).ruin[@name]","randomRuin");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).ruin.share","0.3");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).insertion[@name]","bestInsertion");
    xmlConfig.setProperty(searchStrategy + "(0).probability","0.5");
   
    xmlConfig.setProperty(searchStrategy + "(1).selector[@name]","selectBest");
    xmlConfig.setProperty(searchStrategy + "(1).acceptor[@name]","acceptNewRemoveWorst");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0)[@name]","ruin_and_recreate");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).ruin[@name]","radialRuin");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).ruin.share","0.15");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).insertion[@name]","bestInsertion");
    xmlConfig.setProperty(searchStrategy + "(1).probability","0.5");
   
    return config;
  }
View Full Code Here

   
  }
 
  private static AlgorithmConfig getAlgorithmConfig(String alpha) {
    AlgorithmConfig config = new AlgorithmConfig();
    XMLConfiguration xmlConfig = config.getXMLConfiguration();
    xmlConfig.setProperty("iterations",10000);
    xmlConfig.setProperty("construction.insertion[@name]","bestInsertion");
   
    xmlConfig.setProperty("strategy.memory", 1);
    String searchStrategy = "strategy.searchStrategies.searchStrategy";
   
    xmlConfig.setProperty(searchStrategy + "(0).selector[@name]","selectBest");
    xmlConfig.setProperty(searchStrategy + "(0).acceptor[@name]","schrimpfAcceptance");
    xmlConfig.setProperty(searchStrategy + "(0).acceptor.alpha",alpha);
    xmlConfig.setProperty(searchStrategy + "(0).acceptor.warmup","50");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0)[@name]","ruin_and_recreate");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).ruin[@name]","randomRuin");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).ruin.share","0.3");
    xmlConfig.setProperty(searchStrategy + "(0).modules.module(0).insertion[@name]","bestInsertion");
    xmlConfig.setProperty(searchStrategy + "(0).probability",".5");
   
    xmlConfig.setProperty(searchStrategy + "(1).selector[@name]","selectBest");
    xmlConfig.setProperty(searchStrategy + "(1).acceptor[@name]","schrimpfAcceptance");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0)[@name]","ruin_and_recreate");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).ruin[@name]","radialRuin");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).ruin.share","0.1");
    xmlConfig.setProperty(searchStrategy + "(1).modules.module(0).insertion[@name]","bestInsertion");
    xmlConfig.setProperty(searchStrategy + "(1).probability","0.5");
   
    return config;
  }
View Full Code Here

            switch (fileExtension) {
                case "yml":
                case "yaml":
                    return new YamlConfiguration(configurationFile);
                case "xml":
                    return new XMLConfiguration(configurationFile);
                default:
                    return new PropertiesConfiguration(configurationFile);
            }
        } catch (final ConfigurationException e) {
            throw new IllegalArgumentException(String.format("Could not load configuration at: %s", configurationFile), e);
View Full Code Here

      File mFile = new File(ACUHOME, metricsFileName);
      if (mFile.exists()) {
        if (log.isDebugEnabled())
          log.debug("Loading config file: " + mFile.getAbsolutePath());
        try {
          xConfig = new XMLConfiguration(mFile);
          xConfig.append(getEnvironmentConfiguration());
          xConfig.addConfigurationListener(new MetricsConfigListener());
          xConfig.setReloadingStrategy(new FileChangedReloadingStrategy());
         
          // Start a background Thread that checks a property from the XMLConfiguration
View Full Code Here

     *                                not be read or parsed
     */
    protected HierarchicalConfiguration parseXML(InputStream xml, boolean validate)
            throws ConfigurationException {
        try {
            XMLConfiguration config = new XMLConfiguration();
            config.setValidating(validate);
            config.load(xml);
            return config;
        } catch (Exception e) {
            throw new ConfigurationException(
                    "Configuration file could not be read.", e);
        }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.XMLConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.