public class ConfigurationPropertyProvider extends PropertyProvider
PropertyProvider to support
configuration directories as URLs to load configuration files from, a
directory to write configurations changed at runtime to, a directory to write
the logs to and boolean flags for whether to load configuration files from
bundles (jar-files containing the AristaFlow-components), whether to use
debug logging while bootstrapping and whether to keep the registered log
handlers. arflow.confdir or a mixture of directories and URLs via
arflow.confurl. If arflow.confurl is specified,
arflow.confdir will be ignored. Note that
arflow.confurl expects ";" as separator for the URLs
while arflow.confdir expects the platform-dependent path
separator (File.pathSeparator).
The configuration directories (or URLs) may contain a reference to the
configuration provided when bootstrapping ("$").
The provided configuration will apply at the corresponding place relative to
the other configuration directories. This effectively splits the
configuration directories into 2 parts: directories before the provided
configuration and directories after the provided configuration.
If no position is defined for the provided configuration, it will apply
before the configuration directories. However, the first configuration to
apply is the runtime configuration which persists configuration values set
from within the platform (at runtime).
This class parses the following property from the designated map (in parentheses the default value that will apply if the property is not set):
./conf)false)false)false)false)logger| Constructor and Description |
|---|
ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new
ConfigurationPropertyProvider and parses all
corresponding global properties from the designated map and/or sets the
properties appropriately. |
ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
boolean useDefaultConfDir,
boolean defaultDsForRtConf)
Creates a new
ConfigurationPropertyProvider and parses all
corresponding global properties from the designated map and/or sets the
properties appropriately. |
ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
boolean useDefaultConfDir,
java.lang.String bundleConfigSubdir,
boolean defaultDsForRtConf)
Creates a new
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. |
ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String bundleConfigSubdir)
Creates a new
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. |
ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String bundleConfigSubdir,
boolean defaultDsForRtConf)
Creates a new
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.net.URL> |
getAfterConfDirs()
Gets the configuration directories that apply after the provided
configuration.
|
java.util.List<java.net.URL> |
getBeforeConfDirs()
Gets the configuration directories that apply before the provided
configuration.
|
java.lang.String |
getBundleConfigSubdir()
Gets whether a file-based configuration manager should load a configuration from a bundle (that
is a jar-file containing a configuration) and if so, from which subdirectory below
conf/ in the jar-file. |
java.util.List<java.net.URL> |
getConfDirs()
Gets (an unmodifiable list containing) the configuration
directory/directories of AristaFlow.
|
boolean |
getDebugConfig()
Gets the global property which allows to enable the logging of the
initialisation of the configuration.
|
boolean |
getKeepLogHandler()
Gets the global property which allows to keep already registered log
handlers in the logger hierarchy.
|
java.io.File |
getRuntimeConfDir()
Gets the configuration directory for runtime configurations, that is
configurations that may be changed at runtime.
|
boolean |
getUseDefDsForRtConf()
Gets whether to use the default data source for the runtime configuration.
|
protected void |
initialiseProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Initialises, checks and sets the values of the global properties as well as
the substituted variables.
|
protected static java.util.Map<java.lang.String,java.lang.String> |
injectDefaultConfDir(boolean useDefaultConfDir,
java.util.Map<java.lang.String,java.lang.String> properties)
Checks for whether the designated properties contain configuration URLs or
configuration directories and adds the default configuration directory
. |
protected java.util.List<java.net.URL> |
parseConfDirs(java.lang.String[] confs)
Parses the designated configuration directories and splits them
appropriately based on the position of the provided configuration.
|
getSubstitutedVariables, getUseSunSecurityProviderspublic ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties)
throws ConfigurationException
ConfigurationPropertyProvider and parses all
corresponding global properties from the designated map and/or sets the
properties appropriately. If no configuration directory or URL is
specified, ./conf will be used.properties - A map providing all required global properties and values
for substituted variables.ConfigurationException - If there are problems retrieving a required
global property or a substituted variables from the designated
map, a ConfigurationException will be thrown.public ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String bundleConfigSubdir)
throws ConfigurationException
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. If no
configuration directory or URL is specified, ./conf will be used.properties - A map providing all required global properties and values for substituted
variables.bundleConfigSubdir - The subdirectory below conf/ in the bundle
configuration. This will only be used if the designated properties activate bundle
configuration loading.ConfigurationException - If there are problems retrieving a required global property or a
substituted variables from the designated map, a ConfigurationException
will be thrown.public ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
java.lang.String bundleConfigSubdir,
boolean defaultDsForRtConf)
throws ConfigurationException
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. If no
configuration directory or URL is specified, ./conf will be used.properties - A map providing all required global properties and values for substituted
variables.bundleConfigSubdir - The subdirectory below conf/ in the bundle
configuration. This will only be used if the designated properties activate bundle
configuration loading.defaultDsForRtConf - The default value for whether to use the default data source for
runtime configurations. This will overridden if present in the designated properties.ConfigurationException - If there are problems retrieving a required global property or a
substituted variables from the designated map, a ConfigurationException
will be thrown.public ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
boolean useDefaultConfDir,
boolean defaultDsForRtConf)
throws ConfigurationException
ConfigurationPropertyProvider and parses all
corresponding global properties from the designated map and/or sets the
properties appropriately. If no configuration directory or URL is
specified, ./conf will be used or not depending on the
designated flag.properties - A map providing all required global properties and values
for substituted variables.useDefaultConfDir - Whether ./conf should be used as
default configuration directory in case no other configuration
directory or URL is set.defaultDsForRtConf - The default value for whether to use the default data source for
runtime configurations. This will overridden if present in the designated properties.ConfigurationException - If there are problems retrieving a required
global property or a substituted variables from the designated
map, a ConfigurationException will be thrown.public ConfigurationPropertyProvider(java.util.Map<java.lang.String,java.lang.String> properties,
boolean useDefaultConfDir,
java.lang.String bundleConfigSubdir,
boolean defaultDsForRtConf)
throws ConfigurationException
ConfigurationPropertyProvider and parses all corresponding global
properties from the designated map and/or sets the properties appropriately. If no
configuration directory or URL is specified, ./conf will be used or not depending
on the designated flag.properties - A map providing all required global properties and values for substituted
variables.useDefaultConfDir - Whether ./conf should be used as default configuration
directory in case no other configuration directory or URL is set.bundleConfigSubdir - The subdirectory below conf/ in the bundle
configuration. This will only be used if the designated properties activate bundle
configuration loading.defaultDsForRtConf - The default value for whether to use the default data source for
runtime configurations. This will overridden if present in the designated properties.ConfigurationException - If there are problems retrieving a required global property or a
substituted variables from the designated map, a ConfigurationException
will be thrown.public java.util.List<java.net.URL> getConfDirs()
public java.util.List<java.net.URL> getBeforeConfDirs()
public java.util.List<java.net.URL> getAfterConfDirs()
public boolean getUseDefDsForRtConf()
public java.io.File getRuntimeConfDir()
arflow.datadir
will be used.public java.lang.String getBundleConfigSubdir()
conf/ in the jar-file. null indicates to not load the bundle
configuration.null) and from where below conf/ in the jar-file.public boolean getDebugConfig()
GlobalProperties have been
initialised.public boolean getKeepLogHandler()
GlobalProperties have been
initialised.protected void initialiseProperties(java.util.Map<java.lang.String,java.lang.String> properties)
throws ConfigurationException
./logs)./examples)./lib)false)./logs)./examples)./lib)false)false)false)false)initialiseProperties in class PropertyProviderproperties - The properties which to parse.ConfigurationException - Besides the overridden method, this method
will throw a ConfigurationException if there are
problems with the directory for the runtime configurations, for
instance, it is not a directory or it can not be written to.protected java.util.List<java.net.URL> parseConfDirs(java.lang.String[] confs)
confs - The configuration directories or URLs as provided by the user.ConfigurationConstants.CONFIG_PROVIDED_POSITIONprotected static java.util.Map<java.lang.String,java.lang.String> injectDefaultConfDir(boolean useDefaultConfDir,
java.util.Map<java.lang.String,java.lang.String> properties)
./conf if neither are set and the default should be used.useDefaultConfDir - Whether to add the default configuration directory
in case neither configuration URLs nor configuration directories
are in the designated properties.properties - The properties in which to inject the default
configuration directory if appropriate.