com.novell.admin.ns
Class DefaultNSObject

java.lang.Object
  |
  +--com.novell.admin.ns.NSObject
        |
        +--com.novell.admin.ns.DefaultNSObject
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable
Direct Known Subclasses:
MODObject, NDSObject

public abstract class DefaultNSObject
extends NSObject
implements java.io.Serializable

Memory model for objects stored in a namespace.

This model is provided for applications to access and modify all elements associated with a directory object. Elements such as attributes, flags, and schema for an object should be retrieved using this class.


Field Summary
protected  java.util.Hashtable addedAttributeDefinitions
          Running list of newly added attribute definitions.
protected  AdminNamespace namespace
          Namespace that can be used to get class definition
protected  com.novell.application.console.snapin.ObjectEntry objectEntry
          The associated ObjectEntry.
 
Fields inherited from class com.novell.admin.ns.NSObject
addedAttributes, attributes, classDefinition, deletedAttributes, modifiedAttributes, propertyListeners, revision
 
Constructor Summary
protected DefaultNSObject(com.novell.application.console.snapin.ObjectEntry objEntry, java.util.Vector attributes, long rev)
          Constructor.
 
Method Summary
 void addAttribute(ObjectAttribute attr)
          Adds a newly valued attribute to the object.
 boolean addAuxiliaryClassDefinition(ClassDefinition classDef, ObjectAttribute[] attrs)
          Adds an auxiliary class Definition.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds this listener to the listener list for this object.
protected  void checkAdd(ObjectAttribute attr, boolean isForAuxClass)
          Checks to make sure an attribute can be added to this object.
 void clearAddedAttribute(java.lang.String attrName)
          Removes an attribute from the attributes to add.
 void clearAddedAttributeDefinitions()
          Removes an attribute from the attributes to add.
 void clearDeletedAttribute(java.lang.String attrName)
          Removes an attribute from the attributes to delete.
 void clearModifiedAttribute(java.lang.String attrName)
          Removes an attribute from the attributes to modify.
 NSObject clone(com.novell.application.console.snapin.ObjectEntry newIdentity)
          Creates an exact duplicate of this NSObject but gives it a new identity.
 boolean deleteAttribute(java.lang.String attrName)
          Deletes a currently valued attribute of this object.
 boolean deleteAuxiliaryClassDefinition(ClassDefinition classDef)
          Deletes an auxiliary class definition.
 java.util.Hashtable getAddedAttributeDefinitions()
          Retrieves the attributes that have been added to the object.
 java.lang.String[] getAddedAttributes()
          Retrieves the attributes that have been added to the object.
 ObjectAttribute getAttribute(java.lang.String attrName)
          Retrieves a specific attribute of this object.
 java.lang.String[] getAttributes()
          Retrieves the names of the valued attributes of the object.
 ClassDefinition[] getClassDefinitions()
          Retrieves the schema class definition for the object.
 java.lang.String[] getDeletedAttributes()
          Retrieves the attributes that have been deleted from the object.
 java.lang.String[] getMandatoryAttributes()
          Retrieves the mandatory attributes of the object.
 java.lang.String[] getModifiedAttributes()
          Retrieves the attributes that have been modified in the object.
 com.novell.application.console.snapin.ObjectEntry getObjectEntry()
          Retrieves the object entry representation of the object.
 java.lang.String[] getOptionalAttributes()
          Retrieves the optional attributes of the object.
 long getRevision()
          Retrieves the revision of the object.
 java.lang.String[] getUnvaluedAttributes()
          Retrieves the names of the attributes that are not valued.
 boolean isAttributeMandatory(java.lang.String attrName)
          Checks to see if a particular attribute is mandatory for the Object Entry's schema class or its associated auxiliary classes.
 boolean isAttributeOptional(java.lang.String attrName)
          Checks to see if a particular attribute is optional for the Object Entry's schema class or its associated auxiliary classes.
 boolean isNamedBy(java.lang.String attrName)
          Checks to see if a particular attribute is a naming for the Object Entry's schema class or its associated auxiliary classes.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Callback for attribute modifications.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes this listener from the listener list for this object.
protected  void setClassDefinition()
          Sets the class definition for this object.
 
Methods inherited from class com.novell.admin.ns.NSObject
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectEntry

protected com.novell.application.console.snapin.ObjectEntry objectEntry
The associated ObjectEntry.

addedAttributeDefinitions

protected java.util.Hashtable addedAttributeDefinitions
Running list of newly added attribute definitions.

namespace

protected AdminNamespace namespace
Namespace that can be used to get class definition
Constructor Detail

DefaultNSObject

protected DefaultNSObject(com.novell.application.console.snapin.ObjectEntry objEntry,
                          java.util.Vector attributes,
                          long rev)
Constructor.
Parameters:
objEntry - The object entry representation.
attributes - Vector of ObjectAttributes or Strings if the attributes are to be read later.
rev - revision number of the object.
Method Detail

addAttribute

public void addAttribute(ObjectAttribute attr)
                  throws NamespaceException
Adds a newly valued attribute to the object.
Parameters:
attr - The valued attribute to be added.
Throws:
NamespaceException - Thrown when a condition occurs that disallowed the add.

This may be one of the following conditions.

  • NamespaceException.DUPLICATE_ATTRIBUTE
  • NamespaceException.INVALID_ATTRIBUTE
  • NamespaceException.MANDATORY_ATTRIBUTE
  • NamespaceException.READONLY_ATTRIBUTE
  • NamespaceException.ATTRIBUTE_NOT_VALUED
Overrides:
addAttribute in class NSObject

getAttribute

public ObjectAttribute getAttribute(java.lang.String attrName)
Retrieves a specific attribute of this object.
Parameters:
attrName - The name of the attribute that is to be retrieved.
Returns:
The ObjectAttribute named by 'attrName' if found, null otherwise.
Overrides:
getAttribute in class NSObject

deleteAttribute

public boolean deleteAttribute(java.lang.String attrName)
                        throws NamespaceException
Deletes a currently valued attribute of this object.
Parameters:
attr - The attribute to be deleted from the object.
Returns:
true if attribute was deleted, false if attribute was not found.
Throws:
NamespaceException - A condition occured which disallowed the delete:
  • NamespaceException.MANDATORY_ATTRIBUTE
  • NamespaceException.READONLY_ATTRIBUTE
Overrides:
deleteAttribute in class NSObject

getAddedAttributes

public java.lang.String[] getAddedAttributes()
Retrieves the attributes that have been added to the object.
Returns:
String array of the added attributes.
Overrides:
getAddedAttributes in class NSObject

getAddedAttributeDefinitions

public java.util.Hashtable getAddedAttributeDefinitions()
Retrieves the attributes that have been added to the object.
Returns:
String array of the added attributes.

getAttributes

public java.lang.String[] getAttributes()
Retrieves the names of the valued attributes of the object.
Returns:
A String array of all the attributes.
Overrides:
getAttributes in class NSObject

getMandatoryAttributes

public java.lang.String[] getMandatoryAttributes()
Retrieves the mandatory attributes of the object.
Returns:
A String array of all mandatory attributes.
Overrides:
getMandatoryAttributes in class NSObject

getOptionalAttributes

public java.lang.String[] getOptionalAttributes()
Retrieves the optional attributes of the object.
Returns:
A String array of all optional attributes.
Overrides:
getOptionalAttributes in class NSObject

getUnvaluedAttributes

public java.lang.String[] getUnvaluedAttributes()
Retrieves the names of the attributes that are not valued.
Returns:
A String array of attribute names that are not valued.
Overrides:
getUnvaluedAttributes in class NSObject

getClassDefinitions

public ClassDefinition[] getClassDefinitions()
Retrieves the schema class definition for the object.
Returns:
The schema class definition.
Overrides:
getClassDefinitions in class NSObject

getDeletedAttributes

public java.lang.String[] getDeletedAttributes()
Retrieves the attributes that have been deleted from the object.
Returns:
A String array of the attributes that were deleted.
Overrides:
getDeletedAttributes in class NSObject

getModifiedAttributes

public java.lang.String[] getModifiedAttributes()
Retrieves the attributes that have been modified in the object.
Returns:
A String array of the attributes that were modified.
Overrides:
getModifiedAttributes in class NSObject

getObjectEntry

public com.novell.application.console.snapin.ObjectEntry getObjectEntry()
Retrieves the object entry representation of the object.
Returns:
objectEntry used to name this object.
Overrides:
getObjectEntry in class NSObject

getRevision

public long getRevision()
Retrieves the revision of the object.
Returns:
The revision.
Overrides:
getRevision in class NSObject

clone

public NSObject clone(com.novell.application.console.snapin.ObjectEntry newIdentity)
               throws NamespaceException
Creates an exact duplicate of this NSObject but gives it a new identity.
Parameters:
newIdentity - The ObjectEntry whose identity is assumed.
Returns:
new NSObject.
Throws:
NamespaceException - NamespaceException.OBJECTTYPE_NOT_VALID is thrown if the newIdentity's type is different from this.
Overrides:
clone in class NSObject

