com.novell.nds.dirxml.shimhost
Class SchemaDef

java.lang.Object
  extended bycom.novell.nds.dirxml.shimhost.SchemaDef
All Implemented Interfaces:
ConfigElement

public class SchemaDef
extends Object
implements ConfigElement

Class encapsulating a DirXML <schema-def> schema definition.


Nested Class Summary
static class SchemaDef.AttrDef
          Class encapsulating a DirXML <attr-def> schema definition.
static class SchemaDef.ClassDef
          Class encapsulating a DirXML <class-def> schema definition.
 
Field Summary
static String ATTR_APPLICATION_NAME
          Name of the XML 'application-name' attribute.
static String ATTR_ASN1ID
          Name of the XML 'asn1id' attribute.
static String ATTR_ATTR_NAME
          Name of the XML 'attr-name' attribute.
static String ATTR_CASE_SENSITIVE
          Name of the XML 'case-sensitive' attribute.
static String ATTR_CLASS_NAME
          Name of the XML 'class-name' attribute.
static String ATTR_CONTAINER
          Name of the XML 'container' attribute.
static String ATTR_DN_DELIMS
          Name of the XML 'dn-delims' attribute.
static String ATTR_DN_FORMAT
          Name of the XML 'dn-format' attribute.
static String ATTR_HIERARCHICAL
          Name of the XML 'hierarchical' attribute.
static String ATTR_MULTI_VALUED
          Name of the XML 'multi-valued' attribute.
static String ATTR_NAMING
          Name of the XML 'naming' attribute.
static String ATTR_READ_ONLY
          Name of the XML 'read-only' attribute.
static String ATTR_REQUIRED
          Name of the XML 'required' attribute.
static String ATTR_TYPE
          Name of the XML 'type' attribute.
static int ATTR_TYPE_CLASSNAME
          Constant representing the "className" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_COUNTER
          Constant representing the "counter" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_DN
          Constant representing the "dn" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_INT
          Constant representing the "int" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_INTERVAL
          Constant representing the "interval" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_OCTET
          Constant representing the "octet" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_STATE
          Constant representing the "state" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_STRING
          Constant representing the "string" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_STRUCTURED
          Constant representing the "structured" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_TELENUMBER
          Constant representing the "teleNumber" value for the <attr-def> XML attribute "type".
static int ATTR_TYPE_TIME
          Constant representing the "time" value for the <attr-def> XML attribute "type".
static int DN_FORMAT_DOT
          Constant representing the "dot" value for the <schema-def> XML attribute "dn-format".
static int DN_FORMAT_LDAP
          Constant representing the "slash" value for the <schema-def> XML attribute "dn-format".
static int DN_FORMAT_QUALIFIED_DOT
          Constant representing the "qualified-dot" value for the <schema-def> XML attribute "dn-format".
static int DN_FORMAT_QUALIFIED_SLASH
          Constant representing the "qualified-slash" value for the <schema-def> XML attribute "dn-format".
static int DN_FORMAT_SLASH
          Constant representing the "slash" value for the <schema-def> XML attribute "dn-format".
static String TAG_ATTR_DEF
          Tag name of the <attr-def> element.
static String TAG_CLASS_DEF
          Tag name of the <class-def> element.
static String TAG_SCHEMA_DEF
          Tag name of the <schema-def> element.
static String VAL_CLASSNAME
          "className"
static String VAL_COUNTER
          "counter"
static String VAL_DN
          "dn"
static String VAL_DOT
          "dot"
static String VAL_FALSE
          "false"
static String VAL_INT
          "int"
static String VAL_INTERVAL
          "interval"
static String VAL_LDAP
          "ldap"
static String VAL_OCTET
          "octet"
static String VAL_QUALIFIED_DOT
          "qualified-dot"
static String VAL_QUALIFIED_SLASH
          "qualified-slash"
static String VAL_SLASH
          "slash"
static String VAL_STATE
          "state"
static String VAL_STRING
          "string"
static String VAL_STRUCTURED
          "structured"
static String VAL_TELENUMBER
          "teleNumber"
static String VAL_TIME
          "time"
static String VAL_TRUE
          "true"
 
Constructor Summary
SchemaDef()
          Construct a new, empty SchemaDef instance.
SchemaDef(Element schemaDef)
          Construct a SchemaDef instance based on an XML representation.
SchemaDef(SchemaDef source)
          Copy constructor.
 
