com.novell.admin.ns
Class SchemaDefinition

java.lang.Object
  extended bycom.novell.admin.ns.SchemaDefinition
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
DefaultSchemaDefinition, LDAPSchemaDefinition, NDSSchemaDefinition

public abstract class SchemaDefinition
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This is the base class that represents an in-memory model of an entire schema definition.

See Also:
Serialized Form

Field Summary
protected  java.util.HashMap aliasAttributeNames
          Table of alias attribute names.
protected  java.util.HashMap aliasClassNames
          Table of alias class names.
protected  java.util.HashMap attributes
          Table of attribute definitions.
protected  java.util.HashMap classes
          Table of class definitions.
protected  java.util.HashMap expandedClasses
          Table of expanded class definitions.
protected  NamespaceSnapin namespace
          The namespace that created this.
protected  java.util.HashMap objectTypeCache
          The table of ObjectType objects for the schema.
 
Constructor Summary
SchemaDefinition()
           
SchemaDefinition(NamespaceSnapin ns)
           
 
Method Summary
 boolean canContain(java.lang.String parentClass, java.lang.String childClass)
          Tests if objects of one class type may contain objects of another class type.
 void clearAttributes()
          Clears the internal table of schema attribute definitions and the alias table.
 void clearClasses()
          Clears the internal table of schema class definitions and the alias table.
 void clearObjectTypeCache()
          Clears the internal ObjectType cache.
 java.lang.Object clone()
          Creates an exact duplicate of this object without creating a new object.
 AttributeDefinition getAttributeDefinition(java.lang.String attrName)
          Returns the AttributeDefinition object for a given attribute name.
 AttributeDefinition[] getAttributeDefinitions()
          Returns an array containing all attribute definitions.
 ClassDefinition[] getAuxiliaryClassDefinitions()
           
 ClassDefinition getClassDefinition(java.lang.String className)
          Returns the expanded ClassDefinition object for a given class name.
 ClassDefinition[] getClassDefinitions()
           
 ClassDefinition[] getClassesUsingAttribute(java.lang.String attrName)
          Returns an array of expanded class definitions that use a particular attribute, whether mandatory or optional, whether specified directly or inherited.
 ClassDefinition[] getContainmentClasses(java.lang.String className)
          Returns all containment classes for a specific class type, including inherited ones.
 ClassDefinition[] getEffectiveClasses(java.lang.String parentClass)
          Returns the effective classes that may be instantiated in a parent class.
 AttributeDefinition[] getMandatoryAttributes(java.lang.String className)
          Retrieves all mandatory attributes for a specific class.
 AttributeDefinition[] getNamingAttributes(java.lang.String className)
          Retrieves all naming attributes for a specific class.
 int getNumberOfAttributes()
          Returns the number of attribute definitions in the schema definition.
 int getNumberOfClasses()
          Returns the number of class definitions in the schema definition.
 ObjectType getObjectType(java.lang.String className)
          Returns an ObjectType object for a specific class.
 AttributeDefinition[] getOptionalAttributes(java.lang.String className)
          Retrieves all optional attributes for a specific class.
 ClassDefinition getRawClassDefinition(java.lang.String className)
          Looks up a specific class definition and returns it in raw (unexpanded) form.
 ClassDefinition[] getSubClasses(java.lang.String className)
          Retrieve ALL classes which derive from a specific class type.
 ClassDefinition[] getSuperClasses(java.lang.String className)
          Retrieves all classes from which a specific class inherits.
 boolean isAttributeDefined(java.lang.String attrName)
          Determines if an attribute is defined.
 boolean isClassDefined(java.lang.String className)
          Determines if a given class is defined.
 java.lang.String translateAliasAttributeName(java.lang.String oldName)
          Translate an alias attribute name into the official name.
 java.lang.String translateAliasClassName(java.lang.String oldName)
          Translate an alias class name into the official name.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aliasAttributeNames

protected java.util.HashMap aliasAttributeNames
Table of alias attribute names.


aliasClassNames

