Package com.saperion.util.configuration
Class ConfigurationUtil
java.lang.Object
com.saperion.util.configuration.ConfigurationUtil
This utility offers convenient configuration file usage.
- Author:
- sts
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckConfigFiles(List<ConfigFileDescriptor> configs) Checks if all required configurations files are existing.static StringgetAbsolutePath(ConfigFileDescriptor configFile) Returns the absolute path of the given configuration file.static StringReturns the absolute path of the given configuration file holder.static StringgetPath(ConfigFileDescriptor config) Returns the path of the given config file.static StringgetPath(ConfigurationFileHolder holder) Returns the path of the given config file holder.static PropertiesgetProperties(ConfigFileDescriptor config) Returns Properties object by the given config file.static PropertiesgetProperties(ConfigurationFileHolder holder) Returns Properties object by the given config file holder.static PropertiesgetProperties(String config) Returns Properties object by the given path.static voidsetBasePath(String basepath) Sets the base path of all configurations files handled by this util.
-
Field Details
-
BASE_PATH
The internal base path to the configuration files.
-
-
Method Details
-
setBasePath
Sets the base path of all configurations files handled by this util.- Parameters:
basepath- the base path of all configuration files.
-
checkConfigFiles
Checks if all required configurations files are existing.- Parameters:
configs- The required configurations.- Throws:
Exception- one of the required files is missing.
-
getPath
Returns the path of the given config file.- Parameters:
config- The config file to get the path of.- Returns:
- The config file's path.
-
getPath
Returns the path of the given config file holder.- Parameters:
holder- The config file holder to get the path of.- Returns:
- The config file's path.
-
getProperties
Returns Properties object by the given config file.- Parameters:
config- The config file to build the Properties of.- Returns:
- The built Properties object.
-
getProperties
Returns Properties object by the given config file holder.- Parameters:
holder- The config file holder to build the Properties of.- Returns:
- The built Properties object.
-
getProperties
Returns Properties object by the given path. Tries to load the properties files as XML and flat file.- Parameters:
config- The config path to the config file to build the Properties of.- Returns:
- The built Properties object.
-
getAbsolutePath
Returns the absolute path of the given configuration file.- Parameters:
configFile- The configuration file in question.- Returns:
- the absolute path of the given configuration file if found.
-
getAbsolutePath
Returns the absolute path of the given configuration file holder.- Parameters:
holder- The configuration file in question.- Returns:
- the absolute path of the given configuration file if found.
-