Class AbstractSchemaObject
java.lang.Object
org.apache.directory.api.ldap.model.schema.AbstractSchemaObject
- All Implemented Interfaces:
Serializable, SchemaObject
- Direct Known Subclasses:
AttributeType, DitContentRule, DitStructureRule, LdapSyntax, LoadableSchemaObject, MatchingRule, MatchingRuleUse, NameForm, ObjectClass
Most schema objects have some common attributes. This class
contains the minimum set of properties exposed by a SchemaObject.
We have 11 types of SchemaObjects :
This class provides accessors and setters for the following attributes, which are common to all those SchemaObjects :
Some of those attributes are not used by some Schema elements, even if they should have been used. Here is the list :
We have 11 types of SchemaObjects :
- AttributeType
- DitCOntentRule
- DitStructureRule
- LdapComparator (specific to ADS)
- LdapSyntaxe
- MatchingRule
- MatchingRuleUse
- NameForm
- Normalizer (specific to ADS)
- ObjectClass
- SyntaxChecker (specific to ADS)
This class provides accessors and setters for the following attributes, which are common to all those SchemaObjects :
- oid : The numeric OID
- description : The SchemaObject description
- obsolete : Tells if the schema object is obsolete
- extensions : The extensions, a key/Values map
- schemaObjectType : The SchemaObject type (see upper)
- schema : The schema the SchemaObject is associated with (it's an extension). Can be null
- isEnabled : The SchemaObject status (it's related to the schema status)
- isReadOnly : Tells if the SchemaObject can be modified or not
Some of those attributes are not used by some Schema elements, even if they should have been used. Here is the list :
- name : LdapSyntax, Comparator, Normalizer, SyntaxChecker
- numericOid : DitStructureRule
- obsolete : LdapSyntax, Comparator, Normalizer, SyntaxChecker
- Author:
- Apache Directory Project
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringA short description of this SchemaObjectA map containing the list of supported extensionsprotected intThe hashcode for this schemaObjectprotected booleanWhether or not this SchemaObject is enabledprotected booleanWhether or not this SchemaObject is obsoleteprotected booleanA locked to avoid modifications when set to trueThe optional names for this SchemaObjectprotected SchemaObjectTypeThe SchemaObjectTypeprotected StringThe SchemaObject numeric OIDprotected StringThe name of the schema this object is associated withprotected StringThe SchemaObject specification -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractSchemaObject(SchemaObjectType objectType) Constructor used when a generic reusable SchemaObject is assigned an OID after being instantiated.protectedAbstractSchemaObject(SchemaObjectType objectType, String oid) A constructor for a SchemaObject instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(String key, String... values) Add an extension with its valuesvoidaddExtension(String key, List<String> values) Add an extension with its valuesvoidAdd a new name to the list of names for this SchemaObject.voidclear()Clear the current SchemaObject : remove all the references to other objects, and all the Maps.protected booleancompareOid(String oid1, String oid2) Compare two oids, and return true if they are both null or equal.copy(SchemaObject original) Copies the given schema object into this schema object.booleanGets a short description about this SchemaObject.getExtension(String extension) Get back the values associated with a given extension.Get the schemaObjct extensionsgetName()Gets the first name in the set of short names for this SchemaObject if any exists for it.getNames()Gets short names for this SchemaObject if any exists for it, otherwise, returns an empty list.The SchemaObject type : AttributeType DitCOntentRule DitStructureRule LdapComparator (specific to ADS) LdapSyntaxe MatchingRule MatchingRuleUse NameForm Normalizer (specific to ADS) ObjectClass SyntaxChecker (specific to ADS)getOid()Gets usually what is the numeric object identifier assigned to this SchemaObject.Gets the name of the schema this SchemaObject is associated with.Gets the SchemaObject specification.booleanhasExtension(String extension) Check if a given extension is part of the SchemaObject.inthashCode()booleanTells if this SchemaObject is disabled.booleanTells if this SchemaObject is enabled.booleanGets whether or not this SchemaObject has been inactivated.final voidlock()Transform the SchemaObject to an immutable object TODO locked.protected voidrehash()Compute the hashcode, and store it in the 'h' variableprotected voidCompute the hashcode, and store it in the 'h' variablevoidsetDescription(String description) Sets the SchemaObject's descriptionvoidsetEnabled(boolean enabled) Sets the SchemaObject state, either enabled or disabled.voidsetExtensions(Map<String, List<String>> extensions) Add an extensions with their values.voidSets the list of names for this SchemaObject.voidSets the list of names for this SchemaObject.voidsetObsolete(boolean obsolete) Sets the Obsolete flag.voidA special method used when renaming an SchemaObject: we may have to change it's OIDvoidsetSchemaName(String schemaName) Sets the name of the schema this SchemaObject is associated with.voidsetSpecification(String specification) Sets the SchemaObject's specificationvoidunlock()Unlock the Schema Object and make it modifiable again.Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SchemaObject
copy
-
Field Details
-
oid
The SchemaObject numeric OID -
names
-
isEnabled
protected boolean isEnabledWhether or not this SchemaObject is enabled -
isObsolete
protected boolean isObsoleteWhether or not this SchemaObject is obsolete -
description
A short description of this SchemaObject -
specification
The SchemaObject specification -
schemaName
The name of the schema this object is associated with -
objectType
The SchemaObjectType -
extensions
-
locked
protected volatile boolean lockedA locked to avoid modifications when set to true -
h
protected volatile int hThe hashcode for this schemaObject
-
-
Constructor Details
-
AbstractSchemaObject
A constructor for a SchemaObject instance. It must be invoked by the inherited class.- Parameters:
objectType- The SchemaObjectType to createoid- the SchemaObject numeric OID
-
AbstractSchemaObject
Constructor used when a generic reusable SchemaObject is assigned an OID after being instantiated.- Parameters:
objectType- The SchemaObjectType to create
-
-
Method Details
-
getOid
Gets usually what is the numeric object identifier assigned to this SchemaObject. All schema objects except for MatchingRuleUses have an OID assigned specifically to then. A MatchingRuleUse's OID really is the OID of it's MatchingRule and not specific to the MatchingRuleUse. This effects how MatchingRuleUse objects are maintained by the system.- Specified by:
getOidin interfaceSchemaObject- Returns:
- an OID for this SchemaObject or its MatchingRule if this SchemaObject is a MatchingRuleUse object
-
setOid
A special method used when renaming an SchemaObject: we may have to change it's OID- Specified by:
setOidin interfaceSchemaObject- Parameters:
oid- The new OID
-
getNames
Gets short names for this SchemaObject if any exists for it, otherwise, returns an empty list.- Specified by:
getNamesin interfaceSchemaObject- Returns:
- the names for this SchemaObject
-
getName
Gets the first name in the set of short names for this SchemaObject if any exists for it.- Specified by:
getNamein interfaceSchemaObject- Returns:
- the first of the names for this SchemaObject or the oid if one does not exist
-
addName
Add a new name to the list of names for this SchemaObject. The name is lower cased and trimmed.- Specified by:
addNamein interfaceSchemaObject- Parameters:
namesToAdd- The names to add
-
setNames
Sets the list of names for this SchemaObject. The names are lowercased and trimmed.- Specified by:
setNamesin interfaceSchemaObject- Parameters:
names- The list of names. Can be empty
-
setNames
Sets the list of names for this SchemaObject. The names are lowercased and trimmed.- Parameters:
names- The list of names.
-
getDescription
Gets a short description about this SchemaObject.- Specified by:
getDescriptionin interfaceSchemaObject- Returns:
- a short description about this SchemaObject
-
setDescription
Sets the SchemaObject's description- Specified by:
setDescriptionin interfaceSchemaObject- Parameters:
description- The SchemaObject's description
-
getSpecification
Gets the SchemaObject specification.- Specified by:
getSpecificationin interfaceSchemaObject- Returns:
- the SchemaObject specification
-
setSpecification
Sets the SchemaObject's specification- Specified by:
setSpecificationin interfaceSchemaObject- Parameters:
specification- The SchemaObject's specification
-
isEnabled
public boolean isEnabled()Tells if this SchemaObject is enabled.- Specified by:
isEnabledin interfaceSchemaObject- Returns:
- true if the SchemaObject is enabled, or if it depends on an enabled schema
-
isDisabled
public boolean isDisabled()Tells if this SchemaObject is disabled.- Specified by:
isDisabledin interfaceSchemaObject- Returns:
- true if the SchemaObject is disabled
-
setEnabled
public void setEnabled(boolean enabled) Sets the SchemaObject state, either enabled or disabled.- Specified by:
setEnabledin interfaceSchemaObject- Parameters:
enabled- The current SchemaObject state
-
isObsolete
public boolean isObsolete()Gets whether or not this SchemaObject has been inactivated. All SchemaObjects except Syntaxes allow for this parameter within their definition. For Syntaxes this property should always return false in which case it is never included in the description.- Specified by:
isObsoletein interfaceSchemaObject- Returns:
- true if inactive, false if active
-
setObsolete
public void setObsolete(boolean obsolete) Sets the Obsolete flag.- Specified by:
setObsoletein interfaceSchemaObject- Parameters:
obsolete- The Obsolete flag state
-
getExtensions
Get the schemaObjct extensions- Specified by:
getExtensionsin interfaceSchemaObject- Returns:
- The SchemaObject extensions, as a Map of [extension, values]
-
hasExtension
Check if a given extension is part of the SchemaObject. Extensions are case insensitive.- Specified by:
hasExtensionin interfaceSchemaObject- Parameters:
extension- The extension we are looking for.- Returns:
trueif the extension is present.
-
getExtension
Get back the values associated with a given extension.- Specified by:
getExtensionin interfaceSchemaObject- Parameters:
extension- The extension we are looking for.- Returns:
- The list of values associated with the extension
-
addExtension
Add an extension with its values- Specified by:
addExtensionin interfaceSchemaObject- Parameters:
key- The extension keyvalues- The associated values
-
addExtension
Add an extension with its values- Specified by:
addExtensionin interfaceSchemaObject- Parameters:
key- The extension keyvalues- The associated values
-
setExtensions
Add an extensions with their values. (Actually do a copy)- Specified by:
setExtensionsin interfaceSchemaObject- Parameters:
extensions- The extensions map
-
getObjectType
The SchemaObject type :- AttributeType
- DitCOntentRule
- DitStructureRule
- LdapComparator (specific to ADS)
- LdapSyntaxe
- MatchingRule
- MatchingRuleUse
- NameForm
- Normalizer (specific to ADS)
- ObjectClass
- SyntaxChecker (specific to ADS)
- Specified by:
getObjectTypein interfaceSchemaObject- Returns:
- the SchemaObject type
-
getSchemaName
Gets the name of the schema this SchemaObject is associated with.- Specified by:
getSchemaNamein interfaceSchemaObject- Returns:
- the name of the schema associated with this schemaObject
-
setSchemaName
Sets the name of the schema this SchemaObject is associated with.- Specified by:
setSchemaNamein interfaceSchemaObject- Parameters:
schemaName- the new schema name
-
equals
- Specified by:
equalsin interfaceSchemaObject- Overrides:
equalsin classObject
-
compareOid
-
copy
Copies the given schema object into this schema object.- Specified by:
copyin interfaceSchemaObject- Parameters:
original- the original SchemaObject- Returns:
- this
-
clear
public void clear()Clear the current SchemaObject : remove all the references to other objects, and all the Maps.- Specified by:
clearin interfaceSchemaObject
-
lock
public final void lock()Transform the SchemaObject to an immutable object TODO locked.- Specified by:
lockin interfaceSchemaObject
-
unlock
public void unlock()Unlock the Schema Object and make it modifiable again. -
rehash
protected void rehash()Compute the hashcode, and store it in the 'h' variable -
rehashBase
protected void rehashBase()Compute the hashcode, and store it in the 'h' variable -
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSchemaObject- Overrides:
hashCodein classObject
-