From 080289c5388619b8b5059631c96a4d3b5922b6c1 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 07 Nov 2014 16:47:09 +0000
Subject: [PATCH] OPENDJ-1591 CR-5092 Re-implement UserPasswordEqualityMatchingRule to be  compatible with SDK matching rules and schema

---
 opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java |   25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java
index a276346..300f032 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/UserPasswordEqualityMatchingRuleFactory.java
@@ -24,8 +24,6 @@
  *      Copyright 2008 Sun Microsystems, Inc.
  *      Portions Copyright 2014 ForgeRock AS
  */
-
-
 package org.opends.server.schema;
 
 import java.util.Collection;
@@ -36,20 +34,18 @@
 import org.forgerock.opendj.config.server.ConfigException;
 import org.forgerock.opendj.ldap.schema.CoreSchema;
 import org.forgerock.opendj.ldap.schema.MatchingRule;
+import org.forgerock.opendj.ldap.schema.SchemaBuilder;
 import org.opends.server.types.InitializationException;
 
+import static org.opends.server.schema.SchemaConstants.*;
+
 /**
  * This class is a factory class for UserPasswordExactEqualityMatchingRule.
  */
-public final class UserPasswordEqualityMatchingRuleFactory
-        extends MatchingRuleFactory<MatchingRuleCfg>
+public final class UserPasswordEqualityMatchingRuleFactory extends MatchingRuleFactory<MatchingRuleCfg>
 {
-  //Associated Matching Rule.
   private MatchingRule matchingRule;
 
-
-
-
  /**
   * {@inheritDoc}
   */
@@ -57,14 +53,15 @@
  public final void initializeMatchingRule(MatchingRuleCfg configuration)
          throws ConfigException, InitializationException
  {
-   // TODO: either delete completely UserPasswordEqualityMatchingRule or re-implement it
-   // using SDK classes
-   // Meanwhile, just returning UserPasswordExactEqualityMatchingRule instead
-   matchingRule = CoreSchema.getInstance().getMatchingRule("1.3.6.1.4.1.26027.1.4.2");
+   matchingRule = new SchemaBuilder(CoreSchema.getInstance())
+       .buildMatchingRule(EMR_USER_PASSWORD_OID)
+         .names(EMR_USER_PASSWORD_NAME)
+         .syntaxOID(SYNTAX_USER_PASSWORD_OID).description(EMR_USER_PASSWORD_DESCRIPTION)
+         .implementation(new UserPasswordEqualityMatchingRule())
+         .addToSchema()
+       .toSchema().getMatchingRule(EMR_USER_PASSWORD_OID);
  }
 
-
-
  /**
   * {@inheritDoc}
   */

--
Gitblit v1.10.0