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

java.lang.Object
  extended bycom.novell.nds.dirxml.engine.gcv.GCValue
      extended bycom.novell.nds.dirxml.engine.gcv.GCParent
All Implemented Interfaces:
ConfigElement
Direct Known Subclasses:
GCGroup, GCSubordinates

public class GCParent
extends GCValue

Base class for GCGroup and GCSubordinates classes. Manages child values.

Although groups and subordinates are not actual GCVs, the objects are represented programmatically as GCValues for ease of manipulation via the GCDefinitions class.


Field Summary
protected  List defsList
           
protected  Map defsMap
           
protected  GCDefinitions owner
           
 
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_SUBORDINATES
 
Constructor Summary
protected GCParent(int type, Element definition, GCDefinitions owner)
          Constructor for use by GCValue.construct() method.
protected GCParent(int type, GCDefinitions owner)
          Constructor for use by GCValue construct() method.
 
Method Summary
 void appendValue(GCValue value)
          Add a GCV to the end of the current list of GCVs.
 GCDefinitions getOwner()
          Return the GCDefinitions instance that owns this instance.
 String getValue()
          Return the current value of this instance.
 void insertValue(GCValue newValue, GCValue insertionPoint)
          Insert a GCV into the current list of GCVs.
 void insertValue(GCValue newValue, String insertionPoint)
          Insert a GCV into the current list of GCVs.
 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 "password-ref" GCVs.
 boolean removeValue(GCValue value)
          Remove a GCV from the list of GCVs.
 boolean removeValue(String name)
          Remove a GCV from the list of GCVs.
 void setValue(String value)
          Set the value for this instance.
 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
construct, construct, constructGCVRef, constructGroup, constructHeader, constructSubordinates, getDescription, getDescriptionRef, getDisplayName, getDisplayNameRef, getHidden, getName, getType, getTypeString, getXMLValue, hasBeenModified, localize, resetModified, setDescription, setDescriptionRef, setDisplayName, setDisplayNameRef, setHidden, toXML, typeFromString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defsMap

protected Map defsMap

defsList

protected List defsList

owner

protected GCDefinitions owner
Constructor Detail

GCParent

protected GCParent(int type,
                   GCDefinitions owner)
            throws GCVArgumentException
Constructor for use by GCValue construct() method.

Parameters:
type - int value of derived class
Throws:
GCVArgumentException - thrown if name is invalid

GCParent

protected GCParent(int type,
                   Element definition,
                   GCDefinitions owner)
            throws GCVException
Constructor for use by GCValue.construct() method.

Parameters:
type - int value of derived class
definition - <group> or <subordinates> element defining data.
owner - GCDefinitions instance that owns the GCParent. Must not be null.
Throws:
GCVException - thrown if XML is not complete or correct.
Method Detail

getOwner

public GCDefinitions getOwner()
Return the GCDefinitions instance that owns this instance.

Returns:
owner

appendValue

public void appendValue(GCValue value)
                 throws GCVArgumentException
Add a GCV to the end of the current list of GCVs.

Parameters:
value - GCValue object to add.
Throws:
GCVArgumentException - thrown if value has the same name as a GCV already in the list.

insertValue

public void insertValue(GCValue newValue,
                        String insertionPoint)
                 throws GCVArgumentException
Insert a GCV into the current list of GCVs.

Parameters:
newValue - GCValue object to add.
insertionPoint - name of GCV in front of which newValue is to be inserted.
Throws:
GCVArgumentException - thrown if insertionPoint doesn't match the name of any GCV in the list, or if the name of newValue matches the name of a GCV already in the list.

insertValue

public void insertValue(GCValue newValue,
                        GCValue insertionPoint)
                 throws GCVArgumentException
Insert a GCV into the current list of GCVs.

Parameters:
newValue - GCValue object to add.
insertionPoint - GCV in front of which newValue is to be inserted.
Throws:
GCVArgumentException - thrown if insertionPoint doesn't appear in the list, or if the name of newValue matches the name of a GCV already in the list.

removeValue

public boolean removeValue(String name)
Remove a GCV from the list of GCVs.

Parameters:
name - name of GCV to remove.
Returns:
true if name was found and removed, false otherwise.

removeValue

public boolean removeValue(GCValue value)
Remove a GCV from the list of GCVs.

Parameters:
value - the GCV to remove.
Returns:
true if the GCV was found and removed, false otherwise.

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.

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.

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

parseValue

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

The passed value must match the production described in the description of this class.

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

getValue

public String getValue()
Return the current value of this instance.

Specified by:
getValue in class GCValue
Returns:
String containing 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)