public class ConfigurationManager extends Object
During initialization, this class will check system property "archaius.default.configuration.class" and "archaius.default.configuration.factory". If the former is set, it will use the class name to instantiate it using its default no-arg constructor. If the later is set, it will call its static method getInstance(). In both cases, the returned Configuration object will be set as the system wide configuration.
Constructor and Description |
---|
ConfigurationManager() |
Modifier and Type | Method and Description |
---|---|
static org.apache.commons.configuration.AbstractConfiguration |
getConfigInstance()
Get the current system wide configuration.
|
static DeploymentContext |
getDeploymentContext() |
static void |
install(org.apache.commons.configuration.AbstractConfiguration config)
Install the system wide configuration with the ConfigurationManager.
|
static boolean |
isConfigurationInstalled() |
static void |
loadCascadedPropertiesFromResources(String configName)
Load resource configName.properties first.
|
static void |
loadProperties(Properties properties)
Load the specified properties into system wide configuration
|
static void |
loadPropertiesFromConfiguration(org.apache.commons.configuration.AbstractConfiguration config)
Load properties from the specified configuration into system wide configuration
|
static void |
loadPropertiesFromResources(String path)
Load properties from resource file into the system wide configuration
|
static void |
setDeploymentContext(DeploymentContext context) |
public static void install(org.apache.commons.configuration.AbstractConfiguration config) throws IllegalStateException
DynamicPropertyFactory
by calling DynamicPropertyFactory.initWithConfigurationSource(AbstractConfiguration)
.
This call can be made only once, otherwise IllegalStateException will be thrown.IllegalStateException
public static boolean isConfigurationInstalled()
public static org.apache.commons.configuration.AbstractConfiguration getConfigInstance()
ConcurrentCompositeConfiguration
which contains a SystemConfiguration from Apache Commons
Configuration and a DynamicURLConfiguration
.public static void loadPropertiesFromResources(String path) throws IOException
path
- path of the resourceIOException
public static void loadCascadedPropertiesFromResources(String configName) throws IOException
configName
- prefix of the properties file name.IOException
DeploymentContext.getDeploymentEnvironment()
public static void loadPropertiesFromConfiguration(org.apache.commons.configuration.AbstractConfiguration config)
public static void loadProperties(Properties properties)
public static void setDeploymentContext(DeploymentContext context)
public static DeploymentContext getDeploymentContext()
Copyright © 2020. All Rights Reserved.