Method Summary
 String getApplicationName()
          Get the value for the "application-name" attribute.
 SchemaDef.ClassDef getClassDef(String className)
          Get a ClassDef instance from this SchemaDef instance based on class name.
 String getDNDelims()
          Get the value for the "dn-delims" attribute.
 int getDNFormat()
          Get the value for the "dn-delims" attribute.
static int getDNFormatFromString(String dnFormatString)
          Get the integer value corresponding to a "dn-format" string value.
static String getDNFormatString(int dnFormat)
          Get the string corresponding to a "dn-format" integer value.
 boolean getHierarchical()
          Get the value for the "hierarchical" attribute.
 boolean hasBeenModified()
          Return true if this instance has been modified.
 Iterator iterator()
          Return an Iterator that will iterate over the ClassDef instances in this SchemaDef instance.
 SchemaDef.ClassDef newClass(String className)
          Add a new ClassDef instance.
 boolean removeClass(String className)
          Remove a ClassDef from this instance based on name.
 void resetModified()
          Reset the modified flag for this instance such that hasBeenModified() will return false.
 void setApplicationName(String newName)
          Set the value for the "application-name" attribute.
 void setDNDelims(String newDelims)
          Set the value for the "dn-delims" attribute.
 void setDNFormat(int format)
          Set the value for the "dn-delims" attribute.
 void setHierarchical(boolean value)
          Set the value for the "hierarchical" attribute.
 Element toXML(Node parent)
          Create an XML representation for this instance under the passed Node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG_SCHEMA_DEF

public static final String TAG_SCHEMA_DEF
Tag name of the <schema-def> element.

See Also:
Constant Field Values

TAG_CLASS_DEF

public static final String TAG_CLASS_DEF
Tag name of the <class-def> element.

See Also:
Constant Field Values

TAG_ATTR_DEF

public static final String TAG_ATTR_DEF
Tag name of the <attr-def> element.

See Also:
Constant Field Values

ATTR_APPLICATION_NAME

public static final String ATTR_APPLICATION_NAME
Name of the XML 'application-name' attribute.

See Also:
Constant Field Values

ATTR_DN_DELIMS

public static final String ATTR_DN_DELIMS
Name of the XML 'dn-delims' attribute.

See Also:
Constant Field Values

ATTR_DN_FORMAT

public static final String ATTR_DN_FORMAT
Name of the XML 'dn-format' attribute.

See Also:
Constant Field Values

ATTR_HIERARCHICAL

public static final String ATTR_HIERARCHICAL
Name of the XML 'hierarchical' attribute.

See Also:
Constant Field Values

ATTR_ASN1ID

public static final String ATTR_ASN1ID
Name of the XML 'asn1id' attribute.

See Also:
Constant Field Values

ATTR_CLASS_NAME

public static final String ATTR_CLASS_NAME
Name of the XML 'class-name' attribute.

See Also:
Constant Field Values

ATTR_CONTAINER

public static final String ATTR_CONTAINER
Name of the XML 'container' attribute.

See Also:
Constant Field Values

ATTR_ATTR_NAME

public static final String ATTR_ATTR_NAME
Name of the XML 'attr-name' attribute.

See Also:
Constant Field Values

ATTR_CASE_SENSITIVE

public static final String ATTR_CASE_SENSITIVE
Name of the XML 'case-sensitive' attribute.

See Also:
Constant Field Values

ATTR_MULTI_VALUED

public static final String ATTR_MULTI_VALUED
Name of the XML 'multi-valued' attribute.

See Also:
Constant Field Values

ATTR_NAMING

public static final String ATTR_NAMING
Name of the XML 'naming' attribute.

See Also:
Constant Field Values

ATTR_READ_ONLY

public static final String ATTR_READ_ONLY
Name of the XML 'read-only' attribute.

See Also:
Constant Field Values

ATTR_REQUIRED

public static final String ATTR_REQUIRED
Name of the XML 'required' attribute.

See Also:
Constant Field Values

ATTR_TYPE

public static final String ATTR_TYPE
Name of the XML 'type' attribute.

See Also:
Constant Field Values

VAL_TRUE

public static final String VAL_TRUE
"true"

See Also:
Constant Field Values

VAL_FALSE

public static final String VAL_FALSE
"false"

See Also:
Constant Field Values

VAL_DOT

public static final String VAL_DOT
"dot"

See Also:
Constant Field Values

VAL_QUALIFIED_DOT

public static final String VAL_QUALIFIED_DOT
"qualified-dot"

See Also:
Constant Field Values

VAL_SLASH

public static final String VAL_SLASH
"slash"

See Also:
Constant Field Values

VAL_QUALIFIED_SLASH

public static final String VAL_QUALIFIED_SLASH
"qualified-slash"

See Also:
Constant Field Values

VAL_LDAP

public static final String VAL_LDAP
"ldap"

See Also:
Constant Field Values

VAL_STRING

public static final String VAL_STRING
"string"

See Also:
Constant Field Values

VAL_TELENUMBER

public static final String VAL_TELENUMBER
"teleNumber"

See Also:
Constant Field Values

VAL_INT

public static final String VAL_INT
"int"

See Also:
Constant Field Values

VAL_STATE

public static final String VAL_STATE
"state"

See Also:
Constant Field Values

VAL_COUNTER

public static final String VAL_COUNTER
"counter"

See Also:
Constant Field Values

VAL_DN

public static final String VAL_DN
"dn"

See Also:
Constant Field Values

VAL_INTERVAL

public static final String VAL_INTERVAL
"interval"

See Also:
Constant Field Values

VAL_OCTET

public static final String VAL_OCTET
"octet"

See Also:
Constant Field Values

VAL_TIME

public static final String VAL_TIME
"time"

See Also:
Constant Field Values

VAL_STRUCTURED

public static final String VAL_STRUCTURED
"structured"

See Also:
Constant Field Values

VAL_CLASSNAME

public static final String VAL_CLASSNAME
"className"

See Also:
Constant Field Values

ATTR_TYPE_STRING

public static final int ATTR_TYPE_STRING
Constant representing the "string" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_TELENUMBER

public static final int ATTR_TYPE_TELENUMBER
Constant representing the "teleNumber" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_INT

public static final int ATTR_TYPE_INT
Constant representing the "int" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_STATE

public static final int ATTR_TYPE_STATE
Constant representing the "state" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_COUNTER

public static final int ATTR_TYPE_COUNTER
Constant representing the "counter" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_DN

public static final int ATTR_TYPE_DN
Constant representing the "dn" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_INTERVAL

public static final int ATTR_TYPE_INTERVAL
Constant representing the "interval" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_OCTET

public static final int ATTR_TYPE_OCTET
Constant representing the "octet" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_TIME

public static final int ATTR_TYPE_TIME
Constant representing the "time" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_STRUCTURED

public static final int ATTR_TYPE_STRUCTURED
Constant representing the "structured" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

ATTR_TYPE_CLASSNAME

public static final int ATTR_TYPE_CLASSNAME
Constant representing the "className" value for the <attr-def> XML attribute "type". Used as a return from and a parameter to AttrDef.getType() and AttrDef.setType().

See Also:
SchemaDef.AttrDef.getType(), SchemaDef.AttrDef.setType(int), Constant Field Values

DN_FORMAT_DOT

public static final int DN_FORMAT_DOT
Constant representing the "dot" value for the <schema-def> XML attribute "dn-format". Used as a return from and a parameter to SchemaDef.getDNFormat() and SchemaDef.setDNFormat().

See Also:
getDNFormat(), setDNFormat(int), Constant Field Values

DN_FORMAT_QUALIFIED_DOT

public static final int DN_FORMAT_QUALIFIED_DOT
Constant representing the "qualified-dot" value for the <schema-def> XML attribute "dn-format". Used as a return from and a parameter to SchemaDef.getDNFormat() and SchemaDef.setDNFormat().

See Also:
getDNFormat(), setDNFormat(int), Constant Field Values

DN_FORMAT_SLASH

public static final int DN_FORMAT_SLASH
Constant representing the "slash" value for the <schema-def> XML attribute "dn-format". Used as a return from and a parameter to SchemaDef.getDNFormat() and SchemaDef.setDNFormat().

See Also:
getDNFormat(), setDNFormat(int), Constant Field Values

DN_FORMAT_QUALIFIED_SLASH

public static final int DN_FORMAT_QUALIFIED_SLASH
Constant representing the "qualified-slash" value for the <schema-def> XML attribute "dn-format". Used as a return from and a parameter to SchemaDef.getDNFormat() and SchemaDef.setDNFormat().

See Also:
getDNFormat(), setDNFormat(int), Constant Field Values

DN_FORMAT_LDAP

