|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A Configuraton provides access to all Category and Properties. The Configuration was converted into an Interface after the need for other Configuration implementations existed.
DefaultConfiguration
,
ExtensibleConfiguration
Method Summary | |
void |
addCategoryListener(CategoryListener listener)
|
void |
addCategoryListener(CategoryListener listener,
java.lang.String categoryName)
|
void |
addConfigurationListener(ConfigurationListener listener)
Adds the specified configuration listener to receive configuration changed events from this configuration. |
void |
addInclude(int type,
java.lang.String name)
|
void |
addPropertyListener(PropertyListener listener)
Adds the PropertyListener to the main category. |
void |
addPropertyListener(PropertyListener listener,
java.lang.String categoryName)
Adds the PropertyListener to the given category. |
boolean |
containsCategory(java.lang.String categoryName)
Use this method to determine if a category exists. |
void |
fireConfigurationChangedEvent(ConfigurationChangedEvent event)
Deliver configuration changed event to all listeners that are registered with our listener list. |
java.lang.String[] |
getArray(java.lang.String key)
|
java.lang.String[] |
getArray(java.lang.String key,
java.lang.String[] defaultValue)
|
java.lang.String[] |
getArray(java.lang.String key,
java.lang.String[] defaultValue,
java.lang.String category)
|
boolean |
getBooleanProperty(java.lang.String name,
boolean defaultValue)
Wrapper method to keep API simple |
boolean |
getBooleanProperty(java.lang.String name,
boolean defaultValue,
java.lang.String categoryName)
Wrapper method to Category method |
Category |
getCategory()
Returns the main category for this configuration |
Category |
getCategory(java.lang.String name)
Returns a category based on the name provided. |
java.lang.String[] |
getCategoryNames()
This method returns a string array with all category names. |
char |
getCharProperty(java.lang.String name,
char defaultValue)
Wrapper method to Category method |
char |
getCharProperty(java.lang.String name,
char defaultValue,
java.lang.String category)
Wrapper method to Category method |
java.lang.String |
getConfigName()
Return the name of the current configuration. |
double |
getDoubleProperty(java.lang.String name,
double defaultValue)
Wrapper method to Category method |
double |
getDoubleProperty(java.lang.String name,
double defaultValue,
java.lang.String category)
Wrapper method to Category method |
java.lang.String |
getEncoding()
|
java.util.Vector |
getIncludes()
|
int |
getIntProperty(java.lang.String name,
int defaultValue)
|
int |
getIntProperty(java.lang.String name,
int defaultValue,
java.lang.String category)
|
long |
getLongProperty(java.lang.String name,
long defaultValue)
Wrapper method to Category method |
long |
getLongProperty(java.lang.String name,
long defaultValue,
java.lang.String categoryName)
Wrapper method to Category method |
java.lang.String |
getMainCategoryName()
This method returns the name of the default category |
int |
getNumberOfCategories()
The method returns the number of categories inside this configuration. |
java.util.Properties |
getProperties()
This method returns all properties for the default category |
java.util.Properties |
getProperties(java.lang.String name)
This method returns all properties for the category with the given name |
java.lang.String |
getProperty(java.lang.String key)
This method returns the String value based on the given key. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
This method is the same as getProperty(key) but it returns the defaultValue if the property cannot be found. |
java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue,
java.lang.String categoryName)
This is the real implementation. |
java.lang.String[] |
getPropertyNames(java.lang.String category)
This method returns all the names of the properties for the specific category |
java.lang.String |
getVariable(java.lang.String name)
|
java.util.HashMap |
getVariables()
It returns a HashMap with all variables with the variable name as key |
java.lang.String |
getXMLAsString()
This method converts the Configuration into a String which looks like XML. |
boolean |
hasChanged()
This methods returns a flag which indicates if the configuration has changed since it was loaded. |
boolean |
isNew()
This method determines if the configuration was loaded successfully (returns false) or if the configuration was created by the ConfigurationManager. |
void |
removeCategory(java.lang.String category)
This method deletes a category with all its properties |
void |
removeConfigurationListener(ConfigurationListener listener)
Removes the specified configuration listener from the configuration change events from this configuration. |
void |
removeProperty(java.lang.String name)
This method deletes a property from the default category. |
void |
removeProperty(java.lang.String name,
java.lang.String category)
This method deletes a property with the given name from the specific category. |
void |
resetCreated()
This method is used by the handlers to reset the isNew flag to false. |
void |
setBaseConfiguration(java.lang.String name)
This method is used to define the base configuration of a configuration. |
void |
setBooleanProperty(java.lang.String key,
boolean value)
Wrapper method to Category method |
void |
setBooleanProperty(java.lang.String key,
boolean value,
java.lang.String category)
Wrapper method to Category method |
void |
setCategory(Category category)
|
void |
setCategory(java.lang.String name)
Adds a category to the current configuration. |
void |
setCategory(java.lang.String name,
boolean main)
Besides setting the category, it will also set this category as default category if main is true. |
void |
setCharProperty(java.lang.String key,
char value)
Wrapper method to Category method |
void |
setCharProperty(java.lang.String key,
char value,
java.lang.String category)
Wrapper method to Category method |
void |
setConfigName(java.lang.String configName)
|
void |
setDoubleProperty(java.lang.String key,
double value)
Wrapper method to Category method |
void |
setDoubleProperty(java.lang.String key,
double value,
java.lang.String category)
Wrapper method to Category method |
void |
setEncoding(java.lang.String encoding)
|
void |
setIntProperty(java.lang.String key,
int value)
Wrapper method to Category method |
void |
setIntProperty(java.lang.String key,
int value,
java.lang.String category)
Wrapper method to Category method |
void |
setLongProperty(java.lang.String key,
long value)
Wrapper method to Category method |
void |
setLongProperty(java.lang.String key,
long value,
java.lang.String category)
Wrapper method to Category method |
void |
setProperty(java.lang.String name,
java.lang.String value)
This method sets a property with the name and the value in the default category. |
void |
setProperty(java.lang.String name,
java.lang.String value,
java.lang.String categoryName)
This method sets the value for a property for the given category. |
void |
setVariable(java.lang.String name,
java.lang.String value)
This method sets a variable inside the configuration. |
java.lang.String |
toString()
This method creates a string representation of the configuration. |
Method Detail |
public void setCategory(java.lang.String name)
name
- Name of the category to be added.public void setCategory(Category category)
public void setCategory(java.lang.String name, boolean main)
name
- the name of the categorymain
- if true then this category is the default categorypublic java.lang.String getMainCategoryName()
public java.lang.String[] getCategoryNames()
public java.lang.String getProperty(java.lang.String key)
key
- the name of the propertypublic java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
key
- the name of the propertydefaultValue
- the defaultValue that will be returned if the property cannot be foundpublic java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue, java.lang.String categoryName)
key
- the name of the propertydefaultValue
- the default valuecategoryName
- the name of the categorypublic void setProperty(java.lang.String name, java.lang.String value)
name
- the name of the propertyvalue
- the value as Stringpublic void setProperty(java.lang.String name, java.lang.String value, java.lang.String categoryName)
name
- the name of the propertyvalue
- the value as StringcategoryName
- the name of the categorypublic void removeProperty(java.lang.String name)
name
- the name of the propertypublic void removeProperty(java.lang.String name, java.lang.String category)
name
- the name of the propertycategory
- the name of the categorypublic int getNumberOfCategories()
public void removeCategory(java.lang.String category)
category
- the name of the categorypublic java.util.Properties getProperties()
public java.util.Properties getProperties(java.lang.String name)
name
- the name of the categorypublic java.lang.String[] getPropertyNames(java.lang.String category)
category
- the name of the categorypublic void setVariable(java.lang.String name, java.lang.String value)
name
- the name of the variablevalue
- the value of the variablepublic java.util.HashMap getVariables()
public java.lang.String getVariable(java.lang.String name)
public int getIntProperty(java.lang.String name, int defaultValue)
name
- defaultValue
- public int getIntProperty(java.lang.String name, int defaultValue, java.lang.String category)
name
- defaultValue
- category
- public boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
name
- defaultValue
- Category.getBooleanProperty(String, boolean)
public boolean getBooleanProperty(java.lang.String name, boolean defaultValue, java.lang.String categoryName)
defaultValue
- categoryName
- Category#getBooleanProperty(String, boolean, String)
public void setBooleanProperty(java.lang.String key, boolean value)
key
- value
- public void setBooleanProperty(java.lang.String key, boolean value, java.lang.String category)
key
- value
- category
- public long getLongProperty(java.lang.String name, long defaultValue)
name
- defaultValue
- public long getLongProperty(java.lang.String name, long defaultValue, java.lang.String categoryName)
name
- defaultValue
- category
- public double getDoubleProperty(java.lang.String name, double defaultValue)
name
- defaultValue
- public double getDoubleProperty(java.lang.String name, double defaultValue, java.lang.String category)
name
- defaultValue
- category
- public char getCharProperty(java.lang.String name, char defaultValue)
name
- defaultValue
- public char getCharProperty(java.lang.String name, char defaultValue, java.lang.String category)
name
- defaultValue
- category
- public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getXMLAsString()
public void addPropertyListener(PropertyListener listener)
listener
- public void addPropertyListener(PropertyListener listener, java.lang.String categoryName)
public java.lang.String getConfigName()
public void setConfigName(java.lang.String configName)
public void addConfigurationListener(ConfigurationListener listener)
listener
- The ConfigurationListenerpublic void removeConfigurationListener(ConfigurationListener listener)
listener
- The ConfigurationListenerpublic void fireConfigurationChangedEvent(ConfigurationChangedEvent event)
event
- The ConfigurationChangedEventpublic Category getCategory()
public Category getCategory(java.lang.String name)
name
- The name of the category (if null, main category will be used)public void setLongProperty(java.lang.String key, long value)
key
- value
- public void setIntProperty(java.lang.String key, int value)
key
- value
- public void setCharProperty(java.lang.String key, char value)
key
- value
- public void setCharProperty(java.lang.String key, char value, java.lang.String category)
key
- value
- category
- public void setDoubleProperty(java.lang.String key, double value)
key
- value
- public void setLongProperty(java.lang.String key, long value, java.lang.String category)
key
- value
- category
- public void setIntProperty(java.lang.String key, int value, java.lang.String category)
key
- value
- category
- public void setDoubleProperty(java.lang.String key, double value, java.lang.String category)
key
- value
- category
- public boolean hasChanged()
public java.lang.String[] getArray(java.lang.String key)
key
- public java.lang.String[] getArray(java.lang.String key, java.lang.String[] defaultValue)
key
- defaultValue
- public java.lang.String[] getArray(java.lang.String key, java.lang.String[] defaultValue, java.lang.String category)
key
- defaultValue
- category
- public boolean isNew()
public void resetCreated()
public void setEncoding(java.lang.String encoding)
public java.lang.String getEncoding()
public void addCategoryListener(CategoryListener listener)
public void addCategoryListener(CategoryListener listener, java.lang.String categoryName)
public boolean containsCategory(java.lang.String categoryName)
public void addInclude(int type, java.lang.String name)
public java.util.Vector getIncludes()
public void setBaseConfiguration(java.lang.String name)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |