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 |
AUTHORIZATION_PROVIDER |
private static AuthorizationProvider |
authorizationProvider |
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.lang.String |
HTTP |
private static java.lang.String |
HTTPS |
private static java.util.concurrent.locks.Lock |
LOCK |
static java.lang.String |
LOG4J1_CONFIGURATION_FILE_PROPERTY |
static java.lang.String |
LOG4J1_EXPERIMENTAL |
protected static java.lang.String |
LOG4J1_VERSION |
protected static java.lang.String |
LOG4J2_VERSION |
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) |
static AuthorizationProvider |
authorizationProvider(PropertiesUtil props) |
(package private) static java.lang.String |
extractClassLoaderUriPath(java.net.URI uri) |
static AuthorizationProvider |
getAuthorizationProvider() |
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.
|
protected java.lang.String |
getDefaultPrefix() |
(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 java.lang.String |
getTestPrefix() |
protected java.lang.String |
getVersion() |
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 LOG4J1_CONFIGURATION_FILE_PROPERTY
public static final java.lang.String LOG4J1_EXPERIMENTAL
public static final java.lang.String AUTHORIZATION_PROVIDER
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
protected static final java.lang.String LOG4J1_VERSION
protected static final java.lang.String LOG4J2_VERSION
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
private static final java.lang.String HTTPS
private static final java.lang.String HTTP
private static volatile AuthorizationProvider authorizationProvider
public static ConfigurationFactory getInstance()
public static AuthorizationProvider authorizationProvider(PropertiesUtil props)
public static AuthorizationProvider getAuthorizationProvider()
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 java.lang.String getTestPrefix()
protected java.lang.String getDefaultPrefix()
protected java.lang.String getVersion()
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()