org.opends.server.schema
Class IntegerFirstComponentEqualityMatchingRule

java.lang.Object
  extended by org.opends.server.api.MatchingRule<EqualityMatchingRuleCfg>
      extended by org.opends.server.api.EqualityMatchingRule
          extended by org.opends.server.schema.IntegerFirstComponentEqualityMatchingRule

public class IntegerFirstComponentEqualityMatchingRule
extends EqualityMatchingRule

This class implements the integerFirstComponentMatch matching rule defined in X.520 and referenced in RFC 2252. This rule is intended for use with attributes whose values contain a set of parentheses enclosing a space-delimited set of names and/or name-value pairs (like attribute type or objectclass descriptions) in which the "first component" is the first item after the opening parenthesis.


Constructor Summary
IntegerFirstComponentEqualityMatchingRule()
          Creates a new instance of this integerFirstComponentMatch matching rule.
 
Method Summary
 boolean areEqual(ByteString value1, ByteString value2)
          Indicates whether the two provided normalized values are equal to each other.
 int generateHashCode(AttributeValue attributeValue)
          Generates a hash code for the provided attribute value.
 java.lang.String getDescription()
          Retrieves the description for this matching rule.
 java.lang.String getName()
          Retrieves the common name for this matching rule.
 java.lang.String getOID()
          Retrieves the OID for this matching rule.
 java.lang.String getSyntaxOID()
          Retrieves the OID of the syntax with which this matching rule is associated.
 void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
          Initializes this matching rule based on the information in the provided configuration entry.
 ByteString normalizeValue(ByteString value)
          Retrieves the normalized form of the provided value, which is best suited for efficiently performing matching operations on that value.
 
Methods inherited from class org.opends.server.api.EqualityMatchingRule
valuesMatch
 
Methods inherited from class org.opends.server.api.MatchingRule
equals, finalizeMatchingRule, getNameOrOID, hashCode, isConfigurationAcceptable, isObsolete, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerFirstComponentEqualityMatchingRule

public IntegerFirstComponentEqualityMatchingRule()
Creates a new instance of this integerFirstComponentMatch matching rule.

Method Detail

initializeMatchingRule

public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
                            throws ConfigException,
                                   InitializationException
Initializes this matching rule based on the information in the provided configuration entry.

Specified by:
initializeMatchingRule in class MatchingRule<EqualityMatchingRuleCfg>
Parameters:
configuration - The configuration to use to intialize this matching rule.
Throws:
ConfigException - If an unrecoverable problem arises in the process of performing the initialization.
InitializationException - If a problem that is not configuration-related occurs during initialization.

getName

public java.lang.String getName()
Retrieves the common name for this matching rule.

Specified by:
getName in class MatchingRule<EqualityMatchingRuleCfg>
Returns:
The common name for this matching rule, or null if it does not have a name.

getOID

public java.lang.String getOID()
Retrieves the OID for this matching rule.

Specified by:
getOID in class MatchingRule<EqualityMatchingRuleCfg>
Returns:
The OID for this matching rule.

getDescription

public java.lang.String getDescription()
Retrieves the description for this matching rule.

Specified by:
getDescription in class MatchingRule<EqualityMatchingRuleCfg>
Returns:
The description for this matching rule, or null if there is none.

getSyntaxOID

public java.lang.String getSyntaxOID()
Retrieves the OID of the syntax with which this matching rule is associated.

Specified by:
getSyntaxOID in class MatchingRule<EqualityMatchingRuleCfg>
Returns:
The OID of the syntax with which this matching rule is associated.

normalizeValue

public ByteString normalizeValue(ByteString value)
                          throws DirectoryException
Retrieves the normalized form of the provided value, which is best suited for efficiently performing matching operations on that value.

Specified by:
normalizeValue in class MatchingRule<EqualityMatchingRuleCfg>
Parameters:
value - The value to be normalized.
Returns:
The normalized version of the provided value.
Throws:
DirectoryException - If the provided value is invalid according to the associated attribute syntax.

areEqual

public boolean areEqual(ByteString value1,
                        ByteString value2)
Indicates whether the two provided normalized values are equal to each other.

Specified by:
areEqual in class EqualityMatchingRule
Parameters:
value1 - The normalized form of the first value to compare.
value2 - The normalized form of the second value to compare.
Returns:
true if the provided values are equal, or false if not.

generateHashCode

public int generateHashCode(AttributeValue attributeValue)
Generates a hash code for the provided attribute value. This version of the method will simply create a hash code from the normalized form of the attribute value. For matching rules explicitly designed to work in cases where byte-for-byte comparisons of normalized values is not sufficient for determining equality (e.g., if the associated attribute syntax is based on hashed or encrypted values), then this method must be overridden to provide an appropriate implementation for that case.

Overrides:
generateHashCode in class EqualityMatchingRule
Parameters:
attributeValue - The attribute value for which to generate the hash code.
Returns:
The hash code generated for the provided attribute value.