|
2.12.0: 2009-05-27 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.basedb.core.Config
public class Config
Use this class to access the configuration settings for BASE.
The configuration settings are always stored in a file named
base.config
. It should be located at the root of
one of the paths in the CLASSPATH environment variable. For Tomcat this
means it should be located in the WEB-INF/classes
folder.
Field Summary | |
---|---|
private static Properties |
config
Variable for holding the configuration properties. |
private static File |
configDir
|
private static boolean |
isInitialised
|
Constructor Summary | |
---|---|
Config()
|
Method Summary | |
---|---|
static boolean |
getBoolean(String key)
Get the configuration setting specified by key as a boolean
value. |
static String |
getCharset()
Get the default character set to use when no other has been specified. |
static File |
getConfigDirectory()
Get the directory where the BASE configuration files are located. |
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 long |
getLong(String key,
long defaultValue)
Get the configuration setting specified by key as a long 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. |
(package private) static void |
init()
Loads the settings from the configuration file. |
(package private) static void |
unload()
Unload all settings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static Properties config
private static boolean isInitialised
private static File configDir
Constructor Detail |
---|
public Config()
Method Detail |
---|
static void init() throws ConfigurationException
ConfigurationException
- This exception is thrown if the
configuration settings cannot be loadedstatic void unload()
public static File getConfigDirectory()
java.io.File
objectpublic static String getString(String key)
key
as a String value.
key
- The key for the setting
key
or null if it is not foundpublic static String getString(String key, String defaultValue)
key
as a String value.
key
- The key for the settingdefaultValue
- The value to return if the key
is not found
key
or defaultValue
if it is not found or is emptypublic static int getInt(String key)
key
as an integer value.
key
- The key for the setting
key
or 0 if it is not found or
is not a numberpublic static int getInt(String key, int defaultValue)
key
as an integer value.
key
- The key for the settingdefaultValue
- The value to return if the key
is not found
key
or defaultValue
if it is not foundpublic static long getLong(String key, long defaultValue)
key
as a long value.
key
- The key for the settingdefaultValue
- The value to return if the key
is not found
key
or defaultValue
if it is not foundpublic static boolean getBoolean(String key)
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.
key
- The key for the setting
key
public static String getCharset()
defaultCharset
setting and uses ISO-8859-1
if not specified.
|
2.12.0: 2009-05-27 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |