All LDAP Classes
Internal LDAP Classes

com.novell.ldap
Class LDAPSchemaElement

java.lang.Object
  extended by com.novell.ldap.LDAPAttribute
      extended by com.novell.ldap.LDAPSchemaElement
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
LDAPAttributeSchema, LDAPDITContentRuleSchema, LDAPDITStructureRuleSchema, LDAPMatchingRuleSchema, LDAPMatchingRuleUseSchema, LDAPNameFormSchema, LDAPObjectClassSchema, LDAPSyntaxSchema

public abstract class LDAPSchemaElement
extends LDAPAttribute
implements java.io.Serializable

The LDAPSchemaElement class is the base class representing schema elements (definitions) in LDAP.

An LDAPSchemaElement is read-only, single-valued LDAPAttribute. Therefore, it does not support the addValue and removeValue methods from LDAPAttribute. This class overrides those methods and throws UnsupportedOperationException if either of those methods are invoked by an application.

See Also:
LDAPSchema, LDAPConnection.fetchSchema(java.lang.String), Serialized Form

Field Summary
protected  java.lang.String description
          The description for the schema element.
protected  java.util.HashMap hashQualifier
          A hash table that contains the vendor-specific qualifiers (for example, the X-NDS flags).
protected  java.lang.String[] names
          The names of the schema element.
protected  boolean obsolete
          If present, indicates that the element is obsolete, no longer in use in the directory.
protected  java.lang.String oid
          The OID for the schema element.
protected  java.lang.String[] qualifier
          A string array of optional, or vendor-specific, qualifiers for the schema element.
 
Constructor Summary
protected LDAPSchemaElement(java.lang.String attrName)
          Creates an LDAPSchemaElement by setting the name of the LDAPAttribute.
 
Method Summary
 void addValue(java.lang.Byte[] value)
          LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.
 void addValue(java.lang.String value)
          LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.
protected abstract  java.lang.String formatString()
          Implementations of formatString format a schema element into a string suitable for using in a modify (ADD) operation to the directory.
 java.lang.String getDescription()
          Returns the description of the element.
 java.lang.String getID()
          Returns the unique object identifier (OID) of the element.
 java.lang.String[] getNames()
          Returns an array of names for the element, or null if none is found.
 java.lang.String[] getQualifier(java.lang.String name)
          Returns an array of all values of a specified optional or non- standard qualifier of the element.
 java.util.Enumeration getQualifierNames()
          Returns an enumeration of all qualifiers of the element which are vendor specific (begin with "X-").
 boolean isObsolete()
          Returns whether the element has the OBSOLETE qualifier in its LDAP definition.
private  void readObject(java.io.ObjectInputStream objectIStrm)
          Reads the serialized object from the underlying input stream.
 void removeValue(java.lang.Byte[] value)
          LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.
 void removeValue(java.lang.String value)
          LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.
 void setQualifier(java.lang.String name, java.lang.String[] values)
          Sets the values of a specified optional or non-standard qualifier of the element.
 java.lang.String toString()
          Returns a string in a format suitable for directly adding to a directory, as a value of the particular schema element.
private  void writeObject(java.io.ObjectOutputStream objectOStrm)
          Writes the object state to a stream in standard Default Binary format This function wraps ObjectOutputStream' s defaultWriteObject() to write the non-static and non-transient fields of the current class to the stream
 
Methods inherited from class com.novell.ldap.LDAPAttribute
addBase64Value, addBase64Value, addBase64Value, addURLValue, addURLValue, addValue, clone, compareTo, getBaseName, getBaseName, getByteValue, getByteValueArray, getByteValues, getLangSubtype, getName, getStringValue, getStringValueArray, getStringValues, getSubtypes, getSubtypes, getXMLHandler, hasSubtype, hasSubtypes, newLine, readDSML, readExternal, removeValue, setDeserializedValues, setValue, size, writeDSML, writeExternal, writeValue, writeValue
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

names

protected java.lang.String[] names
The names of the schema element.


oid

protected java.lang.String oid
The OID for the schema element.


description

protected java.lang.String description
The description for the schema element.


obsolete

protected boolean obsolete
If present, indicates that the element is obsolete, no longer in use in the directory.


qualifier

protected java.lang.String[] qualifier
A string array of optional, or vendor-specific, qualifiers for the schema element.

These optional qualifiers begin with "X-"; the Novell eDirectory specific qualifiers begin with "X-NDS".


hashQualifier

protected java.util.HashMap hashQualifier
A hash table that contains the vendor-specific qualifiers (for example, the X-NDS flags).