addAuxiliaryClassDefinition

public boolean addAuxiliaryClassDefinition(ClassDefinition classDef,
                                           ObjectAttribute[] attrs)
                                    throws NamespaceException
Adds an auxiliary class Definition.
Parameters:
classDef - The class definition to add.
attrs - The attributes to add.

The only attributes that will be added are those that are not currently valued. If attributes are valued, please modify the value instead of trying to add the attribute.

Returns:
True if all attributes where added, false otherwise.
Throws:
NamespaceException - NamespaceException.MISSING_MANDATORY_ATTRIBUTE
NamespaceException - NamespaceException.NOT_AUXILIARY_CLASS
NamespaceException - NamespaceException.CLASS_NOT_DEFINED
Overrides:
addAuxiliaryClassDefinition in class NSObject

deleteAuxiliaryClassDefinition

public boolean deleteAuxiliaryClassDefinition(ClassDefinition classDef)
                                       throws NamespaceException
Deletes an auxiliary class definition.
Parameters:
classDef - The class definition to be deleted.
Returns:
True if the class got deleted, false otherwize.
Throws:
NamespaceException - NamespaceException.NOT_AUXILIARY_CLASS
NamespaceException - NamespaceException.CLASS_NOT_DEFINED
Overrides:
deleteAuxiliaryClassDefinition in class NSObject

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Callback for attribute modifications.
Parameters:
event - The property change event that was registered for.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds this listener to the listener list for this object.
Parameters:
listener - The listener to be added.
Overrides:
addPropertyChangeListener in class NSObject

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes this listener from the listener list for this object.
Parameters:
listener - The listener to be removed.
Overrides:
removePropertyChangeListener in class NSObject

clearAddedAttribute

public void clearAddedAttribute(java.lang.String attrName)
Removes an attribute from the attributes to add.
Parameters:
attr - The valued attribute to be removed from the add list.
Overrides:
clearAddedAttribute in class NSObject

clearAddedAttributeDefinitions

public void clearAddedAttributeDefinitions()
Removes an attribute from the attributes to add.
Parameters:
attr - The valued attribute to be removed from the add list.

clearDeletedAttribute

public void clearDeletedAttribute(java.lang.String attrName)
Removes an attribute from the attributes to delete.
Parameters:
attrName - The valued attribute to be removed from the delete list.
Overrides:
clearDeletedAttribute in class NSObject

clearModifiedAttribute

public void clearModifiedAttribute(java.lang.String attrName)
Removes an attribute from the attributes to modify.
Parameters:
attrName - The valued attribute to be removed from the modify list.
Overrides:
clearModifiedAttribute in class NSObject

checkAdd

protected void checkAdd(ObjectAttribute attr,
                        boolean isForAuxClass)
                 throws NamespaceException
Checks to make sure an attribute can be added to this object.
Parameters:
attr - The name of the attribute.
isForAuxClass - Attribibue is being added due to an Aux class association.
Throws:
NamespaceException - Can not add the attribute to this object.

isAttributeMandatory

public boolean isAttributeMandatory(java.lang.String attrName)
Checks to see if a particular attribute is mandatory for the Object Entry's schema class or its associated auxiliary classes.
Parameters:
attrName - Name of the attribute to look for.
Returns:
True if attribute is mandatory, false otherwise.
Overrides:
isAttributeMandatory in class NSObject

isAttributeOptional

public boolean isAttributeOptional(java.lang.String attrName)
Checks to see if a particular attribute is optional for the Object Entry's schema class or its associated auxiliary classes.
Parameters:
attrName - Name of the attribute to look for.
Returns:
True if attribute is optional, false otherwise.
Overrides:
isAttributeOptional in class NSObject

isNamedBy

public boolean isNamedBy(java.lang.String attrName)
Checks to see if a particular attribute is a naming for the Object Entry's schema class or its associated auxiliary classes.
Parameters:
attrName - Name of the attribute to look for.
Returns:
True if the attribute is a naming attribute, false otherwise.
Overrides:
isNamedBy in class NSObject

setClassDefinition

protected void setClassDefinition()
Sets the class definition for this object.
Overrides:
setClassDefinition in class NSObject


API Documentation Copyright © 1998-2003 Novell, Inc. All rights reserved.
NDS is a registered trademark of Novell, Inc. in the United States and other countries.
Generated December 17 2003 1746.