org.apache.directory.shared.ldap.schema
Class ObjectClass

java.lang.Object
  extended by org.apache.directory.shared.ldap.schema.AbstractSchemaObject
      extended by org.apache.directory.shared.ldap.schema.ObjectClass
All Implemented Interfaces:
java.io.Serializable, SchemaObject

public class ObjectClass
extends AbstractSchemaObject

An objectClass definition.

According to ldapbis [MODELS]:

  Object Class definitions are written according to the ABNF:
  
    ObjectClassDescription = LPAREN WSP
        numericoid                ; object identifier
        [ SP "NAME" SP qdescrs ]  ; short names (descriptors)
        [ SP "DESC" SP qdstring ] ; description
        [ SP "OBSOLETE" ]         ; not active
        [ SP "SUP" SP oids ]      ; superior object classes
        [ SP kind ]               ; kind of class
        [ SP "MUST" SP oids ]     ; attribute types
        [ SP "MAY" SP oids ]      ; attribute types
        extensions WSP RPAREN
 
     kind = "ABSTRACT" / "STRUCTURAL" / "AUXILIARY"
 
   where:
     [numericoid] is object identifier assigned to this object class;
     NAME [qdescrs] are short names (descriptors) identifying this object
         class;
     DESC [qdstring] is a short descriptive string;
     OBSOLETE indicates this object class is not active;
     SUP [oids] specifies the direct superclasses of this object class;
     the kind of object class is indicated by one of ABSTRACT,
         STRUCTURAL, or AUXILIARY, default is STRUCTURAL;
     MUST and MAY specify the sets of required and allowed attribute
         types, respectively; and
    [extensions] describe extensions.
 

Version:
$Rev: 927122 $
Author:
Apache Directory Project
See Also:
RFC2252 Section 4.4, ldapbis [MODELS], DescriptionUtils.getDescription(ObjectClass), Serialized Form

Field Summary
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
ObjectClass(java.lang.String oid)
          Creates a new instance of MatchingRuleUseDescription
 
Method Summary
 void addMayAttributeTypeOids(java.lang.String... oids)
          Add some allowed AttributeType
 void addMayAttributeTypes(AttributeType... attributeTypes)
          Add some allowed AttributeTypes
 void addMustAttributeTypeOids(java.lang.String... oids)
          Add some required AttributeType OIDs
 void addMustAttributeTypes(AttributeType... attributeTypes)
          Add some required AttributeTypes
 void addSuperior(ObjectClass... objectClasses)
          Add some superior ObjectClasses
 void addSuperiorOids(java.lang.String... oids)
          Add some superior ObjectClass OIDs
 void addToRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Inject the ObjectClass into the registries, updating the references to other SchemaObject
 void clear()
          Clear the current SchemaObject : remove all the references to other objects, and all the Maps.
 ObjectClass copy()
          Copy an ObjectClass
 boolean equals(java.lang.Object o)
           
 java.util.List<java.lang.String> getMayAttributeTypeOids()
           
 java.util.List<AttributeType> getMayAttributeTypes()
           
 java.util.List<java.lang.String> getMustAttributeTypeOids()
           
 java.util.List<AttributeType> getMustAttributeTypes()
           
 java.util.List<java.lang.String> getSuperiorOids()
          Gets the superclasses OIDsof this ObjectClass.
 java.util.List<ObjectClass> getSuperiors()
          Gets the superclasses of this ObjectClass.
 ObjectClassTypeEnum getType()
          Gets the type of this ObjectClass as a type safe enum.
 boolean isAbstract()
          Tells if the current ObjectClass is ABSTRACT
 boolean isAuxiliary()
          Tells if the current ObjectClass is AUXILIARY
 boolean isStructural()
          Tells if the current ObjectClass is STRUCTURAL
 void removeFromRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Remove the ObjectClass from the registries, updating the references to other SchemaObject.
 void setMayAttributeTypeOids(java.util.List<java.lang.String> mayAttributeTypeOids)
           
 void setMayAttributeTypes(java.util.List<AttributeType> mayAttributeTypes)
          Sets the list of allowed AttributeTypes
 void setMustAttributeTypeOids(java.util.List<java.lang.String> mustAttributeTypeOids)
           
 void setMustAttributeTypes(java.util.List<AttributeType> mustAttributeTypes)
          Sets the list of required AttributeTypes
 void setSuperiorOids(java.util.List<java.lang.String> superiorOids)
          Sets the superior object class OIDs
 void setSuperiors(java.util.List<ObjectClass> superiors)
          Sets the superior object classes
 void setType(ObjectClassTypeEnum objectClassType)
          Set the ObjectClass type, one of ABSTRACT, AUXILIARY or STRUCTURAL.
 java.lang.String toString()
           
 void updateMayAttributeTypes(java.util.List<AttributeType> mayAttributeTypes)
          Update the associated MAY AttributeType, even if the SchemaObject is readOnly
 void updateMustAttributeTypes(java.util.List<AttributeType> mustAttributeTypes)
          Update the associated MUST AttributeType, even if the SchemaObject is readOnly
 void updateSuperiors(java.util.List<ObjectClass> superiors)
          Update the associated SUPERIORS ObjectClasses, even if the SchemaObject is readOnly
 
Methods inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
addExtension, addName, compareOid, copy, getDescription, getExtensions, getName, getNames, getObjectType, getOid, getSchemaName, getSpecification, hashCode, isDisabled, isEnabled, isObsolete, isReadOnly, lock, registerOid, setDescription, setEnabled, setExtensions, setNames, setNames, setObsolete, setOid, setReadOnly, setRegistries, setSchemaName, setSpecification
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectClass

public ObjectClass(java.lang.String oid)
Creates a new instance of MatchingRuleUseDescription

Parameters:
oid - the OID for this objectClass
Method Detail

addToRegistries

public void addToRegistries(java.util.List<java.lang.Throwable> errors,
                            Registries registries)
                     throws LdapException
Inject the ObjectClass into the registries, updating the references to other SchemaObject

Specified by:
addToRegistries in interface SchemaObject
Overrides:
addToRegistries in class AbstractSchemaObject
Parameters:
errors - The errors we got while adding the ObjectClass to the registries
registries - The Registries
Throws:
java.lang.Exception - on failure
LdapException

removeFromRegistries

public void removeFromRegistries(java.util.List<java.lang.Throwable> errors,
                                 Registries registries)
                          throws LdapException
Remove the ObjectClass from the registries, updating the references to other SchemaObject. If one of the referenced SchemaObject does not exist (SUPERIORS, MAY, MUST), an exception is thrown.

Specified by:
removeFromRegistries in interface SchemaObject
Overrides:
removeFromRegistries in class AbstractSchemaObject
Parameters:
errors - The errors we got while removing the ObjectClass from the registries
registries - The Registries
Throws:
If - the ObjectClass is not valid
LdapException

getMayAttributeTypeOids

public java.util.List<java.lang.String> getMayAttributeTypeOids()
Returns:
the mayAttributeTypeOids

getMayAttributeTypes

public java.util.List<AttributeType> getMayAttributeTypes()
Returns:
the mayAttributeTypes

addMayAttributeTypeOids

public void addMayAttributeTypeOids(java.lang.String... oids)
Add some allowed AttributeType

Parameters:
oids - The attributeType oids

addMayAttributeTypes

public void addMayAttributeTypes(AttributeType... attributeTypes)
Add some allowed AttributeTypes

Parameters:
attributeTypes - The attributeTypes

setMayAttributeTypeOids

public void setMayAttributeTypeOids(java.util.List<java.lang.String> mayAttributeTypeOids)
Parameters:
mayAttributeTypeOids - the mayAttributeTypeOids to set

setMayAttributeTypes

public void setMayAttributeTypes(java.util.List<AttributeType> mayAttributeTypes)
Sets the list of allowed AttributeTypes

Parameters:
mayAttributeTypes - the list of allowed AttributeTypes

updateMayAttributeTypes

public void updateMayAttributeTypes(java.util.List<AttributeType> mayAttributeTypes)
Update the associated MAY AttributeType, even if the SchemaObject is readOnly

Parameters:
mayAttributeTypes - the list of allowed AttributeTypes

getMustAttributeTypeOids

public java.util.List<java.lang.String> getMustAttributeTypeOids()
Returns:
the mustAttributeTypeOids

getMustAttributeTypes

public java.util.List<AttributeType> getMustAttributeTypes()
Returns:
the mustAttributeTypes

addMustAttributeTypeOids

public void addMustAttributeTypeOids(java.lang.String... oids)
Add some required AttributeType OIDs

Parameters:
oid - The attributeType OIDs

addMustAttributeTypes

public void addMustAttributeTypes(AttributeType... attributeTypes)
Add some required AttributeTypes

Parameters:
attributeTypes - The attributeTypse

setMustAttributeTypeOids

public void setMustAttributeTypeOids(java.util.List<java.lang.String> mustAttributeTypeOids)
Parameters:
mustAttributeTypeOids - the mustAttributeTypeOids to set

setMustAttributeTypes

public void setMustAttributeTypes(java.util.List<AttributeType> mustAttributeTypes)
Sets the list of required AttributeTypes

Parameters:
mustAttributeTypes - the list of required AttributeTypes

updateMustAttributeTypes

public void updateMustAttributeTypes(java.util.List<AttributeType> mustAttributeTypes)
Update the associated MUST AttributeType, even if the SchemaObject is readOnly

Parameters:
mayAttributeTypes - the list of allowed AttributeTypes

getSuperiors

public java.util.List<ObjectClass> getSuperiors()
Gets the superclasses of this ObjectClass.

Returns:
the superclasses

getSuperiorOids

public java.util.List<java.lang.String> getSuperiorOids()
Gets the superclasses OIDsof this ObjectClass.

Returns:
the superclasses OIDs

addSuperiorOids

public void addSuperiorOids(java.lang.String... oids)
Add some superior ObjectClass OIDs

Parameters:
oids - The superior ObjectClass OIDs

addSuperior

public void addSuperior(ObjectClass... objectClasses)
Add some superior ObjectClasses

Parameters:
objectClasses - The superior ObjectClasses

setSuperiors

public void setSuperiors(java.util.List<ObjectClass> superiors)
Sets the superior object classes

Parameters:
superiors - the object classes to set

updateSuperiors

public void updateSuperiors(java.util.List<ObjectClass> superiors)
Update the associated SUPERIORS ObjectClasses, even if the SchemaObject is readOnly

Parameters:
superiors - the object classes to set

setSuperiorOids

public void setSuperiorOids(java.util.List<java.lang.String> superiorOids)
Sets the superior object class OIDs

Parameters:
superiorOids - the object class OIDs to set

getType

public ObjectClassTypeEnum getType()
Gets the type of this ObjectClass as a type safe enum.

Returns:
the ObjectClass type as an enum

setType

public void setType(ObjectClassTypeEnum objectClassType)
Set the ObjectClass type, one of ABSTRACT, AUXILIARY or STRUCTURAL.

Parameters:
objectClassType - The ObjectClassType value

isStructural

public boolean isStructural()
Tells if the current ObjectClass is STRUCTURAL

Returns:
true if the ObjectClass is STRUCTURAL

isAbstract

public boolean isAbstract()
Tells if the current ObjectClass is ABSTRACT

Returns:
true if the ObjectClass is ABSTRACT

isAuxiliary

public boolean isAuxiliary()
Tells if the current ObjectClass is AUXILIARY

Returns:
true if the ObjectClass is AUXILIARY

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

copy

public ObjectClass copy()
Copy an ObjectClass

Specified by:
copy in interface SchemaObject
Specified by:
copy in class AbstractSchemaObject
Returns:
The copied SchemaObject

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface SchemaObject
Overrides:
equals in class AbstractSchemaObject
See Also:
Object.equals(Object)

clear

public void clear()
Clear the current SchemaObject : remove all the references to other objects, and all the Maps.

Specified by:
clear in interface SchemaObject
Overrides:
clear in class AbstractSchemaObject


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.