com.novell.nds.dirxml.engine.gcv
Class GCStructuredValue

java.lang.Object
  extended by com.novell.nds.dirxml.engine.gcv.GCValue
      extended by com.novell.nds.dirxml.engine.gcv.GCStructuredValue
All Implemented Interfaces:
ConfigElement

public class GCStructuredValue
extends GCValue

Class representing "structured" type Configuration Values.

A "structured" value is a one which contains a template specifying one or more simple values, and which has zero or more instances of the template values.


Nested Class Summary
static class GCStructuredValue.Instance
          Class representing an instance of a GCStructuredValue's template.
static class GCStructuredValue.Template
          Class representing the template definitions for a GCStructuredValue.
 
Nested classes/interfaces inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
GCValue.IllegalCloneStateException, GCValue.XmlComment, GCValue.XmlItem, GCValue.XmlProcessingInstruction
 
Field Summary
static String DEFAULT_INSTANCE_SEPARATOR
          The default value for the instance separator used when converting a GCStructuredValue to a string.
static String DEFAULT_VALUE_SEPARATOR
          The default value for the value separator used when converting a GCStructuredValue to a string.
protected  List instances
           
protected  GCOwner owner
           
protected  GCStructuredValue.Template template
           
 
Fields inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
modified, parent, TYPE_BOOLEAN, TYPE_DN, TYPE_DN_REF, TYPE_ENUM, TYPE_GCV_REF, TYPE_GROUP, TYPE_HEADER, TYPE_INTEGER, TYPE_LIST, TYPE_PASSWORD_REF, TYPE_REAL, TYPE_STRING, TYPE_STRUCTURED, TYPE_SUBORDINATES, xmlItems
 
Method Summary
 GCStructuredValue.Instance addInstance()
          Add an Instance to this structured value.
protected  void appendInstance(GCStructuredValue.Instance newInstance)
          Add an instance to this GCStructuredValue.
 GCValue cloneValue(String name)
          Clone this GCValue instance and return the cloned instance.
 String getInstanceSeparator()
          Get the characters used to separate instances when the structured value is converted to a String.
 GCOwner getOwner()
          Return the owner of this instance.
 GCStructuredValue.Template getTemplate()
          Return this GCStructureValue instance's Template.
 String getValue()
          Return the current value of this instance as a delimited string.
 String getValueSeparator()
          Get the characters used to separate individual instance values when the structured value is converted to a String.
 boolean hasBeenModified()
          Return true if this instance has been modified.
 Iterator instanceIterator()
          Return an Iterator that returns all Instance values in this GCStructuredValue.
 Iterator iterator()
          Return an Iterator instance that can be used to iterate through all descendant GCVs.
 void parseValue(String value)
          Parse the passed value based on the type lexical rules for "structured" GCVs.
 void setInstanceSeparator(String newSeparator)
          Set the character(s) used to separate instances when the structured value is converted to a string.
 void setValue(String value)
          Set the value for this instance.
 void setValueSeparator(String newSeparator)
          Set the character(s) used to separate individual instance values when the structured value is converted to a string.
 Iterator shallowIterator()
          Return an Iterator instance that can be used to iterate through the list of GCVs.
 
Methods inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
addXmlComment, addXmlItems, addXmlProcessingInstruction, cloneCommon, construct, construct, constructGCVRef, constructGCVRef, constructGroup, constructHeader, constructStructuredValue, constructSubordinates, getDescription, getDescriptionRef, getDisplayName, getDisplayNameRef, getHidden, getMandatory, getName, getParent, getType, getTypeString, getXmlItemsIterator, getXMLValue, localize, resetModified, setDescription, setDescriptionRef, setDisplayName, setDisplayNameRef, setHidden, setMandatory, toXML, typeFromString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_VALUE_SEPARATOR

public static final String DEFAULT_VALUE_SEPARATOR
The default value for the value separator used when converting a GCStructuredValue to a string.

See Also:
Constant Field Values

DEFAULT_INSTANCE_SEPARATOR

public static final String DEFAULT_INSTANCE_SEPARATOR
The default value for the instance separator used when converting a GCStructuredValue to a string.

See Also:
Constant Field Values

owner

protected GCOwner owner

template

protected GCStructuredValue.Template template

instances

protected List instances
Method Detail

cloneValue

public GCValue cloneValue(String name)
Clone this GCValue instance and return the cloned instance.

Specified by:
cloneValue in class GCValue
Parameters:
the - name for the cloned value.
Returns:
the cloned instance

appendInstance

protected void appendInstance(GCStructuredValue.Instance newInstance)
Add an instance to this GCStructuredValue. This is for this class and derived classes use only. No validity checking is performed.

Parameters:
newInstance - the Instance to add.

getValueSeparator

public String getValueSeparator()
Get the characters used to separate individual instance values when the structured value is converted to a String.

Returns:
the separator characters

setValueSeparator

public void setValueSeparator(String newSeparator)
Set the character(s) used to separate individual instance values when the structured value is converted to a string. If the passed String is null then DEFAULT_VALUE_SEPARATOR is used.

Parameters:
newSeparator - the separator characters

getInstanceSeparator

public String getInstanceSeparator()
Get the characters used to separate instances when the structured value is converted to a String.

Returns:
the separator characters

setInstanceSeparator

public void setInstanceSeparator(String newSeparator)
Set the character(s) used to separate instances when the structured value is converted to a string. If the passed String is null then DEFAULT_INSTANCE_SEPARATOR is used.

Parameters:
newSeparator - the separator characters

getOwner

public GCOwner getOwner()
Return the owner of this instance.

Overrides:
getOwner in class GCValue
Returns:
owner (may be null)

getTemplate

public GCStructuredValue.Template getTemplate()
Return this GCStructureValue instance's Template.

Returns:
Template

instanceIterator

public Iterator instanceIterator()
Return an Iterator that returns all Instance values in this GCStructuredValue.

Returns:
Iterator

addInstance

public GCStructuredValue.Instance addInstance()
                                       throws GCVStateException
Add an Instance to this structured value.

Returns:
the added Instance
Throws:
IllegalStateException - if a maximum number of instances is set on the template and adding an instance would exceed the maximum.
GCVStateException

iterator

public Iterator iterator()
Return an Iterator instance that can be used to iterate through all descendant GCVs. This iterator will return all descendant GCVs that are real GCVs (not Group or Subordinates).

The Iterator's next() method returns GCValue instances.

The "deep" iterator returned for this GCStructuredValue instance will iterate through all of the values in each value Instance.

Returns:
an Iterator instance.
See Also:
shallowIterator()

shallowIterator

public Iterator shallowIterator()
Return an Iterator instance that can be used to iterate through the list of GCVs. The iterator returned will iterate through only GCValues that are direct children of this instance.

The Iterator's next() method returns GCValue instances.

The "shallow" iterator returned for this GCStructuredValue instance will iterate through all of the values in each value Instance.

Returns:
an Iterator instance.
See Also:
iterator()

hasBeenModified

public boolean hasBeenModified()
Return true if this instance has been modified.

The instance is considered to have been modified if a change was made that affects the persistent representation since:

  1. The instance was constructed from an XML representation.
  2. resetModified() was last called

Specified by:
hasBeenModified in interface ConfigElement
Overrides:
hasBeenModified in class GCValue
Returns:
true or false
See Also:
GCValue.resetModified()

parseValue

public void parseValue(String value)
                throws GCVException
Parse the passed value based on the type lexical rules for "structured" GCVs.

Specified by:
parseValue in class GCValue
Parameters:
value - Value String to parse
Throws:
GCVException - thrown if value does not match "structured" constraints.

getValue

public String getValue()
Return the current value of this instance as a delimited string.

Specified by:
getValue in class GCValue
Returns:
current value of this instance.

setValue

public void setValue(String value)
              throws GCVException
Set the value for this instance.

The passed value must conform to the rules noted under parseValue().

Specified by:
setValue in class GCValue
Parameters:
value - Value String for this instance.
Throws:
GCVException - thrown if value is doesn't not parse correctly.
See Also:
parseValue(java.lang.String)