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 void
checkConfigFiles
(List<ConfigFileDescriptor> configs) Checks if all required configurations files are existing.static String
getAbsolutePath
(ConfigFileDescriptor configFile) Returns the absolute path of the given configuration file.static String
Returns the absolute path of the given configuration file holder.static String
getPath
(ConfigFileDescriptor config) Returns the path of the given config file.static String
getPath
(ConfigurationFileHolder holder) Returns the path of the given config file holder.static Properties
getProperties
(ConfigFileDescriptor config) Returns Properties object by the given config file.static Properties
getProperties
(ConfigurationFileHolder holder) Returns Properties object by the given config file holder.static Properties
getProperties
(String config) Returns Properties object by the given path.static void
setBasePath
(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.
-