|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jconfig.ConfigurationManager
Nested Class Summary | |
private static class |
ConfigurationManager.MyErrorHandler
|
Field Summary | |
private static java.util.Vector |
categories
|
private static ConfigurationManager |
cfgmgr
|
private static java.util.Hashtable |
parameter
|
private boolean |
validate
|
Constructor Summary | |
ConfigurationManager()
|
Method Summary | |
void |
addCategory(java.lang.String category)
|
java.util.Enumeration |
getCategoryNames()
This method returns an Enumeration of all categories. |
static ConfigurationManager |
getInstance()
This method returns an instance of the ConfigurationManager. |
java.util.Hashtable |
getProperties()
This method will return a Hashtable that contains all properties for the category "general". |
java.util.Hashtable |
getProperties(java.lang.String category)
This method will return a Hashtable that contains all properties for the selected category. |
java.lang.String |
getProperty(java.lang.String key)
This method returns the value for a particular key The category is "general". |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
This method returns the value for a particular key. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue,
java.lang.String category)
This method returns the value for a particular key in the certain category. |
void |
load(java.io.File file)
This method will read in a file and generate the properties |
void |
load(java.lang.String theURL)
This method will read the content from an URL and generate the properties |
void |
loadProperties(java.io.File file)
This method will store all categories and properties to a Java-properties file. |
private void |
processProperties(org.w3c.dom.Document doc)
|
void |
setProperty(java.lang.String name,
java.lang.String value)
This method will set the value for a specific property in the category "general". |
void |
setProperty(java.lang.String name,
java.lang.String value,
java.lang.String category)
This method will set the value for a specific property in the selected category. |
void |
setValidation(boolean validate)
This method will set the flag if validation is used for parsing the file/stream from URL or not |
void |
store(java.io.File file)
This method will save the current categories and their properties to a file |
void |
storeProperties(java.io.File file)
This method will generate a Java-properties file. |
void |
storeProperties(java.io.File file,
java.lang.String category)
This method will write a Java-properties file and fill in the properties for the particular category. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.util.Hashtable parameter
private static java.util.Vector categories
private static ConfigurationManager cfgmgr
private boolean validate
Constructor Detail |
public ConfigurationManager()
Method Detail |
public java.lang.String getProperty(java.lang.String key)
key
- the name of the property
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the name of the propertydefaultValue
- the value that will be returned if the property cannot be found
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue, java.lang.String category)
key
- the name of the propertydefaultValue
- the value that will be returned if the property cannot be foundcategory
- the name of the category
public static ConfigurationManager getInstance()
public java.util.Enumeration getCategoryNames()
public java.util.Hashtable getProperties()
public java.util.Hashtable getProperties(java.lang.String category)
category
- the name of the category
public void setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value for this propertypublic void setProperty(java.lang.String name, java.lang.String value, java.lang.String category)
name
- the name of the propertyvalue
- the value for this propertycategory
- the name of the categorypublic void addCategory(java.lang.String category)
public void store(java.io.File file) throws ConfigurationManagerException
file
- the file that will be generated
ConfigurationManagerException
private void processProperties(org.w3c.dom.Document doc)
public void setValidation(boolean validate)
validate
- true if the content should be validated firstpublic void load(java.io.File file) throws ConfigurationManagerException
ConfigurationManagerException
- if the file cannot be processedpublic void load(java.lang.String theURL) throws ConfigurationManagerException
ConfigurationManagerException
- if the file cannot be processedpublic void loadProperties(java.io.File file) throws ConfigurationManagerException
file
- the file
ConfigurationManagerException
- if the file cannot be processedpublic void storeProperties(java.io.File file) throws ConfigurationManagerException
file
- the file
ConfigurationManagerException
- if the file cannot be processedpublic void storeProperties(java.io.File file, java.lang.String category) throws ConfigurationManagerException
file
- the file
ConfigurationManagerException
- if the file cannot be processed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |