From b7b304994dd037ced0df2d5d04c1aa4d41c6bb72 Mon Sep 17 00:00:00 2001
From: sin <sin@localhost>
Date: Wed, 17 Dec 2008 19:25:45 +0000
Subject: [PATCH] Integerated first part of the Fix for Issue# 262:Plugin for Collation/Internationalization

---
 opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java                         |   16 
 opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRuleFactory.java                  |   72 
 opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java                                   |   13 
 opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRuleFactory.java                       |   72 
 opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRule.java                     |   12 
 opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java                          |   12 
 opends/src/server/org/opends/server/types/SearchFilter.java                                                |   13 
 opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRuleFactory.java                 |   72 
 opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRuleFactory.java                     |   71 
 opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java                                         |    2 
 opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRuleFactory.java                         |   72 
 opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java                        |   13 
 opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java                           |   12 
 opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java                                    |  437 +-
 opends/src/server/org/opends/server/schema/WordEqualityMatchingRule.java                                   |   12 
 opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java                         |   13 
 opends/resource/schema/02-config.ldif                                                                      |   15 
 opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java          |  365 ++
 opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRuleFactory.java                     |   72 
 opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRuleFactory.java                       |   70 
 opends/src/messages/messages/schema.properties                                                             |    5 
 opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRule.java                    |   12 
 opends/resource/config/config.ldif                                                                         |  261 +
 opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRule.java                            |   12 
 opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRule.java                      |   12 
 opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRuleFactory.java                      |   70 
 opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java                              |   12 
 opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRule.java                        |   12 
 opends/src/server/org/opends/server/api/MatchingRuleFactory.java                                           |  125 
 opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRuleFactory.java                    |   70 
 opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRule.java                             |   12 
 opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRule.java                                |   16 
 opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRuleFactory.java                     |   71 
 opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java                       |   12 
 opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRuleFactory.java                         |   71 
 opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRuleFactory.java             |   71 
 opends/tests/unit-tests-testng/src/server/org/opends/server/controls/MatchedValuesControlTest.java         |   24 
 opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java                                |   12 
 opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java                             |   10 
 opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRuleFactory.java                |   72 
 opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRuleFactory.java                       |   71 
 opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java                          |   12 
 opends/src/server/org/opends/server/api/EqualityMatchingRule.java                                          |    4 
 opends/src/server/org/opends/server/backends/SchemaBackend.java                                            |    4 
 opends/src/server/org/opends/server/util/StaticUtils.java                                                  |  162 +
 opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java                           |   12 
 opends/src/admin/defn/org/opends/server/admin/std/CollationMatchingRuleConfiguration.xml                   |  126 
 opends/src/server/org/opends/server/api/Backend.java                                                       |    4 
 opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java            |    1 
 opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRuleFactory.java                         |   71 
 opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleFactory.java  |   71 
 opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRuleFactory.java               |   73 
 opends/src/server/org/opends/server/types/Schema.java                                                      |  227 
 opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRuleFactory.java                  |   71 
 opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRuleFactory.java                            |   70 
 opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java                           |   28 
 opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRuleFactory.java                |   71 
 opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRuleFactory.java   |   71 
 opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRule.java                         |   12 
 opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRuleFactory.java           |   71 
 opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java                           |   12 
 opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualLengthApproximateMatchingRule.java |   13 
 opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRuleFactory.java                    |   68 
 opends/src/server/org/opends/server/api/MatchingRule.java                                                  |  110 
 opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java                      |   12 
 opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRuleFactory.java                            |   71 
 opends/src/server/org/opends/server/schema/WordEqualityMatchingRuleFactory.java                            |   71 
 opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRuleFactory.java                   |   71 
 opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRule.java                            |   12 
 opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java                        |   13 
 opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java                               | 2082 ++++++++++++++
 opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRule.java                      |   12 
 opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java                    |   72 
 opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRuleFactory.java                  |   71 
 opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRuleFactory.java                    |   71 
 opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRule.java         |   12 
 opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java                          |   12 
 opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java                                   |   12 
 opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRuleFactory.java                         |   72 
 opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java                              |   13 
 opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRuleFactory.java                 |   70 
 opends/src/admin/defn/org/opends/server/admin/std/MatchingRuleConfiguration.xml                            |    4 
 opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRule.java                        |   12 
 opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRuleFactory.java                 |   72 
 opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java              |   11 
 opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRule.java                           |   13 
 opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRuleFactory.java               |   71 
 opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java                            |   12 
 opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRule.java                  |   12 
 opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRuleFactory.java               |   71 
 opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRule.java                              |   21 
 opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRuleFactory.java                   |   70 
 opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRule.java          |   12 
 opends/src/server/org/opends/server/api/OrderingMatchingRule.java                                          |    3 
 opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRuleFactory.java                   |   71 
 opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRuleFactory.java                    |   72 
 opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRuleFactory.java                      |   71 
 opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRuleFactory.java                   |   71 
 opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRuleFactory.java             |   72 
 opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java                          |   12 
 opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRuleFactory.java              |   71 
 opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaTestMatchingRule.java           |   29 
 opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java                                |   12 
 opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java                       |   12 
 opends/src/server/org/opends/server/api/SubstringMatchingRule.java                                         |    4 
 opends/src/server/org/opends/server/core/DirectoryServer.java                                              |  541 ---
 /dev/null                                                                                                  |   48 
 opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRule.java                    |   14 
 opends/src/server/org/opends/server/api/ApproximateMatchingRule.java                                       |    3 
 opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java              |    2 
 opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleFactory.java       |   72 
 opends/src/server/org/opends/server/api/ExtensibleMatchingRule.java                                        |   46 
 opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRule.java                             |   10 
 opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRuleFactory.java                 |   72 
 opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java                                |   13 
 opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRuleFactory.java                      |   70 
 116 files changed, 6,997 insertions(+), 1,357 deletions(-)

diff --git a/opends/resource/config/config.ldif b/opends/resource/config/config.ldif
index f782b11..9f6f82a 100644
--- a/opends/resource/config/config.ldif
+++ b/opends/resource/config/config.ldif
@@ -832,7 +832,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Auth Password Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.AuthPasswordEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.AuthPasswordEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Auth Password Exact Equality Matching Rule,cn=Matching Rules,cn=config
@@ -840,7 +840,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Auth Password Exact Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.AuthPasswordExactEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.AuthPasswordExactEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Bit String Equality Matching Rule,cn=Matching Rules,cn=config
@@ -848,7 +848,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Bit String Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.BitStringEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.BitStringEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Boolean Equality Matching Rule,cn=Matching Rules,cn=config
@@ -856,7 +856,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Boolean Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.BooleanEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.BooleanEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Exact Equality Matching Rule,cn=Matching Rules,cn=config
@@ -864,7 +864,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Case Exact Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseExactEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseExactEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Exact Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -872,7 +872,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Case Exact Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseExactOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseExactOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Exact Substring Matching Rule,cn=Matching Rules,cn=config
@@ -880,7 +880,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Case Exact Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseExactSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseExactSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Exact IA5 Equality Matching Rule,cn=Matching Rules,cn=config
@@ -888,7 +888,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Case Exact IA5 Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseExactIA5EqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseExactIA5EqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Exact IA5 Substring Matching Rule,cn=Matching Rules,cn=config
@@ -896,7 +896,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Case Exact IA5 Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseExactIA5SubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseExactIA5SubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore Equality Matching Rule,cn=Matching Rules,cn=config
@@ -904,7 +904,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Case Ignore Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -912,7 +912,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Case Ignore Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore Substring Matching Rule,cn=Matching Rules,cn=config
@@ -920,7 +920,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Case Ignore Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore IA5 Equality Matching Rule,cn=Matching Rules,cn=config
@@ -928,7 +928,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Case Ignore IA5 Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreIA5EqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreIA5EqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore IA5 Substring Matching Rule,cn=Matching Rules,cn=config
@@ -936,7 +936,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Case Ignore IA5 Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreIA5SubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreIA5SubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore List Equality Matching Rule,cn=Matching Rules,cn=config
@@ -944,7 +944,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Case Ignore List Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreListEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreListEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Case Ignore List Substring Matching Rule,cn=Matching Rules,cn=config
@@ -952,15 +952,188 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Case Ignore List Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.CaseIgnoreListSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.CaseIgnoreListSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
+dn: cn=Collation Matching Rule,cn=Matching Rules,cn=config
+objectClass: top
+objectClass: ds-cfg-matching-rule
+objectClass: ds-cfg-collation-matching-rule
+cn: Collation Matching Rule
+ds-cfg-java-class: org.opends.server.schema.CollationMatchingRuleFactory
+ds-cfg-enabled: true
+ds-cfg-matching-rule-type: equality
+ds-cfg-matching-rule-type: less-than
+ds-cfg-matching-rule-type: less-than-or-equal-to
+ds-cfg-matching-rule-type: greater-than
+ds-cfg-matching-rule-type: greater-than-or-equal-to
+ds-cfg-matching-rule-type: substring
+#ds-cfg-collation: af:1.3.6.1.4.1.42.2.27.9.4.1.1
+#ds-cfg-collation: am:1.3.6.1.4.1.42.2.27.9.4.2.1
+ds-cfg-collation: ar:1.3.6.1.4.1.42.2.27.9.4.3.1
+ds-cfg-collation: ar-AE:1.3.6.1.4.1.42.2.27.9.4.4.1
+ds-cfg-collation: ar-BH:1.3.6.1.4.1.42.2.27.9.4.5.1
+ds-cfg-collation: ar-DZ:1.3.6.1.4.1.42.2.27.9.4.6.1
+ds-cfg-collation: ar-EG:1.3.6.1.4.1.42.2.27.9.4.7.1
+#ds-cfg-collation: ar-IN:1.3.6.1.4.1.42.2.27.9.4.8.1
+ds-cfg-collation: ar-IQ:1.3.6.1.4.1.42.2.27.9.4.9.1
+ds-cfg-collation: ar-JO:1.3.6.1.4.1.42.2.27.9.4.10.1
+ds-cfg-collation: ar-KW:1.3.6.1.4.1.42.2.27.9.4.11.1
+ds-cfg-collation: ar-LB:1.3.6.1.4.1.42.2.27.9.4.12.1
+ds-cfg-collation: ar-LY:1.3.6.1.4.1.42.2.27.9.4.13.1
+ds-cfg-collation: ar-MA:1.3.6.1.4.1.42.2.27.9.4.14.1
+ds-cfg-collation: ar-OM:1.3.6.1.4.1.42.2.27.9.4.15.1
+ds-cfg-collation: ar-QA:1.3.6.1.4.1.42.2.27.9.4.16.1
+ds-cfg-collation: ar-SA:1.3.6.1.4.1.42.2.27.9.4.17.1
+ds-cfg-collation: ar-SD:1.3.6.1.4.1.42.2.27.9.4.18.1
+ds-cfg-collation: ar-SY:1.3.6.1.4.1.42.2.27.9.4.19.1
+ds-cfg-collation: ar-TN:1.3.6.1.4.1.42.2.27.9.4.20.1
+ds-cfg-collation: ar-YE:1.3.6.1.4.1.42.2.27.9.4.21.1
+ds-cfg-collation: be:1.3.6.1.4.1.42.2.27.9.4.22.1
+ds-cfg-collation: bg:1.3.6.1.4.1.42.2.27.9.4.23.1
+#ds-cfg-collation: bn:1.3.6.1.4.1.42.2.27.9.4.24.1
+ds-cfg-collation: ca:1.3.6.1.4.1.42.2.27.9.4.25.1
+ds-cfg-collation: cs:1.3.6.1.4.1.42.2.27.9.4.26.1
+ds-cfg-collation: da:1.3.6.1.4.1.42.2.27.9.4.27.1
+ds-cfg-collation: de:1.3.6.1.4.1.142.2.27.9.4.28.1
+ds-cfg-collation: de-DE:1.3.6.1.4.1.142.2.27.9.4.28.1
+ds-cfg-collation: de-AT:1.3.6.1.4.1.42.2.27.9.4.29.1
+#ds-cfg-collation: de-BE:1.3.6.1.4.1.42.2.27.9.4.30.1
+ds-cfg-collation: de-CH:1.3.6.1.4.1.42.2.27.9.4.31.1
+ds-cfg-collation: de-LU:1.3.6.1.4.1.42.2.27.9.4.32.1
+ds-cfg-collation: el:1.3.6.1.4.1.42.2.27.9.4.33.1
+ds-cfg-collation: en:1.3.6.1.4.1.42.2.27.9.4.34.1
+ds-cfg-collation: en-US:1.3.6.1.4.1.42.2.27.9.4.34.1
+ds-cfg-collation: en-AU:1.3.6.1.4.1.42.2.27.9.4.35.1
+ds-cfg-collation: en-CA:1.3.6.1.4.1.42.2.27.9.4.36.1
+ds-cfg-collation: en-GB:1.3.6.1.4.1.42.2.27.9.4.37.1
+#ds-cfg-collation: en-HK:1.3.6.1.4.1.42.2.27.9.4.38.1
+ds-cfg-collation: en-IE:1.3.6.1.4.1.42.2.27.9.4.39.1
+ds-cfg-collation: en-IN:1.3.6.1.4.1.42.2.27.9.4.40.1
+#ds-cfg-collation: en-MT:1.3.6.1.4.1.42.2.27.9.4.41.1
+ds-cfg-collation: en-NZ:1.3.6.1.4.1.42.2.27.9.4.42.1
+#ds-cfg-collation: en-PH:1.3.6.1.4.1.42.2.27.9.4.43.1
+#ds-cfg-collation: en-SG:1.3.6.1.4.1.42.2.27.9.4.44.1
+#ds-cfg-collation: en-VI:1.3.6.1.4.1.42.2.27.9.4.45.1
+ds-cfg-collation: en-ZA:1.3.6.1.4.1.42.2.27.9.4.46.1
+#ds-cfg-collation: en-ZW:1.3.6.1.4.1.42.2.27.9.4.47.1
+#ds-cfg-collation: eo:1.3.6.1.4.1.42.2.27.9.4.48.1
+ds-cfg-collation: es:1.3.6.1.4.1.42.2.27.9.4.49.1
+ds-cfg-collation: es-ES:1.3.6.1.4.1.42.2.27.9.4.49.1
+ds-cfg-collation: es-AR:1.3.6.1.4.1.42.2.27.9.4.50.1
+ds-cfg-collation: es-BO:1.3.6.1.4.1.42.2.27.9.4.51.1
+ds-cfg-collation: es-CL:1.3.6.1.4.1.42.2.27.9.4.52.1
+ds-cfg-collation: es-CO:1.3.6.1.4.1.42.2.27.9.4.53.1
+ds-cfg-collation: es-CR:1.3.6.1.4.1.42.2.27.9.4.54.1
+ds-cfg-collation: es-DO:1.3.6.1.4.1.42.2.27.9.4.55.1
+ds-cfg-collation: es-EC:1.3.6.1.4.1.42.2.27.9.4.56.1
+ds-cfg-collation: es-GT:1.3.6.1.4.1.42.2.27.9.4.57.1
+ds-cfg-collation: es-HN:1.3.6.1.4.1.42.2.27.9.4.58.1
+ds-cfg-collation: es-MX:1.3.6.1.4.1.42.2.27.9.4.59.1
+ds-cfg-collation: es-NI:1.3.6.1.4.1.42.2.27.9.4.60.1
+ds-cfg-collation: es-PA:1.3.6.1.4.1.42.2.27.9.4.61.1
+ds-cfg-collation: es-PE:1.3.6.1.4.1.42.2.27.9.4.62.1
+ds-cfg-collation: es-PR:1.3.6.1.4.1.42.2.27.9.4.63.1
+ds-cfg-collation: es-PY:1.3.6.1.4.1.42.2.27.9.4.64.1
+ds-cfg-collation: es-SV:1.3.6.1.4.1.42.2.27.9.4.65.1
+#ds-cfg-collation: es-US:1.3.6.1.4.1.42.2.27.9.4.66.1
+ds-cfg-collation: es-UY:1.3.6.1.4.1.42.2.27.9.4.67.1
+ds-cfg-collation: es-VE:1.3.6.1.4.1.42.2.27.9.4.68.1
+ds-cfg-collation: et:1.3.6.1.4.1.42.2.27.9.4.69.1
+#ds-cfg-collation: eu:1.3.6.1.4.1.42.2.27.9.4.70.1
+#ds-cfg-collation: fa:1.3.6.1.4.1.42.2.27.9.4.71.1
+#ds-cfg-collation: fa-IN:1.3.6.1.4.1.42.2.27.9.4.72.1
+#ds-cfg-collation: fa-IR:1.3.6.1.4.1.42.2.27.9.4.73.1
+ds-cfg-collation: fi:1.3.6.1.4.1.42.2.27.9.4.74.1
+#ds-cfg-collation: fo:1.3.6.1.4.1.42.2.27.9.4.75.1
+ds-cfg-collation: fr:1.3.6.1.4.1.42.2.27.9.4.76.1
+ds-cfg-collation: fr-FR:1.3.6.1.4.1.42.2.27.9.4.76.1
+ds-cfg-collation: fr-BE:1.3.6.1.4.1.42.2.27.9.4.77.1
+ds-cfg-collation: fr-CA:1.3.6.1.4.1.42.2.27.9.4.78.1
+ds-cfg-collation: fr-CH:1.3.6.1.4.1.42.2.27.9.4.79.1
+ds-cfg-collation: fr-LU:1.3.6.1.4.1.42.2.27.9.4.80.1
+#ds-cfg-collation: ga:1.3.6.1.4.1.42.2.27.9.4.81.1
+#ds-cfg-collation: gl:1.3.6.1.4.1.42.2.27.9.4.82.1
+#ds-cfg-collation: gu:1.3.6.1.4.1.42.2.27.9.4.83.1
+#ds-cfg-collation: gv:1.3.6.1.4.1.42.2.27.9.4.84.1
+ds-cfg-collation: he:1.3.6.1.4.1.42.2.27.9.4.85.1
+#ds-cfg-collation: hi:1.3.6.1.4.1.42.2.27.9.4.86.1
+ds-cfg-collation: hr:1.3.6.1.4.1.42.2.27.9.4.87.1
+ds-cfg-collation: hu:1.3.6.1.4.1.42.2.27.9.4.88.1
+#ds-cfg-collation: hy:1.3.6.1.4.1.42.2.27.9.4.89.1
+#ds-cfg-collation: id:1.3.6.1.4.1.42.2.27.9.4.90.1
+ds-cfg-collation: is:1.3.6.1.4.1.42.2.27.9.4.91.1
+ds-cfg-collation: it:1.3.6.1.4.1.42.2.27.9.4.92.1
+ds-cfg-collation: it-CH:1.3.6.1.4.1.42.2.27.9.4.93.1
+ds-cfg-collation: ja:1.3.6.1.4.1.42.2.27.9.4.94.1
+#ds-cfg-collation: kl:1.3.6.1.4.1.42.2.27.9.4.95.1
+#ds-cfg-collation: kn:1.3.6.1.4.1.42.2.27.9.4.96.1
+ds-cfg-collation: ko:1.3.6.1.4.1.42.2.27.9.4.97.1
+#ds-cfg-collation: kok:1.3.6.1.4.1.42.2.27.9.4.98.1
+#ds-cfg-collation: kw:1.3.6.1.4.1.42.2.27.9.4.99.1
+ds-cfg-collation: lt:1.3.6.1.4.1.42.2.27.9.4.100.1
+ds-cfg-collation: lv:1.3.6.1.4.1.42.2.27.9.4.101.1
+ds-cfg-collation: mk:1.3.6.1.4.1.42.2.27.9.4.102.1
+#ds-cfg-collation: mr:1.3.6.1.4.1.42.2.27.9.4.103.1
+#ds-cfg-collation: mt:1.3.6.1.4.1.42.2.27.9.4.104.1
+ds-cfg-collation: nl:1.3.6.1.4.1.42.2.27.9.4.105.1
+ds-cfg-collation: nl-NL:1.3.6.1.4.1.42.2.27.9.4.105.1
+ds-cfg-collation: nl-BE:1.3.6.1.4.1.42.2.27.9.4.106.1
+ds-cfg-collation: no:1.3.6.1.4.1.42.2.27.9.4.107.1
+ds-cfg-collation: no-NO:1.3.6.1.4.1.42.2.27.9.4.107.1
+ds-cfg-collation: no-NO-NY:1.3.6.1.4.1.42.2.27.9.4.108.1
+#ds-cfg-collation: nn:1.3.6.1.4.1.42.2.27.9.4.109.1
+#ds-cfg-collation: nb:1.3.6.1.4.1.42.2.27.9.4.110.1
+#ds-cfg-collation: no-NO-B:1.3.6.1.4.1.42.2.27.9.4.110.1
+#ds-cfg-collation: om:1.3.6.1.4.1.42.2.27.9.4.111.1
+#ds-cfg-collation: om-ET:1.3.6.1.4.1.42.2.27.9.4.112.1
+#ds-cfg-collation: om-KE:1.3.6.1.4.1.42.2.27.9.4.113.1
+ds-cfg-collation: pl:1.3.6.1.4.1.42.2.27.9.4.114.1
+ds-cfg-collation: pt:1.3.6.1.4.1.42.2.27.9.4.115.1
+ds-cfg-collation: pt-PT:1.3.6.1.4.1.42.2.27.9.4.115.1
+ds-cfg-collation: pt-BR:1.3.6.1.4.1.42.2.27.9.4.116.1
+ds-cfg-collation: ro:1.3.6.1.4.1.42.2.27.9.4.117.1
+ds-cfg-collation: ru:1.3.6.1.4.1.42.2.27.9.4.118.1
+ds-cfg-collation: ru-RU:1.3.6.1.4.1.42.2.27.9.4.118.1
+#ds-cfg-collation: ru-UA:1.3.6.1.4.1.42.2.27.9.4.119.1
+#ds-cfg-collation: sh:1.3.6.1.4.1.42.2.27.9.4.120.1
+ds-cfg-collation: sk:1.3.6.1.4.1.42.2.27.9.4.121.1
+ds-cfg-collation: sl:1.3.6.1.4.1.42.2.27.9.4.122.1
+#ds-cfg-collation: so:1.3.6.1.4.1.42.2.27.9.4.123.1
+#ds-cfg-collation: so-SO:1.3.6.1.4.1.42.2.27.9.4.123.1
+#ds-cfg-collation: so-DJ:1.3.6.1.4.1.42.2.27.9.4.124.1
+#ds-cfg-collation: so-ET:1.3.6.1.4.1.42.2.27.9.4.125.1
+#ds-cfg-collation: so-KE:1.3.6.1.4.1.42.2.27.9.4.126.1
+ds-cfg-collation: sq:1.3.6.1.4.1.42.2.27.9.4.127.1
+ds-cfg-collation: sr:1.3.6.1.4.1.42.2.27.9.4.128.1
+ds-cfg-collation: sv:1.3.6.1.4.1.42.2.27.9.4.129.1
+ds-cfg-collation: sv-SE:1.3.6.1.4.1.42.2.27.9.4.129.1
+#ds-cfg-collation: sv-FI:1.3.6.1.4.1.42.2.27.9.4.130.1
+#ds-cfg-collation: sw:1.3.6.1.4.1.42.2.27.9.4.131.1
+#ds-cfg-collation: sw-KE:1.3.6.1.4.1.42.2.27.9.4.132.1
+#ds-cfg-collation: sw-TZ:1.3.6.1.4.1.42.2.27.9.4.133.1
+#ds-cfg-collation: ta:1 3  1.3.6.1.4.1.42.2.27.9.4.134.1
+#ds-cfg-collation: te:1.3.6.1.4.1.42.2.27.9.4.135.1
+ds-cfg-collation: th:1.3.6.1.4.1.42.2.27.9.4.136.1
+#ds-cfg-collation: ti:1.3.6.1.4.1.42.2.27.9.4.137.1
+#ds-cfg-collation: ti-ER:1.3.6.1.4.1.42.2.27.9.4.138.1
+#ds-cfg-collation: ti-ET:1.3.6.1.4.1.42.2.27.9.4.139.1
+ds-cfg-collation: tr:1.3.6.1.4.1.42.2.27.9.4.140.1
+ds-cfg-collation: uk:1.3.6.1.4.1.42.2.27.9.4.141.1
+ds-cfg-collation: vi:1.3.6.1.4.1.42.2.27.9.4.142.1
+ds-cfg-collation: zh:1.3.6.1.4.1.42.2.27.9.4.143.1
+ds-cfg-collation: zh-CN:1.3.6.1.4.1.42.2.27.9.4.144.1
+ds-cfg-collation: zh-HK:1.3.6.1.4.1.42.2.27.9.4.145.1
+#ds-cfg-collation: zh-MO:1.3.6.1.4.1.42.2.27.9.4.146.1
+#ds-cfg-collation: zh-SG:1.3.6.1.4.1.42.2.27.9.4.147.1
+ds-cfg-collation: zh-TW:1.3.6.1.4.1.42.2.27.9.4.148.1
+
 dn: cn=Directory String First Component Equality Matching Rule,cn=Matching Rules,cn=config
 objectClass: top
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Directory String First Component Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.DirectoryStringFirstComponentEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.DirectoryStringFirstComponentEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Distinguished Name Equality Matching Rule,cn=Matching Rules,cn=config
@@ -968,7 +1141,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Distinguished Name Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.DistinguishedNameEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.DistinguishedNameEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Double Metaphone Approximate Matching Rule,cn=Matching Rules,cn=config
@@ -976,7 +1149,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-approximate-matching-rule
 cn: Double Metaphone Approximate Matching Rule
-ds-cfg-java-class: org.opends.server.schema.DoubleMetaphoneApproximateMatchingRule
+ds-cfg-java-class: org.opends.server.schema.DoubleMetaphoneApproximateMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Generalized Time Equality Matching Rule,cn=Matching Rules,cn=config
@@ -984,7 +1157,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Generalized Time Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.GeneralizedTimeEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.GeneralizedTimeEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Generalized Time Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -992,14 +1165,14 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Generalized Time Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.GeneralizedTimeOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.GeneralizedTimeOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Historical CSN Ordering Matching Rule,cn=Matching Rules,cn=config
 objectClass: ds-cfg-ordering-matching-rule
 objectClass: top
 objectClass: ds-cfg-matching-rule
-ds-cfg-java-class: org.opends.server.replication.plugin.HistoricalCsnOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.replication.plugin.HistoricalCsnOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 cn: Historical CSN Ordering Matching Rule
 
@@ -1008,7 +1181,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Integer Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.IntegerEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.IntegerEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Integer Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -1016,7 +1189,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Integer Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.IntegerOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.IntegerOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Integer First Component Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1024,7 +1197,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Integer First Component Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.IntegerFirstComponentEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.IntegerFirstComponentEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Keyword Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1032,7 +1205,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Keyword Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.KeywordEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.KeywordEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Numeric String Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1040,7 +1213,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Numeric String Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.NumericStringEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.NumericStringEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Numeric String Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -1048,7 +1221,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Numeric String Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.NumericStringOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.NumericStringOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Numeric String Substring Matching Rule,cn=Matching Rules,cn=config
@@ -1056,7 +1229,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Numeric String Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.NumericStringSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.NumericStringSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Object Identifier Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1064,7 +1237,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Object Identifier Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.ObjectIdentifierEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.ObjectIdentifierEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Object Identifier First Component Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1072,7 +1245,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Object Identifier First Component Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.ObjectIdentifierFirstComponentEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.ObjectIdentifierFirstComponentEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Octet String Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1080,7 +1253,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Octet String Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.OctetStringEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.OctetStringEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Octet String Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -1088,7 +1261,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: Octet String Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.OctetStringOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.OctetStringOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Octet String Substring Matching Rule,cn=Matching Rules,cn=config
@@ -1096,7 +1269,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Octet String Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.OctetStringSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.OctetStringSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Presentation Address Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1104,7 +1277,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Presentation Address Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.PresentationAddressEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.PresentationAddressEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Protocol Information Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1112,7 +1285,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Protocol Information Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.ProtocolInformationEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.ProtocolInformationEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Telephone Number Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1120,7 +1293,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Telephone Number Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.TelephoneNumberEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.TelephoneNumberEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Telephone Number Substring Matching Rule,cn=Matching Rules,cn=config
@@ -1128,7 +1301,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-substring-matching-rule
 cn: Telephone Number Substring Matching Rule
-ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSubstringMatchingRule
+ds-cfg-java-class: org.opends.server.schema.TelephoneNumberSubstringMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Unique Member Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1136,7 +1309,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Unique Member Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.UniqueMemberEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.UniqueMemberEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=User Password Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1144,7 +1317,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: User Password Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.UserPasswordEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.UserPasswordEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=User Password Exact Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1152,7 +1325,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: User Password Exact Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.UserPasswordExactEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.UserPasswordExactEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=UUID Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1160,7 +1333,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: UUID Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.UUIDEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.UUIDEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=UUID Ordering Matching Rule,cn=Matching Rules,cn=config
@@ -1168,7 +1341,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-ordering-matching-rule
 cn: UUID Ordering Matching Rule
-ds-cfg-java-class: org.opends.server.schema.UUIDOrderingMatchingRule
+ds-cfg-java-class: org.opends.server.schema.UUIDOrderingMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Word Equality Matching Rule,cn=Matching Rules,cn=config
@@ -1176,7 +1349,7 @@
 objectClass: ds-cfg-matching-rule
 objectClass: ds-cfg-equality-matching-rule
 cn: Word Equality Matching Rule
-ds-cfg-java-class: org.opends.server.schema.WordEqualityMatchingRule
+ds-cfg-java-class: org.opends.server.schema.WordEqualityMatchingRuleFactory
 ds-cfg-enabled: true
 
 dn: cn=Monitor Providers,cn=config
diff --git a/opends/resource/schema/02-config.ldif b/opends/resource/schema/02-config.ldif
index 137ba88..87031c9 100644
--- a/opends/resource/schema/02-config.ldif
+++ b/opends/resource/schema/02-config.ldif
@@ -2354,6 +2354,14 @@
   NAME 'ds-cfg-prohibited-subtrees'
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.12
   X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.499
+  NAME 'ds-cfg-matching-rule-type'
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  X-ORIGIN 'OpenDS Directory Server' )
+attributeTypes: ( 1.3.6.1.4.1.26027.1.1.500
+  NAME 'ds-cfg-collation'
+  SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
+  X-ORIGIN 'OpenDS Directory Server' )
 attributeTypes: ( 1.3.6.1.4.1.26027.1.1.511
   NAME 'ds-cfg-quality-of-protection'
   SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
@@ -3966,6 +3974,13 @@
         ds-cfg-allowed-subtrees $
         ds-cfg-prohibited-subtrees )
   X-ORIGIN 'OpenDS Directory Server' )
+objectClasses: ( 1.3.6.1.4.1.26027.1.2.195
+  NAME 'ds-cfg-collation-matching-rule'
+  SUP ds-cfg-matching-rule
+  STRUCTURAL
+  MUST ( ds-cfg-matching-rule-type $
+        ds-cfg-collation )
+  X-ORIGIN 'OpenDS Directory Server' )
 objectClasses: ( 1.3.6.1.4.1.26027.1.2.950
   NAME 'ds-mon-branch'
   SUP top
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/ApproximateMatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/ApproximateMatchingRuleConfiguration.xml
deleted file mode 100644
index 5aba968..0000000
--- a/opends/src/admin/defn/org/opends/server/admin/std/ApproximateMatchingRuleConfiguration.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ! CDDL HEADER START
-  !
-  ! The contents of this file are subject to the terms of the
-  ! Common Development and Distribution License, Version 1.0 only
-  ! (the "License").  You may not use this file except in compliance
-  ! with the License.
-  !
-  ! You can obtain a copy of the license at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
-  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-  ! See the License for the specific language governing permissions
-  ! and limitations under the License.
-  !
-  ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
-  !      Portions Copyright [yyyy] [name of copyright owner]
-  !
-  ! CDDL HEADER END
-  !
-  !
-  !      Copyright 2007-2008 Sun Microsystems, Inc.
-  ! -->
-<adm:managed-object name="approximate-matching-rule"
-  plural-name="approximate-matching-rules"
-  package="org.opends.server.admin.std" extends="matching-rule"
-  xmlns:adm="http://www.opends.org/admin"
-  xmlns:ldap="http://www.opends.org/admin-ldap">
-  <adm:synopsis>
-    <adm:user-friendly-plural-name />
-    define a set of rules for performing approximate matching operations
-    against assertion values. In many cases, approximate matching is
-    based on a "sounds like" operation.
-  </adm:synopsis>
-  <adm:profile name="ldap">
-    <ldap:object-class>
-      <ldap:name>ds-cfg-approximate-matching-rule</ldap:name>
-      <ldap:superior>ds-cfg-matching-rule</ldap:superior>
-    </ldap:object-class>
-  </adm:profile>
-</adm:managed-object>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/CollationMatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/CollationMatchingRuleConfiguration.xml
new file mode 100644
index 0000000..86e7c06
--- /dev/null
+++ b/opends/src/admin/defn/org/opends/server/admin/std/CollationMatchingRuleConfiguration.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ! CDDL HEADER START
+ !
+ ! The contents of this file are subject to the terms of the
+ ! Common Development and Distribution License, Version 1.0 only
+ ! (the "License").  You may not use this file except in compliance
+ ! with the License.
+ !
+ ! You can obtain a copy of the license at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ ! See the License for the specific language governing permissions
+ ! and limitations under the License.
+ !
+ ! When distributing Covered Code, include this CDDL HEADER in each
+ ! file and include the License file at
+ ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ ! add the following below this CDDL HEADER, with the fields enclosed
+ ! by brackets "[]" replaced with your own identifying information:
+ !      Portions Copyright [yyyy] [name of copyright owner]
+ !
+ ! CDDL HEADER END
+ !
+ !
+ !      Copyright 2008 Sun Microsystems, Inc.
+ ! -->
+<adm:managed-object name="collation-matching-rule"
+ plural-name="collation-matching-rules"
+ package="org.opends.server.admin.std" extends="matching-rule"
+ xmlns:adm="http://www.opends.org/admin"
+ xmlns:ldap="http://www.opends.org/admin-ldap">
+ <adm:synopsis>
+   <adm:user-friendly-plural-name />
+   provide support for locale-specific filtering and indexing.
+ </adm:synopsis>
+ <adm:profile name="ldap">
+   <ldap:object-class>
+     <ldap:name>ds-cfg-collation-matching-rule</ldap:name>
+     <ldap:superior>ds-cfg-matching-rule</ldap:superior>
+   </ldap:object-class>
+ </adm:profile>
+ <adm:property name="matching-rule-type" multi-valued="true" mandatory="true">
+   <adm:synopsis>
+     the types of matching rules that should be supported for each locale
+   </adm:synopsis>
+   <adm:syntax>
+     <adm:enumeration>
+        <adm:value name="equality">
+          <adm:synopsis>
+            Specifies if equality type collation matching rule needs to
+            be created for each locale.
+          </adm:synopsis>
+        </adm:value>
+        <adm:value name="less-than">
+          <adm:synopsis>
+            Specifies if less-than type collation matching rule needs to
+            be created for each locale.
+          </adm:synopsis>
+        </adm:value>
+        <adm:value name="less-than-or-equal-to">
+          <adm:synopsis>
+            Specifies if less-than-or-equal-to type collation matching rule
+            needs to be created for each locale.
+          </adm:synopsis>
+        </adm:value>
+        <adm:value name="greater-than">
+          <adm:synopsis>
+            Specifies if greater-than type collation matching rule needs
+            to be created for each locale.
+          </adm:synopsis>
+        </adm:value>
+        <adm:value name="greater-than-or-equal-to">
+          <adm:synopsis>
+            Specifies if greater-than-or-equal-to type collation matching rule
+            needs to be created for each locale.
+          </adm:synopsis>
+        </adm:value>
+        <adm:value name="substring">
+          <adm:synopsis>
+            Specifies if substring type collation matching rule needs to be
+            created for each locale.
+          </adm:synopsis>
+        </adm:value>
+      </adm:enumeration>
+   </adm:syntax>
+   <adm:profile name="ldap">
+     <ldap:attribute>
+       <ldap:name>ds-cfg-matching-rule-type</ldap:name>
+     </ldap:attribute>
+   </adm:profile>
+ </adm:property>
+   <adm:property name="collation" multi-valued="true" mandatory="true">
+   <adm:synopsis>
+     the set of supported locales
+   </adm:synopsis>
+   <adm:description>
+      Collation must be specified using the syntax: LOCALE:OID
+    </adm:description>
+   <adm:syntax>
+     <adm:string>
+       <adm:pattern>
+          <adm:regex>^[a-z-A-Z]+:[0-9.]+\\d$</adm:regex>
+          <adm:usage>LOCALE:OID</adm:usage>
+          <adm:synopsis>
+            A Locale followed by a ":" and an OID.
+          </adm:synopsis>
+        </adm:pattern>
+       </adm:string>
+   </adm:syntax>
+   <adm:profile name="ldap">
+     <ldap:attribute>
+       <ldap:name>ds-cfg-collation</ldap:name>
+     </ldap:attribute>
+   </adm:profile>
+ </adm:property>
+ <adm:property-override name="java-class" advanced="true">
+    <adm:default-behavior>
+      <adm:defined>
+        <adm:value>
+          org.opends.server.schema.CollationMatchingRuleFactory
+        </adm:value>
+      </adm:defined>
+    </adm:default-behavior>
+  </adm:property-override>
+</adm:managed-object>
\ No newline at end of file
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/EqualityMatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/EqualityMatchingRuleConfiguration.xml
deleted file mode 100644
index 6fa9d83..0000000
--- a/opends/src/admin/defn/org/opends/server/admin/std/EqualityMatchingRuleConfiguration.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ! CDDL HEADER START
-  !
-  ! The contents of this file are subject to the terms of the
-  ! Common Development and Distribution License, Version 1.0 only
-  ! (the "License").  You may not use this file except in compliance
-  ! with the License.
-  !
-  ! You can obtain a copy of the license at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
-  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-  ! See the License for the specific language governing permissions
-  ! and limitations under the License.
-  !
-  ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
-  !      Portions Copyright [yyyy] [name of copyright owner]
-  !
-  ! CDDL HEADER END
-  !
-  !
-  !      Copyright 2007-2008 Sun Microsystems, Inc.
-  ! -->
-<adm:managed-object name="equality-matching-rule"
-  plural-name="equality-matching-rules"
-  package="org.opends.server.admin.std" extends="matching-rule"
-  xmlns:adm="http://www.opends.org/admin"
-  xmlns:ldap="http://www.opends.org/admin-ldap">
-  <adm:synopsis>
-    <adm:user-friendly-plural-name />
-    define a set of rules for performing equality matching operations
-    against assertion values (that is, to determine whether an attribute
-    value equals an assertion value).
-  </adm:synopsis>
-  <adm:profile name="ldap">
-    <ldap:object-class>
-      <ldap:name>ds-cfg-equality-matching-rule</ldap:name>
-      <ldap:superior>ds-cfg-matching-rule</ldap:superior>
-    </ldap:object-class>
-  </adm:profile>
-</adm:managed-object>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/MatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/MatchingRuleConfiguration.xml
index 192431d..abff5eb 100644
--- a/opends/src/admin/defn/org/opends/server/admin/std/MatchingRuleConfiguration.xml
+++ b/opends/src/admin/defn/org/opends/server/admin/std/MatchingRuleConfiguration.xml
@@ -26,7 +26,7 @@
   !      Copyright 2007-2008 Sun Microsystems, Inc.
   ! -->
 <adm:managed-object name="matching-rule" plural-name="matching-rules"
-  package="org.opends.server.admin.std" abstract="true"
+  package="org.opends.server.admin.std"
   xmlns:adm="http://www.opends.org/admin"
   xmlns:ldap="http://www.opends.org/admin-ldap">
   <adm:synopsis>
@@ -73,7 +73,7 @@
     <adm:syntax>
       <adm:java-class>
         <adm:instance-of>
-          org.opends.server.api.MatchingRule
+          org.opends.server.api.MatchingRuleFactory
         </adm:instance-of>
       </adm:java-class>
     </adm:syntax>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/OrderingMatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/OrderingMatchingRuleConfiguration.xml
deleted file mode 100644
index 6113933..0000000
--- a/opends/src/admin/defn/org/opends/server/admin/std/OrderingMatchingRuleConfiguration.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ! CDDL HEADER START
-  !
-  ! The contents of this file are subject to the terms of the
-  ! Common Development and Distribution License, Version 1.0 only
-  ! (the "License").  You may not use this file except in compliance
-  ! with the License.
-  !
-  ! You can obtain a copy of the license at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
-  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-  ! See the License for the specific language governing permissions
-  ! and limitations under the License.
-  !
-  ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
-  !      Portions Copyright [yyyy] [name of copyright owner]
-  !
-  ! CDDL HEADER END
-  !
-  !
-  !      Copyright 2007-2008 Sun Microsystems, Inc.
-  ! -->
-<adm:managed-object name="ordering-matching-rule"
-  plural-name="ordering-matching-rules"
-  package="org.opends.server.admin.std" extends="matching-rule"
-  xmlns:adm="http://www.opends.org/admin"
-  xmlns:ldap="http://www.opends.org/admin-ldap">
-  <adm:synopsis>
-    <adm:user-friendly-plural-name />
-    define a set of rules for performing ordering matching operations
-    against assertion values.
-  </adm:synopsis>
-  <adm:description>
-    These matching rules are used for greater-than-or-equal and
-    less-than-or-equal comparisons, as well as for sorting.
-  </adm:description>
-  <adm:profile name="ldap">
-    <ldap:object-class>
-      <ldap:name>ds-cfg-ordering-matching-rule</ldap:name>
-      <ldap:superior>ds-cfg-matching-rule</ldap:superior>
-    </ldap:object-class>
-  </adm:profile>
-</adm:managed-object>
diff --git a/opends/src/admin/defn/org/opends/server/admin/std/SubstringMatchingRuleConfiguration.xml b/opends/src/admin/defn/org/opends/server/admin/std/SubstringMatchingRuleConfiguration.xml
deleted file mode 100644
index 58e5e0a..0000000
--- a/opends/src/admin/defn/org/opends/server/admin/std/SubstringMatchingRuleConfiguration.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ! CDDL HEADER START
-  !
-  ! The contents of this file are subject to the terms of the
-  ! Common Development and Distribution License, Version 1.0 only
-  ! (the "License").  You may not use this file except in compliance
-  ! with the License.
-  !
-  ! You can obtain a copy of the license at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE
-  ! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
-  ! See the License for the specific language governing permissions
-  ! and limitations under the License.
-  !
-  ! When distributing Covered Code, include this CDDL HEADER in each
-  ! file and include the License file at
-  ! trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
-  ! add the following below this CDDL HEADER, with the fields enclosed
-  ! by brackets "[]" replaced with your own identifying information:
-  !      Portions Copyright [yyyy] [name of copyright owner]
-  !
-  ! CDDL HEADER END
-  !
-  !
-  !      Copyright 2007-2008 Sun Microsystems, Inc.
-  ! -->
-<adm:managed-object name="substring-matching-rule"
-  plural-name="substring-matching-rules"
-  package="org.opends.server.admin.std" extends="matching-rule"
-  xmlns:adm="http://www.opends.org/admin"
-  xmlns:ldap="http://www.opends.org/admin-ldap">
-  <adm:synopsis>
-    <adm:user-friendly-plural-name />
-    define a set of rules for performing substring matching operations
-    against assertion values.
-  </adm:synopsis>
-  <adm:description>
-    Substring matching can be used to perform partial matching with
-    attribute values.
-  </adm:description>
-  <adm:profile name="ldap">
-    <ldap:object-class>
-      <ldap:name>ds-cfg-substring-matching-rule</ldap:name>
-      <ldap:superior>ds-cfg-matching-rule</ldap:superior>
-    </ldap:object-class>
-  </adm:profile>
-</adm:managed-object>
diff --git a/opends/src/messages/messages/schema.properties b/opends/src/messages/messages/schema.properties
index f33e679..e3304d5 100644
--- a/opends/src/messages/messages/schema.properties
+++ b/opends/src/messages/messages/schema.properties
@@ -912,3 +912,8 @@
  %s is not a valid generalized time value because it represents an invalid \
  time (e.g., a date that does not exist):  %s
 NOTICE_SCHEMA_IMPORT_FAILED_279=A schema element could not be imported: %s, %s
+MILD_WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_LOCALE_280=The collation \
+ rule %s under matching rule entry %s is invalid as the locale %s is not supported \
+ by JVM
+MILD_WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_FORMAT_281=The provided \
+ collation rule %s does not contain a valid format of OID:LOCALE
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/api/ApproximateMatchingRule.java b/opends/src/server/org/opends/server/api/ApproximateMatchingRule.java
index f5285f3..7a7c557 100644
--- a/opends/src/server/org/opends/server/api/ApproximateMatchingRule.java
+++ b/opends/src/server/org/opends/server/api/ApproximateMatchingRule.java
@@ -28,7 +28,6 @@
 
 
 
-import org.opends.server.admin.std.server.ApproximateMatchingRuleCfg;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 
@@ -45,7 +44,7 @@
      mayExtend=true,
      mayInvoke=false)
 public abstract class ApproximateMatchingRule
-       extends MatchingRule<ApproximateMatchingRuleCfg>
+       extends MatchingRule
 {
   /**
    * Indicates whether the two provided normalized values are
diff --git a/opends/src/server/org/opends/server/api/Backend.java b/opends/src/server/org/opends/server/api/Backend.java
index 12fa4cd..d6d9a79 100644
--- a/opends/src/server/org/opends/server/api/Backend.java
+++ b/opends/src/server/org/opends/server/api/Backend.java
@@ -284,7 +284,7 @@
    *          {@code false} if not.
    */
   public boolean isIndexed(AttributeType attributeType,
-                           MatchingRule<?> matchingRule)
+                           MatchingRule matchingRule)
   {
     return false;
   }
@@ -379,7 +379,7 @@
           return false;
         }
 
-        MatchingRule<?> matchingRule;
+        MatchingRule matchingRule;
         String matchingRuleID = filter.getMatchingRuleID();
         if (matchingRuleID != null)
         {
diff --git a/opends/src/server/org/opends/server/api/EqualityMatchingRule.java b/opends/src/server/org/opends/server/api/EqualityMatchingRule.java
index 9498df9..b240484 100644
--- a/opends/src/server/org/opends/server/api/EqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/api/EqualityMatchingRule.java
@@ -28,7 +28,6 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
@@ -49,8 +48,7 @@
      mayInstantiate=false,
      mayExtend=true,
      mayInvoke=false)
-public abstract class EqualityMatchingRule
-       extends MatchingRule<EqualityMatchingRuleCfg>
+public abstract class EqualityMatchingRule extends MatchingRule
 {
   /**
    * The tracer object for the debug logger.
diff --git a/opends/src/server/org/opends/server/api/ExtensibleMatchingRule.java b/opends/src/server/org/opends/server/api/ExtensibleMatchingRule.java
new file mode 100644
index 0000000..6b25a58
--- /dev/null
+++ b/opends/src/server/org/opends/server/api/ExtensibleMatchingRule.java
@@ -0,0 +1,46 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+package org.opends.server.api;
+
+
+
+/**
+ * This class defines the set of methods and structures that must be
+ * implemented by a Directory Server module that implements an
+ * Extensible matching rule.
+ */
+@org.opends.server.types.PublicAPI(
+     stability=org.opends.server.types.StabilityLevel.VOLATILE,
+     mayInstantiate=false,
+     mayExtend=true,
+     mayInvoke=false)
+public abstract class ExtensibleMatchingRule extends MatchingRule
+{
+
+  //TODO: Index Implementation.
+
+}
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/api/MatchingRule.java b/opends/src/server/org/opends/server/api/MatchingRule.java
index 23586ee..9de97f5 100644
--- a/opends/src/server/org/opends/server/api/MatchingRule.java
+++ b/opends/src/server/org/opends/server/api/MatchingRule.java
@@ -25,18 +25,11 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.api;
-import org.opends.messages.Message;
 
-
-
-import java.util.List;
-
-import org.opends.server.admin.std.server.MatchingRuleCfg;
-import org.opends.server.config.ConfigException;
+import java.util.Collection;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 
 
@@ -44,81 +37,15 @@
  * This class defines the set of methods and structures that must be
  * implemented by a Directory Server module that implements a matching
  * rule.
- *
- * @param  <T>  The type of configuration handled by this matching
- *              rule.
  */
 @org.opends.server.types.PublicAPI(
      stability=org.opends.server.types.StabilityLevel.VOLATILE,
      mayInstantiate=false,
      mayExtend=true,
      mayInvoke=false)
-public abstract class MatchingRule<T extends MatchingRuleCfg>
+public abstract class MatchingRule
 {
   /**
-   * Initializes this matching rule based on the information in the
-   * provided configuration entry.
-   *
-   * @param  configuration  The configuration to use to intialize this
-   *                        matching rule.
-   *
-   * @throws  ConfigException  If an unrecoverable problem arises in
-   *                           the process of performing the
-   *                           initialization.
-   *
-   * @throws  InitializationException  If a problem that is not
-   *                                   configuration-related occurs
-   *                                   during initialization.
-   */
-  public abstract void initializeMatchingRule(T configuration)
-         throws ConfigException, InitializationException;
-
-
-
-  /**
-   * Indicates whether the provided configuration is acceptable for
-   * this matching rule.  It should be possible to call this method on
-   * an uninitialized matching rule instance in order to determine
-   * whether the matching rule would be able to use the provided
-   * configuration.
-   * <BR><BR>
-   * Note that implementations which use a subclass of the provided
-   * configuration class will likely need to cast the configuration
-   * to the appropriate subclass type.
-   *
-   * @param  configuration        The matching rule configuration for
-   *                              which to make the determination.
-   * @param  unacceptableReasons  A list that may be used to hold the
-   *                              reasons that the provided
-   *                              configuration is not acceptable.
-   *
-   * @return  {@code true} if the provided configuration is acceptable
-   *          for this matching rule, or {@code false} if not.
-   */
-  public boolean isConfigurationAcceptable(
-                      MatchingRuleCfg configuration,
-                      List<Message> unacceptableReasons)
-  {
-    // This default implementation does not perform any special
-    // validation.  It should be overridden by matching rule
-    // implementations that wish to perform more detailed validation.
-    return true;
-  }
-
-
-
-  /**
-   * Performs any finalization that may be needed whenever this
-   * matching rule is taken out of service.
-   */
-  public void finalizeMatchingRule()
-  {
-    // No implementation is required by default.
-  }
-
-
-
-  /**
    * Retrieves the common name for this matching rule.
    *
    * @return  The common name for this matching rule, or {@code null}
@@ -129,6 +56,15 @@
 
 
   /**
+   * Retrieves all names for this matching rule.
+   *
+   * @return  All names for this matching rule.
+   */
+  public abstract Collection<String> getAllNames();
+
+
+
+  /**
    * Retrieves the OID for this matching rule.
    *
    * @return  The OID for this matching rule.
@@ -137,6 +73,28 @@
 
 
 
+ /**
+   * Retrieves the normalized form of the provided assertion value,
+   * which is best suite for efficiently performing matching
+   * operations on that value.
+   *
+   * @param  value  The assertion value to be normalized.
+   *
+   * @return  The normalized version of the provided value.
+   *
+   * @throws  DirectoryException  If the provided value is invalid
+   *                              according to the associated
+   *                              attribute syntax.
+   */
+  public ByteString normalizeAssertionValue(ByteString value)
+         throws DirectoryException
+  {
+    // Default implementation is to use attribute value normalization.
+     return normalizeValue(value);
+  }
+
+
+
   /**
    * Retrieves the name or OID for this matching rule.  If it has a
    * name, then it will be returned.  Otherwise, the OID will be
@@ -322,7 +280,7 @@
     buffer.append("( ");
     buffer.append(getOID());
     buffer.append(" NAME '");
-    buffer.append(getName());
+      buffer.append(getName());
 
     String description = getDescription();
     if ((description != null) && (description.length() > 0))
diff --git a/opends/src/server/org/opends/server/api/MatchingRuleFactory.java b/opends/src/server/org/opends/server/api/MatchingRuleFactory.java
new file mode 100644
index 0000000..4106b46
--- /dev/null
+++ b/opends/src/server/org/opends/server/api/MatchingRuleFactory.java
@@ -0,0 +1,125 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+package org.opends.server.api;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.config.ConfigException;
+import org.opends.messages.Message;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class defines the set of methods and structures that must be
+ * implemented by a Directory Server module that implements a matching
+ * rule factory.
+ *
+ * @param  <T>  The type of configuration handled by this matching
+ *              rule.
+ */
+@org.opends.server.types.PublicAPI(
+     stability=org.opends.server.types.StabilityLevel.VOLATILE,
+     mayInstantiate=false,
+     mayExtend=true,
+     mayInvoke=false)
+public abstract class MatchingRuleFactory<T extends MatchingRuleCfg>
+{
+
+  /**
+   * Initializes the matching rule(s) based on the information in the
+   * provided configuration entry.
+   *
+   * @param  configuration  The configuration to use to intialize this
+   *                        matching rule.
+   *
+   * @throws  ConfigException  If an unrecoverable problem arises in
+   *                           the process of performing the
+   *                           initialization.
+   *
+   * @throws  InitializationException  If a problem that is not
+   *                                   configuration-related occurs
+   *                                   during initialization.
+   */
+  public abstract void initializeMatchingRule(T configuration)
+         throws ConfigException, InitializationException;
+
+
+
+  /**
+   * Performs any finalization that may be needed whenever this
+   * matching rule factory is taken out of service.
+   */
+  public  void finalizeMatchingRule()
+  {
+    //No implementation is required by default.
+  }
+
+
+
+  /**
+   * Indicates whether the provided configuration is acceptable for
+   * this matching rule.  It should be possible to call this method on
+   * an uninitialized matching rule instance in order to determine
+   * whether the matching rule would be able to use the provided
+   * configuration.
+   * <BR><BR>
+   * Note that implementations which use a subclass of the provided
+   * configuration class will likely need to cast the configuration
+   * to the appropriate subclass type.
+   *
+   * @param  configuration        The matching rule configuration for
+   *                              which to make the determination.
+   * @param  unacceptableReasons  A list that may be used to hold the
+   *                              reasons that the provided
+   *                              configuration is not acceptable.
+   *
+   * @return  {@code true} if the provided configuration is acceptable
+   *          for this matching rule, or {@code false} if not.
+   */
+  public  boolean isConfigurationAcceptable(
+                      T configuration,
+                      List<Message> unacceptableReasons)
+  {
+    // This default implementation does not perform any special
+    // validation.  It should be overridden by matching rule
+    // implementations that wish to perform more detailed validation.
+    return true;
+  }
+
+
+
+  /**
+   * Returns an umodifiable view of Collection of associated
+   * MatchingRules.
+   *
+   * @return  An unmodifiable view of Collection of
+   *          MatchingRule instances.
+   */
+  public abstract Collection<MatchingRule> getMatchingRules();
+}
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/api/OrderingMatchingRule.java b/opends/src/server/org/opends/server/api/OrderingMatchingRule.java
index 1341fd6..e179685 100644
--- a/opends/src/server/org/opends/server/api/OrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/api/OrderingMatchingRule.java
@@ -31,7 +31,6 @@
 import java.io.Serializable;
 import java.util.Comparator;
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 
@@ -49,7 +48,7 @@
      mayExtend=true,
      mayInvoke=false)
 public abstract class OrderingMatchingRule
-       extends MatchingRule<OrderingMatchingRuleCfg>
+       extends MatchingRule
        implements Comparator<byte[]>, Serializable
 {
   /**
diff --git a/opends/src/server/org/opends/server/api/SubstringMatchingRule.java b/opends/src/server/org/opends/server/api/SubstringMatchingRule.java
index 98f401f..c596465 100644
--- a/opends/src/server/org/opends/server/api/SubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/api/SubstringMatchingRule.java
@@ -30,7 +30,6 @@
 
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
@@ -47,8 +46,7 @@
      mayInstantiate=false,
      mayExtend=true,
      mayInvoke=false)
-public abstract class SubstringMatchingRule
-       extends MatchingRule<SubstringMatchingRuleCfg>
+public abstract class SubstringMatchingRule extends MatchingRule
 {
   /**
    * Normalizes the provided value fragment into a form that can be
diff --git a/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opends/src/server/org/opends/server/backends/SchemaBackend.java
index f52d42f..89f10d0 100644
--- a/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -1639,7 +1639,7 @@
 
 
     // Make sure that none of the associated matching rules are marked OBSOLETE.
-    MatchingRule<?> mr = attributeType.getEqualityMatchingRule();
+    MatchingRule mr = attributeType.getEqualityMatchingRule();
     if ((mr != null) && mr.isObsolete())
     {
       Message message = ERR_SCHEMA_MODIFY_ATTRTYPE_OBSOLETE_MR.get(
@@ -3058,7 +3058,7 @@
     // matching rule.  If there is, then it will only be acceptable if it's the
     // matching rule use that we are replacing (in which case we really do want
     // to use the "!=" operator).
-    MatchingRule<?> matchingRule = matchingRuleUse.getMatchingRule();
+    MatchingRule matchingRule = matchingRuleUse.getMatchingRule();
     MatchingRuleUse existingMRUForRule =
          schema.getMatchingRuleUse(matchingRule);
     if ((existingMRUForRule != null) && (existingMRUForRule != existingMRU))
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 780386e..4a6e736 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -103,38 +103,38 @@
 import org.opends.server.monitors.ConnectionHandlerMonitor;
 import org.opends.server.schema.AttributeTypeSyntax;
 import org.opends.server.schema.BinarySyntax;
-import org.opends.server.schema.BooleanEqualityMatchingRule;
+import org.opends.server.schema.BooleanEqualityMatchingRuleFactory;
 import org.opends.server.schema.BooleanSyntax;
-import org.opends.server.schema.CaseExactEqualityMatchingRule;
-import org.opends.server.schema.CaseExactIA5EqualityMatchingRule;
-import org.opends.server.schema.CaseExactIA5SubstringMatchingRule;
-import org.opends.server.schema.CaseExactOrderingMatchingRule;
-import org.opends.server.schema.CaseExactSubstringMatchingRule;
-import org.opends.server.schema.CaseIgnoreEqualityMatchingRule;
-import org.opends.server.schema.CaseIgnoreIA5EqualityMatchingRule;
-import org.opends.server.schema.CaseIgnoreIA5SubstringMatchingRule;
-import org.opends.server.schema.CaseIgnoreOrderingMatchingRule;
-import org.opends.server.schema.CaseIgnoreSubstringMatchingRule;
+import org.opends.server.schema.CaseExactEqualityMatchingRuleFactory;
+import org.opends.server.schema.CaseExactIA5EqualityMatchingRuleFactory;
+import org.opends.server.schema.CaseExactIA5SubstringMatchingRuleFactory;
+import org.opends.server.schema.CaseExactOrderingMatchingRuleFactory;
+import org.opends.server.schema.CaseExactSubstringMatchingRuleFactory;
+import org.opends.server.schema.CaseIgnoreEqualityMatchingRuleFactory;
+import org.opends.server.schema.CaseIgnoreIA5EqualityMatchingRuleFactory;
+import org.opends.server.schema.CaseIgnoreIA5SubstringMatchingRuleFactory;
+import org.opends.server.schema.CaseIgnoreOrderingMatchingRuleFactory;
+import org.opends.server.schema.CaseIgnoreSubstringMatchingRuleFactory;
 import org.opends.server.schema.DirectoryStringSyntax;
-import org.opends.server.schema.DistinguishedNameEqualityMatchingRule;
+import org.opends.server.schema.DistinguishedNameEqualityMatchingRuleFactory;
 import org.opends.server.schema.DistinguishedNameSyntax;
-import org.opends.server.schema.DoubleMetaphoneApproximateMatchingRule;
-import org.opends.server.schema.GeneralizedTimeEqualityMatchingRule;
-import org.opends.server.schema.GeneralizedTimeOrderingMatchingRule;
+import org.opends.server.schema.DoubleMetaphoneApproximateMatchingRuleFactory;
+import org.opends.server.schema.GeneralizedTimeEqualityMatchingRuleFactory;
+import org.opends.server.schema.GeneralizedTimeOrderingMatchingRuleFactory;
 import org.opends.server.schema.GeneralizedTimeSyntax;
 import org.opends.server.schema.IA5StringSyntax;
-import org.opends.server.schema.IntegerEqualityMatchingRule;
-import org.opends.server.schema.IntegerOrderingMatchingRule;
+import org.opends.server.schema.IntegerEqualityMatchingRuleFactory;
+import org.opends.server.schema.IntegerOrderingMatchingRuleFactory;
 import org.opends.server.schema.IntegerSyntax;
 import org.opends.server.schema.OIDSyntax;
 import org.opends.server.schema.ObjectClassSyntax;
-import org.opends.server.schema.ObjectIdentifierEqualityMatchingRule;
-import org.opends.server.schema.OctetStringEqualityMatchingRule;
-import org.opends.server.schema.OctetStringOrderingMatchingRule;
-import org.opends.server.schema.OctetStringSubstringMatchingRule;
+import org.opends.server.schema.ObjectIdentifierEqualityMatchingRuleFactory;
+import org.opends.server.schema.OctetStringEqualityMatchingRuleFactory;
+import org.opends.server.schema.OctetStringOrderingMatchingRuleFactory;
+import org.opends.server.schema.OctetStringSubstringMatchingRuleFactory;
 import static org.opends.server.schema.SchemaConstants.*;
-import org.opends.server.schema.TelephoneNumberEqualityMatchingRule;
-import org.opends.server.schema.TelephoneNumberSubstringMatchingRule;
+import org.opends.server.schema.TelephoneNumberEqualityMatchingRuleFactory;
+import org.opends.server.schema.TelephoneNumberSubstringMatchingRuleFactory;
 import org.opends.server.schema.TelephoneNumberSyntax;
 import org.opends.server.tools.ConfigureWindowsService;
 import org.opends.server.types.AbstractOperation;
@@ -208,6 +208,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArraySet;
+import org.opends.server.api.MatchingRuleFactory;
 
 
 /**
@@ -1526,12 +1527,44 @@
    */
   private void bootstrapMatchingRules()
   {
+    MatchingRuleFactory<?>[] factories =
+            new MatchingRuleFactory<?>[] {
+              new DoubleMetaphoneApproximateMatchingRuleFactory(),
+              new BooleanEqualityMatchingRuleFactory(),
+              new CaseExactEqualityMatchingRuleFactory(),
+              new CaseExactIA5EqualityMatchingRuleFactory(),
+              new CaseIgnoreEqualityMatchingRuleFactory(),
+              new CaseIgnoreIA5EqualityMatchingRuleFactory(),
+              new DistinguishedNameEqualityMatchingRuleFactory(),
+              new GeneralizedTimeEqualityMatchingRuleFactory(),
+              new IntegerEqualityMatchingRuleFactory(),
+              new OctetStringEqualityMatchingRuleFactory(),
+              new ObjectIdentifierEqualityMatchingRuleFactory(),
+              new TelephoneNumberEqualityMatchingRuleFactory(),
+              new CaseExactOrderingMatchingRuleFactory(),
+              new CaseIgnoreOrderingMatchingRuleFactory(),
+              new GeneralizedTimeOrderingMatchingRuleFactory(),
+              new IntegerOrderingMatchingRuleFactory(),
+              new OctetStringOrderingMatchingRuleFactory(),
+              new CaseExactSubstringMatchingRuleFactory(),
+              new CaseExactIA5SubstringMatchingRuleFactory(),
+              new CaseIgnoreSubstringMatchingRuleFactory(),
+              new CaseIgnoreIA5SubstringMatchingRuleFactory(),
+              new OctetStringSubstringMatchingRuleFactory(),
+              new TelephoneNumberSubstringMatchingRuleFactory()};
+
+    MatchingRuleFactory<?> currentFactory = null;
     try
     {
-      ApproximateMatchingRule matchingRule =
-           new DoubleMetaphoneApproximateMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerApproximateMatchingRule(matchingRule, true);
+      for(MatchingRuleFactory<?> factory: factories)
+      {
+        currentFactory = factory;
+        currentFactory.initializeMatchingRule(null);
+        for(MatchingRule matchingRule: currentFactory.getMatchingRules())
+        {
+         registerMatchingRule(matchingRule, true);
+        }
+      }
     }
     catch (Exception e)
     {
@@ -1541,459 +1574,7 @@
       }
 
       Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(DoubleMetaphoneApproximateMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule = new BooleanEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(BooleanEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule = new CaseExactEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseExactEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new CaseExactIA5EqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseExactIA5EqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule = new CaseIgnoreEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseIgnoreEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new CaseIgnoreIA5EqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseIgnoreIA5EqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new DistinguishedNameEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(DistinguishedNameEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new GeneralizedTimeEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(GeneralizedTimeEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule = new IntegerEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(IntegerEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule = new OctetStringEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(OctetStringEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new ObjectIdentifierEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(ObjectIdentifierEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      EqualityMatchingRule matchingRule =
-           new TelephoneNumberEqualityMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerEqualityMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(TelephoneNumberEqualityMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      OrderingMatchingRule matchingRule = new CaseExactOrderingMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerOrderingMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseExactOrderingMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      OrderingMatchingRule matchingRule = new CaseIgnoreOrderingMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerOrderingMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseIgnoreOrderingMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      OrderingMatchingRule matchingRule =
-           new GeneralizedTimeOrderingMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerOrderingMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(GeneralizedTimeOrderingMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      OrderingMatchingRule matchingRule = new IntegerOrderingMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerOrderingMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(IntegerOrderingMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      OrderingMatchingRule matchingRule = new OctetStringOrderingMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerOrderingMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(OctetStringOrderingMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule = new CaseExactSubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseExactSubstringMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule =
-           new CaseExactIA5SubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseExactIA5SubstringMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule =
-           new CaseIgnoreSubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseIgnoreSubstringMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule =
-           new CaseIgnoreIA5SubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(CaseIgnoreIA5SubstringMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule =
-           new OctetStringSubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(OctetStringSubstringMatchingRule.class.getName(),
-              stackTraceToSingleLineString(e));
-      logError(message);
-    }
-
-
-    try
-    {
-      SubstringMatchingRule matchingRule =
-           new TelephoneNumberSubstringMatchingRule();
-      matchingRule.initializeMatchingRule(null);
-      registerSubstringMatchingRule(matchingRule, true);
-    }
-    catch (Exception e)
-    {
-      if (debugEnabled())
-      {
-        TRACER.debugCaught(DebugLogLevel.ERROR, e);
-      }
-
-      Message message = ERR_CANNOT_BOOTSTRAP_MATCHING_RULE.
-          get(TelephoneNumberSubstringMatchingRule.class.getName(),
+          get(currentFactory.getClass().getName(),
               stackTraceToSingleLineString(e));
       logError(message);
     }
diff --git a/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java b/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java
index 49a4fc2..efeee3d 100644
--- a/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java
+++ b/opends/src/server/org/opends/server/core/MatchingRuleConfigManager.java
@@ -39,20 +39,14 @@
 import org.opends.server.admin.server.ConfigurationAddListener;
 import org.opends.server.admin.server.ConfigurationChangeListener;
 import org.opends.server.admin.server.ConfigurationDeleteListener;
-import org.opends.server.admin.std.meta.ApproximateMatchingRuleCfgDefn;
-import org.opends.server.admin.std.meta.EqualityMatchingRuleCfgDefn;
-import org.opends.server.admin.std.meta.OrderingMatchingRuleCfgDefn;
-import org.opends.server.admin.std.meta.SubstringMatchingRuleCfgDefn;
-import org.opends.server.admin.std.server.ApproximateMatchingRuleCfg;
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
 import org.opends.server.admin.std.server.MatchingRuleCfg;
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.admin.std.server.RootCfg;
 import org.opends.server.admin.server.ServerManagementContext;
+import org.opends.server.admin.std.meta.MatchingRuleCfgDefn;
 import org.opends.server.api.ApproximateMatchingRule;
 import org.opends.server.api.EqualityMatchingRule;
 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.opends.server.config.ConfigException;
@@ -85,8 +79,8 @@
 
 {
   // A mapping between the DNs of the config entries and the associated matching
-  // rules.
-  private ConcurrentHashMap<DN,MatchingRule> matchingRules;
+  // rule Factories.
+  private ConcurrentHashMap<DN,MatchingRuleFactory> matchingRuleFactories;
 
 
 
@@ -95,14 +89,15 @@
    */
   public MatchingRuleConfigManager()
   {
-    matchingRules = new ConcurrentHashMap<DN,MatchingRule>();
+    matchingRuleFactories = new ConcurrentHashMap<DN,MatchingRuleFactory>();
   }
 
 
 
   /**
-   * Initializes all matching rules currently defined in the Directory Server
-   * configuration.  This should only be called at Directory Server startup.
+   * Initializes all matching rules after reading all the Matching Rule
+   * factories currently defined in the Directory Server configuration.
+   * This should only be called at Directory Server startup.
    *
    * @throws  ConfigException  If a configuration problem causes the matching
    *                           rule initialization process to fail.
@@ -138,13 +133,16 @@
         String className = mrConfiguration.getJavaClass();
         try
         {
-          MatchingRule matchingRule =
-               loadMatchingRule(className, mrConfiguration, true);
+          MatchingRuleFactory<?> factory =
+               loadMatchingRuleFactory(className, mrConfiguration, true);
 
           try
           {
-            DirectoryServer.registerMatchingRule(matchingRule, false);
-            matchingRules.put(mrConfiguration.dn(), matchingRule);
+            for(MatchingRule matchingRule: factory.getMatchingRules())
+            {
+              DirectoryServer.registerMatchingRule(matchingRule, false);
+            }
+            matchingRuleFactories.put(mrConfiguration.dn(), factory);
           }
           catch (DirectoryException de)
           {
@@ -174,11 +172,11 @@
     if (configuration.isEnabled())
     {
       // Get the name of the class and make sure we can instantiate it as a
-      // matching rule.
+      // matching rule Factory.
       String className = configuration.getJavaClass();
       try
       {
-        loadMatchingRule(className, configuration, false);
+        loadMatchingRuleFactory(className, configuration, false);
       }
       catch (InitializationException ie)
       {
@@ -209,19 +207,22 @@
       return new ConfigChangeResult(resultCode, adminActionRequired, messages);
     }
 
-    MatchingRule matchingRule = null;
+    MatchingRuleFactory<?> factory = null;
 
     // Get the name of the class and make sure we can instantiate it as a
-    // matching rule.
+    // matching rule Factory.
     String className = configuration.getJavaClass();
     try
     {
-      matchingRule = loadMatchingRule(className, configuration, true);
+      factory = loadMatchingRuleFactory(className, configuration, true);
 
       try
       {
-        DirectoryServer.registerMatchingRule(matchingRule, false);
-        matchingRules.put(configuration.dn(), matchingRule);
+        for(MatchingRule matchingRule: factory.getMatchingRules())
+        {
+          DirectoryServer.registerMatchingRule(matchingRule, false);
+        }
+        matchingRuleFactories.put(configuration.dn(),factory);
       }
       catch (DirectoryException de)
       {
@@ -261,77 +262,82 @@
     // defined attribute types or matching rule uses that use the matching rule.
     // If so, then don't allow it to be deleted.
     boolean configAcceptable = true;
-    MatchingRule matchingRule = matchingRules.get(configuration.dn());
-    if (matchingRule != null)
+    MatchingRuleFactory<?> factory =
+            matchingRuleFactories.get(configuration.dn());
+    for(MatchingRule matchingRule: factory.getMatchingRules())
     {
-      String oid = matchingRule.getOID();
-      for (AttributeType at : DirectoryServer.getAttributeTypes().values())
+      if (matchingRule != null)
       {
-        ApproximateMatchingRule amr = at.getApproximateMatchingRule();
-        if ((amr != null) && oid.equals(amr.getOID()))
+        String oid = matchingRule.getOID();
+        for (AttributeType at : DirectoryServer.getAttributeTypes().values())
         {
-          Message message =
-                  WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
-                          matchingRule.getName(),
-                          at.getNameOrOID());
-          unacceptableReasons.add(message);
+          ApproximateMatchingRule amr = at.getApproximateMatchingRule();
+          if ((amr != null) && oid.equals(amr.getOID()))
+          {
+            Message message =
+                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
+                            matchingRule.getName(),
+                            at.getNameOrOID());
+            unacceptableReasons.add(message);
 
-          configAcceptable = false;
-          continue;
+            configAcceptable = false;
+            continue;
+          }
+
+          EqualityMatchingRule emr = at.getEqualityMatchingRule();
+          if ((emr != null) && oid.equals(emr.getOID()))
+          {
+            Message message =
+                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
+                            matchingRule.getName(),
+                            at.getNameOrOID());
+            unacceptableReasons.add(message);
+
+            configAcceptable = false;
+            continue;
+          }
+
+          OrderingMatchingRule omr = at.getOrderingMatchingRule();
+          if ((omr != null) && oid.equals(omr.getOID()))
+          {
+            Message message =
+                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
+                            matchingRule.getName(),
+                            at.getNameOrOID());
+            unacceptableReasons.add(message);
+
+            configAcceptable = false;
+            continue;
+          }
+
+          SubstringMatchingRule smr = at.getSubstringMatchingRule();
+          if ((smr != null) && oid.equals(smr.getOID()))
+          {
+            Message message =
+                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
+                            matchingRule.getName(),
+                            at.getNameOrOID());
+            unacceptableReasons.add(message);
+
+            configAcceptable = false;
+            continue;
+          }
         }
 
-        EqualityMatchingRule emr = at.getEqualityMatchingRule();
-        if ((emr != null) && oid.equals(emr.getOID()))
+        for (MatchingRuleUse mru :
+                DirectoryServer.getMatchingRuleUses().values())
         {
-          Message message =
-                  WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
-                          matchingRule.getName(),
-                          at.getNameOrOID());
-          unacceptableReasons.add(message);
+          if (oid.equals(mru.getMatchingRule().getOID()))
+          {
+            Message message =
+                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_MRU.get(
+                            matchingRule.getName(),
+                            mru.getName());
+            unacceptableReasons.add(message);
 
-          configAcceptable = false;
-          continue;
-        }
-
-        OrderingMatchingRule omr = at.getOrderingMatchingRule();
-        if ((omr != null) && oid.equals(omr.getOID()))
-        {
-          Message message =
-                  WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
-                          matchingRule.getName(),
-                          at.getNameOrOID());
-          unacceptableReasons.add(message);
-
-          configAcceptable = false;
-          continue;
-        }
-
-        SubstringMatchingRule smr = at.getSubstringMatchingRule();
-        if ((smr != null) && oid.equals(smr.getOID()))
-        {
-          Message message =
-                  WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_AT.get(
-                          matchingRule.getName(),
-                          at.getNameOrOID());
-          unacceptableReasons.add(message);
-
-          configAcceptable = false;
-          continue;
-        }
-      }
-
-      for (MatchingRuleUse mru : DirectoryServer.getMatchingRuleUses().values())
-      {
-        if (oid.equals(mru.getMatchingRule().getOID()))
-        {
-          Message message =
-                  WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_MRU.get(
-                          matchingRule.getName(),
-                          mru.getName());
-          unacceptableReasons.add(message);
-
-          configAcceptable = false;
-          continue;
+            configAcceptable = false;
+            continue;
+          }
         }
       }
     }
@@ -351,11 +357,15 @@
     boolean           adminActionRequired = false;
     ArrayList<Message> messages            = new ArrayList<Message>();
 
-    MatchingRule matchingRule = matchingRules.remove(configuration.dn());
-    if (matchingRule != null)
+    MatchingRuleFactory<?> factory =
+            matchingRuleFactories.remove(configuration.dn());
+    if (factory != null)
     {
-      DirectoryServer.deregisterMatchingRule(matchingRule);
-      matchingRule.finalizeMatchingRule();
+      for(MatchingRule matchingRule: factory.getMatchingRules())
+      {
+        DirectoryServer.deregisterMatchingRule(matchingRule);
+      }
+      factory.finalizeMatchingRule();
     }
 
     return new ConfigChangeResult(resultCode, adminActionRequired, messages);
@@ -373,11 +383,11 @@
     if (configuration.isEnabled())
     {
       // Get the name of the class and make sure we can instantiate it as a
-      // matching rule.
+      // matching rule Factory.
       String className = configuration.getJavaClass();
       try
       {
-        loadMatchingRule(className, configuration, false);
+        loadMatchingRuleFactory(className, configuration, false);
       }
       catch (InitializationException ie)
       {
@@ -389,80 +399,89 @@
     {
       // If the matching rule is currently enabled and the change would make it
       // disabled, then only allow it if the matching rule isn't already in use.
-      MatchingRule matchingRule = matchingRules.get(configuration.dn());
-      if (matchingRule != null)
+      MatchingRuleFactory<?> factory =
+              matchingRuleFactories.get(configuration.dn());
+      if(factory == null)
       {
-        String oid = matchingRule.getOID();
-        for (AttributeType at : DirectoryServer.getAttributeTypes().values())
+        //Factory was disabled again.
+        return configAcceptable;
+      }
+      for(MatchingRule matchingRule: factory.getMatchingRules())
+      {
+        if (matchingRule != null)
         {
-          ApproximateMatchingRule amr = at.getApproximateMatchingRule();
-          if ((amr != null) && oid.equals(amr.getOID()))
+          String oid = matchingRule.getOID();
+          for (AttributeType at : DirectoryServer.getAttributeTypes().values())
           {
-            Message message =
-                    WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
-                            matchingRule.getName(),
-                            at.getNameOrOID());
-            unacceptableReasons.add(message);
+            ApproximateMatchingRule amr = at.getApproximateMatchingRule();
+            if ((amr != null) && oid.equals(amr.getOID()))
+            {
+              Message message =
+                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
+                              matchingRule.getName(),
+                              at.getNameOrOID());
+              unacceptableReasons.add(message);
 
-            configAcceptable = false;
-            continue;
+              configAcceptable = false;
+              continue;
+            }
+
+            EqualityMatchingRule emr = at.getEqualityMatchingRule();
+            if ((emr != null) && oid.equals(emr.getOID()))
+            {
+              Message message =
+                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
+                              matchingRule.getName(),
+                              at.getNameOrOID());
+              unacceptableReasons.add(message);
+
+              configAcceptable = false;
+              continue;
+            }
+
+            OrderingMatchingRule omr = at.getOrderingMatchingRule();
+            if ((omr != null) && oid.equals(omr.getOID()))
+            {
+              Message message =
+                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
+                              matchingRule.getName(),
+                              at.getNameOrOID());
+              unacceptableReasons.add(message);
+
+              configAcceptable = false;
+              continue;
+            }
+
+            SubstringMatchingRule smr = at.getSubstringMatchingRule();
+            if ((smr != null) && oid.equals(smr.getOID()))
+            {
+              Message message =
+                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT
+                      .get(matchingRule.getName(), at.getNameOrOID());
+              unacceptableReasons.add(message);
+
+              configAcceptable = false;
+              continue;
+            }
           }
 
-          EqualityMatchingRule emr = at.getEqualityMatchingRule();
-          if ((emr != null) && oid.equals(emr.getOID()))
+          for (MatchingRuleUse mru :
+               DirectoryServer.getMatchingRuleUses().values())
           {
-            Message message =
-                    WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
-                            matchingRule.getName(),
-                            at.getNameOrOID());
-            unacceptableReasons.add(message);
+            if (oid.equals(mru.getMatchingRule().getOID()))
+            {
+              Message message =
+                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_MRU.get(
+                              matchingRule.getName(), mru.getName());
+              unacceptableReasons.add(message);
 
-            configAcceptable = false;
-            continue;
-          }
-
-          OrderingMatchingRule omr = at.getOrderingMatchingRule();
-          if ((omr != null) && oid.equals(omr.getOID()))
-          {
-            Message message =
-                    WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT.get(
-                            matchingRule.getName(),
-                            at.getNameOrOID());
-            unacceptableReasons.add(message);
-
-            configAcceptable = false;
-            continue;
-          }
-
-          SubstringMatchingRule smr = at.getSubstringMatchingRule();
-          if ((smr != null) && oid.equals(smr.getOID()))
-          {
-            Message message = WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_AT
-                    .get(matchingRule.getName(), at.getNameOrOID());
-            unacceptableReasons.add(message);
-
-            configAcceptable = false;
-            continue;
-          }
-        }
-
-        for (MatchingRuleUse mru :
-             DirectoryServer.getMatchingRuleUses().values())
-        {
-          if (oid.equals(mru.getMatchingRule().getOID()))
-          {
-            Message message =
-                    WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_MRU.get(
-                            matchingRule.getName(), mru.getName());
-            unacceptableReasons.add(message);
-
-            configAcceptable = false;
-            continue;
+              configAcceptable = false;
+              continue;
+            }
           }
         }
       }
     }
-
     return configAcceptable;
   }
 
@@ -479,25 +498,24 @@
     ArrayList<Message> messages            = new ArrayList<Message>();
 
 
-    // Get the existing matching rule if it's already enabled.
-    MatchingRule existingRule = matchingRules.get(configuration.dn());
+   // Get the existing matching rule factory if it's already enabled.
+    MatchingRuleFactory<?> existingFactory =
+            matchingRuleFactories.get(configuration.dn());
 
 
     // If the new configuration has the matching rule disabled, then disable it
     // if it is enabled, or do nothing if it's already disabled.
     if (! configuration.isEnabled())
     {
-      if (existingRule != null)
+     if (existingFactory != null)
       {
-        DirectoryServer.deregisterMatchingRule(existingRule);
-
-        MatchingRule rule = matchingRules.remove(configuration.dn());
-        if (rule != null)
+        for(MatchingRule existingRule: existingFactory.getMatchingRules())
         {
-          rule.finalizeMatchingRule();
+          DirectoryServer.deregisterMatchingRule(existingRule);
         }
+        matchingRuleFactories.remove(configuration.dn());
+        existingFactory.finalizeMatchingRule();
       }
-
       return new ConfigChangeResult(resultCode, adminActionRequired, messages);
     }
 
@@ -508,9 +526,9 @@
     // is required.  If the matching rule is disabled, then instantiate the
     // class and initialize and register it as a matching rule.
     String className = configuration.getJavaClass();
-    if (existingRule != null)
+    if (existingFactory != null)
     {
-      if (! className.equals(existingRule.getClass().getName()))
+      if (! className.equals(existingFactory.getClass().getName()))
       {
         adminActionRequired = true;
       }
@@ -518,15 +536,18 @@
       return new ConfigChangeResult(resultCode, adminActionRequired, messages);
     }
 
-    MatchingRule matchingRule = null;
+    MatchingRuleFactory<?> factory = null;
     try
     {
-      matchingRule = loadMatchingRule(className, configuration, true);
+      factory = loadMatchingRuleFactory(className, configuration, true);
 
       try
       {
-        DirectoryServer.registerMatchingRule(matchingRule, false);
-        matchingRules.put(configuration.dn(), matchingRule);
+        for(MatchingRule matchingRule: factory.getMatchingRules())
+        {
+          DirectoryServer.registerMatchingRule(matchingRule, false);
+        }
+        matchingRuleFactories.put(configuration.dn(), factory);
       }
       catch (DirectoryException de)
       {
@@ -571,82 +592,40 @@
    * @throws  InitializationException  If a problem occurred while attempting to
    *                                   initialize the attribute syntax.
    */
-  private MatchingRule loadMatchingRule(String className,
+  private MatchingRuleFactory loadMatchingRuleFactory(String className,
                                         MatchingRuleCfg configuration,
                                         boolean initialize)
           throws InitializationException
   {
     try
     {
-      MatchingRule matchingRule = null;
-      if (configuration instanceof ApproximateMatchingRuleCfg)
-      {
-        ApproximateMatchingRuleCfgDefn definition =
-             ApproximateMatchingRuleCfgDefn.getInstance();
-        ClassPropertyDefinition propertyDefinition =
-             definition.getJavaClassPropertyDefinition();
-        Class<? extends ApproximateMatchingRule> approximateMatchingRuleClass =
-             propertyDefinition.loadClass(className,
-                                          ApproximateMatchingRule.class);
-        matchingRule = approximateMatchingRuleClass.newInstance();
-      }
-      else if (configuration instanceof EqualityMatchingRuleCfg)
-      {
-        EqualityMatchingRuleCfgDefn definition =
-             EqualityMatchingRuleCfgDefn.getInstance();
-        ClassPropertyDefinition propertyDefinition =
-             definition.getJavaClassPropertyDefinition();
-        Class<? extends EqualityMatchingRule> equalityMatchingRuleClass =
-             propertyDefinition.loadClass(className,
-                                          EqualityMatchingRule.class);
-        matchingRule = equalityMatchingRuleClass.newInstance();
-      }
-      else if (configuration instanceof OrderingMatchingRuleCfg)
-      {
-        OrderingMatchingRuleCfgDefn definition =
-             OrderingMatchingRuleCfgDefn.getInstance();
-        ClassPropertyDefinition propertyDefinition =
-             definition.getJavaClassPropertyDefinition();
-        Class<? extends OrderingMatchingRule> orderingMatchingRuleClass =
-             propertyDefinition.loadClass(className,
-                                          OrderingMatchingRule.class);
-        matchingRule = orderingMatchingRuleClass.newInstance();
-      }
-      else if (configuration instanceof SubstringMatchingRuleCfg)
-      {
-        SubstringMatchingRuleCfgDefn definition =
-             SubstringMatchingRuleCfgDefn.getInstance();
-        ClassPropertyDefinition propertyDefinition =
-             definition.getJavaClassPropertyDefinition();
-        Class<? extends SubstringMatchingRule> substringMatchingRuleClass =
-             propertyDefinition.loadClass(className,
-                                          SubstringMatchingRule.class);
-        matchingRule = substringMatchingRuleClass.newInstance();
-      }
-      else
-      {
-        throw new AssertionError("Unsupported matching rule type:  " +
-                                 className + " with config type " +
-                                 configuration.getClass().getName());
-      }
+      MatchingRuleFactory factory = null;
+      MatchingRuleCfgDefn definition =
+              MatchingRuleCfgDefn.getInstance();
+      ClassPropertyDefinition propertyDefinition =
+           definition.getJavaClassPropertyDefinition();
+      Class<? extends MatchingRuleFactory> matchingRuleFactoryClass =
+           propertyDefinition.loadClass(className,
+                                        MatchingRuleFactory.class);
+      factory = matchingRuleFactoryClass.newInstance();
 
       if (initialize)
       {
-        Method method = matchingRule.getClass().getMethod(
+        Method method = factory.getClass().getMethod(
             "initializeMatchingRule", configuration.configurationClass());
-        method.invoke(matchingRule, configuration);
+        method.invoke(factory, configuration);
       }
       else
       {
         Method method =
-             matchingRule.getClass().getMethod("isConfigurationAcceptable",
+             factory.getClass().getMethod("isConfigurationAcceptable",
                                                MatchingRuleCfg.class,
                                                List.class);
 
         List<Message> unacceptableReasons = new ArrayList<Message>();
-        Boolean acceptable = (Boolean) method.invoke(matchingRule,
-                                                     configuration,
-                                                     unacceptableReasons);
+        Boolean acceptable = (Boolean) method.invoke(factory,
+                                             configuration,
+                                             unacceptableReasons);
         if (! acceptable)
         {
           StringBuilder buffer = new StringBuilder();
@@ -667,7 +646,7 @@
         }
       }
 
-      return matchingRule;
+      return factory;
     }
     catch (Exception e)
     {
diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java
index c116b20..36942ff 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -2093,7 +2093,7 @@
       }
       else
       {
-        MatchingRule<?> mr =
+        MatchingRule mr =
              DirectoryServer.getMatchingRule(toLowerCase(matchingRuleID));
         if (mr == null)
         {
diff --git a/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java b/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
index 8cea779..be77e1e 100644
--- a/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRule.java
@@ -26,7 +26,8 @@
  */
 package org.opends.server.replication.plugin;
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
@@ -74,15 +75,17 @@
     return token1[1].compareTo(token2[1]);
   }
 
+
   /**
    * {@inheritDoc}
    */
-  @Override
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
+  public Collection<String> getAllNames()
   {
-    // No implementation needed here.
+    return Collections.singleton(getName());
   }
 
+
+
   /**
    * Get the name of this class.
    * @return name of the class in String form
diff --git a/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..3a92b0b
--- /dev/null
+++ b/opends/src/server/org/opends/server/replication/plugin/HistoricalCsnOrderingMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.replication.plugin;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+ /**
+ * This class is a factory class for
+  * {@link HistoricalCsnOrderingMatchingRule}.
+ */
+public final class HistoricalCsnOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new HistoricalCsnOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
index e7878a2..59030df 100644
--- a/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRule.java
@@ -30,17 +30,16 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
 import org.opends.server.api.PasswordStorageScheme;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import org.opends.server.loggers.debug.DebugTracer;
@@ -53,7 +52,7 @@
  * This class implements the authPasswordMatch matching rule defined in RFC
  * 3112.
  */
-public class AuthPasswordEqualityMatchingRule
+class AuthPasswordEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -77,10 +76,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..a8472cf
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/AuthPasswordEqualityMatchingRuleFactory.java
@@ -0,0 +1,68 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link AuthPasswordEqualityMatchingRule}.
+ */
+public final class AuthPasswordEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+ //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new AuthPasswordEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
index 113d94e..26333f8 100644
--- a/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRule.java
@@ -30,16 +30,15 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
 
 
-import org.opends.server.types.InitializationException;
 
 import org.opends.server.types.DebugLogLevel;
 import static org.opends.server.loggers.ErrorLogger.*;
@@ -53,7 +52,7 @@
  * This class implements the authPasswordExactMatch matching rule defined in RFC
  * 3112.
  */
-public class AuthPasswordExactEqualityMatchingRule
+class AuthPasswordExactEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -77,10 +76,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..670fcbc
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/AuthPasswordExactEqualityMatchingRuleFactory.java
@@ -0,0 +1,73 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link AuthPasswordExactEqualityMatchingRule}.
+ */
+public final class AuthPasswordExactEqualityMatchingRuleFactory
+                extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new AuthPasswordExactEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
index 3d11487..fb200ec 100644
--- a/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRule.java
@@ -30,15 +30,14 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.ErrorLogger.*;
@@ -51,7 +50,7 @@
  * This class defines the bitStringMatch matching rule defined in X.520 and
  * referenced in RFC 2252.
  */
-public class BitStringEqualityMatchingRule
+class BitStringEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -67,10 +66,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..973ddcf
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/BitStringEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link BitStringEqualityMatchingRule}.
+ */
+public final class BitStringEqualityMatchingRuleFactory
+                extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new BitStringEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
index 8c16745..560e9ad 100644
--- a/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRule.java
@@ -31,14 +31,13 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -50,7 +49,7 @@
  * This class defines the booleanMatch matching rule defined in X.520 and
  * referenced in RFC 4519.
  */
-public class BooleanEqualityMatchingRule
+class BooleanEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -66,10 +65,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..78f6b28
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/BooleanEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link BooleanEqualityMatchingRule}.
+ */
+public final class BooleanEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new BooleanEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRule.java
index 56ed6f6..fcdffa9 100644
--- a/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 
@@ -46,7 +45,7 @@
  * This class defines the caseExactMatch matching rule defined in X.520 and
  * referenced in RFC 4519.
  */
-public class CaseExactEqualityMatchingRule
+class CaseExactEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -62,23 +61,19 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public String getName()
   {
-    // No initialization is required.
+    return EMR_CASE_EXACT_NAME;
   }
 
 
 
   /**
-   * Retrieves the common name for this matching rule.
-   *
-   * @return  The common name for this matching rule, or <CODE>null</CODE> if
-   * it does not have a name.
+   * {@inheritDoc}
    */
-  public String getName()
+  public Collection<String> getAllNames()
   {
-    return EMR_CASE_EXACT_NAME;
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..540e520
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseExactEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link CaseExactEqualityMatchingRule}.
+ */
+public final class CaseExactEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseExactEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
index ff34703..04bd75e 100644
--- a/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRule.java
@@ -31,14 +31,13 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -50,7 +49,7 @@
  * This class implements the caseExactIA5Match matching rule defined in RFC
  * 2252.
  */
-public class CaseExactIA5EqualityMatchingRule
+class CaseExactIA5EqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -64,17 +63,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
-  {
-    // No initialization is required.
-  }
-
-
-
-  /**
    * Retrieves the common name for this matching rule.
    *
    * @return  The common name for this matching rule, or <CODE>null</CODE> if
@@ -88,6 +76,16 @@
 
 
   /**
+   * {@inheritDoc}
+   */
+  public Collection<String> getAllNames()
+  {
+    return Collections.singleton(getName());
+  }
+
+
+
+  /**
    * Retrieves the OID for this matching rule.
    *
    * @return  The OID for this matching rule.
diff --git a/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..f72aad7
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseExactIA5EqualityMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseExactIA5EqualityMatchingRule}.
+ */
+public final class CaseExactIA5EqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseExactIA5EqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
index baf15a1..55a3532 100644
--- a/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRule.java
@@ -28,17 +28,16 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.ErrorLogger.*;
@@ -53,7 +52,7 @@
  * directory vendors do provide an implementation using an OID from their own
  * private namespace.
  */
-public class CaseExactIA5SubstringMatchingRule
+class CaseExactIA5SubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -69,10 +68,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..c0b5b49
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseExactIA5SubstringMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseExactIA5SubstringMatchingRule}.
+ */
+public final class CaseExactIA5SubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseExactIA5SubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
index 7bc5a42..6661de5 100644
--- a/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRule.java
@@ -28,15 +28,13 @@
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
-import static org.opends.messages.SchemaMessages.*;
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -46,7 +44,7 @@
  * This class defines the caseExactOrderingMatch matching rule defined in X.520
  * and referenced in RFC 4519.
  */
-public class CaseExactOrderingMatchingRule
+class CaseExactOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -72,10 +70,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..628f19f
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseExactOrderingMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseExactOrderingMatchingRule}.
+ */
+public final class CaseExactOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+  @Override
+  public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+  {
+    matchingRule =  new CaseExactOrderingMatchingRule();
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public final Collection<MatchingRule> getMatchingRules()
+  {
+    return Collections.singleton(matchingRule);
+  }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRule.java
index 7cb2803..d2ba95a 100644
--- a/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRule.java
@@ -28,15 +28,14 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 
@@ -46,7 +45,7 @@
  * This class defines the caseExactSubstringsMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-public class CaseExactSubstringMatchingRule
+class CaseExactSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -62,10 +61,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..857f3a0
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseExactSubstringMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseExactSubstringMatchingRule}.
+ */
+public final class CaseExactSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseExactSubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRule.java
index 1a22e08..2f028de 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRule.java
@@ -28,13 +28,12 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -61,10 +60,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..1f66e09
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreEqualityMatchingRule}.
+ */
+public final class CaseIgnoreEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
index 4f604aa..df8d712 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRule.java
@@ -31,14 +31,13 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -51,7 +50,7 @@
  * This class implements the caseIgnoreIA5Match matching rule defined in RFC
  * 2252.
  */
-public class CaseIgnoreIA5EqualityMatchingRule
+class CaseIgnoreIA5EqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -67,10 +66,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..b2d37b6
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5EqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreIA5EqualityMatchingRule}.
+ */
+public final class CaseIgnoreIA5EqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated MatchingRule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreIA5EqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
index df7e411..21d5bad 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRule.java
@@ -25,20 +25,17 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.messages.Message;
-
-
-
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -51,7 +48,7 @@
  * This class implements the caseIgnoreIA5SubstringsMatch matching rule defined
  * in RFC 2252.
  */
-public class CaseIgnoreIA5SubstringMatchingRule
+class CaseIgnoreIA5SubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -67,10 +64,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..bb8e1bd
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreIA5SubstringMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreIA5SubstringMatchingRule}.
+ */
+public final class CaseIgnoreIA5SubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreIA5SubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRule.java
index 78d566e..8f694ff 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -47,7 +46,7 @@
  * This class implements the caseIgnoreListMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-public class CaseIgnoreListEqualityMatchingRule
+class CaseIgnoreListEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -63,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..0848bad
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreListEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreListEqualityMatchingRule}.
+ */
+public final class CaseIgnoreListEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreListEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRule.java
index 72aa279..f715801 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRule.java
@@ -28,15 +28,14 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -47,7 +46,7 @@
  * This class implements the caseIgnoreListSubstringsMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-public class CaseIgnoreListSubstringMatchingRule
+class CaseIgnoreListSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -63,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..6961064
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreListSubstringMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreSubstringMatchingRule}.
+ */
+public final class CaseIgnoreListSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+ //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreListSubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
index 400c0c8..c0353f7 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRule.java
@@ -28,13 +28,12 @@
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -71,10 +70,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..414d1dc
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreOrderingMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link CaseIgnoreOrderingMatchingRule}.
+ */
+public final class CaseIgnoreOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+ //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new CaseIgnoreOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRule.java
index 9cbf5a7..5513c1d 100644
--- a/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRule.java
@@ -28,15 +28,14 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -47,7 +46,7 @@
  * This class defines the caseIgnoreSubstringsMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-public class CaseIgnoreSubstringMatchingRule
+class CaseIgnoreSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -63,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..eca54bb
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CaseIgnoreSubstringMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link CaseIgnoreSubstringMatchingRule}.
+ */
+public final class CaseIgnoreSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new CaseIgnoreSubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
new file mode 100644
index 0000000..8868702
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/CollationMatchingRuleFactory.java
@@ -0,0 +1,2082 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.text.CollationKey;
+import java.text.Collator;
+import java.nio.CharBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedSet;
+import org.opends.messages.Message;
+import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.std.meta.CollationMatchingRuleCfgDefn.
+        MatchingRuleType;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.CollationMatchingRuleCfg;
+import org.opends.server.api.ExtensibleMatchingRule;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.core.DirectoryServer;
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.types.ByteString;
+import org.opends.server.types.ConditionResult;
+import org.opends.server.types.ConfigChangeResult;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.InitializationException;
+
+import org.opends.server.types.ResultCode;
+import static org.opends.server.schema.SchemaConstants.*;
+import static org.opends.server.loggers.ErrorLogger.logError;
+import static org.opends.messages.SchemaMessages.*;
+import static org.opends.messages.CoreMessages.*;
+import static org.opends.messages.ConfigMessages.*;
+import static org.opends.server.util.StaticUtils.*;
+
+
+
+/**
+ * This class is a factory class for Collation matching rules. It creates
+ * different matching rules based on the configuration entries.
+ */
+public final class CollationMatchingRuleFactory
+        extends MatchingRuleFactory<CollationMatchingRuleCfg>
+        implements ConfigurationChangeListener<CollationMatchingRuleCfg>
+{
+
+  //Whether equality matching rules are enabled.
+  private boolean equalityMatchingRuleType;
+
+  //Whether less-than matching rules are enabled.
+  private boolean lessThanMatchingRuleType;
+
+  //Whether less-than-equal-to matching rules are enabled.
+  private boolean lessThanEqualToMatchingRuleType;
+
+  //Whether less-than-equal-to matching rules are enabled.
+  private boolean greaterThanMatchingRuleType;
+
+  //Whether greater-than matching rules are enabled.
+  private boolean greaterThanEqualToMatchingRuleType;
+
+  //Whether greater-than-equal-to matching rules are enabled.
+  private boolean substringMatchingRuleType;
+
+  //Stores the list of available locales on this JVM.
+  private static final Set<Locale> supportedLocales;
+
+  //Current Configuration.
+  private CollationMatchingRuleCfg currentConfig;
+
+  //Map of OID and the Matching Rule.
+  private  final Map<String, MatchingRule> matchingRules;
+
+
+  static
+  {
+    supportedLocales = new HashSet<Locale>();
+    for(Locale l:Locale.getAvailableLocales())
+    {
+      supportedLocales.add(l);
+    }
+  }
+
+
+/**
+  * Creates a new instance of CollationMatchingRuleFactory.
+ */
+  public CollationMatchingRuleFactory()
+  {
+    //Initialize the matchingRules.
+    matchingRules = new HashMap<String,MatchingRule>();
+  }
+
+
+
+  /**
+  * {@inheritDoc}
+  */
+  @Override
+  public final Collection<MatchingRule> getMatchingRules()
+  {
+    return Collections.unmodifiableCollection(matchingRules.values());
+  }
+
+
+
+ /**
+  * Adds a new mapping of OID and MatchingRule.
+  *
+  * @param oid OID of the matching rule
+  * @param matchingRule instance of a MatchingRule.
+  */
+  private final void addMatchingRule(String oid,
+          MatchingRule matchingRule)
+  {
+     matchingRules.put(oid, matchingRule);
+  }
+
+
+
+  /**
+   * Returns the Matching rule for the specified OID.
+   *
+   * @param oid OID of the matching rule to be searched.
+   * @return  MatchingRule corresponding to an OID.
+   */
+  private final MatchingRule getMatchingRule(String oid)
+  {
+    return matchingRules.get(oid);
+  }
+
+
+
+
+  /**
+   * Clears the Map containing matching Rules.
+   */
+  private void resetRules()
+  {
+    matchingRules.clear();
+  }
+
+
+
+  /**
+  * Reads the configuration and initializes matching rule types.
+  *
+  * @param  ruleTypes  The Set containing allowed matching rule types.
+  */
+  private void initializeMatchingRuleTypes(SortedSet<MatchingRuleType>
+          ruleTypes)
+  {
+    for(MatchingRuleType type:ruleTypes)
+    {
+      switch(type)
+      {
+        case EQUALITY:
+          equalityMatchingRuleType = true;
+          break;
+        case LESS_THAN:
+          lessThanMatchingRuleType = true;
+          break;
+        case LESS_THAN_OR_EQUAL_TO:
+          lessThanEqualToMatchingRuleType = true;
+          break;
+        case GREATER_THAN:
+          greaterThanMatchingRuleType = true;
+          break;
+        case GREATER_THAN_OR_EQUAL_TO:
+          greaterThanEqualToMatchingRuleType = true;
+          break;
+        case SUBSTRING:
+          substringMatchingRuleType = true;
+          break;
+        default:
+          //No default values allowed.
+      }
+    }
+  }
+
+
+
+ /**
+  * Creates a new Collator instance.
+  *
+  * @param locale Locale for the collator
+  * @return Returns a new Collator instance
+  */
+  private Collator createCollator(Locale locale)
+  {
+    Collator collator = Collator.getInstance(locale);
+    collator.setStrength(Collator.PRIMARY);
+    collator.setDecomposition(Collator.FULL_DECOMPOSITION);
+    return collator;
+  }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+  @Override
+  public void initializeMatchingRule(CollationMatchingRuleCfg configuration)
+  throws ConfigException, InitializationException
+  {
+    initializeMatchingRuleTypes(configuration.getMatchingRuleType());
+    for(String collation:configuration.getCollation())
+    {
+      CollationMapper mapper = new CollationMapper(collation);
+
+      String nOID = mapper.getNumericOID();
+      String languageTag = mapper.getLanguageTag();
+      if(nOID==null || languageTag==null)
+      {
+        Message msg =
+                WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_FORMAT.
+                get(collation);
+        logError(msg);
+        continue;
+      }
+
+      Locale locale = getLocale(languageTag);
+      if(locale!=null)
+      {
+        createLessThanMatchingRule(mapper,locale);
+        createLessThanOrEqualToMatchingRule(mapper,locale);
+        createEqualityMatchingRule(mapper,locale);
+        createGreaterThanOrEqualToMatchingRule(mapper,locale);
+        createGreaterThanMatchingRule(mapper,locale);
+        createSubstringMatchingRule(mapper,locale);
+      }
+      else
+      {
+        //This locale is not supported by JVM.
+        Message msg =
+              WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_LOCALE.
+              get(collation,configuration.dn().toNormalizedString(),
+                  languageTag);
+
+        logError(msg);
+      }
+    }
+    //Save this configuration.
+    currentConfig = configuration;
+    //Register for change events.
+    currentConfig.addCollationChangeListener(this);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public void finalizeMatchingRule()
+  {
+    //De-register the listener.
+    currentConfig.removeCollationChangeListener(this);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public ConfigChangeResult applyConfigurationChange(
+                                 CollationMatchingRuleCfg configuration)
+  {
+    ResultCode        resultCode          = ResultCode.SUCCESS;
+    boolean           adminActionRequired = false;
+    ArrayList<Message> messages            = new ArrayList<Message>();
+
+    if(!configuration.isEnabled() ||
+            currentConfig.isEnabled()!=configuration.isEnabled())
+    {
+      //Don't do anything if:
+      // 1. The configuration is disabled.
+      // 2. There is a change in the enable status
+      //  i.e. (disable->enable or enable->disable). In this case, the
+      //     ConfigManager will have already created the new Factory object.
+      return new ConfigChangeResult(resultCode,
+              adminActionRequired, messages);
+    }
+
+    //Since we have come here it means that this Factory is enabled and
+    //there is a change in the CollationMatchingRuleFactory's configuration.
+    // Deregister all the Matching Rule corresponding to this factory..
+    for(MatchingRule rule: getMatchingRules())
+    {
+      DirectoryServer.deregisterMatchingRule(rule);
+    }
+    //Clear the associated matching rules.
+    resetRules();
+
+    initializeMatchingRuleTypes(configuration.getMatchingRuleType());
+    for(String collation:configuration.getCollation())
+    {
+      CollationMapper mapper = new CollationMapper(collation);
+      String nOID = mapper.getNumericOID();
+      String languageTag = mapper.getLanguageTag();
+      Locale locale = getLocale(languageTag);
+      createLessThanMatchingRule(mapper,locale);
+      createLessThanOrEqualToMatchingRule(mapper,locale);
+      createEqualityMatchingRule(mapper,locale);
+      createGreaterThanOrEqualToMatchingRule(mapper,locale);
+      createGreaterThanMatchingRule(mapper,locale);
+      createSubstringMatchingRule(mapper,locale);
+    }
+
+    try
+    {
+      for(MatchingRule matchingRule: getMatchingRules())
+      {
+        DirectoryServer.registerMatchingRule(matchingRule, false);
+      }
+    }
+    catch (DirectoryException de)
+    {
+        Message message = WARN_CONFIG_SCHEMA_MR_CONFLICTING_MR.get(
+          String.valueOf(configuration.dn()), de.getMessageObject());
+        adminActionRequired = true;
+        messages.add(message);
+    }
+    currentConfig = configuration;
+    return new ConfigChangeResult(resultCode, adminActionRequired, messages);
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  public boolean isConfigurationChangeAcceptable(
+          CollationMatchingRuleCfg configuration,
+                      List<Message> unacceptableReasons)
+  {
+    boolean configAcceptable = true;
+
+    //If the new configuration disables this factory, don't do anything.
+    if(!configuration.isEnabled())
+    {
+      return configAcceptable;
+    }
+
+
+    //If it comes here we don't need to verify MatchingRuleType; it should be
+    //okay as its syntax is verified by the admin framework. Iterate over the
+    //collations and verify if the format is okay. Also, verify if the
+    //locale is allowed by the JVM.
+    for(String collation:configuration.getCollation())
+    {
+      CollationMapper mapper = new CollationMapper(collation);
+
+      String nOID = mapper.getNumericOID();
+      String languageTag = mapper.getLanguageTag();
+      if(nOID==null || languageTag==null)
+      {
+        configAcceptable = false;
+        Message msg =
+                WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_FORMAT.
+                get(collation);
+        unacceptableReasons.add(msg);
+        continue;
+      }
+
+      Locale locale = getLocale(languageTag);
+      if(locale==null)
+      {
+        Message msg =
+              WARN_ATTR_INVALID_COLLATION_MATCHING_RULE_LOCALE.
+              get(collation,configuration.dn().toNormalizedString(),
+                  languageTag);
+        unacceptableReasons.add(msg);
+        configAcceptable = false;
+        continue;
+      }
+    }
+    return configAcceptable;
+  }
+
+
+
+  /**
+  * Creates Less-than Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createLessThanMatchingRule(CollationMapper mapper,Locale locale)
+  {
+    if(!lessThanMatchingRuleType)
+      return;
+
+    String oid = mapper.getNumericOID()+".1";
+    String lTag = mapper.getLanguageTag();
+
+    Collection<String> names = new HashSet<String>();
+    MatchingRule matchingRule = getMatchingRule(oid);
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+
+    names.add(lTag+".lt");
+    names.add(lTag + ".1");
+
+    matchingRule = new CollationLessThanMatchingRule(oid, names, locale);
+    addMatchingRule(oid, matchingRule);
+  }
+
+
+
+ /**
+  * Creates Less-Than-Equal-To Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createLessThanOrEqualToMatchingRule(CollationMapper mapper,
+          Locale locale)
+  {
+    if(!lessThanEqualToMatchingRuleType)
+      return;
+
+    String oid = mapper.getNumericOID()+".2";
+    String lTag = mapper.getLanguageTag();
+
+    Collection<String> names = new HashSet<String>();
+    MatchingRule matchingRule = getMatchingRule(oid);
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+
+    names.add(lTag+".lte");
+    names.add(lTag + ".2");
+
+    matchingRule =
+            new CollationLessThanOrEqualToMatchingRule(oid,names,locale);
+    addMatchingRule(oid, matchingRule);
+  }
+
+
+
+ /**
+  * Creates Equality Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createEqualityMatchingRule(CollationMapper mapper,Locale locale)
+  {
+    if(!equalityMatchingRuleType)
+      return;
+    //Register the default OID as equality matching rule.
+    String lTag = mapper.getLanguageTag();
+    String nOID = mapper.getNumericOID();
+
+    MatchingRule matchingRule = getMatchingRule(nOID);
+    Collection<String> names = new HashSet<String>();
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+
+    names.add(lTag);
+    matchingRule =
+          new CollationEqualityMatchingRule(nOID,names,locale);
+    addMatchingRule(nOID, matchingRule);
+
+    // Register OID.3 as the equality matching rule.
+    String OID = mapper.getNumericOID() + ".3";
+    MatchingRule equalityMatchingRule = getMatchingRule(OID);
+    Collection<String> equalityNames = new HashSet<String>();
+    if(equalityMatchingRule!=null)
+    {
+      for(String name: equalityMatchingRule.getAllNames())
+      {
+        equalityNames.add(name);
+      }
+    }
+
+    equalityNames.add(lTag+".eq");
+    equalityNames.add(lTag+".3");
+
+    equalityMatchingRule =
+          new CollationEqualityMatchingRule(OID,equalityNames,locale);
+    addMatchingRule(OID, equalityMatchingRule);
+  }
+
+
+
+  /**
+  * Creates Greater-than-equal-to Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createGreaterThanOrEqualToMatchingRule(CollationMapper mapper,
+          Locale locale)
+  {
+    if(!greaterThanEqualToMatchingRuleType)
+      return;
+
+    String oid = mapper.getNumericOID()+".4";
+    String lTag = mapper.getLanguageTag();
+
+    Collection<String> names = new HashSet<String>();
+    MatchingRule matchingRule = getMatchingRule(oid);
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+
+    names.add(lTag+".gte");
+    names.add(lTag + ".4");
+    matchingRule =
+          new CollationGreaterThanOrEqualToMatchingRule(oid,names,locale);
+    addMatchingRule(oid, matchingRule);
+  }
+
+
+
+ /**
+  * Creates Greater-than Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createGreaterThanMatchingRule(CollationMapper mapper,
+          Locale locale)
+  {
+    if(!greaterThanMatchingRuleType)
+      return;
+
+    String oid = mapper.getNumericOID()+".5";
+    String lTag = mapper.getLanguageTag();
+
+    Collection<String> names = new HashSet<String>();
+    MatchingRule matchingRule = getMatchingRule(oid);
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+
+    names.add(lTag+".gt");
+    names.add(lTag + ".5");
+    matchingRule =
+          new CollationGreaterThanMatchingRule(oid,names,locale);
+    addMatchingRule(oid, matchingRule);
+  }
+
+
+
+ /**
+  * Creates substring Matching Rule.
+  *
+  * @param mapper CollationMapper containing OID and the language Tag.
+  * @param locale  Locale value
+  */
+  private void createSubstringMatchingRule(CollationMapper mapper,Locale locale)
+  {
+    if(!substringMatchingRuleType)
+      return;
+
+    String oid = mapper.getNumericOID()+".6";
+    String lTag = mapper.getLanguageTag();
+
+    Collection<String> names = new HashSet<String>();
+    MatchingRule matchingRule = getMatchingRule(oid);
+    if(matchingRule!=null)
+    {
+      for(String name: matchingRule.getAllNames())
+      {
+        names.add(name);
+      }
+    }
+    names.add(lTag+".sub");
+    names.add(lTag + ".6");
+    matchingRule =
+          new CollationSubstringMatchingRule(oid,names,locale);
+    addMatchingRule(oid, matchingRule);
+  }
+
+
+
+
+ /**
+  * Verifies if the locale is supported by the JVM.
+  *
+  * @param  lTag  The language tag specified in the configuration.
+  * @return  Locale The locale correspoding to the languageTag.
+  */
+  private Locale getLocale(String lTag)
+  {
+    //Separates the language and the country from the locale.
+    Locale locale;
+    String lang = null;
+    String country = null;
+    String variant = null;
+
+    int countryIndex = lTag.indexOf("-");
+    int variantIndex = lTag.lastIndexOf("-");
+
+    if(countryIndex > 0)
+    {
+      lang = lTag.substring(0,countryIndex);
+
+      if(variantIndex>countryIndex)
+      {
+        country = lTag.substring(countryIndex+1,variantIndex);
+        variant = lTag.substring(variantIndex+1,lTag.length());
+        locale = new Locale(lang,country,variant);
+      }
+      else
+      {
+        country = lTag.substring(countryIndex+1,lTag.length());
+        locale = new Locale(lang,country);
+      }
+    }
+    else
+    {
+      lang = lTag;
+      locale = new Locale(lTag);
+    }
+
+    if(!supportedLocales.contains(locale))
+    {
+      //This locale is not supported by this JVM.
+      locale = null;
+    }
+    return locale;
+  }
+
+
+
+ /**
+  *Collation rule for Equality matching rule.
+  */
+  private final class CollationEqualityMatchingRule
+         extends ExtensibleMatchingRule
+  {
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+
+    /**
+     * Constructs a new CollationEqualityMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationEqualityMatchingRule(String nOID,Collection<String> names,
+            Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName()
+    {
+      //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getDescription()
+    {
+      // There is no standard description for this matching rule.
+      return null;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * Indicates whether the two provided normalized values are equal to
+    * each other.
+    *
+    * @param  value1  The normalized form of the first value to
+    *                 compare.
+    * @param  value2  The normalized form of the second value to
+    *                 compare.
+    *
+    * @return  {@code true} if the provided values are equal, or
+    *          {@code false} if not.
+    */
+    private boolean areEqual(ByteString value1, ByteString value2)
+    {
+      return Arrays.equals(value1.value(), value2.value());
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                     ByteString assertionValue)
+    {
+      if (areEqual(attributeValue, assertionValue))
+      {
+        return ConditionResult.TRUE;
+      }
+      else
+      {
+        return ConditionResult.FALSE;
+      }
+    }
+  }
+
+
+ /**
+  * Collation rule for Substring matching rule.
+  */
+  private final class CollationSubstringMatchingRule
+         extends ExtensibleMatchingRule
+  {
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+
+    /**
+     * Constructs a new CollationSubstringMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationSubstringMatchingRule(String nOID,
+            Collection<String> names,Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getName()
+    {
+      //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getDescription()
+    {
+      return null;
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public  ByteString normalizeAssertionValue(ByteString value)
+           throws DirectoryException
+    {
+      // Get a string  representation of the value.
+      String filterString = value.stringValue();
+      int endPos = filterString.length();
+
+      // Find the locations of all the asterisks in the value.  Also,
+      // check to see if there are any escaped values, since they will
+      // need special treatment.
+      boolean hasEscape = false;
+      LinkedList<Integer> asteriskPositions = new LinkedList<Integer>();
+      for (int i=0; i < endPos; i++)
+      {
+        if (filterString.charAt(i) == 0x2A) // The asterisk.
+        {
+          asteriskPositions.add(i);
+        }
+        else if (filterString.charAt(i) == 0x5C) // The backslash.
+        {
+          hasEscape = true;
+        }
+      }
+
+
+      // If there were no asterisks, then this isn't a substring filter.
+      if (asteriskPositions.isEmpty())
+      {
+        Message message = ERR_SEARCH_FILTER_SUBSTRING_NO_ASTERISKS.get(
+            filterString, 0, endPos);
+        throw new DirectoryException(
+                ResultCode.PROTOCOL_ERROR, message);
+      }
+
+      // If the value starts with an asterisk, then there is no
+      // subInitial component.  Otherwise, parse out the subInitial.
+      String subInitial;
+      int firstPos = asteriskPositions.removeFirst();
+      if (firstPos == 0)
+      {
+        subInitial = null;
+      }
+      else
+      {
+        if (hasEscape)
+        {
+          CharBuffer buffer = CharBuffer.allocate(firstPos);
+          for (int i=0; i < firstPos; i++)
+          {
+            if (filterString.charAt(i) == 0x5C)
+            {
+              char escapeValue = hexToEscapedChar(filterString, i +1);
+              i +=2; //Move to the next sequence.
+              buffer.put(escapeValue);
+            }
+            else
+            {
+              buffer.put(filterString.charAt(i));
+            }
+          }
+
+          char[] subInitialChars = new char[buffer.position()];
+          buffer.flip();
+          buffer.get(subInitialChars);
+          subInitial = new String(subInitialChars);
+        }
+        else
+        {
+          subInitial = filterString.substring(0,firstPos);
+        }
+      }
+
+
+      // Next, process through the rest of the asterisks to get the
+      // subAny values.
+      List<String> subAny = new ArrayList<String>();
+      for (int asteriskPos : asteriskPositions)
+      {
+        int length = asteriskPos - firstPos - 1;
+
+        if (hasEscape)
+        {
+          CharBuffer buffer = CharBuffer.allocate(length);
+          for (int i=firstPos+1; i < asteriskPos; i++)
+          {
+            if (filterString.charAt(i) == 0x5C)
+            {
+              char escapeValue = hexToEscapedChar(filterString, i + 1);
+              i +=2; //Move to the next sequence.
+              buffer.put(escapeValue);
+            }
+            else
+            {
+              buffer.put(filterString.charAt(i));
+            }
+          }
+
+          char[] subAnyChars = new char[buffer.position()];
+          buffer.flip();
+          buffer.get(subAnyChars);
+          subAny.add(new String(subAnyChars));
+        }
+        else
+        {
+          subAny.add(filterString.substring(firstPos+1, firstPos+length+1));
+        }
+
+
+        firstPos = asteriskPos;
+      }
+
+
+      // Finally, see if there is anything after the last asterisk,
+      // which would be the subFinal value.
+      String subFinal;
+      if (firstPos == (endPos-1))
+      {
+        subFinal = null;
+      }
+      else
+      {
+        int length = endPos - firstPos - 1;
+
+        if (hasEscape)
+        {
+          CharBuffer buffer = CharBuffer.allocate(length);
+          for (int i=firstPos+1; i < endPos; i++)
+          {
+            if (filterString.charAt(i) == 0x5C)
+            {
+              char escapeValue = hexToEscapedChar(filterString, i + 1);
+              i +=2; //Move to the next sequence.
+              buffer.put(escapeValue);
+            }
+            else
+            {
+              buffer.put(filterString.charAt(i));
+            }
+          }
+
+          char[] subFinalChars = new char[buffer.position()];
+          buffer.flip();
+          buffer.get(subFinalChars);
+          subFinal = new String(subFinalChars);
+        }
+        else
+        {
+          subFinal = filterString.substring(firstPos+1, length + firstPos + 1);
+        }
+      }
+
+      // Normalize the Values in the following format:
+      // initialLength, initial, numberofany, anyLength1, any1, anyLength2,
+      // any2, ..., anyLengthn, anyn, finalLength, final
+      CollationKey key = null;
+      List<Integer> normalizedList = new ArrayList<Integer>();
+
+      if(subInitial == null)
+      {
+        normalizedList.add(0);
+      }
+      else
+      {
+        key = collator.getCollationKey(subInitial);
+        byte[] initialBytes = key.toByteArray();
+        // Last 4 bytes are 0s with PRIMARY strenght.
+        int length = initialBytes.length - 4 ;
+        normalizedList.add(length);
+        for(int i=0;i<length;i++)
+        {
+          normalizedList.add((int)initialBytes[i]);
+        }
+      }
+      if(subAny.size()==0)
+      {
+        normalizedList.add(0);
+      }
+      else
+      {
+        normalizedList.add(subAny.size());
+        for(String any:subAny)
+        {
+          key = collator.getCollationKey(any);
+          byte[] anyBytes = key.toByteArray();
+          int length = anyBytes.length - 4;
+          normalizedList.add(length);
+          for(int i=0;i<length;i++)
+          {
+            normalizedList.add((int)anyBytes[i]);
+          }
+        }
+      }
+      if(subFinal ==null)
+      {
+        normalizedList.add(0);
+      }
+      else
+      {
+        key = collator.getCollationKey(subFinal);
+        byte[] subFinalBytes = key.toByteArray();
+        int length = subFinalBytes.length - 4;
+        normalizedList.add(length);
+        for(int i=0;i<length;i++)
+        {
+          normalizedList.add((int)subFinalBytes[i]);
+        }
+      }
+
+      byte[] normalizedBytes = new byte[normalizedList.size()];
+      for(int i=0;i<normalizedList.size();i++)
+      {
+        normalizedBytes[i] = normalizedList.get(i).byteValue();
+      }
+      return new ASN1OctetString(normalizedBytes);
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                       ByteString assertionValue)
+    {
+      byte[] valueBytes = attributeValue.value();
+      int valueLength = valueBytes.length - 4;
+
+      byte[] assertionBytes = assertionValue.value();
+
+      int valuePos = 0; // position in the value bytes array.
+      int assertPos = 0; // position in the assertion bytes array.
+      int subInitialLength = 0xFF & assertionBytes[0];
+      //First byte is the length of subInitial.
+
+      if(subInitialLength!= 0)
+      {
+        if(subInitialLength > valueLength)
+        {
+          return ConditionResult.FALSE;
+        }
+
+        for(;valuePos < subInitialLength; valuePos++)
+        {
+          if(valueBytes[valuePos]!=assertionBytes[valuePos+1])
+          {
+            return ConditionResult.FALSE;
+          }
+        }
+      }
+      assertPos = subInitialLength + 1;
+      int anySize = 0xFF & assertionBytes[assertPos++];
+      if(anySize!=0)
+      {
+        while(anySize-- > 0)
+        {
+          int anyLength = 0xFF & assertionBytes[assertPos++];
+          int end = valueLength - anyLength;
+          boolean match = false;
+          for(; valuePos <= end; valuePos++)
+          {
+
+            if(assertionBytes[assertPos] == valueBytes[valuePos])
+            {
+              boolean subMatch = true;
+              for(int i=1;i<anyLength;i++)
+              {
+
+                if(assertionBytes[assertPos+i] != valueBytes[valuePos+i])
+                {
+                  subMatch = false;
+                  break;
+                }
+              }
+
+              if(subMatch)
+              {
+                match = subMatch;
+                break;
+              }
+
+            }
+          }
+
+          if(match)
+          {
+            valuePos += anyLength;
+          }
+          else
+          {
+            return ConditionResult.FALSE;
+          }
+          assertPos = assertPos + anyLength;
+        }
+       }
+
+      int finalLength = 0xFF & assertionBytes[assertPos++];
+      if(finalLength!=0)
+      {
+        if((valueLength - finalLength) < valuePos)
+        {
+          return ConditionResult.FALSE;
+        }
+
+        valuePos = valueLength - finalLength;
+
+        if(finalLength != assertionBytes.length - assertPos )
+        {
+          //Some issue with the encoding.
+          return ConditionResult.FALSE;
+        }
+
+        valuePos = valueLength - finalLength;
+        for (int i=0; i < finalLength; i++,valuePos++)
+        {
+          if (assertionBytes[assertPos+i] != valueBytes[valuePos])
+          {
+            return ConditionResult.FALSE;
+          }
+        }
+      }
+
+      return ConditionResult.TRUE;
+     }
+  }
+
+ /**
+  *Collation rule for less-than matching rule.
+  */
+  private final class CollationLessThanMatchingRule
+         extends ExtensibleMatchingRule
+  {
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+    /**
+     * Constructs a new CollationLessThanMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationLessThanMatchingRule(String nOID,
+            Collection<String> names,Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getName()
+    {
+       //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+
+
+    /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+    /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getDescription()
+    {
+      // There is no standard description for this matching rule.
+      return null;
+    }
+
+
+
+    /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+    /**
+    * {@inheritDoc}
+    */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * Compares the first value to the second and returns a value that
+    * indicates their relative order.
+    *
+    * @param  b1  The normalized form of the first value to
+    *                 compare.
+    * @param  b2  The normalized form of the second value to
+    *                 compare.
+    *
+    * @return  A negative integer if {@code value1} should come before
+    *          {@code value2} in ascending order, a positive integer if
+    *          {@code value1} should come after {@code value2} in
+    *          ascending order, or zero if there is no difference
+    *          between the values with regard to ordering.
+    */
+    private int compare(byte[] b1, byte[] b2)
+    {
+      //Compare values using byte arrays.
+      int minLength = Math.min(b1.length, b2.length);
+
+      for (int i=0; i < minLength; i++)
+      {
+        int firstByte = 0xFF & ((int)b1[i]);
+        int secondByte = 0xFF & ((int)b2[i]);
+
+        if (firstByte == secondByte)
+        {
+          continue;
+        }
+        else if (firstByte < secondByte)
+        {
+          return -1;
+        }
+        else if (firstByte > secondByte)
+        {
+          return 1;
+        }
+      }
+
+      if (b1.length == b2.length)
+      {
+        return 0;
+      }
+      else if (b1.length < b2.length)
+      {
+        return -1;
+      }
+      else
+      {
+        return 1;
+      }
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                       ByteString assertionValue)
+    {
+      int ret = compare(attributeValue.value(),assertionValue.value());
+
+      if(ret <0)
+      {
+        return ConditionResult.TRUE;
+      }
+      else
+      {
+        return ConditionResult.FALSE;
+      }
+    }
+  }
+
+
+  /**
+  * Collation rule for less-than-equal-to matching rule.
+  */
+  private final class CollationLessThanOrEqualToMatchingRule
+         extends ExtensibleMatchingRule
+  {
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+
+    /**
+     * Constructs a new CollationLessThanOrEqualToMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationLessThanOrEqualToMatchingRule(String nOID,
+                                    Collection<String> names,
+                                    Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getName()
+    {
+      //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getDescription()
+    {
+      // There is no standard description for this matching rule.
+      return null;
+    }
+
+
+
+
+    /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * Compares the first value to the second and returns a value that
+    * indicates their relative order.
+    *
+    * @param  b1  The normalized form of the first value to
+    *                 compare.
+    * @param  b2  The normalized form of the second value to
+    *                 compare.
+    *
+    * @return  A negative integer if {@code value1} should come before
+    *          {@code value2} in ascending order, a positive integer if
+    *          {@code value1} should come after {@code value2} in
+    *          ascending order, or zero if there is no difference
+    *          between the values with regard to ordering.
+    */
+    public int compare(byte[] b1, byte[] b2)
+    {
+      //Compare values using byte arrays.
+      int minLength = Math.min(b1.length, b2.length);
+
+      for (int i=0; i < minLength; i++)
+      {
+        int firstByte = 0xFF & ((int)b1[i]);
+        int secondByte = 0xFF & ((int)b2[i]);
+
+        if (firstByte == secondByte)
+        {
+          continue;
+        }
+        else if (firstByte < secondByte)
+        {
+          return -1;
+        }
+        else if (firstByte > secondByte)
+        {
+          return 1;
+        }
+      }
+
+      if (b1.length == b2.length)
+      {
+        return 0;
+      }
+      else if (b1.length < b2.length)
+      {
+        return -1;
+      }
+      else
+      {
+        return 1;
+      }
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                       ByteString assertionValue)
+    {
+      int ret = compare(attributeValue.value(),assertionValue.value());
+
+      if(ret <= 0)
+      {
+        return ConditionResult.TRUE;
+      }
+      else
+      {
+        return ConditionResult.FALSE;
+      }
+    }
+  }
+
+
+
+ /**
+  * Collation rule for greater-than matching rule.
+  */
+  private final class CollationGreaterThanMatchingRule
+         extends ExtensibleMatchingRule
+  {
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+
+    /**
+     * Constructs a new CollationGreaterThanMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationGreaterThanMatchingRule(String nOID,
+            Collection<String> names,Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getName()
+    {
+     //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getDescription()
+    {
+      // There is no standard description for this matching rule.
+      return null;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * Compares the first value to the second and returns a value that
+    * indicates their relative order.
+    *
+    * @param  b1  The normalized form of the first value to
+    *                 compare.
+    * @param  b2  The normalized form of the second value to
+    *                 compare.
+    *
+    * @return  A negative integer if {@code value1} should come before
+    *          {@code value2} in ascending order, a positive integer if
+    *          {@code value1} should come after {@code value2} in
+    *          ascending order, or zero if there is no difference
+    *          between the values with regard to ordering.
+    */
+    public int compare(byte[] b1, byte[] b2)
+    {
+      //Compare values using byte arrays.
+      int minLength = Math.min(b1.length, b2.length);
+
+      for (int i=0; i < minLength; i++)
+      {
+        int firstByte = 0xFF & ((int)b1[i]);
+        int secondByte = 0xFF & ((int)b2[i]);
+
+        if (firstByte == secondByte)
+        {
+          continue;
+        }
+        else if (firstByte < secondByte)
+        {
+          return -1;
+        }
+        else if (firstByte > secondByte)
+        {
+          return 1;
+        }
+      }
+
+      if (b1.length == b2.length)
+      {
+        return 0;
+      }
+      else if (b1.length < b2.length)
+      {
+        return -1;
+      }
+      else
+      {
+        return 1;
+      }
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                       ByteString assertionValue)
+    {
+      int ret = compare(attributeValue.value(),assertionValue.value());
+
+      if(ret > 0)
+      {
+        return ConditionResult.TRUE;
+      }
+      else
+      {
+        return ConditionResult.FALSE;
+      }
+    }
+  }
+
+
+ /**
+  * Collation rule for greater-than-equal-to matching rule.
+  */
+  private final class CollationGreaterThanOrEqualToMatchingRule
+         extends ExtensibleMatchingRule
+  {
+
+    //Names for this class.
+    private final Collection<String> names;
+
+    //Collator for performing equality match.
+    private final Collator collator;
+
+    //Numeric OID of the rule.
+    private final String nOID;
+
+
+    /**
+     * Constructs a new CollationGreaterThanOrEqualToMatchingRule.
+     *
+     * @param nOID OID of the collation matching rule
+     * @param names names of this matching rule
+     * @param locale Locale of the collation matching rule
+     */
+    private CollationGreaterThanOrEqualToMatchingRule(String nOID,
+                                    Collection<String> names,
+                                    Locale locale)
+    {
+      super();
+      this.names = names;
+      this.collator =createCollator(locale);
+      this.nOID = nOID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getName()
+    {
+       //Concatenate all the names and return.
+      StringBuilder builder = new StringBuilder();
+      for(String name: getAllNames())
+      {
+        builder.append(name);
+        builder.append("\b");
+      }
+      return builder.toString();
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public Collection<String> getAllNames()
+    {
+      return Collections.unmodifiableCollection(names);
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getOID()
+    {
+      return nOID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getDescription()
+    {
+      // There is no standard description for this matching rule.
+      return null;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public String getSyntaxOID()
+    {
+      return SYNTAX_DIRECTORY_STRING_OID;
+    }
+
+
+
+   /**
+    * {@inheritDoc}
+    */
+    @Override
+    public ByteString normalizeValue(ByteString value)
+           throws DirectoryException
+    {
+      CollationKey key = collator.getCollationKey(value.stringValue());
+      return new ASN1OctetString(key.toByteArray());
+    }
+
+
+
+   /**
+    * Compares the first value to the second and returns a value that
+    * indicates their relative order.
+    *
+    * @param  b1  The normalized form of the first value to
+    *                 compare.
+    * @param  b2  The normalized form of the second value to
+    *                 compare.
+    *
+    * @return  A negative integer if {@code value1} should come before
+    *          {@code value2} in ascending order, a positive integer if
+    *          {@code value1} should come after {@code value2} in
+    *          ascending order, or zero if there is no difference
+    *          between the values with regard to ordering.
+    */
+    public int compare(byte[] b1, byte[] b2)
+    {
+      //Compare values using byte arrays.
+      int minLength = Math.min(b1.length, b2.length);
+
+      for (int i=0; i < minLength; i++)
+      {
+        int firstByte = 0xFF & ((int)b1[i]);
+        int secondByte = 0xFF & ((int)b2[i]);
+
+        if (firstByte == secondByte)
+        {
+          continue;
+        }
+        else if (firstByte < secondByte)
+        {
+          return -1;
+        }
+        else if (firstByte > secondByte)
+        {
+          return 1;
+        }
+      }
+
+      if (b1.length == b2.length)
+      {
+        return 0;
+      }
+      else if (b1.length < b2.length)
+      {
+        return -1;
+      }
+      else
+      {
+        return 1;
+      }
+    }
+
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ConditionResult valuesMatch(ByteString attributeValue,
+                                       ByteString assertionValue)
+    {
+      int ret = compare(attributeValue.value(),assertionValue.value());
+
+      if(ret >= 0)
+      {
+        return ConditionResult.TRUE;
+      }
+      else
+      {
+        return ConditionResult.FALSE;
+      }
+    }
+  }
+
+
+ /**
+  * A utility class for extracting the OID and Language Tag from the
+  * configuration entry.
+  */
+  private final class CollationMapper
+  {
+    //OID of the collation rule.
+    private  String oid;
+
+    //Language Tag.
+    private  String lTag;
+
+
+    /**
+     * Creates a new instance of CollationMapper.
+     *
+     * @param collation The collation text in the LOCALE:OID format.
+     */
+    private CollationMapper(String collation)
+    {
+      int index = collation.indexOf(":");
+      if(index>0)
+      {
+        oid = collation.substring(index+1,collation.length());
+        lTag = collation.substring(0,index);
+      }
+    }
+
+
+
+    /**
+     * Returns the OID part of the collation text.
+     *
+     * @return OID part of the collation text.
+     */
+    private String getNumericOID()
+    {
+      return oid;
+    }
+
+
+
+    /**
+     * Returns the language Tag of collation text.
+     *
+     * @return Language Tag part of the collation text.
+     */
+    private String getLanguageTag()
+    {
+      return lTag;
+    }
+  }
+}
\ No newline at end of file
diff --git a/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRule.java
index 4fea663..9f9f80e 100644
--- a/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRule.java
@@ -28,14 +28,13 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -50,7 +49,7 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-public class DirectoryStringFirstComponentEqualityMatchingRule
+class DirectoryStringFirstComponentEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -67,10 +66,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..9a8c48a
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/DirectoryStringFirstComponentEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link DirectoryStringFirstComponentEqualityMatchingRule}.
+ */
+public final class DirectoryStringFirstComponentEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new DirectoryStringFirstComponentEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRule.java
index 1cd50a7..8bdb1b8 100644
--- a/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRule.java
@@ -31,16 +31,15 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AcceptRejectWarn;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.DN;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -56,7 +55,7 @@
  * This class defines the distinguishedNameMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-public class DistinguishedNameEqualityMatchingRule
+class DistinguishedNameEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -80,10 +79,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..b4d0b8c
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/DistinguishedNameEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link DistinguishedNameEqualityMatchingRule}.
+ */
+public final class DistinguishedNameEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new DistinguishedNameEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRule.java b/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRule.java
index 01b024c..4a79b64 100644
--- a/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.ApproximateMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.ApproximateMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.DebugLogLevel;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -64,7 +63,7 @@
  * updated to always only generate a single value rather than one or possibly
  * two values.
  */
-public class DoubleMetaphoneApproximateMatchingRule
+class DoubleMetaphoneApproximateMatchingRule
        extends ApproximateMatchingRule
 {
   /**
@@ -87,10 +86,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(ApproximateMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRuleFactory.java
new file mode 100644
index 0000000..3bb3dad
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/DoubleMetaphoneApproximateMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link DoubleMetaphoneApproximateMatchingRule}.
+ */
+public final class DoubleMetaphoneApproximateMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new DoubleMetaphoneApproximateMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
index d05ceef..40e8522 100644
--- a/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRule.java
@@ -28,28 +28,26 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.ServerConstants.*;
 
 
 /**
  * This class defines the generalizedTimeMatch matching rule defined in X.520
  * and referenced in RFC 2252.
  */
-public class GeneralizedTimeEqualityMatchingRule
+class GeneralizedTimeEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -72,10 +70,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..b15760b
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/GeneralizedTimeEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link GeneralizedTimeEqualityMatchingRule}.
+ */
+public final class GeneralizedTimeEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+  {
+    matchingRule = new GeneralizedTimeEqualityMatchingRule();
+  }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+  public final Collection<MatchingRule> getMatchingRules()
+  {
+    return Collections.singleton(matchingRule);
+  }
+}
diff --git a/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
index 151f51d..54335ee 100644
--- a/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRule.java
@@ -28,21 +28,19 @@
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.ServerConstants.*;
 
 
 
@@ -50,7 +48,7 @@
  * This class defines the generalizedTimeOrderingMatch matching rule defined in
  * X.520 and referenced in RFC 2252.
  */
-public class GeneralizedTimeOrderingMatchingRule
+class GeneralizedTimeOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -83,10 +81,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..c011f98
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/GeneralizedTimeOrderingMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link GeneralizedTimeOrderingMatchingRule}.
+ */
+public final class GeneralizedTimeOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new GeneralizedTimeOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
index aff7794..2acf40d 100644
--- a/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRule.java
@@ -31,14 +31,13 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -50,7 +49,7 @@
  * This class defines the integerMatch matching rule defined in X.520 and
  * referenced in RFC 2252.
  */
-public class IntegerEqualityMatchingRule
+class IntegerEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -66,10 +65,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..f942bd5
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/IntegerEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link IntegerEqualityMatchingRule}.
+ */
+public final class IntegerEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new IntegerEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRule.java
index c09b8e1..901ff63 100644
--- a/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRule.java
@@ -25,18 +25,17 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.messages.Message;
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -56,7 +55,7 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-public class IntegerFirstComponentEqualityMatchingRule
+class IntegerFirstComponentEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -80,10 +79,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..3ac0441
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/IntegerFirstComponentEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link IntegerFirstComponentEqualityMatchingRule}.
+ */
+public final class IntegerFirstComponentEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new IntegerFirstComponentEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
index b17a204..917f858 100644
--- a/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRule.java
@@ -25,18 +25,18 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.messages.Message;
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.ErrorLogger.*;
@@ -48,7 +48,7 @@
  * This class defines the integerOrderingMatch matching rule defined in X.520
  * and referenced in RFC 4519.
  */
-public class IntegerOrderingMatchingRule
+class IntegerOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -74,10 +74,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..1663dff
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/IntegerOrderingMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link IntegerOrderingMatchingRule}.
+ */
+public final class IntegerOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new IntegerOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRule.java
index 8ce65d9..90e0825 100644
--- a/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRule.java
@@ -28,12 +28,9 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
-import org.opends.server.config.ConfigException;
-import org.opends.server.types.InitializationException;
-
+import java.util.Collection;
+import java.util.Collections;
 import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
 
 
 
@@ -42,7 +39,7 @@
  * document defines "keyword" as implementation-specific, but in this case we
  * will interpret it in the same way as "word" for the wordMatch rule.
  */
-public class KeywordEqualityMatchingRule
+class KeywordEqualityMatchingRule
        extends WordEqualityMatchingRule
 {
   /**
@@ -58,10 +55,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
@@ -72,6 +68,7 @@
    * @return  The common name for this matching rule, or <CODE>null</CODE> if
    * it does not have a name.
    */
+  @Override
   public String getName()
   {
     return EMR_KEYWORD_NAME;
@@ -84,6 +81,7 @@
    *
    * @return  The OID for this matching rule.
    */
+  @Override
   public String getOID()
   {
     return EMR_KEYWORD_OID;
diff --git a/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..f7b2ee3
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/KeywordEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link KeywordEqualityMatchingRule}.
+ */
+public final class KeywordEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new KeywordEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
index 4366962..2f46dd6 100644
--- a/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRule.java
@@ -31,14 +31,13 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -52,7 +51,7 @@
  * and referenced in RFC 2252.  It allows for values with numeric digits and
  * spaces, but ignores spaces when performing matching.
  */
-public class NumericStringEqualityMatchingRule
+class NumericStringEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -68,10 +67,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..b4e20ed
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/NumericStringEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link NumericStringEqualityMatchingRule}.
+ */
+public final class NumericStringEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new NumericStringEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
index 5c0e714..54a82ac 100644
--- a/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRule.java
@@ -25,18 +25,17 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.messages.Message;
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -49,7 +48,7 @@
  * This implements defines the numericStringOrderingMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-public class NumericStringOrderingMatchingRule
+class NumericStringOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -75,10 +74,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..8492926
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/NumericStringOrderingMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link NumericStringOrderingMatchingRule}.
+ */
+public final class NumericStringOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+ //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule =  new NumericStringOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
index 2c36a95..652825f 100644
--- a/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRule.java
@@ -25,20 +25,20 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.messages.Message;
 
 
 
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -51,7 +51,7 @@
  * This class implements the numericStringSubstringsMatch matching rule defined
  * in X.520 and referenced in RFC 2252.
  */
-public class NumericStringSubstringMatchingRule
+class NumericStringSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -67,10 +67,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..796fba7
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/NumericStringSubstringMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link NumericStringSubstringMatchingRule}.
+ */
+public final class NumericStringSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new NumericStringSubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
index e5fc426..5bd1c0f 100644
--- a/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRule.java
@@ -31,16 +31,15 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types. AttributeType;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.NameForm;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.ResultCode;
@@ -56,7 +55,7 @@
  * and referenced in RFC 2252.  This expects to work on OIDs and will match
  * either an attribute/objectclass name or a numeric OID.
  */
-public class ObjectIdentifierEqualityMatchingRule
+class ObjectIdentifierEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -72,10 +71,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..ffcdc31
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/ObjectIdentifierEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link ObjectIdentifierEqualityMatchingRule}.
+ */
+public final class ObjectIdentifierEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new ObjectIdentifierEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRule.java
index e1da70c..6b845d3 100644
--- a/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRule.java
@@ -28,18 +28,17 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.AttributeSyntax;
 import org.opends.server.api.EqualityMatchingRule;
 import org.opends.server.api.MatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.NameForm;
 import org.opends.server.types.ObjectClass;
 
@@ -56,7 +55,7 @@
  * objectclass descriptions) in which the "first component" is the first item
  * after the opening parenthesis.
  */
-public class ObjectIdentifierFirstComponentEqualityMatchingRule
+class ObjectIdentifierFirstComponentEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -72,10 +71,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..bb09b02
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link ObjectIdentifierFirstComponentEqualityMatchingRule}.
+ */
+public final class ObjectIdentifierFirstComponentEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new ObjectIdentifierFirstComponentEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRule.java
index 83a253f..54a3f15 100644
--- a/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 
@@ -47,7 +46,7 @@
  * will be used as the default equality matching rule for the binary and octet
  * string syntaxes.
  */
-public class OctetStringEqualityMatchingRule
+class OctetStringEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -63,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..4ddc78a
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/OctetStringEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link OctetStringEqualityMatchingRule}.
+ */
+public final class OctetStringEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new OctetStringEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
index 82987e7..a6b3a69 100644
--- a/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRule.java
@@ -28,13 +28,12 @@
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.util.StaticUtils;
 
 import static org.opends.server.schema.SchemaConstants.*;
@@ -46,7 +45,7 @@
  * X.520.  This will be the default ordering matching rule for the binary and
  * octet string syntaxes.
  */
-public class OctetStringOrderingMatchingRule
+class OctetStringOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -72,10 +71,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..fe87569
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/OctetStringOrderingMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link OctectStringOrderingMatchingRule}.
+ */
+public final class OctetStringOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+    matchingRule =  new OctetStringOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRule.java
index 87d7d08..177a9bc 100644
--- a/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRule.java
@@ -28,18 +28,16 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
-import static org.opends.server.util.StaticUtils.*;
 
 
 
@@ -48,7 +46,7 @@
  * X.520.  It will be used as the default substring matching rule for the binary
  * and octet string syntaxes.
  */
-public class OctetStringSubstringMatchingRule
+class OctetStringSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -64,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..6e7b111
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/OctetStringSubstringMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link OctectStringSubstringMatchingRule}.
+ */
+public final class OctetStringSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+  {
+    matchingRule = new OctetStringSubstringMatchingRule();
+  }
+
+
+
+  /**
+   * {@inheritDoc}
+   */
+  @Override
+  public final Collection<MatchingRule> getMatchingRules()
+  {
+    return Collections.singleton(matchingRule);
+  }
+}
diff --git a/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRule.java
index 6e9b168..954aa96 100644
--- a/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -49,7 +48,7 @@
  * associated syntax have been deprecated, this matching rule behaves exactly
  * like the caseIgnoreMatch rule.
  */
-public class PresentationAddressEqualityMatchingRule
+class PresentationAddressEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -62,13 +61,12 @@
 
 
 
-  /**
+/**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..81651b7
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/PresentationAddressEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link PresentationAddressEqualityMatchingRule}.
+ */
+public final class PresentationAddressEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+    matchingRule = new PresentationAddressEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRule.java
index b60ae7c..f778a1f 100644
--- a/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -49,7 +48,7 @@
  * associated syntax have been deprecated, this matching rule behaves exactly
  * like the caseIgnoreMatch rule.
  */
-public class ProtocolInformationEqualityMatchingRule
+class ProtocolInformationEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -65,10 +64,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..373686a
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/ProtocolInformationEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link ProtocolInformationEqualityMatchingRule}.
+ */
+public final class ProtocolInformationEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new ProtocolInformationEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRule.java
index 95fed70..de40bfa 100644
--- a/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -49,7 +48,7 @@
  * very rigorous format, this is widely ignored so this matching will compare
  * only numeric digits and strip out everything else.
  */
-public class TelephoneNumberEqualityMatchingRule
+class TelephoneNumberEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -65,10 +64,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..bda9317
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/TelephoneNumberEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link TelephoneNumberEqualityMatchingRule}.
+ */
+public final class TelephoneNumberEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new TelephoneNumberEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java b/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java
index 3f946fb..b790751 100644
--- a/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRule.java
@@ -28,15 +28,14 @@
 
 
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.List;
 
-import org.opends.server.admin.std.server.SubstringMatchingRuleCfg;
 import org.opends.server.api.SubstringMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -49,7 +48,7 @@
  * specification calls for a very rigorous format, this is widely ignored so
  * this matching will compare only numeric digits and strip out everything else.
  */
-public class TelephoneNumberSubstringMatchingRule
+class TelephoneNumberSubstringMatchingRule
        extends SubstringMatchingRule
 {
   /**
@@ -66,10 +65,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(SubstringMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRuleFactory.java
new file mode 100644
index 0000000..c9e92a3
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/TelephoneNumberSubstringMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link TelephoneNumberSubstringMatchingRule}.
+ */
+public final class TelephoneNumberSubstringMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new TelephoneNumberSubstringMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
index c50d715..05ea4e5 100644
--- a/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRule.java
@@ -30,15 +30,14 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.ErrorLogger.*;
@@ -52,7 +51,7 @@
  * This class defines the uuidMatch matching rule defined in RFC 4530.  It will
  * be used as the default equality matching rule for the UUID syntax.
  */
-public class UUIDEqualityMatchingRule
+class UUIDEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -68,10 +67,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..7116a2b
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/UUIDEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link UUIDEqualityMatchingRule}.
+ */
+public final class UUIDEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+ // Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new UUIDEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java b/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
index 5f17f6c..d83427c 100644
--- a/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRule.java
@@ -25,18 +25,18 @@
  *      Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.schema;
+
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.messages.Message;
 
 
 
-import org.opends.server.admin.std.server.OrderingMatchingRuleCfg;
 import org.opends.server.api.OrderingMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.messages.SchemaMessages.*;
@@ -48,7 +48,7 @@
  * This class defines the uuidOrderingMatch matching rule defined in RFC 4530.
  * This will be the default ordering matching rule for the UUID syntax.
  */
-public class UUIDOrderingMatchingRule
+class UUIDOrderingMatchingRule
        extends OrderingMatchingRule
 {
   /**
@@ -74,10 +74,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(OrderingMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRuleFactory.java
new file mode 100644
index 0000000..57dd4c0
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/UUIDOrderingMatchingRuleFactory.java
@@ -0,0 +1,70 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for {@link UUIDOrderingMatchingRule}.
+ */
+public final class UUIDOrderingMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new UUIDOrderingMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
index ed81a4a..669ca5f 100644
--- a/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRule.java
@@ -31,15 +31,14 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
 import org.opends.server.types.DN;
-import org.opends.server.types.InitializationException;
 import org.opends.server.types.ResultCode;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -58,7 +57,7 @@
  * and will compare values with a distinguished name and optional bit string
  * suffix.
  */
-public class UniqueMemberEqualityMatchingRule
+class UniqueMemberEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -81,10 +80,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..63a24ce
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/UniqueMemberEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+ /**
+ * This class is a factory class for
+  * {@link UniqueMemberEqualityMatchingRule}.
+ */
+public final class UniqueMemberEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new UniqueMemberEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
index f78f6fc..61ba9dc 100644
--- a/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRule.java
@@ -30,17 +30,16 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
 import org.opends.server.api.PasswordStorageScheme;
-import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ConditionResult;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.loggers.debug.DebugLogger.*;
 import org.opends.server.loggers.debug.DebugTracer;
@@ -53,7 +52,7 @@
  * This class implements the userPasswordMatch matching rule, which can be used
  * to determine whether a clear-text value matches an encoded password.
  */
-public class UserPasswordEqualityMatchingRule
+class UserPasswordEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -76,10 +75,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..60a48b2
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java
@@ -0,0 +1,72 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link UserPasswordExactEqualityMatchingRule}.
+ */
+public final class UserPasswordEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new UserPasswordEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRule.java
index c171ca7..7d8b870 100644
--- a/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRule.java
@@ -30,13 +30,12 @@
 
 import java.util.Arrays;
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collections;
+import java.util.Collection;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 
@@ -47,7 +46,7 @@
  * simply compare encoded hashed password values to see if they are exactly
  * equal to each other.
  */
-public class UserPasswordExactEqualityMatchingRule
+class UserPasswordExactEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -63,10 +62,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..43dfa35
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/UserPasswordExactEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link UserPasswordExactEqualityMatchingRule}.
+ */
+public final class UserPasswordExactEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new UserPasswordExactEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/schema/WordEqualityMatchingRule.java b/opends/src/server/org/opends/server/schema/WordEqualityMatchingRule.java
index bfbe2b3..09b9572 100644
--- a/opends/src/server/org/opends/server/schema/WordEqualityMatchingRule.java
+++ b/opends/src/server/org/opends/server/schema/WordEqualityMatchingRule.java
@@ -28,14 +28,13 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 import static org.opends.server.util.StaticUtils.*;
@@ -62,7 +61,7 @@
  *   <LI>An equal sign</LI>
  * </UL>
  */
-public class WordEqualityMatchingRule
+class WordEqualityMatchingRule
        extends EqualityMatchingRule
 {
   /**
@@ -78,10 +77,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/src/server/org/opends/server/schema/WordEqualityMatchingRuleFactory.java b/opends/src/server/org/opends/server/schema/WordEqualityMatchingRuleFactory.java
new file mode 100644
index 0000000..8637fda
--- /dev/null
+++ b/opends/src/server/org/opends/server/schema/WordEqualityMatchingRuleFactory.java
@@ -0,0 +1,71 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.Collection;
+import java.util.Collections;
+import org.opends.server.api.MatchingRuleFactory;
+import org.opends.server.admin.std.server.MatchingRuleCfg;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.config.ConfigException;
+import org.opends.server.types.InitializationException;
+
+/**
+ * This class is a factory class for
+ * {@link WordEqualityMatchingRule}.
+ */
+public final class WordEqualityMatchingRuleFactory
+        extends MatchingRuleFactory<MatchingRuleCfg>
+{
+  //Associated Matching Rule.
+  private MatchingRule matchingRule;
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final void initializeMatchingRule(MatchingRuleCfg configuration)
+         throws ConfigException, InitializationException
+ {
+   matchingRule = new WordEqualityMatchingRule();
+ }
+
+
+
+ /**
+  * {@inheritDoc}
+  */
+ @Override
+ public final Collection<MatchingRule> getMatchingRules()
+ {
+    return Collections.singleton(matchingRule);
+ }
+}
diff --git a/opends/src/server/org/opends/server/types/Schema.java b/opends/src/server/org/opends/server/types/Schema.java
index 039a1ac..f969e45 100644
--- a/opends/src/server/org/opends/server/types/Schema.java
+++ b/opends/src/server/org/opends/server/types/Schema.java
@@ -99,7 +99,7 @@
 
   // The matching rule that will be used to normalize schema element
   // definitions.
-  private EqualityMatchingRule normalizationMatchingRule;
+  private MatchingRule normalizationMatchingRule;
 
   // The set of subordinate attribute types registered within the
   // server schema.
@@ -1019,32 +1019,36 @@
                            ResultCode.CONSTRAINT_VIOLATION, message);
           }
 
-          String name = matchingRule.getName();
-          if (name != null)
+          for(String name:matchingRule.getAllNames())
           {
-            name = toLowerCase(name);
-            if (matchingRules.containsKey(name))
+            if (name != null)
             {
-              MatchingRule conflictingRule = matchingRules.get(name);
+              name = toLowerCase(name);
+              if (matchingRules.containsKey(name))
+              {
+                MatchingRule conflictingRule =
+                        matchingRules.get(name);
 
-              Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
-                  get(matchingRule.getOID(), name,
-                      conflictingRule.getOID());
-              throw new DirectoryException(
-                            ResultCode.CONSTRAINT_VIOLATION, message);
+                Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
+                    get(matchingRule.getOID(), name,
+                        conflictingRule.getOID());
+                throw new DirectoryException(
+                              ResultCode.CONSTRAINT_VIOLATION,
+                              message);
+              }
             }
           }
         }
-
         matchingRules.put(toLowerCase(matchingRule.getOID()),
                           matchingRule);
 
-        String name = matchingRule.getName();
-        if (name != null)
+        for(String name:matchingRule.getAllNames())
         {
-          matchingRules.put(toLowerCase(name), matchingRule);
+          if (name != null)
+          {
+            matchingRules.put(toLowerCase(name), matchingRule);
+          }
         }
-
         // We'll use an attribute value including the normalized value
         // rather than the attribute type because otherwise it would
         // use a very expensive matching rule (OID first component
@@ -1097,13 +1101,14 @@
         matchingRules.remove(toLowerCase(matchingRule.getOID()),
                              matchingRule);
 
-        String name = matchingRule.getName();
-        if (name != null)
+        for(String name:matchingRule.getAllNames())
         {
-          matchingRules.remove(toLowerCase(name), matchingRule);
+          if (name != null)
+          {
+            matchingRules.remove(toLowerCase(name), matchingRule);
+          }
         }
 
-
         // We'll use an attribute value including the normalized value
         // rather than the attribute type because otherwise it would
         // use a very expensive matching rule (OID first component
@@ -1208,7 +1213,8 @@
                          ResultCode.CONSTRAINT_VIOLATION, message);
         }
 
-        String name = matchingRule.getName();
+       for(String name:matchingRule.getAllNames())
+       {
         if (name != null)
         {
           name = toLowerCase(name);
@@ -1223,20 +1229,22 @@
                            ResultCode.CONSTRAINT_VIOLATION, message);
           }
         }
