|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.argval.utils.impl.PropertiesLoaderImpl
public class PropertiesLoaderImpl
This PropertiesLoader provides a standard way for loading (test) configuration(s). It provides
a static method to load the configuration as a Properties object.
The configuration is loaded as follows:
property-key-name-configuration-file is set, that
file is used.
| Constructor Summary | |
|---|---|
PropertiesLoaderImpl(String propKeyConfigurationFile,
String configDirName,
String defaultFileName)
Creates a PropertiesLoader specific for an application / utility. |
|
| Method Summary | |
|---|---|
File |
getPropertiesFile()
Returns the location of the properties file. |
String |
getPropertiesFileMessage()
Returns a message about the location from which the message was loaded. |
Properties |
loadConfiguration()
Returns the loaded configuration Properties, including the System.getProperties(). |
Properties |
loadConfiguration(Boolean includeSystemProperties)
Load the configuration properties from file and add the System properties (environment variable). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesLoaderImpl(String propKeyConfigurationFile,
String configDirName,
String defaultFileName)
PropertiesLoader specific for an application / utility.
Specify the propKeyConfigurationFile as a property key. This key can be used
to specify the location of the configuration file, as system property / environment variable.
As in:
java -Dmy-application-name.configuration.path=Theorg.organisation.application.Start
folderName is optional, use it when the application has a default configuration folder
in the users home directory. Like ${user.home/.my-application-config/.
The defaultFileName required, used to find load the default configuration file, from the
configuration application configuration directory
(${user.home}/.my-application-config/defaultFileName). Or the current working directory
(${user.dir}/defaultFileName).
propKeyConfigurationFile - - the system property key, for locating the configuration file (not null)configDirName - - the applications configuration directory (when it has one) (can be null)defaultFileName - - the default configuration file name (not null).| Method Detail |
|---|
public Properties loadConfiguration()
throws IOException
PropertiesLoaderProperties, including the System.getProperties().
loadConfiguration in interface PropertiesLoaderFileNotFoundException - When no configuration file is found.
IOException - When loading of properties file is not successful.
public Properties loadConfiguration(Boolean includeSystemProperties)
throws IOException
PropertiesLoader
loadConfiguration in interface PropertiesLoaderincludeSystemProperties - - If true the system properties will be included
(over ruling the loaded properties from file), else (when false) the system properties will
not added. (Default is true)
FileNotFoundException - When no configuration file is found.
IOException - When loading of properties file is not successful.
public File getPropertiesFile()
throws FileNotFoundException
PropertiesLoader
getPropertiesFile in interface PropertiesLoaderFileNotFoundException - When no configuration file is found.public String getPropertiesFileMessage()
PropertiesLoader
getPropertiesFileMessage in interface PropertiesLoader
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||