Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.CompositeConfiguration


    Iterator i = _config.getList("queues.queue.name").iterator();
   
    while (i.hasNext())
    {
      String queueName = (String) i.next();
      CompositeConfiguration mungedConf = new CompositeConfiguration();
      mungedConf.addConfiguration(_config.subset("queues.queue." + queueName));
      mungedConf.addConfiguration(_config.subset("queues"));
      _queues.put(queueName, new QueueConfiguration(queueName, mungedConf, this));
        }

    i = _config.getList("exchanges.exchange.name").iterator();
    int count = 0;
    while (i.hasNext())
        {
      CompositeConfiguration mungedConf = new CompositeConfiguration();
      mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")"));
      mungedConf.addConfiguration(_config.subset("exchanges"));
      String exchName = (String) i.next();
      _exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf));
        }

    }
View Full Code Here


            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);
        config.setConfiguration("security", xmlconfig);
        return config;
    }
View Full Code Here

  private ZooKeeperService service;
  private ZooKeeperCluster cluster;
 
  @Before
  public void setUp() throws ConfigurationException, IOException {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-zookeeper-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(ZooKeeperService.class));
    service = (ZooKeeperService) s;
    cluster = service.launchCluster(clusterSpec);
View Full Code Here

  private HadoopProxy proxy;
  private HadoopCluster cluster;
 
  @Before
  public void setUp() throws ConfigurationException, IOException {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-hadoop-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(HadoopService.class));
    service = (HadoopService) s;
   
View Full Code Here

      } else {
        optionsConfig.setProperty(property.getConfigName(),
            optionSet.valueOf(option));
      }
    }
    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(optionsConfig);
    if (optionSet.has(configOption)) {
      Configuration defaults = new PropertiesConfiguration(optionSet.valueOf(configOption));
      config.addConfiguration(defaults);
    }

    for (Property required : EnumSet.of(SERVICE_NAME, CLUSTER_NAME, IDENTITY)) {
      if (config.getString(required.getConfigName()) == null) {
        throw new IllegalArgumentException(String.format("Option '%s' not set.",
            required.getSimpleName()));
      }
    }
    return ClusterSpec.fromConfiguration(config);
View Full Code Here

  private CassandraService service;
  private Cluster cluster;

  @Before
  public void setUp() throws ConfigurationException, IOException {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-cassandra-test.properties"));
    clusterSpec = ClusterSpec.fromConfiguration(config);
    Service s = new ServiceFactory().create(clusterSpec.getServiceName());
    assertThat(s, instanceOf(CassandraService.class));
    service = (CassandraService) s;
    cluster = service.launchCluster(clusterSpec);
View Full Code Here

    return config.getList(key.getConfigName());
  }

  private Configuration composeWithDefaults(Configuration userConfig)
      throws ConfigurationException {
    CompositeConfiguration composed = new CompositeConfiguration();
    composed.addConfiguration(userConfig);
    composed.addConfiguration(
      new PropertiesConfiguration(DEFAULT_PROPERTIES));
    return composed;
  }
View Full Code Here

    if (! userConfFile.createNewFile()) {
      logger.debug("Detect exisiting user configurations {}", userConfFile.getPath());
    }
    this.siteConfiguration = new PropertiesConfiguration(siteConfFile);
    this.userConfiguration = new PropertiesConfiguration(userConfFile);
    this.cc = new CompositeConfiguration();
    cc.addConfiguration(this.userConfiguration);
    cc.addConfiguration(this.siteConfiguration);

    keyList = new ArrayList<String>();
    Iterator<?> it = cc.getKeys();
View Full Code Here

   * @param clusterSpec  The cluster specification instance.
   * @return The composite configuration.
   */
  protected Configuration getConfiguration(
      ClusterSpec clusterSpec, Configuration defaults) {
    CompositeConfiguration cc = new CompositeConfiguration();
    cc.addConfiguration(clusterSpec.getConfiguration());
    cc.addConfiguration(defaults);
    return cc;
  }
View Full Code Here

      }
      if (value != null) {
        optionsConfig.setProperty(property.getConfigName(), value);
      }
    }
    CompositeConfiguration config = new CompositeConfiguration();
    config.addConfiguration(optionsConfig);
    if (optionSet.has(configOption)) {
      Configuration defaults = new PropertiesConfiguration(optionSet.valueOf(configOption));
      config.addConfiguration(defaults);
    }
    ClusterSpec clusterSpec = new ClusterSpec(config);

    for (Property required : EnumSet.of(CLUSTER_NAME, PROVIDER, IDENTITY, CREDENTIAL,
        INSTANCE_TEMPLATES, PRIVATE_KEY_FILE)) {
View Full Code Here

TOP

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

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.