eu.scape_project.watch.utils
Class ConfigUtils

java.lang.Object
  extended by eu.scape_project.watch.utils.ConfigUtils

public class ConfigUtils
extends Object

A simple configuration utilities class, that loads the configuration files into memory and allows the retrieval of some config parameters. It first looks into the home directory for a config file, if none is found it falls back to the /etc/ directory and if none is found again it takes the default properties.

Author:
Watch Dev Team

Field Summary
static String KB_DATA_FOLDER_KEY
          The property designating the data folder of the watch tdb.
static String KB_INSERT_TEST_DATA
          The property designating whether or not the test data should be inserted on startup.
 
Constructor Summary
ConfigUtils()
          The default constructor loads the properties.
 
Method Summary
 boolean getBooleanProperty(String key)
          Returns a boolean value for the specified property key or false if none was found.
 int getIntProperty(String key)
          Returns an integer value for the specified property key or -1.
 String getStringProperty(String key)
          Gets a String representation for the property key or an empty string if no property was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KB_DATA_FOLDER_KEY

public static final String KB_DATA_FOLDER_KEY
The property designating the data folder of the watch tdb.

See Also:
Constant Field Values

KB_INSERT_TEST_DATA

public static final String KB_INSERT_TEST_DATA
The property designating whether or not the test data should be inserted on startup.

See Also:
Constant Field Values
Constructor Detail

ConfigUtils

public ConfigUtils()
The default constructor loads the properties.

See Also:
ConfigUtils#loadConfig()}
Method Detail

getStringProperty

public String getStringProperty(String key)
Gets a String representation for the property key or an empty string if no property was found.

Parameters:
key - the key of the property
Returns:
a string with the value or an empty string if none found.

getIntProperty

public int getIntProperty(String key)
Returns an integer value for the specified property key or -1.

Parameters:
key - the key of the property.
Returns:
the value or -1.

getBooleanProperty

public boolean getBooleanProperty(String key)
Returns a boolean value for the specified property key or false if none was found.

Parameters:
key - the key of the property.
Returns:
the value or false.


Copyright © 2012. All Rights Reserved.