Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.AbstractConfiguration


    public static DynamicPropertyFactory initWithConfigurationSource(DynamicPropertySupport dynamicPropertySupport) {
        synchronized (ConfigurationManager.class) {
            if (dynamicPropertySupport == null) {
                throw new IllegalArgumentException("dynamicPropertySupport is null");
            }
            AbstractConfiguration configuration = null;
            if (dynamicPropertySupport instanceof AbstractConfiguration) {
                configuration = (AbstractConfiguration) dynamicPropertySupport;
            } else if (dynamicPropertySupport instanceof ConfigurationBackedDynamicPropertySupportImpl) {
                configuration = ((ConfigurationBackedDynamicPropertySupportImpl) dynamicPropertySupport).getConfiguration();
            }
View Full Code Here


     */
    public static DynamicPropertyFactory getInstance() {
        if (config == null) {
            synchronized (ConfigurationManager.class) {
                if (config == null) {
                    AbstractConfiguration configFromManager = ConfigurationManager.getConfigInstance();
                    if (configFromManager != null) {
                        initWithConfigurationSource(configFromManager);
                        initializedWithDefaultConfig = !ConfigurationManager.isConfigurationInstalled();
                        logger.info("DynamicPropertyFactory is initialized with configuration sources: " + configFromManager);
                    }
View Full Code Here

        }
        return props;
    }
   
    public static void loadAppOverrideProperties(String appConfigName) throws IOException {
        AbstractConfiguration config = getConfigInstance();
        Properties props = loadCascadedProperties(appConfigName);
        if (config instanceof AggregatedConfiguration) {
            AggregatedConfiguration aggregated = (AggregatedConfiguration) config;
            Configuration appConfig = aggregated.getConfiguration(APPLICATION_PROPERTIES);
            if (appConfig != null) {
View Full Code Here

        }
    };
   
    public ConfigurationBasedDeploymentContext() {
        super();
        AbstractConfiguration config = ConfigurationManager.getConfigInstance();
        if (config != null) {
            String contextValue = getValueFromConfig(DEPLOYMENT_APPLICATION_ID_PROPERTY);
            if (contextValue != null) {
                setApplicationId(contextValue);
            }
            contextValue = getValueFromConfig(DEPLOYMENT_DATACENTER_PROPERTY);
            if (contextValue != null) {
                setDeploymentDatacenter(contextValue);
            }
            contextValue = getValueFromConfig(DEPLOYMENT_ENVIRONMENT_PROPERTY);
            if (contextValue != null) {
                setDeploymentEnvironment(contextValue);
            }
            contextValue = getValueFromConfig(DEPLOYMENT_REGION_PROPERTY);
            if (contextValue != null) {
                setDeploymentRegion(contextValue);
            }
            contextValue = getValueFromConfig(DEPLOYMENT_STACK_PROPERTY);
            if (contextValue != null) {
                setDeploymentStack(contextValue);
            }   
            contextValue = getValueFromConfig(DEPLOYMENT_SERVER_ID_PROPERTY);
            if (contextValue != null) {
                setDeploymentStack(contextValue);
            }   
            config.addConfigurationListener(configListener);
        }
    }
View Full Code Here

            throw new IllegalArgumentException("Can't remove container configuration");
        }
    }
   
    public AbstractConfiguration removeConfigurationAt(int index) {
        AbstractConfiguration config = configList.remove(index);
        String nameFound = getNameForConfiguration(config);
        if (nameFound != null) {
            namedConfigurations.remove(nameFound);
        }
        return config;
View Full Code Here

    // Step 1.
    // Create a Source of Configuration
    // Here we use a simple ConcurrentMapConfiguration
    // You can use your own, or use of the pre built ones including JDBCConfigurationSource
    // which lets you load properties from any RDBMS
    AbstractConfiguration myConfiguration = new ConcurrentMapConfiguration();
    myConfiguration.setProperty("com.netflix.config.samples.sampleapp.prop1", "value1");
    myConfiguration.setProperty(
        "com.netflix.config.samples.SampleApp.SampleBean.name",
        "A Coffee Bean from Gautemala");

    // STEP 2: Optional. Dynamic Runtime property change option
    // We would like to utilize the benefits of obtaining dynamic property
View Full Code Here

        this.archaiusPropertyRegister = archaiusPropertyRegister;
    }

    public void register() {
        archaiusPropertyRegister.register(breakerboxConfiguration);
        final AbstractConfiguration configInstance = ConfigurationManager.getConfigInstance();
        for (Map.Entry<TenacityPropertyKey, TenacityConfiguration> entry : configurations.entrySet()) {
            registerConfiguration(entry.getKey(), entry.getValue(), configInstance);
        }
    }
View Full Code Here

        }       
    }
   
    public static Properties getPropertiesFromFile(URL startingUrl, Set<String> loaded, String... nextLoadKeys)
            throws FileNotFoundException {
        AbstractConfiguration config = getConfigFromPropertiesFile(startingUrl, loaded, nextLoadKeys);
        return getProperties(config);
    }
View Full Code Here

  void addConfiguration(CombinedConfiguration combinedConfiguration,
      final Configuration configuration) {
    if (configuration instanceof AbstractConfiguration) {
      combinedConfiguration.addConfiguration((AbstractConfiguration) configuration);
    } else {
      combinedConfiguration.addConfiguration(new AbstractConfiguration() {

        public boolean isEmpty() {
          return configuration.isEmpty();
        }
View Full Code Here

    private AdminResourcesContainer container;

    @After
    public void tearDown() throws Exception {
        final AbstractConfiguration configInst = ConfigurationManager.getConfigInstance();
        configInst.clearProperty(AdminResourcesContainer.CONTAINER_LISTEN_PORT);
        container.shutdown();
    }
View Full Code Here

TOP

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

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.