Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.CompositeConfiguration


        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);
        return config;
    }
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

    }
  }

  public synchronized void startup() throws Exception {
    LOG.info("Starting up cluster...");
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
      config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(this.configResource));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();

    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
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

    return config.getList(key.getConfigName());
  }
 
  private Configuration composeWithDefaults(Configuration userConfig)
      throws ConfigurationException {
    CompositeConfiguration composed = new CompositeConfiguration();
    composed.addConfiguration(userConfig);
    composed.addConfiguration(new PropertiesConfiguration(
        getClass().getClassLoader().getResource(DEFAULT_PROPERTIES)));
    return composed;
  }
View Full Code Here

      assertEquals("CDHCLUSTER.COM", cloudServersSpec.getKerberosRealm());
  }
 
  @Test
  public void testApplySubroleAliases() throws ConfigurationException {
    CompositeConfiguration c = new CompositeConfiguration();
    Configuration config = new PropertiesConfiguration();
    config.addProperty("whirr.instance-templates",
      "1 puppet:somepup::pet+something-else, 1 something-else-only");
    c.addConfiguration(config);
    InstanceTemplate template = InstanceTemplate.parse(c).get(0);
    Set<String> expected = Sets.newLinkedHashSet(Arrays.asList(new String[]{
      "puppet:somepup::pet", "something-else"}));
    assertThat(template.getRoles(), is(expected));
View Full Code Here

    public synchronized void startup() throws Exception
    {
        LOG.info("Starting up cluster...");

        config = new CompositeConfiguration();
        if (System.getProperty("whirr.config") != null)
        {
            config.addConfiguration(
                new PropertiesConfiguration(System.getProperty("whirr.config")));
        }
View Full Code Here

       *  load the widgetserver.properties and local.widget.properties file
       *  and put it into this context as an attribute 'properties' available to all resources
       */
      File localPropsFile = new File(System.getProperty("user.dir") + File.separator + "local.widgetserver.properties");
      PropertiesConfiguration localConfiguration = new PropertiesConfiguration(localPropsFile);
      CompositeConfiguration configuration = new CompositeConfiguration();
      configuration.addConfiguration(localConfiguration);
      configuration.addConfiguration(new PropertiesConfiguration("widgetserver.properties"));
     
      context.setAttribute("properties", (Configuration) configuration);
      
       // load these up now so we don't have to do it on every request(i.e. filter) in the future
       usePreferenceInstanceQueues = configuration.getBoolean(WidgetRuntimeHelper.USE_PREFERENCE_INSTANCE_QUEUES)
      useSharedDataInstanceQueues = configuration.getBoolean(WidgetRuntimeHelper.USE_SHAREDDATA_INSTANCE_QUEUES);      
      
      /*
        * Merge in system properties overrides
        */
       Iterator<Object> systemKeysIter = System.getProperties().keySet().iterator();
       while (systemKeysIter.hasNext()) {
           String key = systemKeysIter.next().toString();
           if (configuration.containsKey(key) || key.startsWith("widget.")) {
               String setting = configuration.getString(key);
               String override = System.getProperty(key);
               if ((override != null) && (override.length() > 0) && !override.equals(setting)) {
                   configuration.setProperty(key, override);
                   if (setting != null) {
                       _logger.info("Overridden server configuration property: " + key + "=" +override);
                   }
               }
           }
       }
      
       /*
        * Initialize persistence manager factory now, not on first request
        */
       PersistenceManagerFactory.initialize(configuration);
      
       /*
        * Initialise the locale handler
        */
       LocaleHandler.getInstance().initialize(configuration);
      final Locale locale = new Locale(configuration.getString("widget.default.locale"));
      final Messages localizedMessages = LocaleHandler.getInstance().getResourceBundle(locale);
      
       /*
       *  load the opensocial.properties file and put it into this context
       *  as an attribute 'opensocial' available to all resources
       */
      File localOpenSocialPropsFile = new File(System.getProperty("user.dir") + File.separator + "local.opensocial.properties");
            PropertiesConfiguration localOpenSocialConfiguration = new PropertiesConfiguration(localOpenSocialPropsFile);
            CompositeConfiguration opensocialConfiguration = new CompositeConfiguration();
            opensocialConfiguration.addConfiguration(localOpenSocialConfiguration);
            opensocialConfiguration.addConfiguration(new PropertiesConfiguration("opensocial.properties"));
      context.setAttribute("opensocial", (Configuration) opensocialConfiguration);
     
      /*
       * Load installed features
       */
 
View Full Code Here

          log.info("Allow external re-configuration: " + allowexternal);
        }
      } catch (ConfigurationException e) {
        log.error("Error intializing configuration: ", e);
      }
      config = new CompositeConfiguration();

      // Only add these config sources if we allow external configuration
      if (allowexternal) {
        // Override with system properties, this is prio 1 if it exists (java -Dscep.test=foo)
        config.addConfiguration(new SystemConfiguration());
View Full Code Here

    if (config == null) {
          try {
            // Default values build into war file, this is last prio used if no of the other sources override this
            boolean allowexternal = Boolean.getBoolean(new PropertiesConfiguration(ExtraConfiguration.class.getResource("/" + PROPERTY_FILENAME)).getString(CONFIGALLOWEXTERNAL, "false"));

            config = new CompositeConfiguration();
           
            PropertiesConfiguration pc;
        // Only add these config sources if we allow external configuration
            if (allowexternal) {
              // Override with system properties, this is prio 1 if it exists (java -Dscep.test=foo)
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.