gov.aps.jca.configuration
Class DefaultConfiguration

java.lang.Object
  |
  +--gov.aps.jca.configuration.AbstractConfiguration
        |
        +--gov.aps.jca.configuration.DefaultConfiguration
All Implemented Interfaces:
Configuration, java.io.Serializable

public class DefaultConfiguration
extends AbstractConfiguration
implements java.io.Serializable

This is the default Configuration implementation.

Version:
1.0
Author:
Federico Barbieri, Stefano Mazzocchi, Pierpaolo Fumagalli, Peter Donald
See Also:
Serialized Form

Constructor Summary
DefaultConfiguration(java.lang.String name)
           
DefaultConfiguration(java.lang.String name, java.lang.String location)
          Create a new DefaultConfiguration instance.
DefaultConfiguration(java.lang.String name, java.lang.String location, java.lang.String ns, java.lang.String prefix)
          Create a new DefaultConfiguration instance.
 
Method Summary
 java.lang.String addAttribute(java.lang.String name, java.lang.String value)
          Deprecated. Use setAttribute() instead
 void addChild(Configuration configuration)
          Add a child Configuration to this configuration element.
 void appendValueData(java.lang.String value)
          Deprecated. Use setValue() instead
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the attribute specified by its name as a String.
 java.lang.String[] getAttributeNames()
          Return an array of all attribute names.
 Configuration getChild(java.lang.String name, boolean createNew)
          Return the first Configuration object child of this associated with the given name.
 int getChildCount()
          Return count of children.
 Configuration[] getChildren()
          Return an Iterator of Configuration elements containing all node children.
 Configuration[] getChildren(java.lang.String name)
          Return an Enumeration of Configuration objects children of this associated with the given name.
 java.lang.String getLocation()
          Returns a description of location of element.
 java.lang.String getName()
          Returns the name of this configuration element.
 java.lang.String getNamespace()
          Returns the namespace of this configuration element
 java.lang.String getValue()
          Returns the value of the configuration element as a String.
 java.lang.String getValue(java.lang.String defaultValue)
          Returns the value of the configuration element as a String.
 void makeReadOnly()
          Make this configuration read-only.
 void removeChild(Configuration configuration)
          Remove a child Configuration to this configuration element.
 void setAttribute(java.lang.String name, java.lang.String value)
          Set the value of the specified attribute to the specified string.
 void setValue(java.lang.String value)
          Set the value of this Configuration object to the specified string.
 
Methods inherited from class gov.aps.jca.configuration.AbstractConfiguration
getAttribute, getAttributeAsBoolean, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsFloat, getAttributeAsInteger, getAttributeAsInteger, getAttributeAsLong, getAttributeAsLong, getChild, getValueAsBoolean, getValueAsBoolean, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultConfiguration

public DefaultConfiguration(java.lang.String name)

DefaultConfiguration

public DefaultConfiguration(java.lang.String name,
                            java.lang.String location)
Create a new DefaultConfiguration instance.

Parameters:
name - a String value
location - a String value

DefaultConfiguration

public DefaultConfiguration(java.lang.String name,
                            java.lang.String location,
                            java.lang.String ns,
                            java.lang.String prefix)
Create a new DefaultConfiguration instance.

Parameters:
name - config node name
location - Builder-specific locator string
ns - Namespace string (typically a URI). Should not be null; use "" if no namespace.
prefix - A short string prefixed to element names, associating elements with a longer namespace string. Should not be null; use "" if no namespace.
Method Detail

getName

public java.lang.String getName()
Returns the name of this configuration element.

Specified by:
getName in interface Configuration
Returns:
a String value

getNamespace

public java.lang.String getNamespace()
                              throws ConfigurationException
Returns the namespace of this configuration element

Specified by:
getNamespace in interface Configuration
Returns:
a String value
Throws:
ConfigurationException - if an error occurs

getLocation

public java.lang.String getLocation()
Returns a description of location of element.

Specified by:
getLocation in interface Configuration
Returns:
a String value

getValue

public java.lang.String getValue(java.lang.String defaultValue)
Returns the value of the configuration element as a String.

Specified by:
getValue in interface Configuration
Overrides:
getValue in class AbstractConfiguration
Parameters:
defaultValue - the default value to return if value malformed or empty
Returns:
a String value

getValue

public java.lang.String getValue()
                          throws ConfigurationException
Returns the value of the configuration element as a String.

Specified by:
getValue in interface Configuration
Returns:
a String value
Throws:
ConfigurationException - If the value is not present.

getAttributeNames

public java.lang.String[] getAttributeNames()
Return an array of all attribute names.

Specified by:
getAttributeNames in interface Configuration
Returns:
a String[] value

getChildren

public Configuration[] getChildren()
Return an Iterator of Configuration elements containing all node children.

Specified by:
getChildren in interface Configuration
Returns:
The child nodes with name

getAttribute

public java.lang.String getAttribute(java.lang.String name)
                              throws ConfigurationException
Returns the value of the attribute specified by its name as a String.

Specified by:
getAttribute in interface Configuration
Parameters:
name - a String value
Returns:
a String value
Throws:
ConfigurationException - If the attribute is not present.

getChild

public Configuration getChild(java.lang.String name,
                              boolean createNew)
Return the first Configuration object child of this associated with the given name.

Specified by:
getChild in interface Configuration
Overrides:
getChild in class AbstractConfiguration
Parameters:
name - a String value
createNew - a boolean value
Returns:
a Configuration value

getChildren

public Configuration[] getChildren(java.lang.String name)
Return an Enumeration of Configuration objects children of this associated with the given name.
The returned Enumeration may be empty.

Specified by:
getChildren in interface Configuration
Parameters:
name - The name of the required children Configuration.
Returns:
a Configuration[] value

appendValueData

public void appendValueData(java.lang.String value)
Deprecated. Use setValue() instead

Append data to the value of this configuration element.

Parameters:
value - a String value

setValue

public void setValue(java.lang.String value)
Set the value of this Configuration object to the specified string.

Parameters:
value - a String value

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
Set the value of the specified attribute to the specified string.

Parameters:
name - name of the attribute to set
value - a String value

addAttribute

public java.lang.String addAttribute(java.lang.String name,
                                     java.lang.String value)
Deprecated. Use setAttribute() instead

Add an attribute to this configuration element, returning its old value or null.

Parameters:
name - a String value
value - a String value
Returns:
a String value

addChild

public void addChild(Configuration configuration)
Add a child Configuration to this configuration element.

Parameters:
configuration - a Configuration value

removeChild

public void removeChild(Configuration configuration)
Remove a child Configuration to this configuration element.

Parameters:
configuration - a Configuration value

getChildCount

public int getChildCount()
Return count of children.

Returns:
an int value

makeReadOnly

public void makeReadOnly()
Make this configuration read-only.