+       }
       }
 
       String oid = toLowerCase(matchingRule.getOID());
       approximateMatchingRules.put(oid, matchingRule);
       matchingRules.put(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        approximateMatchingRules.put(name, matchingRule);
-        matchingRules.put(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          approximateMatchingRules.put(name, matchingRule);
+          matchingRules.put(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1267,14 +1275,15 @@
       approximateMatchingRules.remove(oid, matchingRule);
       matchingRules.remove(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        approximateMatchingRules.remove(name, matchingRule);
-        matchingRules.remove(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          approximateMatchingRules.remove(name, matchingRule);
+          matchingRules.remove(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1376,20 +1385,24 @@
                          ResultCode.CONSTRAINT_VIOLATION, message);
         }
 
-        String name = matchingRule.getName();
-        if (name != null)
+        for(String name:matchingRule.getAllNames())
         {
-          name = toLowerCase(name);
-          if (matchingRules.containsKey(name))
-          {
-            MatchingRule conflictingRule = matchingRules.get(name);
+           if (name != null)
+           {
+              name = toLowerCase(name);
+              if (matchingRules.containsKey(name))
+              {
+                MatchingRule conflictingRule =
+                        matchingRules.get(name);
 
-            Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
-                get(matchingRule.getOID(), name,
-                    conflictingRule.getOID());
-            throw new DirectoryException(
-                           ResultCode.CONSTRAINT_VIOLATION, message);
-          }
+                Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
+                    get(matchingRule.getOID(), name,
+                        conflictingRule.getOID());
+                throw new DirectoryException(
+                               ResultCode.CONSTRAINT_VIOLATION,
+                               message);
+              }
+           }
         }
       }
 
@@ -1397,14 +1410,15 @@
       equalityMatchingRules.put(oid, matchingRule);
       matchingRules.put(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        equalityMatchingRules.put(name, matchingRule);
-        matchingRules.put(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          equalityMatchingRules.put(name, matchingRule);
+          matchingRules.put(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1435,15 +1449,16 @@
       equalityMatchingRules.remove(oid, matchingRule);
       matchingRules.remove(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        equalityMatchingRules.remove(name, matchingRule);
-        matchingRules.remove(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          equalityMatchingRules.remove(name, matchingRule);
+          matchingRules.remove(name, matchingRule);
+        }
       }
 
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1545,19 +1560,22 @@
                          ResultCode.CONSTRAINT_VIOLATION, message);
         }
 
-        String name = matchingRule.getName();
-        if (name != null)
+        for(String name:matchingRule.getAllNames())
         {
-          name = toLowerCase(name);
-          if (matchingRules.containsKey(name))
+          if (name != null)
           {
-            MatchingRule conflictingRule = matchingRules.get(name);
+            name = toLowerCase(name);
+            if (matchingRules.containsKey(name))
+            {
+              MatchingRule conflictingRule = matchingRules.get(name);
 
-            Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
-                get(matchingRule.getOID(), name,
-                    conflictingRule.getOID());
-            throw new DirectoryException(
-                           ResultCode.CONSTRAINT_VIOLATION, message);
+              Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
+                  get(matchingRule.getOID(), name,
+                      conflictingRule.getOID());
+              throw new DirectoryException(
+                             ResultCode.CONSTRAINT_VIOLATION,
+                             message);
+            }
           }
         }
       }
@@ -1566,14 +1584,15 @@
       orderingMatchingRules.put(oid, matchingRule);
       matchingRules.put(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        orderingMatchingRules.put(name, matchingRule);
-        matchingRules.put(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          orderingMatchingRules.put(name, matchingRule);
+          matchingRules.put(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1604,14 +1623,15 @@
       orderingMatchingRules.remove(oid, matchingRule);
       matchingRules.remove(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        orderingMatchingRules.remove(name, matchingRule);
-        matchingRules.remove(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          orderingMatchingRules.remove(name, matchingRule);
+          matchingRules.remove(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1713,19 +1733,22 @@
                          ResultCode.CONSTRAINT_VIOLATION, message);
         }
 
-        String name = matchingRule.getName();
-        if (name != null)
+        for(String name:matchingRule.getAllNames())
         {
-          name = toLowerCase(name);
-          if (matchingRules.containsKey(name))
+          if (name != null)
           {
-            MatchingRule conflictingRule = matchingRules.get(name);
+            name = toLowerCase(name);
+            if (matchingRules.containsKey(name))
+            {
+              MatchingRule conflictingRule = matchingRules.get(name);
 
-            Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
-                get(matchingRule.getOID(), name,
-                    conflictingRule.getOID());
-            throw new DirectoryException(
-                           ResultCode.CONSTRAINT_VIOLATION, message);
+              Message message = ERR_SCHEMA_CONFLICTING_MR_NAME.
+                  get(matchingRule.getOID(), name,
+                      conflictingRule.getOID());
+              throw new DirectoryException(
+                             ResultCode.CONSTRAINT_VIOLATION,
+                             message);
+            }
           }
         }
       }
@@ -1734,14 +1757,15 @@
       substringMatchingRules.put(oid, matchingRule);
       matchingRules.put(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        substringMatchingRules.put(name, matchingRule);
-        matchingRules.put(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          substringMatchingRules.put(name, matchingRule);
+          matchingRules.put(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
@@ -1772,14 +1796,15 @@
       substringMatchingRules.remove(oid, matchingRule);
       matchingRules.remove(oid, matchingRule);
 
-      String name = matchingRule.getName();
-      if (name != null)
+      for(String name:matchingRule.getAllNames())
       {
-        name = toLowerCase(name);
-        substringMatchingRules.remove(name, matchingRule);
-        matchingRules.remove(name, matchingRule);
+        if (name != null)
+        {
+          name = toLowerCase(name);
+          substringMatchingRules.remove(name, matchingRule);
+          matchingRules.remove(name, matchingRule);
+        }
       }
-
       // We'll use an attribute value including the normalized value
       // rather than the attribute type because otherwise it would use
       // a very expensive matching rule (OID first component match)
diff --git a/opends/src/server/org/opends/server/types/SearchFilter.java b/opends/src/server/org/opends/server/types/SearchFilter.java
index d69bafe..5bb6795 100644
--- a/opends/src/server/org/opends/server/types/SearchFilter.java
+++ b/opends/src/server/org/opends/server/types/SearchFilter.java
@@ -2110,7 +2110,7 @@
       }
       else
       {
-        MatchingRule<?> mr = DirectoryServer.getMatchingRule(
+        MatchingRule mr = DirectoryServer.getMatchingRule(
                                toLowerCase(matchingRuleID));
         if (mr == null)
         {
@@ -3306,8 +3306,8 @@
     }
 
 
-    // We must have a matching rule to use in the determination.
-    MatchingRule<?> matchingRule = null;
+    MatchingRule matchingRule = null;
+
     if (matchingRuleID != null)
     {
       matchingRule =
@@ -3383,8 +3383,9 @@
     ByteString normalizedValue;
     try
     {
-      normalizedValue =
-           matchingRule.normalizeValue(assertionValue.getValue());
+        normalizedValue =
+              matchingRule.
+               normalizeAssertionValue(assertionValue.getValue());
     }
     catch (Exception e)
     {
@@ -3895,7 +3896,7 @@
           }
           else
           {
-            MatchingRule<?> mr =
+            MatchingRule mr =
                  DirectoryServer.getMatchingRule(
                       toLowerCase(matchingRuleID));
             if (mr == null)
diff --git a/opends/src/server/org/opends/server/util/StaticUtils.java b/opends/src/server/org/opends/server/util/StaticUtils.java
index 0cbb9ac..ce001b2 100644
--- a/opends/src/server/org/opends/server/util/StaticUtils.java
+++ b/opends/src/server/org/opends/server/util/StaticUtils.java
@@ -70,10 +70,13 @@
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.DN;
 import org.opends.server.types.DebugLogLevel;
+import org.opends.server.types.DirectoryException;
 import org.opends.server.types.Entry;
 import org.opends.server.types.IdentifiedException;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.RDN;
+import org.opends.server.types.ResultCode;
+import static org.opends.messages.CoreMessages.*;
 
 
 /**
@@ -4115,5 +4118,164 @@
     return addr != null && addr.contains("@") && addr.contains(".");
 
   }
+
+
+
+   /**
+    * Evaluates  and converts 2 consequetive characters  of the provided
+    * string starting at startPos and converts them into a single escaped char.
+    *
+    * @param  hexString  The hexadecimal string containing
+    *                 the escape sequence.
+    * @param startPos The starting position of the hexadecimal escape
+    *                  sequence.
+    *
+    * @return The escaped character
+    *
+    * @throws  DirectoryException  If the provided string contains invalid
+    *                          hexadecimal digits .
+   */
+  public static char hexToEscapedChar(String hexString,int startPos)
+          throws DirectoryException
+  {
+
+    // The two positions  must be the hex characters that
+    // comprise the escaped value.
+    if ((startPos+ 1) >= hexString.length())
+    {
+      Message message =
+          ERR_SEARCH_FILTER_INVALID_ESCAPED_BYTE.
+            get(hexString, startPos+1);
+
+      throw new DirectoryException(ResultCode.PROTOCOL_ERROR,
+                                   message);
+    }
+    byte byteValue = 0;
+    switch(hexString.charAt(startPos))
+    {
+      case 0x30: // '0'
+        break;
+      case 0x31: // '1'
+        byteValue = (byte) 0x10;
+        break;
+      case 0x32: // '2'
+        byteValue = (byte) 0x20;
+        break;
+      case 0x33: // '3'
+        byteValue = (byte) 0x30;
+        break;
+      case 0x34: // '4'
+        byteValue = (byte) 0x40;
+        break;
+      case 0x35: // '5'
+        byteValue = (byte) 0x50;
+        break;
+      case 0x36: // '6'
+        byteValue = (byte) 0x60;
+        break;
+      case 0x37: // '7'
+        byteValue = (byte) 0x70;
+        break;
+      case 0x38: // '8'
+        byteValue = (byte) 0x80;
+        break;
+      case 0x39: // '9'
+        byteValue = (byte) 0x90;
+        break;
+      case 0x41: // 'A'
+      case 0x61: // 'a'
+        byteValue = (byte) 0xA0;
+        break;
+      case 0x42: // 'B'
+      case 0x62: // 'b'
+        byteValue = (byte) 0xB0;
+        break;
+      case 0x43: // 'C'
+      case 0x63: // 'c'
+        byteValue = (byte) 0xC0;
+        break;
+      case 0x44: // 'D'
+      case 0x64: // 'd'
+        byteValue = (byte) 0xD0;
+        break;
+      case 0x45: // 'E'
+      case 0x65: // 'e'
+        byteValue = (byte) 0xE0;
+        break;
+      case 0x46: // 'F'
+      case 0x66: // 'f'
+        byteValue = (byte) 0xF0;
+        break;
+      default:
+        Message message =
+                      ERR_SEARCH_FILTER_INVALID_ESCAPED_BYTE.
+                        get(hexString, startPos);
+        throw new DirectoryException(
+                                 ResultCode.PROTOCOL_ERROR, message);
+    }
+
+    switch (hexString.charAt(++startPos))
+    {
+      case 0x30: // '0'
+        break;
+      case 0x31: // '1'
+        byteValue |= (byte) 0x01;
+        break;
+      case 0x32: // '2'
+        byteValue |= (byte) 0x02;
+        break;
+      case 0x33: // '3'
+        byteValue |= (byte) 0x03;
+        break;
+      case 0x34: // '4'
+        byteValue |= (byte) 0x04;
+        break;
+      case 0x35: // '5'
+        byteValue |= (byte) 0x05;
+        break;
+      case 0x36: // '6'
+        byteValue |= (byte) 0x06;
+        break;
+      case 0x37: // '7'
+        byteValue |= (byte) 0x07;
+        break;
+      case 0x38: // '8'
+        byteValue |= (byte) 0x08;
+        break;
+      case 0x39: // '9'
+        byteValue |= (byte) 0x09;
+        break;
+      case 0x41: // 'A'
+      case 0x61: // 'a'
+        byteValue |= (byte) 0x0A;
+        break;
+      case 0x42: // 'B'
+      case 0x62: // 'b'
+        byteValue |= (byte) 0x0B;
+        break;
+      case 0x43: // 'C'
+      case 0x63: // 'c'
+        byteValue |= (byte) 0x0C;
+        break;
+      case 0x44: // 'D'
+      case 0x64: // 'd'
+        byteValue |= (byte) 0x0D;
+        break;
+      case 0x45: // 'E'
+      case 0x65: // 'e'
+        byteValue |= (byte) 0x0E;
+        break;
+      case 0x46: // 'F'
+      case 0x66: // 'f'
+        byteValue |= (byte) 0x0F;
+        break;
+      default:
+        Message message =ERR_SEARCH_FILTER_INVALID_ESCAPED_BYTE.
+                        get(hexString, startPos);
+        throw new DirectoryException(
+                                 ResultCode.PROTOCOL_ERROR, message);
+    }
+    return (char)byteValue;
+  }
 }
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaTestMatchingRule.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaTestMatchingRule.java
index 9e3dbae..eeed142 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaTestMatchingRule.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/backends/SchemaTestMatchingRule.java
@@ -28,13 +28,13 @@
 
 
 
-import org.opends.server.admin.std.server.EqualityMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.EqualityMatchingRule;
-import org.opends.server.config.ConfigException;
-import org.opends.server.schema.CaseIgnoreEqualityMatchingRule;
+import org.opends.server.api.MatchingRule;
+import org.opends.server.schema.CaseIgnoreEqualityMatchingRuleFactory;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 
 
@@ -51,7 +51,7 @@
   private boolean isObsolete;
 
   // The matching rule that will do all the real work behind the scenes.
-  private CaseIgnoreEqualityMatchingRule caseIgnoreMatchingRule;
+  private EqualityMatchingRule caseIgnoreMatchingRule;
 
   // The name for this matching rule.
   private String name;
@@ -77,8 +77,11 @@
     this.name = name;
     this.oid  = oid;
 
-    caseIgnoreMatchingRule = new CaseIgnoreEqualityMatchingRule();
-    caseIgnoreMatchingRule.initializeMatchingRule(null);
+    CaseIgnoreEqualityMatchingRuleFactory factory =
+            new CaseIgnoreEqualityMatchingRuleFactory();
+    factory.initializeMatchingRule(null);
+    caseIgnoreMatchingRule = (EqualityMatchingRule)factory.
+            getMatchingRules().iterator().next();
     isObsolete = false;
   }
 
@@ -103,8 +106,11 @@
     this.oid        = oid;
     this.isObsolete = isObsolete;
 
-    caseIgnoreMatchingRule = new CaseIgnoreEqualityMatchingRule();
-    caseIgnoreMatchingRule.initializeMatchingRule(null);
+    CaseIgnoreEqualityMatchingRuleFactory factory =
+            new CaseIgnoreEqualityMatchingRuleFactory();
+    factory.initializeMatchingRule(null);
+    caseIgnoreMatchingRule = (EqualityMatchingRule)factory.
+            getMatchingRules().iterator().next();
   }
 
 
@@ -112,10 +118,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(EqualityMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/MatchedValuesControlTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/MatchedValuesControlTest.java
index 7ee1b7d..7b51bb0 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/MatchedValuesControlTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/controls/MatchedValuesControlTest.java
@@ -29,13 +29,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.opends.server.api.MatchingRuleFactory;
 import org.opends.server.api.MatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1Element;
 import org.opends.server.protocols.asn1.ASN1OctetString;
-import org.opends.server.schema.BooleanEqualityMatchingRule;
-import org.opends.server.schema.DistinguishedNameEqualityMatchingRule;
-import org.opends.server.schema.IntegerEqualityMatchingRule;
+import org.opends.server.schema.BooleanEqualityMatchingRuleFactory;
+import org.opends.server.schema.DistinguishedNameEqualityMatchingRuleFactory;
+import org.opends.server.schema.IntegerEqualityMatchingRuleFactory;
 import org.opends.server.types.AttributeType;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.ByteString;
@@ -853,14 +854,23 @@
   }
 
   @DataProvider(name = "extensibleMatchFilterData")
-  public Object[][] createExtensibleMatchFilterData()
+  public Object[][] createExtensibleMatchFilterData() throws Exception
   {
+    MatchingRuleFactory<?> factory = new BooleanEqualityMatchingRuleFactory();
+    factory.initializeMatchingRule(null);
+    MatchingRule booleanEquality = factory.getMatchingRules().iterator().next();
+    factory = new IntegerEqualityMatchingRuleFactory();
+    factory.initializeMatchingRule(null);
+    MatchingRule integerEquality = factory.getMatchingRules().iterator().next();
+    factory = new DistinguishedNameEqualityMatchingRuleFactory();
+    factory.initializeMatchingRule(null);
+    MatchingRule distinguishedEquality = factory.getMatchingRules().iterator().next();
 
     return new Object[][]
     {
-    { "description", new BooleanEqualityMatchingRule(), "description" },
-    { "objectclass", new IntegerEqualityMatchingRule() ,"top" },
-    { "fakeobjecttype", new DistinguishedNameEqualityMatchingRule(), "fakevalue" }, };
+    { "description", booleanEquality, "description" },
+    { "objectclass", integerEquality ,"top" },
+    { "fakeobjecttype", distinguishedEquality, "fakevalue" }, };
   }
 
   /**
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
index 9ff578d..c7cf07c 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/AttributeTypeSyntaxTest.java
@@ -120,7 +120,6 @@
     // Create and register the approximate matching rule for testing purposes.
     EqualLengthApproximateMatchingRule testApproxRule =
          new EqualLengthApproximateMatchingRule();
-    testApproxRule.initializeMatchingRule(null);
     DirectoryServer.registerApproximateMatchingRule(testApproxRule, false);
 
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java
new file mode 100644
index 0000000..bf5d060
--- /dev/null
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/CollationMatchingRuleTest.java
@@ -0,0 +1,365 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Copyright 2008 Sun Microsystems, Inc.
+ */
+
+
+package org.opends.server.schema;
+
+import java.util.List;
+
+
+import org.opends.server.protocols.asn1.ASN1OctetString;
+import org.opends.server.TestCaseUtils;
+import org.opends.server.protocols.internal.InternalClientConnection;
+import org.opends.server.protocols.internal.InternalSearchOperation;
+import org.opends.server.protocols.ldap.LDAPFilter;
+import org.opends.server.tools.LDAPModify;
+import org.opends.server.types.DereferencePolicy;
+import org.opends.server.types.ResultCode;
+import org.opends.server.types.SearchResultEntry;
+import org.opends.server.types.SearchScope;
+import org.testng.annotations.*;
+import static org.testng.Assert.*;
+
+
+/**
+ * This Test Class tests various collation matching rules.
+ */
+public final class CollationMatchingRuleTest
+        extends SchemaTestCase
+{
+
+  /**
+   * Ensures that the Directory Server is running before executing the
+   * testcases.
+   *
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @BeforeClass()
+  public void startServer()
+         throws Exception
+  {
+    TestCaseUtils.startServer();
+    TestCaseUtils.initializeTestBackend(true);
+  }
+
+
+  /**
+   * Test to verify an ADD of an entry containing international characters.
+   * @throws  Exception  If an unexpected problem occurs.
+   */
+  @Test()
+  public void addEntry() throws Exception
+  {
+    String filePath = TestCaseUtils.createTempFile(
+            "dn: uid=user,o=test",
+            "objectClass: person",
+            "objectClass: organizationalPerson",
+            "objectClass: inetorgperson",
+            "objectClass: top",
+            "departmentNumber:: w4NiYzExMQ==", //Ãbc111
+            "carLicense:: w6liZTI=", //ébe2
+            "uid: user",
+            "cn:: U8ODbmNoZXo=", //SÃnchez
+            "sn:: UXXDqWJlYw=="); //Québec
+    String[] args = new String []
+    {
+      "-h", "127.0.0.1",
+      "-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
+      "-D","cn=directory manager",
+      "-w","password",
+      "-a",
+      "-f", filePath,
+    };
+    int err = LDAPModify.mainModify(args, false, null,null);
+    assertEquals(err,0);
+  }
+
+
+
+  /**
+   * Test to search the collation equality matching rule using OID.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationEqualityUsingOID() throws Exception
+  {
+    //Search the collation rule with OID of en and no suffix in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.decode("cn:1.3.6.1.4.1.42.2.27.9.4.34.1:=sanchez"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation equality matching rule using language Tag.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationEqualityUsingLanguageTag() throws Exception
+  {
+    //Search the collation rule with language tag of en and no suffix
+    //in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.decode("cn:en:=sanchez"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation Less than matching rule using OID and suffix.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationLTUsingOIDSuffix() throws Exception
+  {
+    //Search the collation rule with OID of es and suffix in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.
+              decode("departmentnumber:1.3.6.1.4.1.42.2.27.9.4.49.1.1:=Ãbc120"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation Less than Equal to matching rule using
+   * Language Tag and suffix.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationLTEUsingLanguageSuffix() throws Exception
+  {
+    //Search the collation rule with tag of fr and suffix in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.
+              decode("carLicense:fr.2:=ebe2"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation Greater than matching rule using language
+   * tag.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationGTUsingLanguage() throws Exception
+  {
+    //Search the collation rule with tag of fr in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.
+              decode("carLicense:fr.5:=ébe1"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation Greater than Equal to matching rule using
+   * language tag.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationGTEUsingLanguage() throws Exception
+  {
+    //Search the collation rule with tag of es and suffix in the filter.
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.
+              decode("departmentnumber:es.4:=abc111"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned.
+    assertNotNull(e);
+  }
+
+
+
+  /**
+   * Test to search the collation substring matching rule using
+   * language tag and suffix.
+   */
+  @Test(dependsOnMethods = {"org.opends.server.schema."+
+                "CollationMatchingRuleTest.addEntry"})
+  public void searchCollationSubstring() throws Exception
+  {
+    /*Search the collation rule with tag of en and suffix in the filter.
+     *It searches for string quebec against the value of sn which is
+     *Québec.
+     */
+    InternalClientConnection conn =
+         InternalClientConnection.getRootConnection();
+
+    InternalSearchOperation searchOperation =
+         new InternalSearchOperation(
+              conn,
+              InternalClientConnection.nextOperationID(),
+              InternalClientConnection.nextMessageID(),
+              null,
+              new ASN1OctetString("uid=user,o=test"),
+              SearchScope.WHOLE_SUBTREE,
+              DereferencePolicy.NEVER_DEREF_ALIASES,
+              Integer.MAX_VALUE,
+              Integer.MAX_VALUE,
+              false,
+              LDAPFilter.
+              decode("sn:en.6:=*u*bec"),
+              null, null);
+
+    searchOperation.run();
+    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
+    List<SearchResultEntry> entries = searchOperation.getSearchEntries();
+    SearchResultEntry e = entries.get(0);
+    //An entry must be returned for sn=quebec.
+    assertNotNull(e);
+  }
+}
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualLengthApproximateMatchingRule.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualLengthApproximateMatchingRule.java
index 68b3026..e32ac69 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualLengthApproximateMatchingRule.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/EqualLengthApproximateMatchingRule.java
@@ -28,14 +28,12 @@
 
 
 
-import org.opends.server.admin.std.server.ApproximateMatchingRuleCfg;
+import java.util.Collection;
+import java.util.Collections;
 import org.opends.server.api.ApproximateMatchingRule;
-import org.opends.server.config.ConfigEntry;
-import org.opends.server.config.ConfigException;
 import org.opends.server.types.ByteString;
 import org.opends.server.types.ByteStringFactory;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.InitializationException;
 
 import static org.opends.server.schema.SchemaConstants.*;
 
@@ -46,7 +44,7 @@
  * consider two values approximately equal only if they have the same length.
  * It is intended purely for testing purposes.
  */
-public class EqualLengthApproximateMatchingRule
+class EqualLengthApproximateMatchingRule
        extends ApproximateMatchingRule
 {
   /**
@@ -62,10 +60,9 @@
   /**
    * {@inheritDoc}
    */
-  public void initializeMatchingRule(ApproximateMatchingRuleCfg configuration)
-         throws ConfigException, InitializationException
+  public Collection<String> getAllNames()
   {
-    // No initialization is required.
+    return Collections.singleton(getName());
   }
 
 
diff --git a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java
index 652ae5b..d1766ca 100644
--- a/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java
+++ b/opends/tests/unit-tests-testng/src/server/org/opends/server/schema/GenericSchemaTestCase.java
@@ -125,7 +125,7 @@
     TreeSet<String> invalidOIDs = new TreeSet<String>();
 
     Schema schema = DirectoryServer.getSchema();
-    for (MatchingRule<?> mr : schema.getMatchingRules().values())
+    for (MatchingRule mr : schema.getMatchingRules().values())
     {
       if (! isNumericOID(mr.getOID()))
       {

--
Gitblit v1.10.0