dbXML API

com.dbxml.util
Class Configuration

java.lang.Object
  extended bycom.dbxml.util.Configuration

public final class Configuration
extends java.lang.Object

Configuration is a utility class that allows Configurable objects to easily manage configuration information in a simple and consistent fashion.

See Also:
Configurable

Constructor Summary
Configuration(org.w3c.dom.Document config)
           
Configuration(org.w3c.dom.Element config)
           
 
Method Summary
 void add(Configuration newConfig)
          add adds an existing Configuration node to this Configuration node.
 Configuration add(java.lang.String name)
          add adds a new Configuration node to this Configuration node.
 void delete()
          delete deletes this Configuration node from its parent Configuration.
 java.lang.String getAttribute(java.lang.String name)
          getAttribute returns an attribute from the Configuration node.
 java.lang.String getAttribute(java.lang.String name, java.lang.String defValue)
          getAttribute returns an attribute from the Configuration node.
 boolean getBooleanAttribute(java.lang.String name)
          getBooleanAttribute returns an attribute from the Configuration node.
 boolean getBooleanAttribute(java.lang.String name, boolean defValue)
          getBooleanAttribute returns an attribute from the Configuration node.
 boolean getBooleanValue()
          getBooleanValue returns the value from the Configuration node.
 boolean getBooleanValue(boolean defValue)
          getBooleanValue returns the value from the Configuration node.
 byte getByteAttribute(java.lang.String name)
          getByteAttribute returns an attribute from the Configuration node.
 byte getByteAttribute(java.lang.String name, byte defValue)
          getByteAttribute returns an attribute from the Configuration node.
 byte getByteValue()
          getByteValue returns the value from the Configuration node.
 byte getByteValue(byte defValue)
          getByteValue returns the value from the Configuration node.
 char getCharAttribute(java.lang.String name)
          getCharAttribute returns an attribute from the Configuration node.
 char getCharAttribute(java.lang.String name, char defValue)
          getCharAttribute returns an attribute from the Configuration node.
 char getCharValue()
          getCharValue returns the value from the Configuration node.
 char getCharValue(char defValue)
          getCharValue returns the value from the Configuration node.
 Configuration getChild(java.lang.String name)
          getChild returns the first child Configuration node that matches the specified name.
 Configuration getChild(java.lang.String name, boolean create)
          getChild returns the first child Configuration node that matches the specified name.
 Configuration[] getChildren()
          getChildren returns the child Configuration nodes for this Configuration node.
 double getDoubleAttribute(java.lang.String name)
          getDoubleAttribute returns an attribute from the Configuration node.
 double getDoubleAttribute(java.lang.String name, double defValue)
          getDoubleAttribute returns an attribute from the Configuration node.
 double getDoubleValue()
          getDoubleValue returns the value from the Configuration node.
 double getDoubleValue(double defValue)
          getDoubleValue returns the value from the Configuration node.
 org.w3c.dom.Element getElement()
          getElement returns the Element being managed by this Configuration.
 float getFloatAttribute(java.lang.String name)
          getFloatAttribute returns an attribute from the Configuration node.
 float getFloatAttribute(java.lang.String name, float defValue)
          getFloatAttribute returns an attribute from the Configuration node.
 float getFloatValue()
          getFloatValue returns the value from the Configuration node.
 float getFloatValue(float defValue)
          getFloatValue returns the value from the Configuration node.
 int getIntAttribute(java.lang.String name)
          getIntAttribute returns an attribute from the Configuration node.
 int getIntAttribute(java.lang.String name, int defValue)
          getIntAttribute returns an attribute from the Configuration node.
 int getIntValue()
          getIntValue returns the value from the Configuration node.
 int getIntValue(int defValue)
          getIntValue returns the value from the Configuration node.
 long getLongAttribute(java.lang.String name)
          getLongAttribute returns an attribute from the Configuration node.
 long getLongAttribute(java.lang.String name, long defValue)
          getLongAttribute returns an attribute from the Configuration node.
 long getLongValue()
          getLongValue returns the value from the Configuration node.
 long getLongValue(long defValue)
          getLongValue returns the value from the Configuration node.
 java.lang.String getName()
          getName returns the name of the Configuration node.
 short getShortAttribute(java.lang.String name)
          getShortAttribute returns an attribute from the Configuration node.
 short getShortAttribute(java.lang.String name, short defValue)
          getShortAttribute returns an attribute from the Configuration node.
 short getShortValue()
          getShortValue returns the value from the Configuration node.
 short getShortValue(short defValue)
          getShortValue returns the value from the Configuration node.
 java.lang.String getValue()
          getValue returns the value from the Configuration node.
 java.lang.String getValue(java.lang.String defValue)
          getValue returns the value from the Configuration node.
 boolean hasAttributes()
          hasAttributes returns whether or not the Configuration node has any attributes associated with it.
 boolean hasChildren()
          hasChildren returns whether or not the Configuration node has child Configuration elements.
 boolean hasValue()
          hasValue returns whether or not the Configuration node has a textual value associated with it.
 java.lang.String[] listAttributes()
          listAttributes returns a list of the attribute names that exist for this Configuration node.
 void processChildren(ConfigurationCallback callback)
          processChildren runs through the children of this Configuration and performs prcessing callbacks to the ConfigurationCallback object.
 void processChildren(java.lang.String name, ConfigurationCallback callback)
          processChildren runs through the children of this Configuration and performs prcessing callbacks to the ConfigurationCallback object.
 void removeAttribute(java.lang.String name)
          removeAttribute removes the named attribute from this Configuration.
 void setAttribute(java.lang.String name, boolean value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, byte value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, char value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, double value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, float value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, int value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, long value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, short value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(java.lang.String name, java.lang.String value)
          setAttribute sets the attribute value for this Configuration.
 void setValue(boolean value)
          setValue sets the value of the Configuration node.
 void setValue(byte value)
          setValue sets the value of the Configuration node.
 void setValue(char value)
          setValue sets the value of the Configuration node.
 void setValue(double value)
          setValue sets the value of the Configuration node.
 void setValue(float value)
          setValue sets the value of the Configuration node.
 void setValue(int value)
          setValue sets the value of the Configuration node.
 void setValue(long value)
          setValue sets the value of the Configuration node.
 void setValue(short value)
          setValue sets the value of the Configuration node.
 void setValue(java.lang.String value)
          setValue sets the value of the Configuration node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(org.w3c.dom.Element config)

Configuration

public Configuration(org.w3c.dom.Document config)
Method Detail

getElement

public org.w3c.dom.Element getElement()
getElement returns the Element being managed by this Configuration.

Returns:
The Configuration Element
Throws:
ReadOnlyException - If the Configuration is Read-only

getName

public java.lang.String getName()
getName returns the name of the Configuration node.

Returns:
The Node name

hasAttributes

public boolean hasAttributes()
hasAttributes returns whether or not the Configuration node has any attributes associated with it.

Returns:
Whether or not attributes exist

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String defValue)
getAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getAttribute

