public class ConfigurationManager
extends java.lang.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.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
APPLICATION_PROPERTIES |
static java.lang.String |
DISABLE_DEFAULT_ENV_CONFIG
System property to disable adding EnvironmentConfiguration to the default ConcurrentCompositeConfiguration
|
static java.lang.String |
DISABLE_DEFAULT_SYS_CONFIG
System property to disable adding SystemConfiguration to the default ConcurrentCompositeConfiguration
|
static java.lang.String |
ENV_CONFIG_NAME |
static java.lang.String |
PROP_NEXT_LOAD |
static java.lang.String |
SYS_CONFIG_NAME |
static java.lang.String |
URL_CONFIG_NAME |
Constructor and Description |
---|
ConfigurationManager() |
Modifier and Type | Method and Description |
---|---|
static AbstractConfiguration |
getConfigFromPropertiesFile(java.net.URL startingUrl) |
static AbstractConfiguration |
getConfigInstance()
Get the current system wide configuration.
|
static DeploymentContext |
getDeploymentContext() |
static java.util.Set<java.lang.String> |
getLoadedPropertiesURLs() |
static java.util.Properties |
getPropertiesFromFile(java.net.URL startingUrl) |
static void |
install(AbstractConfiguration config)
Install the system wide configuration with the ConfigurationManager.
|
static boolean |
isConfigurationInstalled() |
static void |
loadAppOverrideProperties(java.lang.String appConfigName) |
static void |
loadCascadedPropertiesFromResources(java.lang.String configName)
Load resource configName.properties first.
|
static void |
loadProperties(java.util.Properties properties)
Load the specified properties into system wide configuration
|
static void |
loadPropertiesFromConfiguration(AbstractConfiguration config)
Load properties from the specified configuration into system wide configuration
|
static void |
loadPropertiesFromResources(java.lang.String path)
Load properties from resource file(s) into the system wide configuration
|
static void |
setDeploymentContext(DeploymentContext context) |
public static final java.lang.String PROP_NEXT_LOAD
public static final java.lang.String URL_CONFIG_NAME
public static final java.lang.String SYS_CONFIG_NAME
public static final java.lang.String ENV_CONFIG_NAME
public static final java.lang.String DISABLE_DEFAULT_ENV_CONFIG
public static final java.lang.String DISABLE_DEFAULT_SYS_CONFIG
public static final java.lang.String APPLICATION_PROPERTIES
public static java.util.Set<java.lang.String> getLoadedPropertiesURLs()
public static void install(AbstractConfiguration config) throws java.lang.IllegalStateException
DynamicPropertyFactory
by calling DynamicPropertyFactory.initWithConfigurationSource(AbstractConfiguration)
.
This call can be made only once, otherwise IllegalStateException will be thrown.java.lang.IllegalStateException
public static boolean isConfigurationInstalled()
public static AbstractConfiguration getConfigInstance()
ConcurrentCompositeConfiguration
which contains a SystemConfiguration from Apache Commons
Configuration and a DynamicURLConfiguration
.public static void loadPropertiesFromResources(java.lang.String path) throws java.io.IOException
path
- relative path of the resourcesjava.io.IOException
public static void loadCascadedPropertiesFromResources(java.lang.String configName) throws java.io.IOException
configName
- prefix of the properties file name.java.io.IOException
DeploymentContext.getDeploymentEnvironment()
public static void loadAppOverrideProperties(java.lang.String appConfigName) throws java.io.IOException
java.io.IOException
public static void loadPropertiesFromConfiguration(AbstractConfiguration config)
public static void loadProperties(java.util.Properties properties)
public static void setDeploymentContext(DeploymentContext context)
public static DeploymentContext getDeploymentContext()
public static AbstractConfiguration getConfigFromPropertiesFile(java.net.URL startingUrl) throws java.io.FileNotFoundException
java.io.FileNotFoundException
public static java.util.Properties getPropertiesFromFile(java.net.URL startingUrl) throws java.io.FileNotFoundException
java.io.FileNotFoundException