com.novell.admin.ns.ldap
Class LDAPSchemaDefinition

java.lang.Object
  extended bycom.novell.admin.ns.SchemaDefinition
      extended bycom.novell.admin.ns.ldap.LDAPSchemaDefinition
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public final class LDAPSchemaDefinition
extends SchemaDefinition

This class models the entire LDAP schema.

All schema changes should be done through this class. Cloned instances of this class can only be used for modeling. The only instance of this class that will result in actual LDAP changes must be retrieved from the LDAPSchema class.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.novell.admin.ns.SchemaDefinition
aliasAttributeNames, aliasClassNames, attributes, classes, expandedClasses, namespace, objectTypeCache
 
Constructor Summary
LDAPSchemaDefinition(LDAPschema schema, NamespaceSnapin ns)
          Constructor.
 
Method Summary
 void addAttributeDefinition(AttributeDefinition attrDef)
          Shortcut method to add an AttributeDefinition to the attribute hashmap.
 void addClassDefinition(ClassDefinition classDef)
          Shortcut method to add a ClassDefinition to the classes hashmap.
 java.lang.Object clone()
          Creates an exact duplicate of this object without doing a new.
 void generateExpandedDefinitions()
          Takes the set of unexpanded class definitions and creates a Hashmap of expanded class definitions.
 void putAttributeDefinition(LDAPAttributeDefinition attributeDef)
          Adds a new attribute definition to the schema.
 void putClassDefinition(LDAPClassDefinition classDef)
          Adds a new class definition to the schema or replaces an existing definition with another.
 void removeAttributeDefinition(java.lang.String attrName)
          Removes an attribute definition from the schema.
 void removeClassDefinition(java.lang.String className)
          Removes a class definition from the schema.
 
Methods inherited from class com.novell.admin.ns.SchemaDefinition
canContain, clearAttributes, clearClasses, clearObjectTypeCache, getAttributeDefinition, getAttributeDefinitions, getAuxiliaryClassDefinitions, getClassDefinition, getClassDefinitions, getClassesUsingAttribute, getContainmentClasses, getEffectiveClasses, getMandatoryAttributes, getNamingAttributes, getNumberOfAttributes, getNumberOfClasses, getObjectType, getOptionalAttributes, getRawClassDefinition, getSubClasses, getSuperClasses, isAttributeDefined, isClassDefined, translateAliasAttributeName, translateAliasClassName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPSchemaDefinition

public LDAPSchemaDefinition(LDAPschema schema,
                            NamespaceSnapin ns)
Constructor.

This constructor should NOT be used by applications. Applications should get the schema definition from the Schema Service implementation class.

Parameters:
schema - The LDAP Schema Service class that factoried this.
Method Detail

addAttributeDefinition

public void addAttributeDefinition(AttributeDefinition attrDef)
Shortcut method to add an AttributeDefinition to the attribute hashmap.

Parameters:
attrDef - The AttributeDefinition to put in the hashmap.

addClassDefinition

public void addClassDefinition(ClassDefinition classDef)
Shortcut method to add a ClassDefinition to the classes hashmap.

Parameters:
classDef - The unexpanded ClassDefinition to put in the hashmap.

clone

public java.lang.Object clone()
Creates an exact duplicate of this object without doing a new.

One side effect of cloning is that no changes will ever be committed to LDAP! Only the original definition object will cause changes to LDAP! This allows for a "sandbox" metaphor.

Overrides:
clone in class SchemaDefinition
Returns:
A newly created LDAPSchemaDefinition object.

generateExpandedDefinitions

public void generateExpandedDefinitions()
                                 throws NamespaceException
Takes the set of unexpanded class definitions and creates a Hashmap of expanded class definitions.

Expanded definitions contain all the inherited attributes and rules as opposed to just those defined by the immediate class. The inherited information includes: Superclasses Mandatory attributes Optional attributes Containmenet classes Naming attributes

Throws:
NamespaceException - Class not defined in schema.

putAttributeDefinition

public void putAttributeDefinition(LDAPAttributeDefinition attributeDef)
                            throws SPIException
Adds a new attribute definition to the schema.

Changes will be committed to LDAP unless this object is a clone.

Parameters:
attributeDef - The new attribute definition.
Throws:
SPIException - Service provider threw an exception.

putClassDefinition

public void putClassDefinition(LDAPClassDefinition classDef)
                        throws NamespaceException,
                               SPIException
Adds a new class definition to the schema or replaces an existing definition with another.

Changes will be committed to LDAP unless this object is a clone.

Parameters:
classDef - The new class definition (unexpanded form).
Throws:
NamespaceException - Attribute or superclass not defined.
SPIException - Service provider threw an exception.

removeAttributeDefinition

public void removeAttributeDefinition(java.lang.String attrName)
                               throws NamespaceException,
                                      SPIException
Removes an attribute definition from the schema.

If this instance is an original, delete will be committed to LDAP.

Parameters:
attrName - The name of the attribute that is to be removed.
Throws:
NamespaceException - Attribute invalid or in use by a schema class.
SPIException - Service provider threw an exception.

removeClassDefinition

public void removeClassDefinition(java.lang.String className)
                           throws NamespaceException,
                                  SPIException
Removes a class definition from the schema.

If this instance is an original, delete will be committed to LDAP.

Parameters:
className - The name of the class that is to be removed.
Throws:
NamespaceException - Class in use by another schema class or class not defined.
SPIException - Service provider threw an exception.


API Documentation Copyright © 1998-2004 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated September 2 2004 0111.