|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.unitils.core.ConfigurationLoader
public class ConfigurationLoader
Utility that loads the configuration of unitils.
Unitils settings can be defined in 3 files and in the system properties:PROPKEY_CUSTOM_CONFIGURATION
property in the default settings. The name of the local settings file (unitils-local.propeties) is defined
by the PROPKEY_LOCAL_CONFIGURATION
in the custom or default settings. If these properties are set to
null or empty, the corresponding property file will not be loaded.
A runtime exception is thrown when the default properties cannot be loaded.
A warning is logged when the custom propreties cannot be loaded.
A debug message is logged when the local properties cannot be loaded.
Ant-like property place holders, e.g. ${holder} will be expanded if needed all property place holders to actual values.
For example suppose you have a property defined as follows: root.dir=/usr/home
Expanding following ${root.dir}/somesubdir
will then give following result: /usr/home/somesubdir
Field Summary | |
---|---|
static String |
DEFAULT_PROPERTIES_FILE_NAME
Name of the fixed configuration file that contains all defaults |
static String |
PROPKEY_CUSTOM_CONFIGURATION
Property in the defaults configuration file that contains the name of the custom configuration file |
static String |
PROPKEY_LOCAL_CONFIGURATION
Property in the defaults and/or custom configuration file that contains the name of the user local configuration file |
Constructor Summary | |
---|---|
ConfigurationLoader()
|
Method Summary | |
---|---|
protected void |
expandPropertyValues(Properties properties)
Expands all property place holders to actual values. |
protected String |
getConfigurationFileName(String propertyName,
Properties properties)
Gets the configuration file name from the system properties or if not defined, from the given loaded properties. |
Properties |
loadConfiguration()
Creates and loads all configuration settings. |
protected void |
loadCustomConfiguration(Properties properties)
Load the custom project level configuration file (unitils.properties) |
protected void |
loadDefaultConfiguration(Properties properties)
Load the default properties file that is distributed with unitils (unitils-default.properties) |
protected void |
loadLocalConfiguration(Properties properties)
Load the local configuration file from the user home, or from the classpath |
protected void |
loadSystemProperties(Properties properties)
Load the environment properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_PROPERTIES_FILE_NAME
public static final String PROPKEY_CUSTOM_CONFIGURATION
public static final String PROPKEY_LOCAL_CONFIGURATION
Constructor Detail |
---|
public ConfigurationLoader()
Method Detail |
---|
public Properties loadConfiguration()
protected void loadDefaultConfiguration(Properties properties)
properties
- The instance to add to loaded properties to, not nullprotected void loadCustomConfiguration(Properties properties)
properties
- The instance to add to loaded properties to, not nullprotected void loadLocalConfiguration(Properties properties)
properties
- The instance to add to loaded properties to, not nullprotected void loadSystemProperties(Properties properties)
properties
- The instance to add to loaded properties to, not nullprotected void expandPropertyValues(Properties properties)
properties
- The properties, not nullprotected String getConfigurationFileName(String propertyName, Properties properties)
propertyName
- The name of the property that defines the local/custom file name, not nullproperties
- The propertis that were already loaded, not null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |