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
public abstract class AbstractSchemaObject extends Object implements SchemaObject, Serializable
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 :- 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:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExtension(String key, String... values)
Add an extension with its valuesvoid
addExtension(String key, List<String> values)
Add an extension with its valuesvoid
addName(String... namesToAdd)
Add a new name to the list of names for this SchemaObject.void
clear()
Clear the current SchemaObject : remove all the references to other objects, and all the Maps.SchemaObject
copy(SchemaObject original)
Copies the given schema object into this schema object.boolean
equals(Object o1)
String
getDescription()
Gets a short description about this SchemaObject.List<String>
getExtension(String extension)
Get back the values associated with a given extension.Map<String,List<String>>
getExtensions()
String
getName()
Gets the first name in the set of short names for this SchemaObject if any exists for it.List<String>
getNames()
Gets short names for this SchemaObject if any exists for it, otherwise, returns an empty list.SchemaObjectType
getObjectType()
The SchemaObject type : AttributeType DitCOntentRule DitStructureRule LdapComparator (specific to ADS) LdapSyntaxe MatchingRule MatchingRuleUse NameForm Normalizer (specific to ADS) ObjectClass SyntaxChecker (specific to ADS)String
getOid()
Gets usually what is the numeric object identifier assigned to this SchemaObject.String
getSchemaName()
Gets the name of the schema this SchemaObject is associated with.String
getSpecification()
Gets the SchemaObject specification.boolean
hasExtension(String extension)
Check if a given extension is part of the SchemaObject.int
hashCode()
boolean
isDisabled()
Tells if this SchemaObject is disabled.boolean
isEnabled()
Tells if this SchemaObject is enabled.boolean
isObsolete()
Gets whether or not this SchemaObject has been inactivated.void
lock()
Transform the SchemaObject to an immutable object TODO locked.void
setDescription(String description)
Sets the SchemaObject's descriptionvoid
setEnabled(boolean enabled)
Sets the SchemaObject state, either enabled or disabled.void
setExtensions(Map<String,List<String>> extensions)
Add an extensions with their values.void
setNames(String... names)
Sets the list of names for this SchemaObject.void
setNames(List<String> names)
Sets the list of names for this SchemaObject.void
setObsolete(boolean obsolete)
Sets the Obsolete flag.void
setOid(String oid)
A special method used when renaming an SchemaObject: we may have to change it's OIDvoid
setSchemaName(String schemaName)
Sets the name of the schema this SchemaObject is associated with.void
setSpecification(String specification)
Sets the SchemaObject's specificationvoid
unlock()
Unlock the Schema Object and make it modifiable again.-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.directory.api.ldap.model.schema.SchemaObject
copy
-
-
-
-
Method Detail
-
getOid
public String 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:
getOid
in interfaceSchemaObject
- Returns:
- an OID for this SchemaObject or its MatchingRule if this SchemaObject is a MatchingRuleUse object
-
setOid
public void setOid(String oid)
A special method used when renaming an SchemaObject: we may have to change it's OID- Specified by:
setOid
in interfaceSchemaObject
- Parameters:
oid
- The new OID
-
getNames
public List<String> getNames()
Gets short names for this SchemaObject if any exists for it, otherwise, returns an empty list.- Specified by:
getNames
in interfaceSchemaObject
- Returns:
- the names for this SchemaObject
-
getName
public String getName()
Gets the first name in the set of short names for this SchemaObject if any exists for it.- Specified by:
getName
in interfaceSchemaObject
- Returns:
- the first of the names for this SchemaObject or the oid if one does not exist
-
addName
public void addName(String... namesToAdd)
Add a new name to the list of names for this SchemaObject. The name is lower cased and trimmed.- Specified by:
addName
in interfaceSchemaObject
- Parameters:
namesToAdd
- The names to add
-
setNames
public void setNames(List<String> names)
Sets the list of names for this SchemaObject. The names are lowercased and trimmed.- Specified by:
setNames
in interfaceSchemaObject
- Parameters:
names
- The list of names. Can be empty
-
setNames
public void setNames(String... names)
Sets the list of names for this SchemaObject. The names are lowercased and trimmed.- Parameters:
names
- The list of names.
-
getDescription
public String getDescription()
Gets a short description about this SchemaObject.- Specified by:
getDescription
in interfaceSchemaObject
- Returns:
- a short description about this SchemaObject
-
setDescription
public void setDescription(String description)
Sets the SchemaObject's description- Specified by:
setDescription
in interfaceSchemaObject
- Parameters:
description
- The SchemaObject's description
-
getSpecification
public String getSpecification()
Gets the SchemaObject specification.- Specified by:
getSpecification
in interfaceSchemaObject
- Returns:
- the SchemaObject specification
-
setSpecification
public void setSpecification(String specification)
Sets the SchemaObject's specification- Specified by:
setSpecification
in interfaceSchemaObject
- Parameters:
specification
- The SchemaObject's specification
-
isEnabled
public boolean isEnabled()
Tells if this SchemaObject is enabled.- Specified by:
isEnabled
in 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:
isDisabled
in interfaceSchemaObject
- Returns:
- true if the SchemaObject is disabled
-
setEnabled
public void setEnabled(boolean enabled)
Sets the SchemaObject state, either enabled or disabled.- Specified by:
setEnabled
in 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:
isObsolete
in interfaceSchemaObject
- Returns:
- true if inactive, false if active
-
setObsolete
public void setObsolete(boolean obsolete)
Sets the Obsolete flag.- Specified by:
setObsolete
in interfaceSchemaObject
- Parameters:
obsolete
- The Obsolete flag state
-
getExtensions
public Map<String,List<String>> getExtensions()
- Specified by:
getExtensions
in interfaceSchemaObject
- Returns:
- The SchemaObject extensions, as a Map of [extension, values]
-
hasExtension
public boolean hasExtension(String extension)
Check if a given extension is part of the SchemaObject. Extensions are case insensitive.- Specified by:
hasExtension
in interfaceSchemaObject
- Parameters:
extension
- The extension we are looking for.- Returns:
true
if the extension is present.
-
getExtension
public List<String> getExtension(String extension)
Get back the values associated with a given extension.- Specified by:
getExtension
in interfaceSchemaObject
- Parameters:
extension
- The extension we are looking for.- Returns:
- The list of values associated with the extension
-
addExtension
public void addExtension(String key, String... values)
Add an extension with its values- Specified by:
addExtension
in interfaceSchemaObject
- Parameters:
key
- The extension keyvalues
- The associated values
-
addExtension
public void addExtension(String key, List<String> values)
Add an extension with its values- Specified by:
addExtension
in interfaceSchemaObject
- Parameters:
key
- The extension keyvalues
- The associated values
-
setExtensions
public void setExtensions(Map<String,List<String>> extensions)
Add an extensions with their values. (Actually do a copy)- Specified by:
setExtensions
in interfaceSchemaObject
- Parameters:
extensions
- The extensions map
-
getObjectType
public SchemaObjectType 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:
getObjectType
in interfaceSchemaObject
- Returns:
- the SchemaObject type
-
getSchemaName
public String getSchemaName()
Gets the name of the schema this SchemaObject is associated with.- Specified by:
getSchemaName
in interfaceSchemaObject
- Returns:
- the name of the schema associated with this schemaObject
-
setSchemaName
public void setSchemaName(String schemaName)
Sets the name of the schema this SchemaObject is associated with.- Specified by:
setSchemaName
in interfaceSchemaObject
- Parameters:
schemaName
- the new schema name
-
equals
public boolean equals(Object o1)
- Specified by:
equals
in interfaceSchemaObject
- Overrides:
equals
in classObject
-
copy
public SchemaObject copy(SchemaObject original)
Copies the given schema object into this schema object.- Specified by:
copy
in 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:
clear
in interfaceSchemaObject
-
lock
public final void lock()
Transform the SchemaObject to an immutable object TODO locked.- Specified by:
lock
in interfaceSchemaObject
-
unlock
public void unlock()
Unlock the Schema Object and make it modifiable again.
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceSchemaObject
- Overrides:
hashCode
in classObject
-
-