protected java.util.HashMap aliasClassNames
Table of alias class names.


attributes

protected java.util.HashMap attributes
Table of attribute definitions.


classes

protected java.util.HashMap classes
Table of class definitions. Unexpanded definitions.


expandedClasses

protected java.util.HashMap expandedClasses
Table of expanded class definitions. Contains inherited attributes, naming, containment, and superclasses.


namespace

protected NamespaceSnapin namespace
The namespace that created this.


objectTypeCache

protected java.util.HashMap objectTypeCache
The table of ObjectType objects for the schema.

Constructor Detail

SchemaDefinition

public SchemaDefinition()

SchemaDefinition

public SchemaDefinition(NamespaceSnapin ns)
Method Detail

canContain

public boolean canContain(java.lang.String parentClass,
                          java.lang.String childClass)
Tests if objects of one class type may contain objects of another class type.

Parameters:
parentClass - The name of the parent class type.
childClass - The name of the child class type.
Returns:
True if the object based on the parent class type can contain the object based on the child class type, false otherwise.

clearAttributes

public void clearAttributes()
Clears the internal table of schema attribute definitions and the alias table.


clearClasses

public void clearClasses()
Clears the internal table of schema class definitions and the alias table.


clearObjectTypeCache

public void clearObjectTypeCache()
Clears the internal ObjectType cache.


clone

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

Returns:
A newly created SchemaDefinition object.

getAttributeDefinition

public AttributeDefinition getAttributeDefinition(java.lang.String attrName)
                                           throws NamespaceException
Returns the AttributeDefinition object for a given attribute name.

Parameters:
attrName - The name of the attribute.
Returns:
The attribute definition, if it is found.
Throws:
NamespaceException - NamespaceException.ATTRIBUTE_NOT_DEFINED.

getAttributeDefinitions

public AttributeDefinition[] getAttributeDefinitions()
Returns an array containing all attribute definitions.

Returns:
A new array containing the attribute definitions.

getAuxiliaryClassDefinitions

public ClassDefinition[] getAuxiliaryClassDefinitions()

getClassDefinition

public ClassDefinition getClassDefinition(java.lang.String className)
                                   throws NamespaceException
Returns the expanded ClassDefinition object for a given class name.

The expanded class definition also contains inherited attributes and classes in its tables of mandatory, optional, naming, containment, and superclasses.

Parameters:
className - The name of the class.
Returns:
The expanded class definition, if found.
Throws:
NamespaceException - NamespaceException.CLASS_NOT_DEFINED.

getClassDefinitions

public ClassDefinition[] getClassDefinitions()

getClassesUsingAttribute

public ClassDefinition[] getClassesUsingAttribute(java.lang.String attrName)
Returns an array of expanded class definitions that use a particular attribute, whether mandatory or optional, whether specified directly or inherited.

Parameters:
attrName - The name of the attribute used.
Returns:
A new array containing expanded class definitions.

getContainmentClasses

public ClassDefinition[] getContainmentClasses(java.lang.String className)
                                        throws NamespaceException
Returns all containment classes for a specific class type, including inherited ones.

You can get a String array of the containment classes with: getClassDefinition(className).getContainmentClasses()

Parameters:
className - The name of the class to get containment classes for.
Returns:
An array of unexpanded ClassDefinition objects representing those classes that may contain the specified class.
Throws:
NamespaceException - Refer to NamespaceException documentation.

getEffectiveClasses

public ClassDefinition[] getEffectiveClasses(java.lang.String parentClass)
Returns the effective classes that may be instantiated in a parent class. (Returns expanded definitions.)

Parameters:
parentClass - The name of the parent class.
Returns:
An array of ClassDefinition objects representing the class types that can be instantiated as children of the parent class.

getMandatoryAttributes

public AttributeDefinition[] getMandatoryAttributes(java.lang.String className)
                                             throws NamespaceException
Retrieves all mandatory attributes for a specific class.

For backward compatibility. Deprecated. Use getClassDefinition(className).getMandatoryAttributes();

