Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.CompositeConfiguration


   * file is updated the file will be reloaded. By default the reloadDelay is
   * set to 1 second to prevent excessive date stamp checking.
   */
  private void loadConfiguration(String configurationFile) throws ConfigurationException {
    //Properties from system properties
    CompositeConfiguration compositeConfig = new CompositeConfiguration();
    compositeConfig.addConfiguration(new SystemConfiguration());
    //Properties from XML file
    XMLConfiguration xmlConfig = null;
    if (configurationFile!=null) {
      xmlConfig = new XMLConfiguration(configurationFile);
    } else {
      final String filename = System.getProperty(UDDI_CONFIG_FILENAME_PROPERTY);
      if (filename != null) {
        xmlConfig = new XMLConfiguration(filename);
      } else {
        xmlConfig = new XMLConfiguration(DEFAULT_UDDI_CONFIG)
      }
    }
    log.info("Reading UDDI Client properties file " + xmlConfig.getBasePath());
    long refreshDelay = xmlConfig.getLong(Property.UDDI_RELOAD_DELAY, 1000l);
    log.debug("Setting refreshDelay to " + refreshDelay);
    FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
    fileChangedReloadingStrategy.setRefreshDelay(refreshDelay);
    xmlConfig.setReloadingStrategy(fileChangedReloadingStrategy);
    compositeConfig.addConfiguration(xmlConfig);
    //Making the new configuration globally accessible.
    config = compositeConfig;
    loadManager();
  }
View Full Code Here


    try
    {
      // String
      // fileName=FilenameUtils.separatorsToSystem("C:\\init\\MOBILEguard\\yajsw/lib/jvmstat/*.jar");
      // System.out.println("FileName: "+fileName);
      CompositeConfiguration compConfig = new CompositeConfiguration();
      AbstractConfiguration configuraton = new BaseConfiguration();
      compConfig.addConfiguration(new EnvironmentConfiguration());
      configuraton.setProperty("wrapper.java.classpath.1", "${VERSANT_ROOT}/lib/jvi.*jar");
      configuraton.setProperty("wrapper.java.classpath.2", "${GROOVY_HOME}/lib/*.jar");
      compConfig.addConfiguration(configuraton);
      System.out.println("Configuration: " + ConfigurationConverter.getProperties(compConfig));
      System.out.println("subset: " + ConfigurationConverter.getProperties(compConfig.subset("wrapper.java")));

      // Collection files=FileUtils.getFiles("../..",
      // "C:/versant/7_0_1/lib/jvi*.jar");
      // Collection collection=
      // org.apache.commons.io.FileUtils.listFiles(new File("C:/"),
View Full Code Here

    }

    private ClusterSpec whirrConfigurationToClusterSpec(HostDescription hostDescription,
                                                        File workingDirectory) throws IOException, GFacHandlerException, ConfigurationException {
        File whirrConfig = getWhirrConfigurationFile(hostDescription, workingDirectory);
        CompositeConfiguration compositeConfiguration = new CompositeConfiguration();
        Configuration configuration = new PropertiesConfiguration(whirrConfig);
        compositeConfiguration.addConfiguration(configuration);

        ClusterSpec hadoopClusterSpec = new ClusterSpec(compositeConfiguration);

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

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

    public QueueConfiguration(String name, VirtualHostConfiguration virtualHostConfiguration) throws ConfigurationException
    {
        _vHostConfig = virtualHostConfiguration;
        _name = name;

        CompositeConfiguration mungedConf = new CompositeConfiguration();
        mungedConf.addConfiguration(_vHostConfig.getConfig().subset("queues.queue." + escapeTagName(name)));
        mungedConf.addConfiguration(_vHostConfig.getConfig().subset("queues"));

        setConfiguration("virtualhosts.virtualhost.queues.queue", mungedConf);
    }
View Full Code Here

        PropertiesConfiguration queueConfig = new PropertiesConfiguration();
        queueConfig.addProperty("queues.queue.test.argument", QueueArgumentsConverter.QPID_GROUP_HEADER_KEY + "=mykey");
        queueConfig.addProperty("queues.queue.test.argument", QueueArgumentsConverter.QPID_SHARED_MSG_GROUP + "=1");

        CompositeConfiguration config = new CompositeConfiguration();
        config.addConfiguration(_fullHostConf.getConfig());
        config.addConfiguration(queueConfig);

        final VirtualHostConfiguration vhostConfig = new VirtualHostConfiguration("test", config, _broker);;
        qConf = new QueueConfiguration("test", vhostConfig);
        assertEquals(2, qConf.getArguments().size());
        assertEquals("mykey", qConf.getArguments().get(QueueArgumentsConverter.QPID_GROUP_HEADER_KEY));
View Full Code Here

            throws ConfigurationException
    {
        PropertiesConfiguration queueConfig = new PropertiesConfiguration();
        queueConfig.setProperty("queues.queue.test." + property, value);

        CompositeConfiguration config = new CompositeConfiguration();
        config.addConfiguration(_fullHostConf.getConfig());
        config.addConfiguration(queueConfig);

        return new VirtualHostConfiguration("test", config, _broker);
    }
View Full Code Here

  public CommonsConfigurationFactoryBean() {
  }

  public CommonsConfigurationFactoryBean(Configuration configuration) {
    Assert.notNull(configuration);
    this.configuration = new CompositeConfiguration(configuration);
  }
View Full Code Here

    if (configuration == null && (configurations == null || configurations.length == 0)
        && (locations == null || locations.length == 0))
      throw new IllegalArgumentException("no configuration object or location specified");

    if (configuration == null)
      configuration = new CompositeConfiguration();

    configuration.setThrowExceptionOnMissing(throwExceptionOnMissing);

    if (configurations != null) {
      for (int i = 0; i < configurations.length; i++) {
View Full Code Here

        i = getListValue("exchanges.exchange.name").iterator();
        int count = 0;
        while (i.hasNext())
        {
            CompositeConfiguration mungedConf = new CompositeConfiguration();
            mungedConf.addConfiguration(config.subset("exchanges.exchange(" + count++ + ")"));
            mungedConf.addConfiguration(getConfig().subset("exchanges"));
            String exchName = (String) i.next();
            _exchanges.put(exchName, new ExchangeConfiguration(exchName, mungedConf));
        }
    }
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.