From dd8c19ab2e4fc3347c7cf74b4351a48e3774166a Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 29 Sep 2014 12:24:49 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support - SubstringMatchingRule

---
 opendj3-server-dev/replace.rb |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/opendj3-server-dev/replace.rb b/opendj3-server-dev/replace.rb
index db9f248..d6a8af7 100755
--- a/opendj3-server-dev/replace.rb
+++ b/opendj3-server-dev/replace.rb
@@ -35,6 +35,26 @@
   DSML_DIR = ["src/dsml/org"]
 
   # Replacement for matching rules
+  MRULES_TO_SDK = {
+    :dirs => JAVA_DIRS + SNMP_DIR,
+    :extensions => ["java"],
+    :stopwords => ["MatchingRule"],
+    :replacements =>
+      [
+        /import org.opends.server.api.MatchingRule;/,
+        'import org.forgerock.opendj.ldap.schema.MatchingRule;',
+
+        # For MR factories
+        /\binitializeMatchingRule\(MatchingRuleCfg configuration\)/,
+        "initializeMatchingRule(ServerContext serverContext, MatchingRuleCfg configuration)",
+
+        # For MR factories
+        /\bmatchingRule = new \w*MatchingRule();/,
+        "matchingRule = serverContext.getSchemaNG().getMatchingRule(EMR_);"
+
+       ]
+  }
+
   MRULES = {
     :dirs => JAVA_DIRS + SNMP_DIR,
     :extensions => ["java"],
@@ -42,10 +62,10 @@
     :replacements =>
       [
 
-        /import org.opends.server.api.EqualityMatchingRule;/,
-        'import org.opends.server.api.MatchingRule;',
+        /import org.opends.server.api.SubstringMatchingRule;/,
+        '',
 
-        /\bEqualityMatchingRule\b/,
+        /\bSubstringMatchingRule\b/,
         "MatchingRule",
 
        ]
@@ -194,7 +214,6 @@
       ]
   }
 
-
   # Replacement for types
   TYPES = {
     :dirs => JAVA_DIRS,
@@ -323,9 +342,9 @@
       ]
   }
 
-  # List of replacements to run
-  REPLACEMENTS = [ MRULES ]
+  ###############################  List of replacements to run #################################
 
+  REPLACEMENTS = [ MRULES ]
 
   ################################### Processing methods ########################################
 

--
Gitblit v1.10.0