public static final int DN_FORMAT_LDAP
Constant representing the "slash" value for the <schema-def> XML attribute "dn-format". Used as a return from and a parameter to SchemaDef.getDNFormat() and SchemaDef.setDNFormat().

See Also:
getDNFormat(), setDNFormat(int), Constant Field Values
Constructor Detail

SchemaDef

public SchemaDef()
Construct a new, empty SchemaDef instance.


SchemaDef

public SchemaDef(Element schemaDef)
          throws XMLException
Construct a SchemaDef instance based on an XML representation.

Parameters:
schemaDef - the <schema-def> element
Throws:
XMLException - thrown if there is an error in the XML representation

SchemaDef

public SchemaDef(SchemaDef source)
Copy constructor.

Parameters:
source - the SchemaDef instance to copy
Method Detail

getApplicationName

public String getApplicationName()
Get the value for the "application-name" attribute.

Returns:
application name or null

setApplicationName

public void setApplicationName(String newName)
Set the value for the "application-name" attribute.

Parameters:
newName - new value for "application-name" (may be null)

getDNDelims

public String getDNDelims()
Get the value for the "dn-delims" attribute.

Returns:
dn delimiters or null

setDNDelims

public void setDNDelims(String newDelims)
Set the value for the "dn-delims" attribute.

Parameters:
newDelims - new value for "dn-delims" (may be null)

getDNFormat

public int getDNFormat()
Get the value for the "dn-delims" attribute.

Returns:
one of DN_FORMAT_DOT, DN_FORMAT_QUALIFIED_DOT, etc.

setDNFormat

public void setDNFormat(int format)
                 throws IllegalArgumentException
Set the value for the "dn-delims" attribute.

Parameters:
format - one of DN_FORMAT_DOT, DN_FORMAT_QUALIFIED_DOT, etc.
Throws:
IllegalArgumentException - thrown if format parameter is incorrect

getHierarchical

public boolean getHierarchical()
Get the value for the "hierarchical" attribute.

Returns:
true or false

setHierarchical

public void setHierarchical(boolean value)
Set the value for the "hierarchical" attribute.

Parameters:
value - true or false

getClassDef

public SchemaDef.ClassDef getClassDef(String className)
Get a ClassDef instance from this SchemaDef instance based on class name.

Parameters:
className - the name of the class
Returns:
null or a ClassDef instance

newClass

public SchemaDef.ClassDef newClass(String className)
                            throws IllegalStateException
Add a new ClassDef instance.

Parameters:
className - name of new class
Returns:
newly-created ClassDef instance
Throws:
IllegalStateException - thrown if a ClassDef already exists with the passed name

removeClass

public boolean removeClass(String className)
Remove a ClassDef from this instance based on name.

Parameters:
className - name of class to be removed
Returns:
true if a ClassDef was removed

getDNFormatFromString

public static int getDNFormatFromString(String dnFormatString)
                                 throws IllegalArgumentException
Get the integer value corresponding to a "dn-format" string value.

Parameters:
dnFormatString - "dot", "qualified-dot", "slash", "qualified-slash", "ldap"
Returns:
integer value
Throws:
IllegalArgumentException - thrown if dnFormatString is not a valid value

getDNFormatString

public static String getDNFormatString(int dnFormat)
                                throws IllegalArgumentException
Get the string corresponding to a "dn-format" integer value.

Parameters:
dnFormat - DN_FORMAT_DOT, DN_FORMAT_QUALIFIED_DOT, etc.
Returns:
"dot", "qualified-dot", "slash", "qualified-slash", "ldap"
Throws:
IllegalArgumentException - thrown if dnFormat is not a valid value

iterator

public Iterator iterator()
Return an Iterator that will iterate over the ClassDef instances in this SchemaDef instance.

Returns:
Iterator whose next() method returns ClassDef instances

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
Returns:
true or false
See Also:
resetModified()

resetModified

public void resetModified()
Reset the modified flag for this instance such that hasBeenModified() will return false.

Specified by:
resetModified in interface ConfigElement
See Also:
hasBeenModified()

toXML

public Element toXML(Node parent)
Create an XML representation for this instance under the passed Node.

Note that the act of creating an XML representation does not reset this instance's modified flag. It must be reset by calling resetModified().

Specified by:
toXML in interface ConfigElement
Parameters:
parent - Node under which to construct XML representation.
Returns:
created Element
See Also:
hasBeenModified(), resetModified()