Last update: 2011-06-23

org.proteios.core
Class Config

java.lang.Object
  extended by org.proteios.core.Config

public class Config
extends Object

Use this class to access the configuration settings for Proteios. The default configuration should be located in /proteios.config. For tomcat that is .../WEB-INF/classes/proteios.config. You could change the location of this file by specifying the environment variable PROTEIOS_CONFIG; which should be a valid URL e.g. file:///etc/proteios/config

Version:
2.0
Author:
Nicklas, Gregory

Field Summary
static String PROTEIOS_CONFIG
          Environment variable optionally defined to alter location of proteios.config file
 
Constructor Summary
Config()
           
 
Method Summary
static boolean getBoolean(String key)
          Get the configuration setting specified by key as a boolean value.
static String getConfigFileName()
           
static int getInt(String key)
          Get the configuration setting specified by key as an integer value.
static int getInt(String key, int defaultValue)
          Get the configuration setting specified by key as an integer value.
static String getString(String key)
          Get the configuration setting specified by key as a String value.
static String getString(String key, String defaultValue)
          Get the configuration setting specified by key as a String value.
static void setConfigFileName(String configFileName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROTEIOS_CONFIG

public static final String PROTEIOS_CONFIG
Environment variable optionally defined to alter location of proteios.config file

See Also:
Constant Field Values
Constructor Detail

Config

public Config()
Method Detail

getConfigFileName

public static String getConfigFileName()

setConfigFileName

public static void setConfigFileName(String configFileName)

getString

public static String getString(String key)
Get the configuration setting specified by key as a String value.

Parameters:
key - The key for the setting
Returns:
The value specified by key or null if it is not found

getString

public static String getString(String key,
                               String defaultValue)
Get the configuration setting specified by key as a String value.

Parameters:
key - The key for the setting
defaultValue - The value to return if the key is not found
Returns:
The value specified by key or defaultValue if it is not found or is empty

getInt

public static int getInt(String key)
Get the configuration setting specified by key as an integer value.

Parameters:
key - The key for the setting
Returns:
The value specified by key or 0 if it is not found or is not a number

getInt

public static int getInt(String key,
                         int defaultValue)
Get the configuration setting specified by key as an integer value.

Parameters:
key - The key for the setting
defaultValue - The value to return if the key is not found
Returns:
The value specified by key or defaultValue if it is not found

getBoolean

public static boolean getBoolean(String key)
Get the configuration setting specified by key as a boolean value. FALSE is returned if the setting doesn't exist, if it contains an empty string, or one of the values 'no', 'false' or '0'. In all other cases TRUE is returned.

Parameters:
key - The key for the setting
Returns:
The value specified by key

Last update: 2011-06-23