Xindice API
version 1.2m1

org.apache.xindice.util
Class Configuration

java.lang.Object
  extended byorg.apache.xindice.util.Configuration

public final class Configuration
extends Object

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

Version:
$Revision: 541508 $, $Date: 2007-05-24 21:54:12 -0400 (Thu, 24 May 2007) $
See Also:
Configurable

Constructor Summary
Configuration(org.w3c.dom.Document config)
          Create read only configuration out of Document
Configuration(org.w3c.dom.Document config, boolean readOnly)
           
Configuration(org.w3c.dom.Element config)
          Create read only configuration out of Element
Configuration(org.w3c.dom.Element config, boolean readOnly)
           
 
Method Summary
 void add(Configuration newConfig)
          add adds an existing Configuration node to this Configuration node.
 Configuration add(String name)
          add adds a new Configuration node to this Configuration node.
 void delete()
          delete deletes this Configuration node from its parent Configuration.
 String getAttribute(String name)
          getAttribute returns an attribute from the Configuration node.
 String getAttribute(String name, String defValue)
          getAttribute returns an attribute from the Configuration node.
 boolean getBooleanAttribute(String name)
          getBooleanAttribute returns an attribute from the Configuration node.
 boolean getBooleanAttribute(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(String name)
          getByteAttribute returns an attribute from the Configuration node.
 byte getByteAttribute(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(String name)
          getCharAttribute returns an attribute from the Configuration node.
 char getCharAttribute(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(String name)
          getChild returns the first child Configuration node that matches the specified name.
 Configuration getChild(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.
 Configuration[] getChildren(String name)
          getChildren returns all children Configuration nodes that matches the specified name.
 double getDoubleAttribute(String name)
          getDoubleAttribute returns an attribute from the Configuration node.
 double getDoubleAttribute(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(String name)
          getFloatAttribute returns an attribute from the Configuration node.
 float getFloatAttribute(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(String name)
          getIntAttribute returns an attribute from the Configuration node.
 int getIntAttribute(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(String name)
          getLongAttribute returns an attribute from the Configuration node.
 long getLongAttribute(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.
 String getName()
          getName returns the name of the Configuration node.
 short getShortAttribute(String name)
          getShortAttribute returns an attribute from the Configuration node.
 short getShortAttribute(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.
 String getValue()
          getValue returns the value from the Configuration node.
 String getValue(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.
 boolean isDirty()
           
 boolean isReadOnly()
          isReadOnly returns whether or not this Configuration node is a read-only node.
 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(String name, ConfigurationCallback callback)
          processChildren runs through the children of this Configuration and performs prcessing callbacks to the ConfigurationCallback object.
 void removeAttribute(String name)
          removeAttribute removes the named attribute from this Configuration.
 void resetDirty()
           
 void setAttribute(String name, boolean value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, byte value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, char value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, double value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, float value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, int value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, long value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, short value)
          setAttribute sets the attribute value for this Configuration.
 void setAttribute(String name, 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(String value)
          setValue sets the value of the Configuration node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Configuration

public Configuration(org.w3c.dom.Element config,
                     boolean readOnly)

Configuration

public Configuration(org.w3c.dom.Document config,
                     boolean readOnly)

Configuration

public Configuration(org.w3c.dom.Element config)
Create read only configuration out of Element

Parameters:
config - Configuration element

Configuration

public Configuration(org.w3c.dom.Document config)
Create read only configuration out of Document

Parameters:
config - Configuration document
Method Detail

resetDirty

public void resetDirty()

isDirty

public boolean isDirty()

getElement

public org.w3c.dom.Element getElement()
                               throws ReadOnlyException
getElement returns the Element being managed by this Configuration. Returned Element should not be modified, use Configuration's methods to modify managed Element.

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

getName

public 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 String getAttribute(String name,
                           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 String getAttribute(String name)
getAttribute returns an attribute from the Configuration node.

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

getBooleanAttribute

public boolean getBooleanAttribute(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(String name)
getBooleanAttribute returns an attribute from the Configuration node.

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

getIntAttribute

public int getIntAttribute(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(String name)
getIntAttribute returns an attribute from the Configuration node.

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

getShortAttribute

public short getShortAttribute(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(String name)
getShortAttribute returns an attribute from the Configuration node.

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

getLongAttribute

public long getLongAttribute(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(String name)
getLongAttribute returns an attribute from the Configuration node.

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

getFloatAttribute

public float getFloatAttribute(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(String name)
getFloatAttribute returns an attribute from the Configuration node.

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

getDoubleAttribute

public double getDoubleAttribute(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(String name)
getDoubleAttribute returns an attribute from the Configuration node.

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

getByteAttribute

public byte getByteAttribute(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(String name)
getByteAttribute returns an attribute from the Configuration node.

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

getCharAttribute

public char getCharAttribute(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(String name)
getCharAttribute returns an attribute from the Configuration node.

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

listAttributes

public 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 String getValue(String defValue)
getValue returns the value from the Configuration node.

Parameters:
defValue - The default value
Returns:
The value

getValue

public 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(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

getChildren

public Configuration[] getChildren(String name)
getChildren returns all children Configuration nodes that matches the specified name.

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

getChild

public Configuration getChild(String name,
                              boolean create)
                       throws ReadOnlyException
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(String name)
getChild returns the first child Configuration node that matches the specified name.

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

isReadOnly

public boolean isReadOnly()
isReadOnly returns whether or not this Configuration node is a read-only node.

Returns:
The read-only status

add

public Configuration add(String name)
                  throws ReadOnlyException
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)
         throws ReadOnlyException
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.

Parameters:
newConfig - The Configuration node to add
Throws:
ReadOnlyException - if the Configuration is read-only

delete

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

Throws:
ReadOnlyException - if the Configuration is read-only

removeAttribute

public void removeAttribute(String name)
                     throws ReadOnlyException
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(String name,
                         String value)
                  throws ReadOnlyException
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(String name,
                         boolean value)
                  throws ReadOnlyException
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(String name,
                         int value)
                  throws ReadOnlyException
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(String name,
                         short value)
                  throws ReadOnlyException
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(String name,
                         long value)
                  throws ReadOnlyException
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(String name,
                         float value)
                  throws ReadOnlyException
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(String name,
                         double value)
                  throws ReadOnlyException
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(String name,
                         byte value)
                  throws ReadOnlyException
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(String name,
                         char value)
                  throws ReadOnlyException
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(String value)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
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)
              throws ReadOnlyException
setValue sets the value of the Configuration node.

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

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.