From 5203374a1e5dc294088749071cf5350d2f82787d Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Thu, 20 Mar 2014 10:06:11 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1308 Migrate schema support Code Review : CR-3230

---
 opendj3-server-dev/src/server/org/opends/server/api/AttributeSyntax.java                                                  |    2 
 opendj3-server-dev/src/server/org/opends/server/schema/FaxSyntax.java                                                     |    5 
 opendj3-server-dev/src/server/org/opends/server/controls/ServerSideSortRequestControl.java                                |    6 
 opendj3-server-dev/src/server/org/opends/server/schema/GuideSyntax.java                                                   |    5 
 opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java                                                |    3 
 opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVIndex.java                                                |   13 
 opendj3-server-dev/src/server/org/opends/server/schema/PresentationAddressSyntax.java                                     |    5 
 opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java                                             |   55 ++++
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java |   19 +
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestAttributeType.java                      |    6 
 opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java                             |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/NameFormSyntax.java                                                |    5 
 opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java                                                  |    7 
 opendj3-server-dev/src/server/org/opends/server/schema/CertificateSyntax.java                                             |    5 
 opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java                                                     |   42 +++
 opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordSyntax.java                                            |    3 
 opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java                                |    4 
 opendj3-server-dev/src/server/org/opends/server/schema/CertificateExactAssertionSyntax.java                               |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/NumericStringSyntax.java                                           |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/DistinguishedNameSyntax.java                                       |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/UUIDSyntax.java                                                    |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/PostalAddressSyntax.java                                           |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java                               |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/AciSyntax.java                                                     |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/OctetStringSyntax.java                                             |    5 
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java                                 |   12 
 opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java                                         |   30 +-
 opendj3-server-dev/src/server/org/opends/server/schema/DITStructureRuleSyntax.java                                        |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/UTCTimeSyntax.java                                                 |    5 
 opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java              |   52 +++-
 opendj3-server-dev/src/server/org/opends/server/types/RDN.java                                                            |   17 
 opendj3-server-dev/src/server/org/opends/server/schema/OtherMailboxSyntax.java                                            |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/PrintableStringSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/ProtocolInformationSyntax.java                                     |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/CertificateListSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java                                         |   97 +++----
 opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java                                          |    4 
 opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java                                  |   51 +++
 opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java                                    |    5 
 opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java                                       |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/IA5StringSyntax.java                                               |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/DITContentRuleSyntax.java                                          |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java                                      |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/EnhancedGuideSyntax.java                                           |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/OIDSyntax.java                                                     |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordSyntax.java                                            |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/BitStringSyntax.java                                               |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/DirectoryStringSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/BooleanSyntax.java                                                 |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/JPEGSyntax.java                                                    |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleSyntax.java                                            |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/TelexNumberSyntax.java                                             |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java                                   |   14 
 opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java                                               |   35 -
 opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSyntax.java                                         |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/ObjectClassSyntax.java                                             |    5 
 opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java                                                 |    9 
 opendj3-server-dev/src/server/org/opends/server/schema/AttributeTypeSyntax.java                                           |   11 
 opendj3-server-dev/src/server/org/opends/server/backends/jeb/OrderingIndexer.java                                         |    4 
 opendj3-server-dev/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java                                      |    3 
 opendj3-server-dev/src/server/org/opends/server/schema/BinarySyntax.java                                                  |    4 
 opendj3-server-dev/src/server/org/opends/server/schema/CountryStringSyntax.java                                           |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/SubstringAssertionSyntax.java                                      |    5 
 opendj3-server-dev/src/server/org/opends/server/types/SortKey.java                                                        |   17 
 opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVKeyComparator.java                                        |   30 -
 opendj3-server-dev/src/server/org/opends/server/schema/IntegerSyntax.java                                                 |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/CertificatePairSyntax.java                                         |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/FaxNumberSyntax.java                                               |    5 
 opendj3-server-dev/src/server/org/opends/server/schema/DeliveryMethodSyntax.java                                          |    5 
 71 files changed, 416 insertions(+), 336 deletions(-)

diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
index 1555a50..9b11452 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
@@ -87,7 +87,6 @@
 import org.forgerock.i18n.LocalizableMessageBuilder;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.types.AttributeType;
 import org.forgerock.opendj.ldap.schema.AttributeUsage;
@@ -1215,7 +1214,7 @@
     }
   }
 
-  private OrderingMatchingRule getOrderingMatchingRule()
+  private MatchingRule getOrderingMatchingRule()
   {
     if (ordering.getSelectedIndex() == 0)
     {
@@ -1223,7 +1222,7 @@
     }
     else
     {
-      return (OrderingMatchingRule)ordering.getSelectedItem();
+      return (MatchingRule)ordering.getSelectedItem();
     }
   }
 
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
index 6b21f9a..4ae5f67 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/NewAttributePanel.java
@@ -813,7 +813,7 @@
     }
   }
 
-  private OrderingMatchingRule getOrderingMatchingRule()
+  private MatchingRule getOrderingMatchingRule()
   {
     if (ordering.getSelectedIndex() == 0)
     {
@@ -821,7 +821,7 @@
     }
     else
     {
-      return (OrderingMatchingRule)ordering.getSelectedItem();
+      return (MatchingRule)ordering.getSelectedItem();
     }
   }
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
index 65ab9fd..5a1605d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/AbstractMatchingRule.java
@@ -27,6 +27,7 @@
 package org.opends.server.api;
 
 import java.util.Collection;
+import java.util.Comparator;
 
 import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteSequence;
@@ -35,6 +36,7 @@
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.schema.Syntax;
+import org.forgerock.opendj.ldap.spi.IndexQueryFactory;
 
 /**
  * This class provides default implementation of MatchingRule. A
@@ -49,6 +51,24 @@
 public abstract class AbstractMatchingRule implements MatchingRule
 {
 
+  private static final Assertion UNDEFINED_ASSERTION = new Assertion()
+  {
+    @Override
+    public ConditionResult matches(final ByteSequence normalizedAttributeValue)
+    {
+      return ConditionResult.UNDEFINED;
+    }
+
+    @Override
+    public <T> T createIndexQuery(IndexQueryFactory<T> factory)
+        throws DecodeException
+    {
+      // Subclassing this class will always work, albeit inefficiently.
+      // This is better than throwing an exception for no good reason.
+      return factory.createMatchAllQuery();
+    }
+  };
+
   /**
    * {@inheritDoc}
    */
@@ -110,6 +130,24 @@
 
   /** {@inheritDoc} */
   @Override
+  public Assertion getGreaterOrEqualAssertion(ByteSequence value)
+      throws DecodeException
+  {
+    return UNDEFINED_ASSERTION;
+  }
+
+
+
+  /** {@inheritDoc} */
+  @Override
+  public Assertion getLessOrEqualAssertion(ByteSequence value)
+      throws DecodeException
+  {
+    return UNDEFINED_ASSERTION;
+  }
+
+  /** {@inheritDoc} */
+  @Override
   public boolean isObsolete()
   {
     return false;
@@ -140,6 +178,23 @@
     return ConditionResult.UNDEFINED;
   }
 
+  private static final Comparator<ByteSequence> DEFAULT_COMPARATOR =
+      new Comparator<ByteSequence>()
+      {
+        @Override
+        public int compare(final ByteSequence o1, final ByteSequence o2)
+        {
+          return o1.compareTo(o2);
+        }
+      };
+
+  /** {@inheritDoc} */
+  @Override
+  public Comparator<ByteSequence> comparator()
+  {
+    return DEFAULT_COMPARATOR;
+  }
+
 
 
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/AttributeSyntax.java b/opendj3-server-dev/src/server/org/opends/server/api/AttributeSyntax.java
index fc4b069..fd5456c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/AttributeSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/AttributeSyntax.java
@@ -165,7 +165,7 @@
    *          attributes with this syntax, or {@code null} if ordering
    *          matches will not be allowed for this type by default.
    */