public java.lang.String getAttribute(java.lang.String name)
getAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getBooleanAttribute

public boolean getBooleanAttribute(java.lang.String name,
                                   boolean defValue)
getBooleanAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getBooleanAttribute

public boolean getBooleanAttribute(java.lang.String name)
getBooleanAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getIntAttribute

public int getIntAttribute(java.lang.String name,
                           int defValue)
getIntAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getIntAttribute

public int getIntAttribute(java.lang.String name)
getIntAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getShortAttribute

public short getShortAttribute(java.lang.String name,
                               short defValue)
getShortAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getShortAttribute

public short getShortAttribute(java.lang.String name)
getShortAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getLongAttribute

public long getLongAttribute(java.lang.String name,
                             long defValue)
getLongAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getLongAttribute

public long getLongAttribute(java.lang.String name)
getLongAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getFloatAttribute

public float getFloatAttribute(java.lang.String name,
                               float defValue)
getFloatAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getFloatAttribute

public float getFloatAttribute(java.lang.String name)
getFloatAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getDoubleAttribute

public double getDoubleAttribute(java.lang.String name,
                                 double defValue)
getDoubleAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getDoubleAttribute

public double getDoubleAttribute(java.lang.String name)
getDoubleAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getByteAttribute

public byte getByteAttribute(java.lang.String name,
                             byte defValue)
getByteAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getByteAttribute

public byte getByteAttribute(java.lang.String name)
getByteAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

getCharAttribute

public char getCharAttribute(java.lang.String name,
                             char defValue)
getCharAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
defValue - The default value
Returns:
The attribute value

getCharAttribute

public char getCharAttribute(java.lang.String name)
getCharAttribute returns an attribute from the Configuration node.

Parameters:
name - The attribute name
Returns:
The attribute value

listAttributes