Parameters:
className - The name of the class.
Returns:
An array of AttributeDefinition objects representing the mandatory attributes of the specified class.
Throws:
NamespaceException - Thrown if the class is not defined in the schema.

getNamingAttributes

public AttributeDefinition[] getNamingAttributes(java.lang.String className)
                                          throws NamespaceException
Retrieves all naming attributes for a specific class.

For backward compatibility. Deprecated. Use getClassDefinition(className).getNamingAttributes();

Parameters:
className - The name of the class.
Returns:
An array of AttributeDefinition objects representing the naming attributes of the specified class.
Throws:
NamespaceException - Thrown if the class is not defined in the schema.

getNumberOfAttributes

public final int getNumberOfAttributes()
Returns the number of attribute definitions in the schema definition.

Returns:
The number of attributes.

getNumberOfClasses

public final int getNumberOfClasses()
Returns the number of class definitions in the schema definition.

Returns:
The number of classes.

getObjectType

public ObjectType getObjectType(java.lang.String className)
                         throws SPIException
Returns an ObjectType object for a specific class.

Parameters:
className - The name of the class.
Returns:
A valid ObjectType.
Throws:
SPIException - Refer to SPIException documentation.

getOptionalAttributes

public AttributeDefinition[] getOptionalAttributes(java.lang.String className)
                                            throws NamespaceException
Retrieves all optional attributes for a specific class.

For backward compatibility. Deprecated. Use getClassDefinition(className).getOptionalAttributes();

Parameters:
className - The name of the class.
Returns:
An array of AttributeDefinition objects representing the optional attributes of the specified class.
Throws:
NamespaceException - Thrown if the class not defined in schema.

getRawClassDefinition

public ClassDefinition getRawClassDefinition(java.lang.String className)
                                      throws NamespaceException
Looks up a specific class definition and returns it in raw (unexpanded) form.

A class in raw form lists only those attribute and class rules specified directly by the class, not the inherited ones.

Use this function as a generic replacement for getUnexpandedClassDefinition which was originally coded to return an NDSClassDefinition.

Parameters:
className - The name of the class to look up.
Returns:
A valid LDAPClassDefinition in unexpanded form.
Throws:
NamespaceException - Class is not defined.

getSubClasses

public ClassDefinition[] getSubClasses(java.lang.String className)
Retrieve ALL classes which derive from a specific class type.

The class definitions returned are in expanded form.

Parameters:
className - Name of the super class.
Returns:
An array of expanded ClassDefinition objects representing the immediate subclasses.

getSuperClasses

public ClassDefinition[] getSuperClasses(java.lang.String className)
                                  throws NamespaceException
Retrieves all classes from which a specific class inherits.

The class definitions returned are in unexpanded form. This routine was kept for backward compatibility. You can get the complete list as a String array with: getClassDefinition(className).getSuperClasses();

Parameters:
className - The name of the subclass.
Returns:
An array of unexpanded ClassDefinition objects representing the super classes.
Throws:
NamespaceException - Thrown if the class is not defined in schema.

isAttributeDefined

public final boolean isAttributeDefined(java.lang.String attrName)
Determines if an attribute is defined.

Parameters:
attrName - The name of the attribute to check.
Returns:
True if the attribute is defined, false otherwise.

isClassDefined

public final boolean isClassDefined(java.lang.String className)
Determines if a given class is defined.

Parameters:
className - The name of the class to check. This may be the standard name or an alias name.
Returns:
True if the class is defined, false otherwise.

translateAliasAttributeName

public java.lang.String translateAliasAttributeName(java.lang.String oldName)
Translate an alias attribute name into the official name. If the name is not an alias, the original name is returned.

Returns:
The offical attribute name, or the original string if it's not an alias.

translateAliasClassName

public java.lang.String translateAliasClassName(java.lang.String oldName)
Translate an alias class name into the official name. If the name is not an alias, the original name is returned.

Returns:
The offical class name, or the original string if it's not an alias.


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.