Constructor Detail

LDAPSchemaElement

protected LDAPSchemaElement(java.lang.String attrName)
Creates an LDAPSchemaElement by setting the name of the LDAPAttribute. Because this is the only constructor, all extended classes are expected to call this constructor. The value of the LDAPAttribute must be set by the setValue method.

Parameters:
attrName - The attribute name of the schema definition. Valid names are one of the following: "attributeTypes", "objectClasses", "ldapSyntaxes", "nameForms", "dITContentRules", "dITStructureRules", "matchingRules", or "matchingRuleUse"
Method Detail

getNames

public java.lang.String[] getNames()
Returns an array of names for the element, or null if none is found.

The getNames method accesses the NAME qualifier (from the BNF descriptions of LDAP schema definitions). The array consists of all values of the NAME qualifier.

Returns:
An array of names for the element, or null if none is found.

getDescription

public java.lang.String getDescription()
Returns the description of the element.

The getDescription method returns the value of the DESC qualifier (from the BNF descriptions of LDAP schema definitions).

Returns:
The description of the element.

getID

public java.lang.String getID()
Returns the unique object identifier (OID) of the element.

Returns:
The OID of the element.

getQualifier

public java.lang.String[] getQualifier(java.lang.String name)
Returns an array of all values of a specified optional or non- standard qualifier of the element.

The getQualifier method may be used to access the values of vendor-specific qualifiers (which begin with "X-").

Parameters:
name - The name of the qualifier, case-sensitive.
Returns:
An array of values for the specified non-standard qualifier.

getQualifierNames

public java.util.Enumeration getQualifierNames()
Returns an enumeration of all qualifiers of the element which are vendor specific (begin with "X-").

Returns:
An enumeration of all qualifiers of the element.

isObsolete

public boolean isObsolete()
Returns whether the element has the OBSOLETE qualifier in its LDAP definition.

Returns:
True if the LDAP definition contains the OBSOLETE qualifier; false if OBSOLETE qualifier is not present.

toString

public java.lang.String toString()
Returns a string in a format suitable for directly adding to a directory, as a value of the particular schema element.

Overrides:
toString in class LDAPAttribute
Returns:
A string that can be used to add the element to the directory.

formatString

protected abstract java.lang.String formatString()
Implementations of formatString format a schema element into a string suitable for using in a modify (ADD) operation to the directory. toString uses this method. This method is needed because a call to setQualifier requires reconstructing the string value of the schema element.


setQualifier

public void setQualifier(java.lang.String name,
                         java.lang.String[] values)
Sets the values of a specified optional or non-standard qualifier of the element.

The setQualifier method is used to set the values of vendor- specific qualifiers (which begin with "X-").

Parameters:
name - The name of the qualifier, case-sensitive.

values - The values to set for the qualifier.

addValue

public void addValue(java.lang.String value)
LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.

Overrides:
addValue in class LDAPAttribute
Parameters:
value - Value of the attribute as a String.
Throws:
java.lang.UnsupportedOperationException - always thrown since LDAPSchemaElement is read-only

addValue

public void addValue(java.lang.Byte[] value)
LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.

Throws:
java.lang.UnsupportedOperationException - always thrown since LDAPSchemaElement is read-only

removeValue

public void removeValue(java.lang.String value)
LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.

Overrides:
removeValue in class LDAPAttribute
Parameters:
value - Value of the attribute as a string.

Note: Removing a value which is not present in the attribute has no effect.

Throws:
java.lang.UnsupportedOperationException - always thrown since LDAPSchemaElement is read-only

removeValue

public void removeValue(java.lang.Byte[] value)
LDAPSchemaElement is read-only and this method is over-ridden to throw an exception.

Throws:
java.lang.UnsupportedOperationException - always thrown since LDAPSchemaElement is read-only

writeObject

private void writeObject(java.io.ObjectOutputStream objectOStrm)
                  throws java.io.IOException
Writes the object state to a stream in standard Default Binary format This function wraps ObjectOutputStream' s defaultWriteObject() to write the non-static and non-transient fields of the current class to the stream

Parameters:
objectOStrm - The OutputSteam where the Object need to be written
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream objectIStrm)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Reads the serialized object from the underlying input stream. This function wraps ObjectInputStream's defaultReadObject() function

Parameters:
objectIStrm - InputStream used to recover those objects previously serialized.
Throws:
java.io.IOException
java.lang.ClassNotFoundException

All LDAP Classes
Internal LDAP Classes

Copyright ? 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000