-  public abstract OrderingMatchingRule getOrderingMatchingRule();
+  public abstract MatchingRule getOrderingMatchingRule();
 
 
 
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
index 7d671a2..be53226 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/MatchingRule.java
@@ -27,6 +27,7 @@
 package org.opends.server.api;
 
 import java.util.Collection;
+import java.util.Comparator;
 
 import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteSequence;
@@ -110,13 +111,41 @@
   /**
    * Whole class to be replaced by the equivalent SDK class.
    *
-   * @param value
+   * @param assertionValue
    *          the value
    * @return SDK syntax
    * @throws DecodeException
    *           if problem
    */
-  Assertion getAssertion(final ByteSequence value) throws DecodeException;
+  Assertion getAssertion(final ByteSequence assertionValue) throws DecodeException;
+
+  /**
+   * Returns the normalized form of the provided assertion value, which is
+   * best suited for efficiently performing greater than or equal ordering
+   * matching operations on that value. The assertion value is guaranteed to
+   * be valid against this matching rule's assertion syntax.
+   *
+   * @param assertionValue
+   *            The syntax checked assertion value to be normalized.
+   * @return The normalized version of the provided assertion value.
+   * @throws DecodeException
+   *             if the syntax of the value is not valid.
+   */
+  public Assertion getGreaterOrEqualAssertion(final ByteSequence assertionValue) throws DecodeException;
+
+  /**
+   * Returns the normalized form of the provided assertion value, which is
+   * best suited for efficiently performing greater than or equal ordering
+   * matching operations on that value. The assertion value is guaranteed to
+   * be valid against this matching rule's assertion syntax.
+   *
+   * @param assertionValue
+   *            The syntax checked assertion value to be normalized.
+   * @return The normalized version of the provided assertion value.
+   * @throws DecodeException
+   *             if the syntax of the value is not valid.
+   */
+  public Assertion getLessOrEqualAssertion(final ByteSequence assertionValue) throws DecodeException;
 
   /**
    * Indicates whether this matching rule is declared "OBSOLETE". The
@@ -155,4 +184,13 @@
    *          The buffer to which the information should be appended.
    */
   void toString(StringBuilder buffer);
+
+  /**
+   * Get a comparator that can be used to compare the attribute values
+   * normalized by this matching rule.
+   *
+   * @return A comparator that can be used to compare the attribute values
+   *         normalized by this matching rule.
+   */
+  Comparator<ByteSequence> comparator();
 }
diff --git a/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java b/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
index b5135c4..8a33e70 100644
--- a/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
+++ b/opendj3-server-dev/src/server/org/opends/server/api/VirtualAttributeProvider.java
@@ -349,45 +349,41 @@
   }
 
 
-
   /**
-   * Indicates whether this virtual attribute provider will generate
-   * any value for the provided entry that is greater than or equal to
-   * the given value.
+   * Indicates whether this virtual attribute provider will generate any value
+   * for the provided entry that is greater than or equal to the given value.
    *
-   * @param  entry  The entry for which to make the determination.
-   * @param  rule   The virtual attribute rule which defines the
-   *                constraints for the virtual attribute.
-   * @param  value  The value for which to make the determination.
-   *
-   * @return  {@code UNDEFINED} if the associated attribute type does
-   *          not have an ordering matching rule, {@code TRUE} if at
-   *          least one of the generated values will be greater than
-   *          or equal to the specified value, or {@code FALSE} if
-   *          none of the generated values will be greater than or
-   *          equal to the specified value.
+   * @param entry
+   *          The entry for which to make the determination.
+   * @param rule
+   *          The virtual attribute rule which defines the constraints for the
+   *          virtual attribute.
+   * @param assertionValue
+   *          The value for which to make the determination.
+   * @return {@code UNDEFINED} if the associated attribute type does not have an
+   *         ordering matching rule, {@code TRUE} if at least one of the
+   *         generated values will be greater than or equal to the specified
+   *         value, or {@code FALSE} if none of the generated values will be
+   *         greater than or equal to the specified value.
    */
   public ConditionResult greaterThanOrEqualTo(Entry entry,
                               VirtualAttributeRule rule,
-                              ByteString value)
+                              ByteString assertionValue)
   {
-    OrderingMatchingRule matchingRule =
-         rule.getAttributeType().getOrderingMatchingRule();
+    MatchingRule matchingRule = rule.getAttributeType().getOrderingMatchingRule();
     if (matchingRule == null)
     {
       return ConditionResult.UNDEFINED;
     }
 
-    ByteString normalizedValue;
+    Assertion assertion = null;
     try
     {
-      normalizedValue = matchingRule.normalizeAttributeValue(value);
+      assertion = matchingRule.getGreaterOrEqualAssertion(assertionValue);
     }
     catch (Exception e)
     {
       logger.traceException(e);
-
-      // We couldn't normalize the provided value => return "undefined".
       return ConditionResult.UNDEFINED;
     }
 
@@ -396,8 +392,7 @@
     {
       try
       {
-        ByteString nv = matchingRule.normalizeAttributeValue(v);
-        if (matchingRule.compareValues(nv, normalizedValue) >= 0)
+        if (assertion.matches(matchingRule.normalizeAttributeValue(v)).toBoolean())
         {
           return ConditionResult.TRUE;
         }
@@ -405,7 +400,6 @@
       catch (Exception e)
       {
         logger.traceException(e);
-
         // We couldn't normalize one of the attribute values.
         // We will return "undefined" if we can't find a definite match
         result = ConditionResult.UNDEFINED;
@@ -418,43 +412,40 @@
 
 
   /**
-   * Indicates whether this virtual attribute provider will generate
-   * any value for the provided entry that is less than or equal to
-   * the given value.
+   * Indicates whether this virtual attribute provider will generate any value
+   * for the provided entry that is less than or equal to the given value.
    *
-   * @param  entry  The entry for which to make the determination.
-   * @param  rule   The virtual attribute rule which defines the
-   *                constraints for the virtual attribute.
-   * @param  value  The value for which to make the determination.
-   *
-   * @return  {@code UNDEFINED} if the associated attribute type does
-   *          not have an ordering matching rule, {@code TRUE} if at
-   *          least one of the generated values will be less than or
-   *          equal to the specified value, or {@code FALSE} if none
-   *          of the generated values will be greater than or equal to
-   *          the specified value.
+   * @param entry
+   *          The entry for which to make the determination.
+   * @param rule
+   *          The virtual attribute rule which defines the constraints for the
+   *          virtual attribute.
+   * @param assertionValue
+   *          The value for which to make the determination.
+   * @return {@code UNDEFINED} if the associated attribute type does not have an
+   *         ordering matching rule, {@code TRUE} if at least one of the
+   *         generated values will be less than or equal to the specified value,
+   *         or {@code FALSE} if none of the generated values will be greater
+   *         than or equal to the specified value.
    */
   public ConditionResult lessThanOrEqualTo(Entry entry,
                               VirtualAttributeRule rule,
-                              ByteString value)
+                              ByteString assertionValue)
   {
-    OrderingMatchingRule matchingRule =
-         rule.getAttributeType().getOrderingMatchingRule();
+    MatchingRule matchingRule = rule.getAttributeType().getOrderingMatchingRule();
     if (matchingRule == null)
     {
       return ConditionResult.UNDEFINED;
     }
 
-    ByteString normalizedValue;
+    Assertion assertion = null;
     try
     {
-      normalizedValue = matchingRule.normalizeAttributeValue(value);
+      assertion = matchingRule.getLessOrEqualAssertion(assertionValue);
     }
     catch (Exception e)
     {
       logger.traceException(e);
-
-      // We couldn't normalize the provided value => return "undefined".
       return ConditionResult.UNDEFINED;
     }
 
@@ -463,8 +454,7 @@
     {
       try
       {
-        ByteString nv = matchingRule.normalizeAttributeValue(v);
-        if (matchingRule.compareValues(nv, normalizedValue) <= 0)
+        if (assertion.matches(matchingRule.normalizeAttributeValue(v)).toBoolean())
         {
           return ConditionResult.TRUE;
         }
@@ -492,7 +482,7 @@
    * @param  entry  The entry for which to make the determination.
    * @param  rule   The virtual attribute rule which defines the
    *                constraints for the virtual attribute.
-   * @param  value  The value for which to make the determination.
+   * @param  assertionValue  The value for which to make the determination.
    *
    * @return  {@code UNDEFINED} if the associated attribute type does
    *          not have an approximate matching rule, {@code TRUE} if at
@@ -503,7 +493,7 @@
    */
   public ConditionResult approximatelyEqualTo(Entry entry,
                               VirtualAttributeRule rule,
-                              ByteString value)
+                              ByteString assertionValue)
   {
     MatchingRule matchingRule = rule.getAttributeType().getApproximateMatchingRule();
     if (matchingRule == null)
@@ -514,7 +504,7 @@
     Assertion assertion = null;
     try
     {
-      assertion = matchingRule.getAssertion(value);
+      assertion = matchingRule.getAssertion(assertionValue);
     }
     catch (Exception e)
     {
@@ -527,7 +517,10 @@
     {
       try
       {
-        result = assertion.matches(matchingRule.normalizeAttributeValue(v));
+        if  (assertion.matches(matchingRule.normalizeAttributeValue(v)).toBoolean())
+        {
+          return ConditionResult.TRUE;
+        }
       }
       catch (Exception e)
       {
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
index d60a0dc..6d0874d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/AttributeIndex.java
@@ -975,7 +975,7 @@
     try
     {
       // Use the ordering matching rule to normalize the value.
-      OrderingMatchingRule orderingRule =
+      MatchingRule orderingRule =
            filter.getAttributeType().getOrderingMatchingRule();
       // FIXME JNR this looks wrong, it should use normalizeAssertionValue()
       byte[] normalizedValue = orderingRule.normalizeAttributeValue(
@@ -1243,7 +1243,7 @@
     try
     {
       // Use the ordering matching rule to normalize the values.
-      OrderingMatchingRule orderingRule =
+      MatchingRule orderingRule =
            getAttributeType().getOrderingMatchingRule();
 
       // Set the lower and upper bounds for a range search.
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/OrderingIndexer.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/OrderingIndexer.java
index 7f2f79f..5fa05ae 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/OrderingIndexer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/OrderingIndexer.java
@@ -34,7 +34,7 @@
 import org.forgerock.opendj.ldap.schema.Schema;
 import org.forgerock.opendj.ldap.spi.IndexingOptions;
 import org.opends.server.api.ExtensibleIndexer;
-import org.opends.server.api.OrderingMatchingRule;
+import org.opends.server.api.MatchingRule;
 import org.opends.server.types.AttributeType;
 
 /**
@@ -47,7 +47,7 @@
    * The attribute type ordering matching rule which is also the
    * comparator for the index keys generated by this class.
    */
-  private OrderingMatchingRule orderingRule;
+  private MatchingRule orderingRule;
 
 
   /**
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVIndex.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVIndex.java
index 25cd32a..cc8038e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVIndex.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVIndex.java
@@ -43,7 +43,6 @@
 import org.opends.server.admin.std.meta.LocalDBVLVIndexCfgDefn.Scope;
 import org.opends.server.admin.std.server.LocalDBVLVIndexCfg;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.controls.ServerSideSortRequestControl;
 import org.opends.server.controls.VLVRequestControl;
 import org.opends.server.controls.VLVResponseControl;
@@ -162,8 +161,8 @@
 
     String[] sortAttrs = config.getSortOrder().split(" ");
     SortKey[] sortKeys = new SortKey[sortAttrs.length];
-    OrderingMatchingRule[] orderingRules =
-        new OrderingMatchingRule[sortAttrs.length];
+    MatchingRule[] orderingRules =
+        new MatchingRule[sortAttrs.length];
     boolean[] ascending = new boolean[sortAttrs.length];
     for(int i = 0; i < sortAttrs.length; i++)
     {
@@ -1747,8 +1746,8 @@
 
     String[] sortAttrs = cfg.getSortOrder().split(" ");
     SortKey[] sortKeys = new SortKey[sortAttrs.length];
-    OrderingMatchingRule[] orderingRules =
-        new OrderingMatchingRule[sortAttrs.length];
+    MatchingRule[] orderingRules =
+        new MatchingRule[sortAttrs.length];
     boolean[] ascending = new boolean[sortAttrs.length];
     for(int i = 0; i < sortAttrs.length; i++)
     {
@@ -1858,8 +1857,8 @@
     {
       String[] sortAttrs = cfg.getSortOrder().split(" ");
       SortKey[] sortKeys = new SortKey[sortAttrs.length];
-      OrderingMatchingRule[] orderingRules =
-          new OrderingMatchingRule[sortAttrs.length];
+      MatchingRule[] orderingRules =
+          new MatchingRule[sortAttrs.length];
       boolean[] ascending = new boolean[sortAttrs.length];
       for(int i = 0; i < sortAttrs.length; i++)
       {
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVKeyComparator.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVKeyComparator.java
index f740742..c3a61db 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVKeyComparator.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/VLVKeyComparator.java
@@ -29,11 +29,11 @@
 import java.io.Serializable;
 import java.util.Comparator;
 
+import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.DirectoryException;
 
@@ -54,7 +54,7 @@
    */
   static final long serialVersionUID = 1585167927344130604L;
 
-  private OrderingMatchingRule[] orderingRules;
+  private MatchingRule[] orderingRules;
 
   private boolean[] ascending;
 
@@ -66,7 +66,7 @@
    * @param ascending     The array of booleans indicating the ordering for
    *                      each value.
    */
-  public VLVKeyComparator(OrderingMatchingRule[] orderingRules,
+  public VLVKeyComparator(MatchingRule[] orderingRules,
                           boolean[] ascending)
   {
     this.orderingRules = orderingRules;
@@ -189,15 +189,10 @@
         return -1;
       }
 
-      int result;
-      if(ascending[j])
-      {
-        result = orderingRules[j].compare(b1Bytes, b2Bytes);
-      }
-      else
-      {
-        result = orderingRules[j].compare(b2Bytes, b1Bytes);
-      }
+      final Comparator<ByteSequence> comp = orderingRules[j].comparator();
+      final ByteString val1 = ByteString.valueOf(b1Bytes);
+      final ByteString val2 = ByteString.valueOf(b2Bytes);
+      final int result = ascending[j] ? comp.compare(val1, val2) : comp.compare(val2, val1);
 
       if(result != 0)
       {
@@ -322,15 +317,8 @@
         return -1;
       }
 
-      int result;
-      if(ascending[j])
-      {
-        result = orderingRules[j].compareValues(b1Bytes, b2Bytes);
-      }
-      else
-      {
-        result = orderingRules[j].compareValues(b2Bytes, b1Bytes);
-      }
+      final Comparator<ByteSequence> comp = orderingRules[j].comparator();
+      final int result = ascending[j] ? comp.compare(b1Bytes, b2Bytes) : comp.compare(b2Bytes, b1Bytes);
 
       if(result != 0)
       {
diff --git a/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java b/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
index 9282ede..9732d95 100644
--- a/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
@@ -38,11 +38,9 @@
 import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteSequence;
 import org.forgerock.opendj.ldap.ByteString;
-import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.util.Reject;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.ldap.LDAPResultCode;
@@ -160,7 +158,7 @@
   private MatchingRule matchingRule;
 
   // The ordering matching rule for this matched values filter.
-  private OrderingMatchingRule orderingMatchingRule;
+  private MatchingRule orderingMatchingRule;
 
   // The matching rule ID for this matched values filter.
   private final String matchingRuleID;
@@ -1200,7 +1198,7 @@
    * @return  The ordering matching rule that should be used for this matched
    *          values filter, or <CODE>null</CODE> if there is none.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     if (orderingMatchingRule == null)
     {
@@ -1332,11 +1330,11 @@
         {
           try
           {
-            ByteString nv = orderingMatchingRule.normalizeAssertionValue(value);
-            return orderingMatchingRule.compareValues(
-                nv, orderingMatchingRule.normalizeAttributeValue(value)) >= 0;
+            ByteString normValue = orderingMatchingRule.normalizeAttributeValue(value);
+            Assertion assertion = orderingMatchingRule.getGreaterOrEqualAssertion(assertionValue);
+            return assertion.matches(normValue).toBoolean();
           }
-          catch (Exception e)
+          catch (DecodeException e)
           {
             logger.traceException(e);
           }
@@ -1353,11 +1351,11 @@
         {
           try
           {
-            ByteString nv = orderingMatchingRule.normalizeAssertionValue(value);
-            return orderingMatchingRule.compareValues(
-                nv, orderingMatchingRule.normalizeAttributeValue(value)) <= 0;
+            ByteString normValue = orderingMatchingRule.normalizeAttributeValue(value);
+            Assertion assertion = orderingMatchingRule.getLessOrEqualAssertion(assertionValue);
+            return assertion.matches(normValue).toBoolean();
           }
-          catch (Exception e)
+          catch (DecodeException e)
           {
             logger.traceException(e);
           }
@@ -1378,9 +1376,9 @@
         {
           try
           {
+            ByteString normValue = approximateMatchingRule.normalizeAttributeValue(value);
             Assertion assertion = approximateMatchingRule.getAssertion(assertionValue);
-            ByteString nv = approximateMatchingRule.normalizeAttributeValue(value);
-            return assertion.matches(nv).toBoolean();
+            return assertion.matches(normValue).toBoolean();
           }
           catch (Exception e)
           {
@@ -1405,9 +1403,9 @@
 
           try
           {
-            ByteString nv1 = matchingRule.normalizeAttributeValue(value);
+            ByteString normValue = matchingRule.normalizeAttributeValue(value);
             Assertion assertion = matchingRule.getAssertion(assertionValue);
-            return assertion.matches(nv1) == ConditionResult.TRUE;
+            return assertion.matches(normValue).toBoolean();
           }
           catch (Exception e)
           {
diff --git a/opendj3-server-dev/src/server/org/opends/server/controls/ServerSideSortRequestControl.java b/opendj3-server-dev/src/server/org/opends/server/controls/ServerSideSortRequestControl.java
index 4014859..caae2a3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/controls/ServerSideSortRequestControl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/controls/ServerSideSortRequestControl.java
@@ -33,7 +33,7 @@
 import java.util.StringTokenizer;
 import java.io.IOException;
 
-import org.opends.server.api.OrderingMatchingRule;
+import org.opends.server.api.MatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.forgerock.opendj.io.*;
 import org.opends.server.protocols.ldap.LDAPResultCode;
@@ -121,7 +121,7 @@
             new SortOrder(sortKeys.toArray(new SortKey[0])));
           }
 
-          OrderingMatchingRule orderingRule = null;
+          MatchingRule orderingRule = null;
           boolean ascending = true;
           if(reader.hasNextElement() &&
               reader.peekType() == TYPE_ORDERING_RULE_ID)
@@ -455,7 +455,7 @@
         return new SortOrder(sortKeys.toArray(new SortKey[0]));
       }
 
-      OrderingMatchingRule orderingRule = null;
+      MatchingRule orderingRule = null;
       if(decodedKey[1] != null)
       {
         orderingRule =
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
index 0d85aef..5a4a9bb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -119,7 +119,6 @@
 import org.opends.server.api.KeyManagerProvider;
 import org.opends.server.api.MatchingRuleFactory;
 import org.opends.server.api.MonitorProvider;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.PasswordGenerator;
 import org.opends.server.api.PasswordStorageScheme;
 import org.opends.server.api.PasswordValidator;
@@ -3173,9 +3172,9 @@
    * @return  The requested ordering matching rule, or <CODE>null</CODE> if no
    *          such matching rule has been defined in the server.
    */
-  public static OrderingMatchingRule getOrderingMatchingRule(String lowerName)
+  public static MatchingRule getOrderingMatchingRule(String lowerName)
   {
-    return (OrderingMatchingRule) directoryServer.schema.getMatchingRule(lowerName);
+    return (MatchingRule) directoryServer.schema.getMatchingRule(lowerName);
   }
 
   /**
@@ -3192,7 +3191,7 @@
    *                              <CODE>false</CODE>
    */
   public static void registerOrderingMatchingRule(
-      OrderingMatchingRule matchingRule, boolean overwriteExisting)
+      MatchingRule matchingRule, boolean overwriteExisting)
       throws DirectoryException
   {
     directoryServer.schema.registerMatchingRule(matchingRule, overwriteExisting);
@@ -3204,7 +3203,7 @@
    *
    * @param  matchingRule  The matching rule to deregister with the server.
    */
-  public static void deregisterOrderingMatchingRule(OrderingMatchingRule
+  public static void deregisterOrderingMatchingRule(MatchingRule
                                                     matchingRule)
   {
     directoryServer.schema.deregisterMatchingRule(matchingRule);
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java b/opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java
index 7821df6..2cca763 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java
@@ -44,7 +44,6 @@
 import org.opends.server.admin.std.meta.MatchingRuleCfgDefn;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.MatchingRuleFactory;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.types.AttributeType;
@@ -287,7 +286,7 @@
             continue;
           }
 
-          OrderingMatchingRule omr = at.getOrderingMatchingRule();
+          MatchingRule omr = at.getOrderingMatchingRule();
           if ((omr != null) && oid.equals(omr.getOID()))
           {
             LocalizableMessage message =
@@ -424,7 +423,7 @@
               continue;
             }
 
-            OrderingMatchingRule omr = at.getOrderingMatchingRule();
+            MatchingRule omr = at.getOrderingMatchingRule();
             if ((omr != null) && oid.equals(omr.getOID()))
             {
               LocalizableMessage message =
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
index fdf3ded..7ff209b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AbstractOrderingMatchingRule.java
@@ -24,6 +24,9 @@
  */
 package org.opends.server.schema;
 
+
+import java.util.Comparator;
+
 import org.forgerock.opendj.ldap.*;
 import org.opends.server.api.AbstractMatchingRule;
 import org.opends.server.api.NotImplementedAssertion;
@@ -63,10 +66,54 @@
       @Override
       public ConditionResult matches(ByteSequence attributeValue)
       {
-        return ConditionResult.valueOf(
-            compareValues(assertionValue, attributeValue) < 0);
+        return ConditionResult.valueOf(compareValues(attributeValue, assertionValue) < 0);
       }
     };
   }
 
+  /** {@inheritDoc} */
+  @Override
+  public Assertion getGreaterOrEqualAssertion(ByteSequence value) throws DecodeException
+  {
+    final ByteString normAssertion = normalizeAssertionValue(value);
+    return new NotImplementedAssertion()
+    {
+      @Override
+      public ConditionResult matches(final ByteSequence normalizedAttributeValue)
+      {
+        return ConditionResult.valueOf(compareValues(normalizedAttributeValue, normAssertion) >= 0);
+      }
+    };
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public Assertion getLessOrEqualAssertion(ByteSequence value) throws DecodeException
+  {
+    final ByteString normAssertion = normalizeAssertionValue(value);
+    return new NotImplementedAssertion()
+    {
+      @Override
+      public ConditionResult matches(final ByteSequence normalizedAttributeValue)
+      {
+        return ConditionResult.valueOf(compareValues(normalizedAttributeValue, normAssertion) <= 0);
+      }
+    };
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public Comparator<ByteSequence> comparator()
+  {
+    return new Comparator<ByteSequence>()
+    {
+      @Override
+      public int compare(ByteSequence o1, ByteSequence o2)
+      {
+        return AbstractOrderingMatchingRule.this.compare(o1.toByteArray(), o2.toByteArray());
+      }
+    };
+  }
+
+
 }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AciSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/AciSyntax.java
index 38aa45a..0b0efed 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AciSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AciSyntax.java
@@ -31,7 +31,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -159,7 +158,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // We don't have an orderingMatchingRule
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AttributeTypeSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/AttributeTypeSyntax.java
index 646f2b2..1343c27 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AttributeTypeSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AttributeTypeSyntax.java
@@ -41,7 +41,6 @@
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -77,7 +76,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -198,7 +197,7 @@
    * {@inheritDoc}
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
@@ -442,7 +441,7 @@
     AttributeSyntax<?> syntax = DirectoryServer.getDefaultAttributeSyntax();
     MatchingRule approximateMatchingRule = null;
     MatchingRule equalityMatchingRule = null;
-    OrderingMatchingRule orderingMatchingRule = null;
+    MatchingRule orderingMatchingRule = null;
     SubstringMatchingRule substringMatchingRule = null;
     AttributeUsage attributeUsage = AttributeUsage.USER_APPLICATIONS;
     boolean isCollective = false;
@@ -675,8 +674,8 @@
         // for this attribute type.
         StringBuilder woidBuffer = new StringBuilder();
         pos = readWOID(lowerStr, woidBuffer, pos);
-        OrderingMatchingRule omr =
-             (OrderingMatchingRule) schema.getMatchingRule(woidBuffer.toString());
+        MatchingRule omr =
+             (MatchingRule) schema.getMatchingRule(woidBuffer.toString());
         if (omr == null)
         {
           // This is bad because we have no idea what the ordering matching
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordSyntax.java
index f05e56e..58ba26e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/AuthPasswordSyntax.java
@@ -33,7 +33,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -159,7 +158,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/BinarySyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/BinarySyntax.java
index 344c81f..1d3fa08 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/BinarySyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/BinarySyntax.java
@@ -52,7 +52,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -166,7 +166,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/BitStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/BitStringSyntax.java
index c9051b9..f737f13 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/BitStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/BitStringSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -148,7 +147,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // Ordering matches are not allowed by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/BooleanSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/BooleanSyntax.java
index c7de1ec..55f923e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/BooleanSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/BooleanSyntax.java
@@ -34,7 +34,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.util.ServerConstants;
@@ -154,7 +153,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // Ordering matches are not allowed by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateExactAssertionSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateExactAssertionSyntax.java
index c2fbdaa..8794601 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateExactAssertionSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateExactAssertionSyntax.java
@@ -33,7 +33,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -59,7 +58,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -155,7 +154,7 @@
   /**
    * {@inheritDoc}
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateListSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateListSyntax.java
index de8fb8b..5587395 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateListSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateListSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -169,7 +168,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CertificatePairSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/CertificatePairSyntax.java
index 243cf23..2c28215 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CertificatePairSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CertificatePairSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -169,7 +168,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateSyntax.java
index ff25719..64803f8 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CertificateSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CertificateSyntax.java
@@ -37,7 +37,6 @@
 import org.opends.server.admin.std.server.CertificateAttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -71,7 +70,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -214,7 +213,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/CountryStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/CountryStringSyntax.java
index c54f807..ffa8802 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/CountryStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/CountryStringSyntax.java
@@ -35,7 +35,6 @@
 import org.opends.server.admin.std.server.CountryStringAttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -71,7 +70,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -225,7 +224,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/DITContentRuleSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/DITContentRuleSyntax.java
index 00708f1..7d531c4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/DITContentRuleSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/DITContentRuleSyntax.java
@@ -39,7 +39,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -67,7 +66,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -172,7 +171,7 @@
    * {@inheritDoc}
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/DITStructureRuleSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/DITStructureRuleSyntax.java
index 680f067..8db9e3f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/DITStructureRuleSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/DITStructureRuleSyntax.java
@@ -37,7 +37,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -70,7 +69,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -169,7 +168,7 @@
   /**
    * {@inheritDoc}
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/DeliveryMethodSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
index c9e12cd..b66c717 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/DeliveryMethodSyntax.java
@@ -35,7 +35,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -103,7 +102,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -229,7 +228,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/DirectoryStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/DirectoryStringSyntax.java
index 7f2ebab..166e11a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/DirectoryStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/DirectoryStringSyntax.java
@@ -37,7 +37,6 @@
 import org.opends.server.admin.std.server.DirectoryStringAttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.ConfigChangeResult;
@@ -72,7 +71,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -222,7 +221,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/DistinguishedNameSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
index d64dd9c..de8e386 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/DistinguishedNameSyntax.java
@@ -35,7 +35,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.DN;
@@ -166,7 +165,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/EnhancedGuideSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
index 35900c7..75a43db 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/EnhancedGuideSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -172,7 +171,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/FaxNumberSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/FaxNumberSyntax.java
index a6f9cd7..5d465ff 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/FaxNumberSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/FaxNumberSyntax.java
@@ -34,7 +34,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -93,7 +92,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -202,7 +201,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/FaxSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/FaxSyntax.java
index 3fceeff..c67cfd6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/FaxSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/FaxSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -59,7 +58,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -168,7 +167,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
index e1b7a23..092c9ed 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/GeneralizedTimeSyntax.java
@@ -39,7 +39,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -76,7 +75,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -194,7 +193,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/GuideSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/GuideSyntax.java
index 10dd5ba..8e7b2c0 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/GuideSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/GuideSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -169,7 +168,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/IA5StringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/IA5StringSyntax.java
index bb799ab..a1ec1af 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/IA5StringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/IA5StringSyntax.java
@@ -31,7 +31,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -180,7 +179,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/IntegerSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/IntegerSyntax.java
index 1040421..b72caa7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/IntegerSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/IntegerSyntax.java
@@ -33,7 +33,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 
@@ -56,7 +55,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -170,7 +169,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/JPEGSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/JPEGSyntax.java
index c551395..4433fca 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/JPEGSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/JPEGSyntax.java
@@ -36,7 +36,6 @@
 import org.opends.server.admin.std.server.JPEGAttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -69,7 +68,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -184,7 +183,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
index f7021c4..7f3832c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/LDAPSyntaxDescriptionSyntax.java
@@ -71,7 +71,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -186,7 +186,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
@@ -1040,7 +1040,7 @@
      *          matches will not be allowed for this type by default.
      */
     @Override
-    public OrderingMatchingRule getOrderingMatchingRule()
+    public MatchingRule getOrderingMatchingRule()
     {
       return subSyntax.getOrderingMatchingRule();
     }
@@ -1107,7 +1107,7 @@
     private SubstringMatchingRule substringMatchingRule;
 
     //The ordering matching rule.
-    private OrderingMatchingRule orderingMatchingRule;
+    private MatchingRule orderingMatchingRule;
 
     //The approximate matching rule.
     private MatchingRule approximateMatchingRule;
@@ -1223,7 +1223,7 @@
      *          matches will not be allowed for this type by default.
      */
     @Override
-    public OrderingMatchingRule getOrderingMatchingRule()
+    public MatchingRule getOrderingMatchingRule()
     {
       if(orderingMatchingRule == null)
       {
@@ -1303,7 +1303,7 @@
     private SubstringMatchingRule substringMatchingRule;
 
     //The ordering matching rule.
-    private OrderingMatchingRule orderingMatchingRule;
+    private MatchingRule orderingMatchingRule;
 
     //The approximate matching rule.
     private MatchingRule approximateMatchingRule;
@@ -1432,7 +1432,7 @@
      *          matches will not be allowed for this type by default.
      */
     @Override
-    public OrderingMatchingRule getOrderingMatchingRule()
+    public MatchingRule getOrderingMatchingRule()
     {
       if(orderingMatchingRule == null)
       {
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleSyntax.java
index 01e656e..8105ecd 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleSyntax.java
@@ -36,7 +36,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.AttributeSyntax;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -70,7 +69,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -185,7 +184,7 @@
    *          matches will not be allowed for this type by default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java
index 1224826..c2e9a28 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/MatchingRuleUseSyntax.java
@@ -37,7 +37,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.AttributeSyntax;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -70,7 +69,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -169,7 +168,7 @@
   /**
    * {@inheritDoc}
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
index 07abfa9..60df603 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/NameAndOptionalUIDSyntax.java
@@ -31,7 +31,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -164,7 +163,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/NameFormSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/NameFormSyntax.java
index 772821d..e7b6b84 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/NameFormSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/NameFormSyntax.java
@@ -39,7 +39,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -66,7 +65,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -171,7 +170,7 @@
    * {@inheritDoc}
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringSyntax.java
index bcc0093..a8e6f8d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/NumericStringSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -172,7 +171,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/OIDSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/OIDSyntax.java
index ffb86db..ceb9c87 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/OIDSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/OIDSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -158,7 +157,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/ObjectClassSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/ObjectClassSyntax.java
index 2b160a6..8c886aa 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/ObjectClassSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/ObjectClassSyntax.java
@@ -41,7 +41,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -70,7 +69,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -175,7 +174,7 @@
    * {@inheritDoc}
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringSyntax.java
index 45f87cd..fa94370 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/OctetStringSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -59,7 +58,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -168,7 +167,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/OtherMailboxSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/OtherMailboxSyntax.java
index 0d8a646..e270d10 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/OtherMailboxSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/OtherMailboxSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -161,7 +160,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // Ordering matching is not allowed by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/PostalAddressSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/PostalAddressSyntax.java
index 5200478..0f71e4f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/PostalAddressSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/PostalAddressSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -162,7 +161,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // Ordering matching will not be allowed by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/PresentationAddressSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/PresentationAddressSyntax.java
index 4340984..e7bf0a5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/PresentationAddressSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/PresentationAddressSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -62,7 +61,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -182,7 +181,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/PrintableStringSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/PrintableStringSyntax.java
index 5ccb023..a37794a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/PrintableStringSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/PrintableStringSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -64,7 +63,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -184,7 +183,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/ProtocolInformationSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
index 2959b29..a131c5c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/ProtocolInformationSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -62,7 +61,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -182,7 +181,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/SubstringAssertionSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
index 7ade8c6..7ac9584 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/SubstringAssertionSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -172,7 +171,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
index 73ab070..cbc9f36 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/SubtreeSpecificationSyntax.java
@@ -36,7 +36,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.DN;
@@ -57,7 +56,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -159,7 +158,7 @@
    *         default.
    */
   @Override
-  public OrderingMatchingRule getOrderingMatchingRule() {
+  public MatchingRule getOrderingMatchingRule() {
 
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
index 1547028..69ada31 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/SupportedAlgorithmSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -60,7 +59,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -172,7 +171,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
index 8b5207f..081bab0 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/TelephoneNumberSyntax.java
@@ -36,7 +36,6 @@
 import org.opends.server.admin.std.server.TelephoneNumberAttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -200,7 +199,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
index 8ec87f8..937fc44 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/TeletexTerminalIdentifierSyntax.java
@@ -34,7 +34,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -91,7 +90,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -203,7 +202,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/TelexNumberSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/TelexNumberSyntax.java
index 0b38960..b128e20 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/TelexNumberSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/TelexNumberSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -59,7 +58,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -168,7 +167,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UTCTimeSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/UTCTimeSyntax.java
index e84f512..dda4e03 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UTCTimeSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UTCTimeSyntax.java
@@ -38,7 +38,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -93,7 +92,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
   // The default substring matching rule for this syntax.
   private SubstringMatchingRule defaultSubstringMatchingRule;
@@ -226,7 +225,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UUIDSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/UUIDSyntax.java
index 5e8a719..94eab5d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UUIDSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UUIDSyntax.java
@@ -32,7 +32,6 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -58,7 +57,7 @@
   private MatchingRule defaultEqualityMatchingRule;
 
   // The default ordering matching rule for this syntax.
-  private OrderingMatchingRule defaultOrderingMatchingRule;
+  private MatchingRule defaultOrderingMatchingRule;
 
 
 
@@ -157,7 +156,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return defaultOrderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordSyntax.java b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordSyntax.java
index 2ced188..f37170a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordSyntax.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordSyntax.java
@@ -33,7 +33,6 @@
 import org.opends.server.admin.std.server.AttributeSyntaxCfg;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.opends.server.core.DirectoryServer;
@@ -162,7 +161,7 @@
    *          attributes with this syntax, or <CODE>null</CODE> if ordering
    *          matches will not be allowed for this type by default.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     // There is no ordering matching rule by default.
     return null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java b/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
index 07dfc3c..8c38d96 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
@@ -50,7 +50,6 @@
 import org.forgerock.util.Reject;
 import org.forgerock.util.Utils;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 
@@ -238,24 +237,20 @@
     @Override
     public final ConditionResult greaterThanOrEqualTo(ByteString value)
     {
-      OrderingMatchingRule matchingRule = attributeType
-          .getOrderingMatchingRule();
+      MatchingRule matchingRule = attributeType.getOrderingMatchingRule();
       if (matchingRule == null)
       {
         return ConditionResult.UNDEFINED;
       }
 
-      ByteString normalizedValue;
+      Assertion assertion;
       try
       {
-        normalizedValue = matchingRule.normalizeAttributeValue(value);
+        assertion = matchingRule.getGreaterOrEqualAssertion(value);
       }
-      catch (Exception e)
+      catch (DecodeException e)
       {
         logger.traceException(e);
-
-        // We couldn't normalize the provided value. We should return
-        // "undefined".
         return ConditionResult.UNDEFINED;
       }
 
@@ -264,8 +259,7 @@
       {
         try
         {
-          ByteString nv = matchingRule.normalizeAttributeValue(v);
-          if (matchingRule.compareValues(nv, normalizedValue) >= 0)
+          if (assertion.matches(matchingRule.normalizeAttributeValue(v)).toBoolean())
           {
             return ConditionResult.TRUE;
           }
@@ -273,7 +267,6 @@
         catch (Exception e)
         {
           logger.traceException(e);
-
           // We couldn't normalize one of the attribute values. If we
           // can't find a definite match, then we should return
           // "undefined".
@@ -314,24 +307,20 @@
     @Override
     public final ConditionResult lessThanOrEqualTo(ByteString value)
     {
-      OrderingMatchingRule matchingRule = attributeType
-          .getOrderingMatchingRule();
+      MatchingRule matchingRule = attributeType.getOrderingMatchingRule();
       if (matchingRule == null)
       {
         return ConditionResult.UNDEFINED;
       }
 
-      ByteString normalizedValue;
+      Assertion assertion;
       try
       {
-        normalizedValue = matchingRule.normalizeAttributeValue(value);
+        assertion = matchingRule.getLessOrEqualAssertion(value);
       }
-      catch (Exception e)
+      catch (DecodeException e)
       {
         logger.traceException(e);
-
-        // We couldn't normalize the provided value. We should return
-        // "undefined".
         return ConditionResult.UNDEFINED;
       }
 
@@ -340,8 +329,7 @@
       {
         try
         {
-          ByteString nv = matchingRule.normalizeAttributeValue(v);
-          if (matchingRule.compareValues(nv, normalizedValue) <= 0)
+          if (assertion.matches(matchingRule.normalizeAttributeValue(v)).toBoolean())
           {
             return ConditionResult.TRUE;
           }
@@ -351,8 +339,7 @@
           logger.traceException(e);
 
           // We couldn't normalize one of the attribute values. If we
-          // can't find a definite match, then we should return
-          // "undefined".
+          // can't find a definite match, then we should return "undefined".
           result = ConditionResult.UNDEFINED;
         }
       }
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java b/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
index bf9ea2c..c9ad084 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
@@ -34,7 +34,6 @@
 import org.forgerock.opendj.ldap.schema.AttributeUsage;
 import org.opends.server.api.AttributeSyntax;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 
@@ -107,7 +106,7 @@
   private final MatchingRule equalityMatchingRule;
 
   // The ordering matching rule for this attribute type.
-  private final OrderingMatchingRule orderingMatchingRule;
+  private final MatchingRule orderingMatchingRule;
 
   // The definition string used to create this attribute type.
   private final String definition;
@@ -252,7 +251,7 @@
                        AttributeSyntax<?> syntax,
                        MatchingRule approximateMatchingRule,
                        MatchingRule equalityMatchingRule,
-                       OrderingMatchingRule orderingMatchingRule,
+                       MatchingRule orderingMatchingRule,
                        SubstringMatchingRule substringMatchingRule,
                        AttributeUsage attributeUsage,
                        boolean isCollective,
@@ -475,7 +474,7 @@
    * @return  The matching rule that should be used for ordering with
    *          this attribute type.
    */
-  public OrderingMatchingRule getOrderingMatchingRule()
+  public MatchingRule getOrderingMatchingRule()
   {
     return orderingMatchingRule;
   }
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java b/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
index 06d09f2..c0549a2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/DirectoryConfig.java
@@ -39,7 +39,6 @@
 import org.opends.server.api.ConfigHandler;
 import org.opends.server.api.ExtendedOperationHandler;
 import org.opends.server.api.InvokableComponent;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SASLMechanismHandler;
 import org.opends.server.api.ServerShutdownListener;
 import org.opends.server.api.SubstringMatchingRule;
@@ -261,7 +260,7 @@
    *          <CODE>null</CODE> if no such matching rule has been
    *          defined in the server.
    */
-  public static OrderingMatchingRule
+  public static MatchingRule
        getOrderingMatchingRule(String lowerName)
   {
     return DirectoryServer.getOrderingMatchingRule(lowerName);
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/RDN.java b/opendj3-server-dev/src/server/org/opends/server/types/RDN.java
index f4a28d4..f9f79b7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/RDN.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/RDN.java
@@ -35,7 +35,6 @@
 import org.forgerock.opendj.ldap.DecodeException;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.core.DirectoryServer;
 
 import static org.opends.messages.CoreMessages.*;
@@ -1169,7 +1168,7 @@
   }
 
   /**
-   * Compares two attribute values by using the provided OrderingMatchingRule if
+   * Compares two attribute values by using the provided MatchingRule if
    * it is not null, or relying on alphabetical ordering otherwise.
    *
    * @param value1
@@ -1177,21 +1176,20 @@
    * @param value2
    *          the second attribute value to compare
    * @param type
-   *          the type whose OrderingMatchingRule is to be used for comparison
+   *          the type whose MatchingRule is to be used for comparison
    * @return A negative integer if this value1 should come before the value2, a
    *         positive integer if value1 should come after value2, or zero if
    *         there is no difference with regard to ordering.
    */
   private int compare(ByteString value1, ByteString value2, AttributeType type)
   {
-    final OrderingMatchingRule omr = type.getOrderingMatchingRule();
-    final MatchingRule emr = type.getEqualityMatchingRule();
+    final MatchingRule orderingRule = type.getOrderingMatchingRule();
+    final MatchingRule rule = orderingRule != null ? orderingRule : type.getEqualityMatchingRule();
 
     ByteString val1;
     ByteString val2;
     try
     {
-      final MatchingRule rule = omr != null ? omr : emr;
       val1 = rule.normalizeAttributeValue(value1);
       val2 = rule.normalizeAttributeValue(value2);
     }
@@ -1201,11 +1199,6 @@
       val1 = value1;
       val2 = value2;
     }
-
-    if (omr != null)
-    {
-      return omr.compareValues(val1, val2);
-    }
-    return val1.compareTo(val2);
+    return rule.comparator().compare(val1, val2);
   }
 }
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/SortKey.java b/opendj3-server-dev/src/server/org/opends/server/types/SortKey.java
index f1629d4..877a2d5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/SortKey.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/SortKey.java
@@ -28,7 +28,7 @@
 
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.forgerock.opendj.ldap.ByteString;
-import org.opends.server.api.OrderingMatchingRule;
+import org.opends.server.api.MatchingRule;
 
 /**
  * This class defines a data structure that may be used as a sort key.
@@ -56,7 +56,7 @@
   private boolean ascending;
 
   // The ordering matching rule to use with this sort key.
-  private OrderingMatchingRule orderingRule;
+  private MatchingRule orderingRule;
 
 
 
@@ -86,8 +86,7 @@
    * @param  orderingRule   The ordering matching rule to use with
    *                        this sort key.
    */
-  public SortKey(AttributeType attributeType, boolean ascending,
-                 OrderingMatchingRule orderingRule)
+  public SortKey(AttributeType attributeType, boolean ascending, MatchingRule orderingRule)
   {
     this.attributeType = attributeType;
     this.ascending     = ascending;
@@ -128,7 +127,7 @@
    *
    * @return  The ordering matching rule to use with this sort key.
    */
-  public OrderingMatchingRule getOrderingRule()
+  public MatchingRule getOrderingRule()
   {
     return orderingRule;
   }
@@ -173,7 +172,7 @@
     {
       return compareValues(orderingRule, value1, value2);
     }
-    final OrderingMatchingRule rule = attributeType.getOrderingMatchingRule();
+    final MatchingRule rule = attributeType.getOrderingMatchingRule();
     if (rule != null)
     {
       return compareValues(rule, value1, value2);
@@ -181,7 +180,7 @@
     return 0;
   }
 
-  private int compareValues(OrderingMatchingRule rule, ByteString value1,
+  private int compareValues(MatchingRule rule, ByteString value1,
       ByteString value2)
   {
     try
@@ -190,11 +189,11 @@
       final ByteString val2 = rule.normalizeAttributeValue(value2);
       if (ascending)
       {
-        return rule.compareValues(val1, val2);
+        return rule.comparator().compare(val1, val2);
       }
       else
       {
-        return rule.compareValues(val2, val1);
+        return rule.comparator().compare(val2, val1);
       }
     }
     catch (Exception e)
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
index e5e66a6..11c4945 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -35,8 +35,10 @@
 import org.assertj.core.api.Assertions;
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.config.server.ConfigException;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
 import org.opends.server.TestCaseUtils;
 import org.opends.server.admin.std.meta.ReplicationDomainCfgDefn.AssuredType;
 import org.opends.server.core.DirectoryServer;
@@ -92,7 +94,7 @@
   public void basicRuleTest() throws Exception
   {
     // Creates a rule
-    HistoricalCsnOrderingMatchingRule r =
+    HistoricalCsnOrderingMatchingRule rule =
       new HistoricalCsnOrderingMatchingRule();
 
     CSN del1 = new CSN(1,  0,  1);
@@ -101,9 +103,18 @@
     ByteString v1 = ByteString.valueOf("a" + ":" + del1);
     ByteString v2 = ByteString.valueOf("a" + ":" + del2);
 
-    assertEquals(r.compareValues(v1, v1), 0);
-    assertEquals(r.compareValues(v1, v2), -1);
-    assertEquals(r.compareValues(v2, v1), 1);
+    Assertion assert1 = rule.getAssertion(v2);
+    assertEquals(assert1.matches(rule.normalizeAttributeValue(v1)), ConditionResult.TRUE);
+    assertEquals(assert1.matches(rule.normalizeAttributeValue(v2)), ConditionResult.FALSE);
+
+    Assertion assert2 = rule.getLessOrEqualAssertion(v2);
+    assertEquals(assert2.matches(rule.normalizeAttributeValue(v1)), ConditionResult.TRUE);
+    assertEquals(assert2.matches(rule.normalizeAttributeValue(v2)), ConditionResult.TRUE);
+
+    Assertion assert3 = rule.getGreaterOrEqualAssertion(v2);
+    assertEquals(assert3.matches(rule.normalizeAttributeValue(v1)), ConditionResult.FALSE);
+    assertEquals(assert3.matches(rule.normalizeAttributeValue(v2)), ConditionResult.TRUE);
+
   }
 
   /**
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java
index d1b40c8..5b615fd 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/schema/OrderingMatchingRuleTest.java
@@ -26,7 +26,9 @@
  */
 package org.opends.server.schema;
 
+import org.forgerock.opendj.ldap.Assertion;
 import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
 import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.core.DirectoryServer;
@@ -54,26 +56,50 @@
    * Test the comparison of valid values.
    */
   @Test(dataProvider= "Orderingmatchingrules")
-  public void OrderingMatchingRules(String value1,String value2, int result)
+  public void testAssertionMatches(String attributeValue, String assertionValue, int expectedResult)
          throws Exception
   {
     // Make sure that the specified class can be instantiated as a task.
     OrderingMatchingRule ruleInstance = getRule();
 
-    // we should call initializeMatchingRule but they all seem empty at the
-    // moment.
+    // we should call initializeMatchingRule but they all seem empty at the moment.
     // ruleInstance.initializeMatchingRule(configEntry);
 
-    ByteString normalizedValue1 =
-      ruleInstance.normalizeAttributeValue(ByteString.valueOf(value1));
-    ByteString normalizedValue2 =
-      ruleInstance.normalizeAttributeValue(ByteString.valueOf(value2));
-    int res = ruleInstance.compareValues(normalizedValue1, normalizedValue2);
+    ByteString normalizedAttrValue = ruleInstance.normalizeAttributeValue(ByteString.valueOf(attributeValue));
+
+    Assertion assert1 = ruleInstance.getAssertion(ByteString.valueOf(assertionValue));
+    ConditionResult result = assert1.matches(normalizedAttrValue);
+    assertEquals(result.toBoolean(), expectedResult < 0);
+
+    Assertion assert2 = ruleInstance.getLessOrEqualAssertion(ByteString.valueOf(assertionValue));
+    ConditionResult result2 = assert2.matches(normalizedAttrValue);
+    assertEquals(result2.toBoolean(), expectedResult <= 0);
+
+    Assertion assert3 = ruleInstance.getGreaterOrEqualAssertion(ByteString.valueOf(assertionValue));
+    ConditionResult result3 = assert3.matches(normalizedAttrValue);
+    assertEquals(result3.toBoolean(), expectedResult >= 0);
+
+  }
+
+  /**
+   * Test the comparison of valid values.
+   */
+  @Test(dataProvider= "Orderingmatchingrules")
+  public void testComparison(String value1, String value2, int result) throws Exception
+  {
+    OrderingMatchingRule rule = getRule();
+
+    // we should call initializeMatchingRule but they all seem empty at the moment.
+    // ruleInstance.initializeMatchingRule(configEntry);
+
+    ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString.valueOf(value1));
+    ByteString normalizedValue2 = rule.normalizeAttributeValue(ByteString.valueOf(value2));
+    int res = rule.comparator().compare(normalizedValue1, normalizedValue2);
     if (result == 0)
     {
       if (res != 0)
       {
-        fail(ruleInstance + ".compareValues should return 0 for values " +
+        fail(rule + ".compareValues should return 0 for values " +
             value1 + " and " + value2);
       }
     }
@@ -81,7 +107,7 @@
     {
       if (res <= 0)
       {
-        fail(ruleInstance + ".compareValues should return a positive integer "
+        fail(rule + ".compareValues should return a positive integer "
             + "for values : " + value1 + " and " + value2);
       }
     }
@@ -89,7 +115,7 @@
     {
       if (res >= 0)
       {
-        fail(ruleInstance + ".compareValues should return a negative integer "
+        fail(rule + ".compareValues should return a negative integer "
             + "for values : " + value1 + " and " + value2);
       }
     }
@@ -116,7 +142,7 @@
    * Test that invalid values are rejected.
    */
   @Test(dataProvider= "OrderingMatchingRuleInvalidValues")
-  public void OrderingMatchingRulesInvalidValues(String value) throws Exception
+  public void orderingMatchingRulesInvalidValues(String value) throws Exception
   {
     // Make sure that the specified class can be instantiated as a task.
     OrderingMatchingRule ruleInstance = getRule();
@@ -140,7 +166,7 @@
    * Test that invalid values are rejected.
    */
   @Test(dataProvider= "OrderingMatchingRuleInvalidValues")
-  public void OrderingMatchingRulesInvalidValuesWarn(String value)
+  public void orderingMatchingRulesInvalidValuesWarn(String value)
          throws Exception
   {
     // Make sure that the specified class can be instantiated as a task.
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestAttributeType.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestAttributeType.java
index c5787af..4523423 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestAttributeType.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestAttributeType.java
@@ -35,7 +35,7 @@
 import org.forgerock.util.Utils;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.api.AttributeSyntax;
-import org.opends.server.api.OrderingMatchingRule;
+import org.opends.server.api.MatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.testng.Assert;
@@ -66,7 +66,7 @@
     private MatchingRule equalityMatchingRule;
 
     // The ordering matching rule for this attribute type.
-    private OrderingMatchingRule orderingMatchingRule;
+    private MatchingRule orderingMatchingRule;
 
     // The substring matching rule for this attribute type.
     private SubstringMatchingRule substringMatchingRule;
@@ -360,7 +360,7 @@
      *          The orderingMatchingRule.
      */
     public void setOrderingMatchingRule(
-        OrderingMatchingRule orderingMatchingRule) {
+        MatchingRule orderingMatchingRule) {
       this.orderingMatchingRule = orderingMatchingRule;
     }
 
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java
index 14c3e5b..ca8ab0d 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestDN.java
@@ -1129,14 +1129,10 @@
         { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 },
         { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 },
         { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 },
-        { "x-test-integer-type=10,dc=com",
-            "x-test-integer-type=9,dc=com", 1 },
-        { "x-test-integer-type=999,dc=com",
-            "x-test-integer-type=1000,dc=com", -1 },
-        { "x-test-integer-type=-1,dc=com",
-            "x-test-integer-type=0,dc=com", -1 },
-        { "x-test-integer-type=0,dc=com",
-            "x-test-integer-type=-1,dc=com", 1 },
+        { "x-test-integer-type=10,dc=com", "x-test-integer-type=9,dc=com", 1 },
+        { "x-test-integer-type=999,dc=com", "x-test-integer-type=1000,dc=com", -1 },
+        { "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", -1 },
+        { "x-test-integer-type=0,dc=com", "x-test-integer-type=-1,dc=com", 1 },
         { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 },
         { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 },
         { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 },

--
Gitblit v1.10.0