|
iiitToolkit 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.iiit.xmlconfig.Configuration
Represents the configuration read by ConfigFileReader.
Constructor Summary | |
protected |
Configuration(String name)
Creates a new instance of Configuration |
Method Summary | |
void |
addAttribute(String key,
String value)
Add a single attribute to the configuration |
void |
addSubConfiguration(Configuration config)
Adds a subconfiguration |
String |
getAttribute(String key)
Retrieve an attribute of the current configuration with a given name |
String |
getAttribute(String key,
String defaultValue)
Retrieve an attribute from the current configuration with a given name |
Enumeration |
getAttributeKeys()
Returns an Enumeration of all defined attribute names of the current configuration |
Hashtable |
getAttributes()
Get the Hashtable containig all attributes of the current configuration |
boolean |
getBooleanAttribute(String key)
Retrieve an boolean attribute of the current configuration with a given name |
boolean |
getBooleanAttribute(String key,
boolean defaultValue)
Retrieve an boolean attribute of the current configuration with a given name |
int |
getIntAttribute(String key)
Retrieve an integer attribute of the current configuration with a given name |
int |
getIntAttribute(String key,
int defaultValue)
Retrieve an integer attribute of the current configuration with a given name |
String |
getName()
Get the name of the current configuration |
Configuration |
getSubConfiguration(String name)
Retrieve a single sub-configuration with a given name. |
Vector |
getSubConfigurations()
Get all sub-configurations of the current configuration |
Vector |
getSubConfigurations(String name)
Get all sub-configurations of the current configuration with a given name |
static Configuration |
load(String filename)
Loads a configuration from a XML file. |
void |
logConfig()
Print the current configuration to an already initialized Log4J-Logger with level DEBUG. |
void |
printConfig()
Print the current configuration to System.out(). |
void |
save(String filename)
Saves the XML representation of the current configuration to a file. |
protected void |
setName(String name)
Set the name of the current configuration |
StringBuffer |
toXML()
Creates a XML representation of the current configuration |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected Configuration(String name)
name
- The name of the configurationMethod Detail |
public static Configuration load(String filename) throws FileNotFoundException, IOException, SAXException
filename
- the full pathname of the file to read.
FileNotFoundException
- if the named file does not exist, is a directory rather than a regular file, or
for some other reason cannot be opened for reading.
IOException
- if an I/O error occurs.
SAXException
- any SAX exception, possibly wrapping another exception.public void save(String filename) throws IOException
filename
- the full pathname of the file to write.
IOException
- if an I/O error occurs.public StringBuffer toXML()
public void logConfig()
public void printConfig()
protected void setName(String name)
name
- The namepublic void addSubConfiguration(Configuration config)
config
- The configuration to addpublic void addAttribute(String key, String value)
key
- The name of the attributevalue
- The value of the attributepublic String getName()
public Vector getSubConfigurations()
public Vector getSubConfigurations(String name)
name
- The name of the sub-configuration to retrieve
public Configuration getSubConfiguration(String name)
name
- The name of the sub-configuration
public Hashtable getAttributes()
public String getAttribute(String key)
key
- The name of the attribute to retrieve
public int getIntAttribute(String key)
key
- The name of the attribute to retrieve
public boolean getBooleanAttribute(String key)
key
- The name of the attribute to retrieve
public String getAttribute(String key, String defaultValue)
key
- The name of the attribute to retrievedefaultValue
- The value to return if the is no attribute with the given name
public int getIntAttribute(String key, int defaultValue)
key
- The name of the attribute to retrievedefaultValue
- The value to return if the is no attribute with the given name
public boolean getBooleanAttribute(String key, boolean defaultValue)
key
- The name of the attribute to retrievedefaultValue
- The value to return if the is no attribute with the given name
public Enumeration getAttributeKeys()
|
iiitToolkit 1.0 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |