From e28ddc3ed27d4352ddc7c476f4e5208b2eb27251 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 06 Mar 2014 23:25:34 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support

---
 opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java |   80 ++++++----------------------------------
 1 files changed, 12 insertions(+), 68 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java b/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
index 06b5e16..7914dbb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/TimeBasedMatchingRuleFactory.java
@@ -38,13 +38,14 @@
 import org.forgerock.opendj.ldap.ByteStringBuilder;
 import org.forgerock.opendj.ldap.ConditionResult;
 import org.forgerock.opendj.ldap.DecodeException;
+import org.forgerock.opendj.ldap.spi.IndexQueryFactory;
+import org.forgerock.opendj.ldap.spi.IndexingOptions;
 import org.opends.server.admin.std.server.MatchingRuleCfg;
 import org.opends.server.api.*;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.types.AttributeValue;
 import org.opends.server.types.DirectoryException;
-import org.opends.server.types.IndexConfig;
 import org.opends.server.types.InitializationException;
 import org.opends.server.util.StaticUtils;
 
@@ -403,7 +404,8 @@
     * {@inheritDoc}
     */
     @Override
-    public Collection<ExtensibleIndexer> getIndexers(IndexConfig config)
+    public Collection<ExtensibleIndexer> getIndexers(
+        IndexingOptions indexingOptions)
     {
       if(indexer == null)
       {
@@ -630,40 +632,11 @@
       }
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     @Override
-    public final void getKeys(AttributeValue value,
-        Map<byte[], Boolean> modifiedKeys, Boolean insert)
+    public String getIndexID()
     {
-      Set<byte[]> keys = new HashSet<byte[]>();
-      getKeys(value, keys);
-      for (byte[] key : keys)
-      {
-        Boolean cInsert = modifiedKeys.get(key);
-        if (cInsert == null)
-        {
-          modifiedKeys.put(key, insert);
-        }
-        else if (!cInsert.equals(insert))
-        {
-          modifiedKeys.remove(key);
-        }
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPreferredIndexName()
-    {
-      return RELATIVE_TIME_INDEX_NAME;
+      return RELATIVE_TIME_INDEX_NAME + "." + getExtensibleIndexID();
     }
   }
 
@@ -674,7 +647,6 @@
    */
   private final class PartialDateAndTimeMatchingRule
           extends TimeBasedMatchingRule
-          implements ExtensibleMatchingRule
   {
      /**
       * Indexer associated with this instance.
@@ -1050,7 +1022,8 @@
       * {@inheritDoc}
       */
     @Override
-    public Collection<ExtensibleIndexer> getIndexers(IndexConfig config)
+    public Collection<ExtensibleIndexer> getIndexers(
+        IndexingOptions indexingOptions)
     {
       if(indexer == null)
       {
@@ -1237,40 +1210,11 @@
       matchingRule.timeKeys(value.getValue(), keys);
     }
 
-
-
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     @Override
-    public void getKeys(AttributeValue attValue,
-        Map<byte[], Boolean> modifiedKeys, Boolean insert)
+    public String getIndexID()
     {
-      Set<byte[]> keys = new HashSet<byte[]>();
-      getKeys(attValue, keys);
-      for (byte[] key : keys)
-      {
-        Boolean cInsert = modifiedKeys.get(key);
-        if (cInsert == null)
-        {
-          modifiedKeys.put(key, insert);
-        }
-        else if (!cInsert.equals(insert))
-        {
-          modifiedKeys.remove(key);
-        }
-      }
-    }
-
-
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getPreferredIndexName()
-    {
-      return PARTIAL_DATE_TIME_INDEX_NAME;
+      return PARTIAL_DATE_TIME_INDEX_NAME + "." + getExtensibleIndexID();
     }
 
 

--
Gitblit v1.10.0