public java.lang.String[] listAttributes()
listAttributes returns a list of the attribute names that exist for this Configuration node.

Returns:
The Attribute names

hasValue

public boolean hasValue()
hasValue returns whether or not the Configuration node has a textual value associated with it.

Returns:
Whether or not the node has a text value

getValue

public java.lang.String getValue(java.lang.String defValue)
getValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getValue

public java.lang.String getValue()
getValue returns the value from the Configuration node.

Returns:
The value

getBooleanValue

public boolean getBooleanValue(boolean defValue)
getBooleanValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getBooleanValue

public boolean getBooleanValue()
getBooleanValue returns the value from the Configuration node.

Returns:
The value

getIntValue

public int getIntValue(int defValue)
getIntValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getIntValue

public int getIntValue()
getIntValue returns the value from the Configuration node.

Returns:
The value

getShortValue

public short getShortValue(short defValue)
getShortValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getShortValue

public short getShortValue()
getShortValue returns the value from the Configuration node.

Returns:
The value

getLongValue

public long getLongValue(long defValue)
getLongValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getLongValue

public long getLongValue()
getLongValue returns the value from the Configuration node.

Returns:
The value

getFloatValue

public float getFloatValue(float defValue)
getFloatValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getFloatValue

public float getFloatValue()
getFloatValue returns the value from the Configuration node.

Returns:
The value

getDoubleValue

public double getDoubleValue(double defValue)
getDoubleValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getDoubleValue

public double getDoubleValue()
getDoubleValue returns the value from the Configuration node.

Returns:
The value

getByteValue

public byte getByteValue(byte defValue)
getByteValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getByteValue

public byte getByteValue()
getByteValue returns the value from the Configuration node.

Returns:
The value

getCharValue

public char getCharValue(char defValue)
getCharValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getCharValue

public char getCharValue()
getCharValue returns the value from the Configuration node.

Returns:
The value

hasChildren

public boolean hasChildren()
hasChildren returns whether or not the Configuration node has child Configuration elements.

Returns:
Whether or not children exist

getChildren

public Configuration[] getChildren()
getChildren returns the child Configuration nodes for this Configuration node.

Returns:
The children

processChildren

public void processChildren(ConfigurationCallback callback)
processChildren runs through the children of this Configuration and performs prcessing callbacks to the ConfigurationCallback object.

Parameters:
callback - The callback object

processChildren

public void processChildren(java.lang.String name,
                            ConfigurationCallback callback)
processChildren runs through the children of this Configuration and performs prcessing callbacks to the ConfigurationCallback object.

Parameters:
callback - The callback object
name - The Configuration name to process

getChild

public Configuration getChild(java.lang.String name,
                              boolean create)
getChild returns the first child Configuration node that matches the specified name.

Parameters:
name - The Configuration node name
create - Create Configuration if it doesn't exist
Returns:
The child Configuration
Throws:
ReadOnlyException - if the Configuration is read-only

getChild

public Configuration getChild(java.lang.String name)
getChild returns the first child Configuration node that matches the specified name.

Parameters:
name - The Configuration node name
Returns:
The child Configuration

add

public Configuration add(java.lang.String name)
add adds a new Configuration node to this Configuration node.

Parameters:
name - The name of the Configuration node
Returns:
The new Configuration node
Throws:
ReadOnlyException - if the Configuration is read-only

add

public void add(Configuration newConfig)
add adds an existing Configuration node to this Configuration node. Note! This method does NOT perform a deep copy on the DOM Node that newConfig manages.

Throws:
ReadOnlyException - if the Configuration is read-only

delete

public void delete()
delete deletes this Configuration node from its parent Configuration.

Throws:
ReadOnlyException - if the Configuration is read-only

removeAttribute

public void removeAttribute(java.lang.String name)
removeAttribute removes the named attribute from this Configuration.

Parameters:
name - The attribute name
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         boolean value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         int value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         short value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         long value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         float value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         double value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         byte value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setAttribute

public void setAttribute(java.lang.String name,
                         char value)
setAttribute sets the attribute value for this Configuration.

Parameters:
name - The attribute name
value - The attribute value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(java.lang.String value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(boolean value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(int value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(short value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(long value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(float value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(double value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(byte value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

setValue

public void setValue(char value)
setValue sets the value of the Configuration node.

Parameters:
value - The New Value
Throws:
ReadOnlyException - if the Configuration is read-only

dbXML API

Copyright (c) 2004 The dbXML Group