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

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

public abstract class GCParent
extends GCValue
implements GCOwner

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.novell.nds.dirxml.engine.gcv.GCValue
GCValue.IllegalCloneStateException, GCValue.XmlComment, GCValue.XmlItem, GCValue.XmlProcessingInstruction
 
Field Summary
protected  boolean cloning
           
protected  GCOwner 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_STRUCTURED, TYPE_SUBORDINATES, xmlItems
 
Constructor Summary
protected GCParent(int type, Element definition, GCOwner owner)
          Constructor for use by GCValue.construct() method.
protected GCParent(int type, GCOwner owner)
          Constructor for use by GCValue construct() method.
 
Method Summary
 void addName(GCValue newValue)
          Add a name to the defsList map.
 void appendValue(GCValue value)
          Add a GCV to the end of the current list of GCVs.
 boolean checkAllowedType(int type)
          Check whether or not a particular Control Value type is allowed in this collection of GCVs.
protected  void cloneCommon(GCValue newValue)
          Helper function for derived classes to implement cloneValue.
 GCOwner 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.
 boolean isNameAllowed(String name)
          Check to see if a name is allowed.
 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.
 void removeName(GCValue oldValue)
          Remove a name from the defsList map.
 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 replaceValue(GCValue newValue, GCValue oldValue)
           
 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
addXmlComment, addXmlItems, addXmlProcessingInstruction, cloneValue, construct, construct, constructGCVRef, constructGCVRef, constructGroup, constructHeader, constructStructuredValue, constructSubordinates, getDescription, getDescriptionRef, getDisplayName, getDisplayNameRef, getHidden, getMandatory, getName, getParent, getType, getTypeString, getXmlItemsIterator, getXMLValue, hasBeenModified, 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

owner

protected GCOwner owner

cloning

protected boolean cloning
Constructor Detail

GCParent

protected GCParent(int type,
                   GCOwner 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,
                   GCOwner 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

cloneCommon

protected void cloneCommon(GCValue newValue)
Helper function for derived classes to implement cloneValue. Clones data common to all GCValue instances.

Overrides:
cloneCommon in class GCValue
Parameters:
newValue - the value to which to copy

getOwner

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

Overrides:
getOwner in class GCValue
Returns:
owner

appendValue

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

Specified by:
appendValue in interface GCOwner
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.

Specified by:
insertValue in interface GCOwner
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.

Specified by:
insertValue in interface GCOwner
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.

replaceValue

public void replaceValue(GCValue newValue,
                         GCValue oldValue)
                  throws GCVArgumentException
Specified by:
replaceValue in interface GCOwner
Throws:
GCVArgumentException

removeValue

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

Specified by:
removeValue in interface GCOwner
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.

Specified by:
removeValue in interface GCOwner
Parameters:
value - the GCV to remove.
Returns:
true if the GCV was found and removed, false otherwise.

isNameAllowed

public boolean isNameAllowed(String name)
Check to see if a name is allowed.

Specified by:
isNameAllowed in interface GCOwner
Parameters:
name - the name to check
Returns:
true or false

addName

public void addName(GCValue newValue)
             throws GCVArgumentException
Add a name to the defsList map. This is designed to be called from GCParent.

Specified by:
addName in interface GCOwner
Parameters:
newValue - new GCValue
Throws:
GCVArgumentException

removeName

public void removeName(GCValue oldValue)
Remove a name from the defsList map. This is designed to be called from GCParent.

Specified by:
removeName in interface GCOwner
Parameters:
oldValue - GCValue being removed.

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.

Specified by:
iterator in interface GCOwner
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.

Specified by:
shallowIterator in interface GCOwner
Returns:
an Iterator instance.
See Also:
iterator()

checkAllowedType

public boolean checkAllowedType(int type)
Check whether or not a particular Control Value type is allowed in this collection of GCVs.

Classes derived from GCDefinitions (e.g., ShimParams) may allow more or fewer types.

Specified by:
checkAllowedType in interface GCOwner
Parameters:
type - GCValue.TYPE_STRING, etc.
Returns:
true if allowed, false otherwise

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)