Class SystemPropertyProvider
- java.lang.Object
-
- de.aristaflow.adept2.base.configuration.PropertyProvider
-
- de.aristaflow.adept2.base.configuration.ConfigurationPropertyProvider
-
- de.aristaflow.adept2.base.configuration.SystemPropertyProvider
-
public class SystemPropertyProvider extends ConfigurationPropertyProvider
ASystemPropertyProvider
provides the means to retrieve global properties and the variables to be substituted directly from system properties of the JVM. This is useful for stand-alone applications, that are applications running as a single application in a JVM as opposite to applications running in an execution context like an application server.This class parses the following property from the system environment (in parentheses the default value that will apply if the property is not set):
- os.name
- arflow.logdir (default:
./logs
) - arflow.datadir (default:
./examples
) - arflow.libdir (default:
./lib
) - arflow.useSunSecProvider (default:
false
) - arflow.confurl
- arflow.confdir (applies only if arflow.confurl not set, optional default
./conf
) - arflow.configuration.runtime.defaultdatasource (default:
false
) - arflow.confdir.runtime (default: "rtConf/" below arflow.datadir)
- arflow.configuration.bundle (default:
false
) - arflow.debug.configuration (default:
false
) - arflow.logging.keephandler (default:
false
) - arflow.confVar.*
-
-
Field Summary
-
Fields inherited from class de.aristaflow.adept2.base.configuration.PropertyProvider
logger
-
-
Constructor Summary
Constructors Modifier Constructor Description SystemPropertyProvider()
Creates a newSystemPropertyProvider
and parses all corresponding system properties and/or sets the properties appropriately.SystemPropertyProvider(boolean useDefaultConfDir)
Creates a newSystemPropertyProvider
and parses all corresponding system properties and/or sets the properties appropriately.SystemPropertyProvider(boolean useDefaultConfDir, boolean defaultDsForRtConf)
Creates a newSystemPropertyProvider
and parses all corresponding system properties and/or sets the properties appropriately.SystemPropertyProvider(Map<String,String> overrides)
Creates a newSystemPropertyProvider
and parses the properties from the designated map.protected
SystemPropertyProvider(Map<String,String> properties, boolean useDefaultConfDir, boolean defaultDsForRtConf)
Creates a newSystemPropertyProvider
by delegating directly to the parent provider.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static Map<String,String>
merge(Map<String,String> overrides, Map<String,String> properties)
Merges the designated maps, whereas theoverrides
take precedence over theproperties
.-
Methods inherited from class de.aristaflow.adept2.base.configuration.ConfigurationPropertyProvider
getAfterConfDirs, getBeforeConfDirs, getBundleConfigSubdir, getConfDirs, getDebugConfig, getKeepLogHandler, getRuntimeConfDir, getUseDefDsForRtConf, initialiseProperties, injectDefaultConfDir, parseConfDirs
-
Methods inherited from class de.aristaflow.adept2.base.configuration.PropertyProvider
getSkipClosing, getSubstitutedVariables, getTotalMemPerthousandStreamThreshold, getUsePre300Security, getUseSunSecurityProviders
-
-
-
-
Constructor Detail
-
SystemPropertyProvider
public SystemPropertyProvider() throws ConfigurationException
Creates a newSystemPropertyProvider
and parses all corresponding system properties and/or sets the properties appropriately. If no configuration directory or URL is specified,./conf
will be used.- Throws:
ConfigurationException
- If there are problems retrieving a required global property or a substituted variables from the system properties, aConfigurationException
will be thrown.
-
SystemPropertyProvider
public SystemPropertyProvider(boolean useDefaultConfDir) throws ConfigurationException
Creates a newSystemPropertyProvider
and parses all corresponding system properties 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.- Parameters:
useDefaultConfDir
- Whether./conf
should be used as default configuration directory in case no other configuration directory or URL is set.- Throws:
ConfigurationException
- If there are problems retrieving a required global property or a substituted variables from the system properties, aConfigurationException
will be thrown.
-
SystemPropertyProvider
public SystemPropertyProvider(boolean useDefaultConfDir, boolean defaultDsForRtConf) throws ConfigurationException
Creates a newSystemPropertyProvider
and parses all corresponding system properties 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.- Parameters:
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.- Throws:
ConfigurationException
- If there are problems retrieving a required global property or a substituted variables from the system properties, aConfigurationException
will be thrown.
-
SystemPropertyProvider
public SystemPropertyProvider(Map<String,String> overrides) throws ConfigurationException
Creates a newSystemPropertyProvider
and parses the properties from the designated map. If an entry does not exist in the designated map, the corresponding system property will apply. No default configuration directory or URL will be used.- Parameters:
overrides
- The properties overriding the system properties.- Throws:
ConfigurationException
- If there are problems retrieving a required global property or a substituted variables from the system properties or the designated map, aConfigurationException
will be thrown.
-
SystemPropertyProvider
protected SystemPropertyProvider(Map<String,String> properties, boolean useDefaultConfDir, boolean defaultDsForRtConf) throws ConfigurationException
Creates a newSystemPropertyProvider
by delegating directly to the parent provider.- Parameters:
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.- Throws:
ConfigurationException
- If there are problems retrieving a required global property or a substituted variables from the designated map, aConfigurationException
will be thrown.- See Also:
ConfigurationPropertyProvider(Map, boolean, boolean)
-
-
Method Detail
-
merge
protected static Map<String,String> merge(Map<String,String> overrides, Map<String,String> properties)
Merges the designated maps, whereas theoverrides
take precedence over theproperties
.- Parameters:
overrides
- The map containing the properties to be used with high priority.properties
- The map containing the properties to be used with low priority.- Returns:
- A map containing the properties of the designated maps according to their respective priority.
-
-