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

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

public class MatchingRule
extends AbstractSchemaObject

A matchingRule definition. MatchingRules associate a comparator and a normalizer, forming the basic tools necessary to assert actions against attribute values. MatchingRules are associated with a specific Syntax for the purpose of resolving a normalized form and for comparisons.

According to ldapbis [MODELS]:

  4.1.3. Matching Rules
  
    Matching rules are used by servers to compare attribute values against
    assertion values when performing Search and Compare operations.  They
    are also used to identify the value to be added or deleted when
    modifying entries, and are used when comparing a purported
    distinguished name with the name of an entry.
  
    A matching rule specifies the syntax of the assertion value.
 
    Each matching rule is identified by an object identifier (OID) and,
    optionally, one or more short names (descriptors).
 
    Matching rule definitions are written according to the ABNF:
 
      MatchingRuleDescription = LPAREN WSP
          numericoid                ; object identifier
          [ SP "NAME" SP qdescrs ]  ; short names (descriptors)
          [ SP "DESC" SP qdstring ] ; description
          [ SP "OBSOLETE" ]         ; not active
          SP "SYNTAX" SP numericoid ; assertion syntax
          extensions WSP RPAREN     ; extensions
 
    where:
      [numericoid] is object identifier assigned to this matching rule;
      NAME [qdescrs] are short names (descriptors) identifying this
          matching rule;
      DESC [qdstring] is a short descriptive string;
      OBSOLETE indicates this matching rule is not active;
      SYNTAX identifies the assertion syntax by object identifier; and
      [extensions] describe extensions.
 

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

Field Summary
protected  LdapComparator<? super java.lang.Object> ldapComparator
          The associated Comparator
protected  LdapSyntax ldapSyntax
          The associated LdapSyntax
protected  Normalizer normalizer
          The associated Normalizer
 
Fields inherited from class org.apache.directory.shared.ldap.schema.AbstractSchemaObject
description, extensions, isEnabled, isObsolete, isReadOnly, locked, names, objectType, oid, schemaName, specification
 
Constructor Summary
MatchingRule(java.lang.String oid)
          Creates a new instance of MatchingRule.
 
Method Summary
 void addToRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Inject the MatchingRule 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.
 MatchingRule copy()
          Copy an MatchingRule
 boolean equals(java.lang.Object o)
           
 LdapComparator<? super java.lang.Object> getLdapComparator()
          Gets the LdapComparator enabling the use of this MatchingRule for ORDERING and sorted indexing.
 Normalizer getNormalizer()
          Gets the Normalizer enabling the use of this MatchingRule for EQUALITY matching and indexing.
 LdapSyntax getSyntax()
          Gets the LdapSyntax used by this MatchingRule.
 java.lang.String getSyntaxOid()
          Gets the LdapSyntax OID used by this MatchingRule.
 void removeFromRegistries(java.util.List<java.lang.Throwable> errors, Registries registries)
          Remove the MatchingRule from the registries, updating the references to other SchemaObject.
 void setLdapComparator(LdapComparator<?> ldapComparator)
          Sets the LdapComparator
 void setNormalizer(Normalizer normalizer)
          Sets the Normalizer
 void setSyntax(LdapSyntax ldapSyntax)
          Sets the Syntax
 void setSyntaxOid(java.lang.String oid)
          Sets the Syntax's OID
 java.lang.String toString()
           
 void updateLdapComparator(LdapComparator<?> ldapComparator)
          Update the associated Comparator, even if the SchemaObject is readOnly
 void updateNormalizer(Normalizer normalizer)
          Update the associated Normalizer, even if the SchemaObject is readOnly
 void updateSyntax(LdapSyntax ldapSyntax)
          Update the associated Syntax, 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
 

Field Detail

ldapComparator

protected LdapComparator<? super java.lang.Object> ldapComparator
The associated Comparator


normalizer

protected Normalizer normalizer
The associated Normalizer


ldapSyntax

protected LdapSyntax ldapSyntax
The associated LdapSyntax

Constructor Detail

MatchingRule

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

Parameters:
oid - The MatchingRule OID
registries - The Registries reference
Method Detail

addToRegistries

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

Specified by:
addToRegistries in interface SchemaObject
Overrides:
addToRegistries in class AbstractSchemaObject
Parameters:
registries - The Registries
errors - The errors we got
Throws:
If - the addition failed
LdapException

removeFromRegistries

public void removeFromRegistries(java.util.List<java.lang.Throwable> errors,
                                 Registries registries)
                          throws LdapException
Remove the MatchingRule from the registries, updating the references to other SchemaObject. If one of the referenced SchemaObject does not exist (), 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 MatchingRule is not valid
LdapException

getSyntax

public LdapSyntax getSyntax()
Gets the LdapSyntax used by this MatchingRule.

Returns:
the LdapSyntax of this MatchingRule

getSyntaxOid

public java.lang.String getSyntaxOid()
Gets the LdapSyntax OID used by this MatchingRule.

Returns:
the LdapSyntax of this MatchingRule
Throws:
NamingException - if there is a failure resolving the object

setSyntaxOid

public void setSyntaxOid(java.lang.String oid)
Sets the Syntax's OID

Parameters:
oid - The Syntax's OID

setSyntax

public void setSyntax(LdapSyntax ldapSyntax)
Sets the Syntax

Parameters:
oid - The Syntax

updateSyntax

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

Parameters:
oid - The Syntax

getLdapComparator

public LdapComparator<? super java.lang.Object> getLdapComparator()
Gets the LdapComparator enabling the use of this MatchingRule for ORDERING and sorted indexing.

Returns:
the ordering LdapComparator
Throws:
NamingException - if there is a failure resolving the object

setLdapComparator

public void setLdapComparator(LdapComparator<?> ldapComparator)
Sets the LdapComparator

Parameters:
oid - The LdapComparator

updateLdapComparator

public void updateLdapComparator(LdapComparator<?> ldapComparator)
Update the associated Comparator, even if the SchemaObject is readOnly

Parameters:
oid - The LdapComparator

getNormalizer

public Normalizer getNormalizer()
Gets the Normalizer enabling the use of this MatchingRule for EQUALITY matching and indexing.

Returns:
the associated normalizer
Throws:
NamingException - if there is a failure resolving the object

setNormalizer

public void setNormalizer(Normalizer normalizer)
Sets the Normalizer

Parameters:
oid - The Normalizer

updateNormalizer

public void updateNormalizer(Normalizer normalizer)
Update the associated Normalizer, even if the SchemaObject is readOnly

Parameters:
oid - The Normalizer

toString

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

copy

public MatchingRule copy()
Copy an MatchingRule

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()

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.