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

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

public class AttributeType
extends AbstractSchemaObject
implements java.lang.Cloneable

An attributeType specification. attributeType specifications describe the nature of attributes within the directory. The attributeType specification's properties are accessible through this interface.

According to ldapbis [MODELS]:

  4.1.2. Attribute Types
  
    Attribute Type definitions are written according to the ABNF:
  
      AttributeTypeDescription = LPAREN WSP
          numericoid                   ; object identifier
          [ SP "NAME" SP qdescrs ]     ; short names (descriptors)
          [ SP "DESC" SP qdstring ]    ; description
          [ SP "OBSOLETE" ]            ; not active
          [ SP "SUP" SP oid ]          ; supertype
          [ SP "EQUALITY" SP oid ]     ; equality matching rule
          [ SP "ORDERING" SP oid ]     ; ordering matching rule
          [ SP "SUBSTR" SP oid ]       ; substrings matching rule
          [ SP "SYNTAX" SP noidlen ]   ; value syntax
          [ SP "SINGLE-VALUE" ]        ; single-value
          [ SP "COLLECTIVE" ]          ; collective
          [ SP "NO-USER-MODIFICATION" ]; not user modifiable
          [ SP "USAGE" SP usage ]      ; usage
          extensions WSP RPAREN        ; extensions
  
      usage = "userApplications"     / ; user
              "directoryOperation"   / ; directory operational
              "distributedOperation" / ; DSA-shared operational
              "dSAOperation"           ; DSA-specific operational
  
    where:
      [numericoid] is object identifier assigned to this attribute type;
      NAME [qdescrs] are short names (descriptors) identifying this
          attribute type;
      DESC [qdstring] is a short descriptive string;
      OBSOLETE indicates this attribute type is not active;
      SUP oid specifies the direct supertype of this type;
      EQUALITY, ORDERING, SUBSTRING provide the oid of the equality,
          ordering, and substrings matching rules, respectively;
      SYNTAX identifies value syntax by object identifier and may suggest
          a minimum upper bound;
      COLLECTIVE indicates this attribute type is collective [X.501];
      NO-USER-MODIFICATION indicates this attribute type is not user
          modifiable;
      USAGE indicates the application of this attribute type; and
      [extensions] describe extensions.
  
    Each attribute type description must contain at least one of the SUP
    or SYNTAX fields.
  
    Usage of userApplications, the default, indicates that attributes of
    this type represent user information.  That is, they are user
    attributes.
  
    COLLECTIVE requires usage userApplications.  Use of collective
    attribute types in LDAP is not discussed in this technical
    specification.
  
    A usage of directoryOperation, distributedOperation, or dSAOperation
    indicates that attributes of this type represent operational and/or
    administrative information.  That is, they are operational attributes.
  
    directoryOperation usage indicates that the attribute of this type is
    a directory operational attribute.  distributedOperation usage
    indicates that the attribute of this DSA-shared usage operational
    attribute.  dSAOperation usage indicates that the attribute of this
    type is a DSA-specific operational attribute.
  
    NO-USER-MODIFICATION requires an operational usage.
  
    Note that the [AttributeTypeDescription] does not list the matching
    rules which can be used with that attribute type in an extensibleMatch
    search filter.  This is done using the 'matchingRuleUse' attribute
    described in Section 4.1.4.
  
    This document refines the schema description of X.501 by requiring
    that the SYNTAX field in an [AttributeTypeDescription] be a string
    representation of an object identifier for the LDAP string syntax
    definition with an optional indication of the suggested minimum bound
    of a value of this attribute.
  
    A suggested minimum upper bound on the number of characters in a value
    with a string-based syntax, or the number of bytes in a value for all
    other syntaxes, may be indicated by appending this bound count inside
    of curly braces following the syntax's OBJECT IDENTIFIER in an
  
    Attribute Type Description.  This bound is not part of the syntax name
    itself.  For instance, "1.3.6.4.1.1466.0{64}" suggests that server
    implementations should allow a string to be 64 characters long,
    although they may allow longer strings.  Note that a single character
    of the Directory String syntax may be encoded in more than one octet
    since UTF-8 is a variable-length encoding.
 

Version:
$Rev: 927122 $
Author:
Apache Directory Project
See Also:
RFC 2252 Section 4.2, ldapbis [MODELS], DescriptionUtils.getDescription(AttributeType), Serialized Form

Field Summary
static long serialVersionUID
          The serialVersionUID
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
AttributeType(java.lang.String oid)
          Creates a AttributeType object using a unique OID.
 
Method Summary
 void addToRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Inject the attributeType 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.
 AttributeType copy()
          Copy an AttributeType
 boolean equals(java.lang.Object o)
           
 MatchingRule getEquality()
          Gets the MatchingRule for this AttributeType used for equality matching.
 java.lang.String getEqualityName()
          Gets the Equality Name for this AttributeType's values.
 java.lang.String getEqualityOid()
          Gets the Equality OID for this AttributeType's values.
 MatchingRule getOrdering()
          Gets the MatchingRule for this AttributeType used for Ordering matching.
 java.lang.String getOrderingName()
          Gets the MatchingRule name for this AttributeType used for Ordering matching.
 java.lang.String getOrderingOid()
          Gets the Ordering OID for this AttributeType's values.
 MatchingRule getSubstring()
          Gets the MatchingRule for this AttributeType used for Substr matching.
 java.lang.String getSubstringName()
          Gets the MatchingRule name for this AttributeType used for Substring matching.
 java.lang.String getSubstringOid()
          Gets the Substr OID for this AttributeType's values.
 AttributeType getSuperior()
          Gets the the superior AttributeType of this AttributeType.
 java.lang.String getSuperiorName()
          Gets the Name of the superior AttributeType for this AttributeType.
 java.lang.String getSuperiorOid()
          Gets the OID of the superior AttributeType for this AttributeType.
 LdapSyntax getSyntax()
          Gets the Syntax for this AttributeType's values.
 int getSyntaxLength()
          Gets a length limit for this AttributeType.
 java.lang.String getSyntaxName()
          Gets the Syntax name for this AttributeType's values.
 java.lang.String getSyntaxOid()
          Gets the Syntax OID for this AttributeType's values.
 UsageEnum getUsage()
          Determines the usage for this AttributeType.
 boolean isAncestorOf(AttributeType descendant)
          Checks to see if this AttributeType is the ancestor of another attributeType.
 boolean isCollective()
          Gets whether or not this AttributeType is a collective attribute.
 boolean isDescendantOf(AttributeType ancestor)
          Checks to see if this AttributeType is the descendant of another attributeType.
 boolean isSingleValued()
          Gets whether or not this AttributeType is single-valued.
 boolean isUserModifiable()
          Gets whether or not this AttributeType can be modified by a user.
 void removeFromRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Remove the attributeType from the registries, updating the references to other SchemaObject.
 void setCollective(boolean collective)
          Sets the collective flag
 void setEquality(MatchingRule equality)
          Sets the Equality MR for this AttributeType
 void setEqualityOid(java.lang.String equalityOid)
          Sets the Equality OID for this AttributeType
 void setOrdering(MatchingRule ordering)
          Sets the Ordering MR for this AttributeType
 void setOrderingOid(java.lang.String orderingOid)
          Sets the Ordering OID for this AttributeType
 void setSingleValued(boolean singleValued)
          Tells if this AttributeType is Single Valued or not
 void setSubstring(MatchingRule substring)
          Sets the Substr MR for this AttributeType
 void setSubstringOid(java.lang.String substrOid)
          Sets the Substr OID for this AttributeType
 void setSuperior(AttributeType superior)
          Sets the superior for this AttributeType
 void setSuperior(java.lang.String superiorOid)
          Sets the superior oid for this AttributeType
 void setSuperiorOid(java.lang.String superiorOid)
          Sets the superior AttributeType OID of this AttributeType
 void setSyntax(LdapSyntax syntax)
          Sets the Syntax for this AttributeType
 void setSyntaxLength(int length)
          Sets the length limit of this AttributeType based on its associated syntax.
 void setSyntaxOid(java.lang.String syntaxOid)
          Sets the Syntax OID for this AttributeType
 void setUsage(UsageEnum usage)
          Sets the AttributeType usage, one of :
USER_APPLICATIONS DIRECTORY_OPERATION DISTRIBUTED_OPERATION DSA_OPERATION
 void setUserModifiable(boolean canUserModify)
          Tells if this AttributeType can be modified by a user or not
 java.lang.String toString()
           
 void updateCollective(boolean collective)
          Updates the collective flag
 void updateEquality(MatchingRule equality)
          Update the associated Equality MatchingRule, even if the SchemaObject is readOnly
 void updateOrdering(MatchingRule ordering)
          Update the associated Ordering MatchingRule, even if the SchemaObject is readOnly
 void updateSubstring(MatchingRule substring)
          Update the associated Substring MatchingRule, even if the SchemaObject is readOnly
 void updateSuperior(AttributeType superior)
          Update the associated Superior AttributeType, even if the SchemaObject is readOnly
 void updateSyntax(LdapSyntax syntax)
          Update the associated Syntax, even if the SchemaObject is readOnly
 void updateUsage(UsageEnum usage)
          Updates the AttributeType usage, one of :
USER_APPLICATIONS DIRECTORY_OPERATION DISTRIBUTED_OPERATION DSA_OPERATION
 
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
 

Field Detail

serialVersionUID

public static final long serialVersionUID
The serialVersionUID

See Also:
Constant Field Values
Constructor Detail

AttributeType

public AttributeType(java.lang.String oid)
Creates a AttributeType object using a unique OID.

Parameters:
oid - the OID for this AttributeType
Method Detail

addToRegistries

public void addToRegistries(java.util.List<java.lang.Throwable> errors,
                            Registries registries)
                     throws LdapException
Inject the attributeType into the registries, updating the references to other SchemaObject. If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX), an exception is thrown.

Specified by:
addToRegistries in interface SchemaObject
Overrides:
addToRegistries in class AbstractSchemaObject
Parameters:
registries - The Registries
errors - The errors we got
Throws:
If - the AttributeType is not valid
LdapException

removeFromRegistries

public void removeFromRegistries(java.util.List<java.lang.Throwable> errors,
                                 Registries registries)
                          throws LdapException
Remove the attributeType from the registries, updating the references to other SchemaObject. If one of the referenced SchemaObject does not exist (SUP, EQUALITY, ORDERING, SUBSTR, SYNTAX), an exception is thrown.

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

isSingleValued

public boolean isSingleValued()
Gets whether or not this AttributeType is single-valued.

Returns:
true if only one value can exist for this AttributeType, false otherwise

setSingleValued

public void setSingleValued(boolean singleValued)
Tells if this AttributeType is Single Valued or not

Parameters:
singleValue - True if the AttributeType is single-valued

isUserModifiable

public boolean isUserModifiable()
Gets whether or not this AttributeType can be modified by a user.

Returns:
true if users can modify it, false if only the directory can.

setUserModifiable

public void setUserModifiable(boolean canUserModify)
Tells if this AttributeType can be modified by a user or not

Parameters:
canUserModify - The flag to set

isCollective

public boolean isCollective()
Gets whether or not this AttributeType is a collective attribute.

Returns:
true if the attribute is collective, false otherwise

updateCollective

public void updateCollective(boolean collective)
Updates the collective flag

Parameters:
collective - The new value to set

setCollective

public void setCollective(boolean collective)
Sets the collective flag

Parameters:
collective - The new value to set

getUsage

public UsageEnum getUsage()
Determines the usage for this AttributeType.

Returns:
a type safe UsageEnum

setUsage

public void setUsage(UsageEnum usage)
Sets the AttributeType usage, one of :
  • USER_APPLICATIONS
  • DIRECTORY_OPERATION
  • DISTRIBUTED_OPERATION
  • DSA_OPERATION

    Parameters:
    usage - The AttributeType usage
    See Also:
    UsageEnum

  • updateUsage

    public void updateUsage(UsageEnum usage)
    Updates the AttributeType usage, one of :
  • USER_APPLICATIONS
  • DIRECTORY_OPERATION
  • DISTRIBUTED_OPERATION
  • DSA_OPERATION

    Parameters:
    usage - The AttributeType usage
    See Also:
    UsageEnum

  • getSyntaxLength

    public int getSyntaxLength()
    Gets a length limit for this AttributeType.

    Returns:
    the length of the attribute

    setSyntaxLength

    public void setSyntaxLength(int length)
    Sets the length limit of this AttributeType based on its associated syntax.

    Parameters:
    length - the new length to set

    getSuperior

    public AttributeType getSuperior()
    Gets the the superior AttributeType of this AttributeType.

    Returns:
    the superior AttributeType for this AttributeType

    getSuperiorOid

    public java.lang.String getSuperiorOid()
    Gets the OID of the superior AttributeType for this AttributeType.

    Returns:
    The OID of the superior AttributeType for this AttributeType.

    getSuperiorName

    public java.lang.String getSuperiorName()
    Gets the Name of the superior AttributeType for this AttributeType.

    Returns:
    The Name of the superior AttributeType for this AttributeType.

    setSuperiorOid

    public void setSuperiorOid(java.lang.String superiorOid)
    Sets the superior AttributeType OID of this AttributeType

    Parameters:
    superiorOid - The superior AttributeType OID of this AttributeType

    setSuperior

    public void setSuperior(AttributeType superior)
    Sets the superior for this AttributeType

    Parameters:
    superior - The superior for this AttributeType

    setSuperior

    public void setSuperior(java.lang.String superiorOid)
    Sets the superior oid for this AttributeType

    Parameters:
    superior - The superior oid for this AttributeType

    updateSuperior

    public void updateSuperior(AttributeType superior)
    Update the associated Superior AttributeType, even if the SchemaObject is readOnly

    Parameters:
    superior - The superior for this AttributeType

    getSyntax

    public LdapSyntax getSyntax()
    Gets the Syntax for this AttributeType's values.

    Returns:
    the value syntax

    getSyntaxName

    public java.lang.String getSyntaxName()
    Gets the Syntax name for this AttributeType's values.

    Returns:
    the value syntax name

    getSyntaxOid

    public java.lang.String getSyntaxOid()
    Gets the Syntax OID for this AttributeType's values.

    Returns:
    the value syntax's OID

    setSyntaxOid

    public void setSyntaxOid(java.lang.String syntaxOid)
    Sets the Syntax OID for this AttributeType

    Parameters:
    superiorOid - The syntax OID for this AttributeType

    setSyntax

    public void setSyntax(LdapSyntax syntax)
    Sets the Syntax for this AttributeType

    Parameters:
    syntax - The Syntax for this AttributeType

    updateSyntax

    public void updateSyntax(LdapSyntax syntax)
    Update the associated Syntax, even if the SchemaObject is readOnly

    Parameters:
    syntax - The Syntax for this AttributeType

    getEquality

    public MatchingRule getEquality()
    Gets the MatchingRule for this AttributeType used for equality matching.

    Returns:
    the equality matching rule

    getEqualityOid

    public java.lang.String getEqualityOid()
    Gets the Equality OID for this AttributeType's values.

    Returns:
    the value Equality's OID

    getEqualityName

    public java.lang.String getEqualityName()
    Gets the Equality Name for this AttributeType's values.

    Returns:
    the value Equality's Name

    setEqualityOid

    public void setEqualityOid(java.lang.String equalityOid)
    Sets the Equality OID for this AttributeType

    Parameters:
    equalityOid - The Equality OID for this AttributeType

    setEquality

    public void setEquality(MatchingRule equality)
    Sets the Equality MR for this AttributeType

    Parameters:
    equality - The Equality MR for this AttributeType

    updateEquality

    public void updateEquality(MatchingRule equality)
    Update the associated Equality MatchingRule, even if the SchemaObject is readOnly

    Parameters:
    equality - The Equality MR for this AttributeType

    getOrdering

    public MatchingRule getOrdering()
    Gets the MatchingRule for this AttributeType used for Ordering matching.

    Returns:
    the Ordering matching rule

    getOrderingName

    public java.lang.String getOrderingName()
    Gets the MatchingRule name for this AttributeType used for Ordering matching.

    Returns:
    the Ordering matching rule name

    getOrderingOid

    public java.lang.String getOrderingOid()
    Gets the Ordering OID for this AttributeType's values.

    Returns:
    the value Equality's OID

    setOrderingOid

    public void setOrderingOid(java.lang.String orderingOid)
    Sets the Ordering OID for this AttributeType

    Parameters:
    orderingOid - The Ordering OID for this AttributeType

    setOrdering

    public void setOrdering(MatchingRule ordering)
    Sets the Ordering MR for this AttributeType

    Parameters:
    ordering - The Ordering MR for this AttributeType

    updateOrdering

    public void updateOrdering(MatchingRule ordering)
    Update the associated Ordering MatchingRule, even if the SchemaObject is readOnly

    Parameters:
    ordering - The Ordering MR for this AttributeType

    getSubstring

    public MatchingRule getSubstring()
    Gets the MatchingRule for this AttributeType used for Substr matching.

    Returns:
    the Substr matching rule

    getSubstringName

    public java.lang.String getSubstringName()
    Gets the MatchingRule name for this AttributeType used for Substring matching.

    Returns:
    the Substring matching rule name

    getSubstringOid

    public java.lang.String getSubstringOid()
    Gets the Substr OID for this AttributeType's values.

    Returns:
    the value Substr's OID

    setSubstringOid

    public void setSubstringOid(java.lang.String substrOid)
    Sets the Substr OID for this AttributeType

    Parameters:
    substrOid - The Substr OID for this AttributeType

    setSubstring

    public void setSubstring(MatchingRule substring)
    Sets the Substr MR for this AttributeType

    Parameters:
    substring - The Substr MR for this AttributeType

    updateSubstring

    public void updateSubstring(MatchingRule substring)
    Update the associated Substring MatchingRule, even if the SchemaObject is readOnly

    Parameters:
    substring - The Substr MR for this AttributeType

    isAncestorOf

    public boolean isAncestorOf(AttributeType descendant)
    Checks to see if this AttributeType is the ancestor of another attributeType.

    Parameters:
    descendant - the perspective descendant to check
    Returns:
    true if the descendant is truly a derived from this AttributeType

    isDescendantOf

    public boolean isDescendantOf(AttributeType ancestor)
    Checks to see if this AttributeType is the descendant of another attributeType.

    Parameters:
    ancestor - the perspective ancestor to check
    Returns:
    true if this AttributeType truly descends from the ancestor

    toString

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

    copy

    public AttributeType copy()
    Copy an AttributeType

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

    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

    equals

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


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