public abstract class ConfigurationFactory extends ConfigurationBuilderFactory
Configuration
objects from a configuration file.
ConfigurationFactory allows the configuration implementation to be
dynamically chosen in 1 of 3 ways:
ConfigurationFactory
category. The Order
annotation should be used to configure the
factory to be the first one inspected. See
XmlConfigurationFactory for an example.Modifier and Type | Class and Description |
---|---|
private static class |
ConfigurationFactory.Factory
Default Factory.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CATEGORY
Plugin category used to inject a ConfigurationFactory
Plugin
class. |
private static java.lang.String |
CLASS_LOADER_SCHEME
The name of the classloader URI scheme.
|
private static java.lang.String |
CLASS_PATH_SCHEME
The name of the classpath URI scheme, synonymous with the classloader URI scheme.
|
private static ConfigurationFactory |
configFactory |
static java.lang.String |
CONFIGURATION_FACTORY_PROPERTY
Allows the ConfigurationFactory class to be specified as a system property.
|
static java.lang.String |
CONFIGURATION_FILE_PROPERTY
Allows the location of the configuration file to be specified as a system property.
|
protected static java.lang.String |
DEFAULT_PREFIX
File name prefix for standard configurations.
|
private static java.util.List<ConfigurationFactory> |
factories |
private static java.util.concurrent.locks.Lock |
LOCK |
protected static Logger |
LOGGER
Allows subclasses access to the status logger without creating another instance.
|
protected StrSubstitutor |
substitutor |
protected static java.lang.String |
TEST_PREFIX
File name prefix for test configurations.
|
Constructor and Description |
---|
ConfigurationFactory() |
Modifier and Type | Method and Description |
---|---|
private static void |
addFactory(java.util.Collection<ConfigurationFactory> list,
java.lang.Class<? extends ConfigurationFactory> factoryClass) |
private static void |
addFactory(java.util.Collection<ConfigurationFactory> list,
java.lang.String factoryClass) |
(package private) static java.lang.String |
extractClassLoaderUriPath(java.net.URI uri) |
abstract Configuration |
getConfiguration(LoggerContext loggerContext,
ConfigurationSource source) |
Configuration |
getConfiguration(LoggerContext loggerContext,
java.lang.String name,
java.net.URI configLocation)
Returns the Configuration.
|
Configuration |
getConfiguration(LoggerContext loggerContext,
java.lang.String name,
java.net.URI configLocation,
java.lang.ClassLoader loader)
Returns the Configuration obtained using a given ClassLoader.
|
(package private) static java.util.List<ConfigurationFactory> |
getFactories() |
protected ConfigurationSource |
getInputFromString(java.lang.String config,
java.lang.ClassLoader loader)
Loads the configuration from the location represented by the String.
|
static ConfigurationFactory |
getInstance()
Returns the ConfigurationFactory.
|
protected abstract java.lang.String[] |
getSupportedTypes() |
protected boolean |
isActive() |
(package private) static boolean |
isClassLoaderUri(java.net.URI uri) |
static void |
removeConfigurationFactory(ConfigurationFactory factory)
Removes the ConfigurationFactory.
|
static void |
resetConfigurationFactory()
Resets the ConfigurationFactory to the default.
|
static void |
setConfigurationFactory(ConfigurationFactory factory)
Sets the configuration factory.
|
newConfigurationBuilder, newConfigurationBuilder
public static final java.lang.String CONFIGURATION_FACTORY_PROPERTY
public static final java.lang.String CONFIGURATION_FILE_PROPERTY
public static final java.lang.String CATEGORY
Plugin
class.protected static final Logger LOGGER
protected static final java.lang.String TEST_PREFIX
protected static final java.lang.String DEFAULT_PREFIX
private static final java.lang.String CLASS_LOADER_SCHEME
private static final java.lang.String CLASS_PATH_SCHEME
private static volatile java.util.List<ConfigurationFactory> factories
private static ConfigurationFactory configFactory
protected final StrSubstitutor substitutor
private static final java.util.concurrent.locks.Lock LOCK
public static ConfigurationFactory getInstance()
private static void addFactory(java.util.Collection<ConfigurationFactory> list, java.lang.String factoryClass)
private static void addFactory(java.util.Collection<ConfigurationFactory> list, java.lang.Class<? extends ConfigurationFactory> factoryClass)
public static void setConfigurationFactory(ConfigurationFactory factory)
factory
- the ConfigurationFactory.public static void resetConfigurationFactory()
public static void removeConfigurationFactory(ConfigurationFactory factory)
factory
- The factory to remove.protected abstract java.lang.String[] getSupportedTypes()
protected boolean isActive()
public abstract Configuration getConfiguration(LoggerContext loggerContext, ConfigurationSource source)
public Configuration getConfiguration(LoggerContext loggerContext, java.lang.String name, java.net.URI configLocation)
loggerContext
- The logger contextname
- The configuration name.configLocation
- The configuration location.public Configuration getConfiguration(LoggerContext loggerContext, java.lang.String name, java.net.URI configLocation, java.lang.ClassLoader loader)
loggerContext
- The logger contextname
- The configuration name.configLocation
- A URI representing the location of the configuration.loader
- The default ClassLoader to use. If this is null
, then the
default ClassLoader will be used.static boolean isClassLoaderUri(java.net.URI uri)
static java.lang.String extractClassLoaderUriPath(java.net.URI uri)
protected ConfigurationSource getInputFromString(java.lang.String config, java.lang.ClassLoader loader)
config
- The configuration location.loader
- The default ClassLoader to use.static java.util.List<ConfigurationFactory> getFactories()