edu.upc.dama.dex.utils
Class DEXConfig

java.lang.Object
  extended by java.util.Dictionary
      extended by java.util.Hashtable
          extended by java.util.Properties
              extended by edu.upc.dama.dex.utils.DEXConfig
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class DEXConfig
extends java.util.Properties

Runtime configuration settings for the DEX framework.

Maintains a set of hardwired configuration settings that can be overrriden by creating a text properties file containing custom values. By default, DEX will look for the file "dex.cfg" in the current working directory for configuration name/value pairs. The framework can be instructed to look for a different file by putting the full path to the file into the "dex.config" System property (for example by using a -D flag at the Java runtime command line).

Some of the supported configuration properties include:

Application creators are welcome to add their own custom properties to the configuration files and use the DEXConfig instance to access those properties.

This class is a singleton, accessed through a static accessor method.

See Also:
Serialized Form
Author:
Sparsity Technologies

Field Summary
 
Fields inherited from class java.util.Properties
defaults
 
Method Summary
static java.lang.String get(java.lang.String key)
          Gets a DEX configuration property.
static boolean getBoolean(java.lang.String key)
          Gets a DEX configuration property as a boolean.
static DEXConfig getConfig()
          Gets the global DEXConfig instance.
static double getDouble(java.lang.String key)
          Gets a DEX configuration property as a double.
static float getFloat(java.lang.String key)
          Gets a DEX configuration property as a float.
static int getInt(java.lang.String key)
          Gets a DEX configuration property as an integer.
static long getLong(java.lang.String key)
          Gets a DEX configuration property as a long.
static void set(java.lang.String key, java.lang.String value)
          Sets a DEX configuration property.
 
Methods inherited from class java.util.Properties
getProperty, getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

getConfig

public static DEXConfig getConfig()
Gets the global DEXConfig instance.

Returns:
The configuration instance.

get

public static java.lang.String get(java.lang.String key)
Gets a DEX configuration property.

Parameters:
key - the name of the property to lookup.
Returns:
the property value, or null if the key is not found.

getInt

public static int getInt(java.lang.String key)
Gets a DEX configuration property as an integer.

Parameters:
key - the name of the property to lookup.
Returns:
the property value, or the minimum possible integer value if the key is not found or parsing of the number fails.

getLong

public static long getLong(java.lang.String key)
Gets a DEX configuration property as a long.

Parameters:
key - the name of the property to lookup.
Returns:
the property value, or the minimum possible long value if the key is not found or parsing of the number fails.

getFloat

public static float getFloat(java.lang.String key)
Gets a DEX configuration property as a float.

Parameters:
key - the name of the property to lookup.
Returns:
the property value, or a Float.NaN. value if the key is not found or parsing of the number fails.

getDouble

public static double getDouble(java.lang.String key)
Gets a DEX configuration property as a double.

Parameters:
key - the name of the property to lookup.
Returns:
the property value, or a Double.NaN value if the key is not found or parsing of the number fails.

getBoolean

public static boolean getBoolean(java.lang.String key)
Gets a DEX configuration property as a boolean.

Parameters:
key - the name of the property to lookup.
Returns:
the property value. False is returned if the key is not found or does not parse to a true/false value.

set

public static void set(java.lang.String key,
                       java.lang.String value)
Sets a DEX configuration property.

Parameters:
key - the name of the property.
value - the value of the property.