|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Interface for JFig The JFig package provides very simple, flexible and powerful functionality for managing one or more configurations in a java environment.
It allows for a combination of a hierarchy of configuration files, substitution variables and property variables. Methods are provided to get values stored in a configuration dictionary with a variety of types (String, array, integer, float, boolean, etc) and default values.
Usage:
To get an instance of the JFig singleton, use:
JFig. getInstance();
There are a number of helper methods to retrieve configuration values. The
most common is:
String value = JFig. getInstance().getValue ("aSection","aKey","aDefaultValue");
See the javadocs for additional helper methods to retrieve values as different java types and with different exception handling.
Method Summary | |
void |
addConfigEventListener(JFigListener listener)
Add ConfigEvent listeners to vector so they can be notified when there is a significant change in the configuration. |
java.lang.String[] |
getArrayValue(java.lang.String section,
java.lang.String key)
convenience method for getting values as array The value is tokenized depending on the first token found in the following order: comma, semicolon, colon, space |
java.lang.String[] |
getArrayValue(java.lang.String section,
java.lang.String key,
java.lang.String notFoundValue)
convenience method for getting values as array with default value |
boolean |
getBooleanValue(java.lang.String section,
java.lang.String key,
java.lang.String notFoundValue)
convenience method for getting values as boolean |
JFigDictionary |
getConfigDictionary()
return the ConfigurationDictionary Made public so we can access this from a jsp and show the configuration via html. |
java.util.Map |
getEntriesStartingWith(java.lang.String section,
java.lang.String key)
Return a map of all values starting with "key" in the scetcion. |
float |
getFloatValue(java.lang.String section,
java.lang.String key,
java.lang.String notFoundValue)
getFloatValue() convenience method for getting values as float |
int |
getIntegerValue(java.lang.String section,
java.lang.String key)
convenience method for getting values as int |
int |
getIntegerValue(java.lang.String section,
java.lang.String key,
java.lang.String notFoundValue)
convenience method for getting values as int, with default value |
java.util.Map |
getSection(java.lang.String section)
Return an entire section |
java.util.Properties |
getSectionAsProperties(java.lang.String section)
Return a section converted to a Properties object (but not system properties) |
java.util.Properties |
getSectionAsProperties(java.lang.String section,
java.util.Properties properties)
Return a section added to the supplied Properties object |
java.lang.String |
getValue(java.lang.String section,
java.lang.String key)
Call configParser to get the value for a key in a given section. |
java.lang.String |
getValue(java.lang.String section,
java.lang.String key,
java.lang.String defaultValue)
First look in given section. |
java.util.List |
getValuesStartingWith(java.lang.String section,
java.lang.String key)
Return a list of all values starting with "key" in the scetcion. |
void |
print()
Print the values in the configuration dictionary. |
void |
printConfigurationDictionary()
Deprecated. |
void |
reprocessConfiguration()
reprocess the configuration creating a new config dictionary |
void |
reprocessConfiguration(JFigLocator locator)
reprocess the configuration creating a new config dictionary |
void |
setConfigurationValue(java.lang.String sectionName,
java.lang.String keyString,
java.lang.String valueString)
Set a configuration value. |
Method Detail |
public void addConfigEventListener(JFigListener listener)
listener
- The feature to be added to the ConfigEventListener
attributepublic void print()
public void printConfigurationDictionary()
public void reprocessConfiguration() throws JFigException
JFigException
public void reprocessConfiguration(JFigLocator locator) throws JFigException
JFigException
public JFigDictionary getConfigDictionary()
public java.lang.String[] getArrayValue(java.lang.String section, java.lang.String key) throws JFigException
JFigException
public boolean getBooleanValue(java.lang.String section, java.lang.String key, java.lang.String notFoundValue)
public float getFloatValue(java.lang.String section, java.lang.String key, java.lang.String notFoundValue) throws JFigException
section
- Description of Parameterkey
- Description of ParameternotFoundValue
- Description of Parameter
JFigException
- Description of Exceptionpublic int getIntegerValue(java.lang.String section, java.lang.String key) throws JFigException
JFigException
public int getIntegerValue(java.lang.String section, java.lang.String key, java.lang.String notFoundValue)
public java.lang.String getValue(java.lang.String section, java.lang.String key, java.lang.String defaultValue)
section
- Description of Parameterkey
- Description of ParameterdefaultValue
- Description of Parameter
public java.util.List getValuesStartingWith(java.lang.String section, java.lang.String key)
section
- key
-
public java.util.Map getEntriesStartingWith(java.lang.String section, java.lang.String key)
section
- key
-
public java.lang.String getValue(java.lang.String section, java.lang.String key) throws JFigException
JFigException
public java.util.Map getSection(java.lang.String section)
section
-
public java.util.Properties getSectionAsProperties(java.lang.String section)
section
-
public java.util.Properties getSectionAsProperties(java.lang.String section, java.util.Properties properties)
section
-
public void setConfigurationValue(java.lang.String sectionName, java.lang.String keyString, java.lang.String valueString)
public java.lang.String[] getArrayValue(java.lang.String section, java.lang.String key, java.lang.String notFoundValue)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |