Class 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 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 interface SchemaObject
        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 interface SchemaObject
        Parameters:
        oid - The new OID
      • getNames

        public List<StringgetNames()
        Gets short names for this SchemaObject if any exists for it, otherwise, returns an empty list.
        Specified by:
        getNames in interface SchemaObject
        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 interface SchemaObject
        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 interface SchemaObject
        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 interface SchemaObject
        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.
      • isEnabled

        public boolean isEnabled()
        Tells if this SchemaObject is enabled.
        Specified by:
        isEnabled in interface SchemaObject
        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 interface SchemaObject
        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 interface SchemaObject
        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 interface SchemaObject
        Returns:
        true if inactive, false if active
      • setObsolete

        public void setObsolete​(boolean obsolete)
        Sets the Obsolete flag.
        Specified by:
        setObsolete in interface SchemaObject
        Parameters:
        obsolete - The Obsolete flag state
      • hasExtension

        public boolean hasExtension​(String extension)
        Check if a given extension is part of the SchemaObject. Extensions are case insensitive.
        Specified by:
        hasExtension in interface SchemaObject
        Parameters:
        extension - The extension we are looking for.
        Returns:
        true if the extension is present.
      • getExtension

        public List<StringgetExtension​(String extension)
        Get back the values associated with a given extension.
        Specified by:
        getExtension in interface SchemaObject
        Parameters:
        extension - The extension we are looking for.
        Returns:
        The list of values associated with the extension
      • 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 interface SchemaObject
        Returns:
        the SchemaObject type
      • getSchemaName

        public String getSchemaName()
        Gets the name of the schema this SchemaObject is associated with.
        Specified by:
        getSchemaName in interface SchemaObject
        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 interface SchemaObject
        Parameters:
        schemaName - the new schema name
      • copy

        public SchemaObject copy​(SchemaObject original)
        Copies the given schema object into this schema object.
        Specified by:
        copy in interface SchemaObject
        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 interface SchemaObject
      • lock

        public final void lock()
        Transform the SchemaObject to an immutable object TODO locked.
        Specified by:
        lock in interface SchemaObject
      • unlock

        public void unlock()
        Unlock the Schema Object and make it modifiable again.