From 2f13f91c158747ca997a44d8e61830f46b77dd82 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 14 Mar 2014 11:31:24 +0000
Subject: [PATCH] OPENDJ-1308 (CR-3156) Migrate schema support - ByteString - Indexer
---
opendj3-server-dev/src/server/org/opends/server/backends/jeb/Indexer.java | 46 +++++++++++++++++++++++++++++++++++-----------
1 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Indexer.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Indexer.java
index a876e85..3f51f03 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Indexer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/Indexer.java
@@ -22,17 +22,20 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions copyright 2012-2014 ForgeRock AS.
*/
package org.opends.server.backends.jeb;
-import org.opends.server.types.Entry;
-import org.opends.server.types.Modification;
-
import java.util.Comparator;
-import java.util.Set;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+
+import org.forgerock.opendj.ldap.ByteString;
+import org.opends.server.backends.jeb.AttributeIndex.BSKeyComparator;
+import org.opends.server.backends.jeb.AttributeIndex.KeyComparator;
+import org.opends.server.types.Entry;
+import org.opends.server.types.Modification;
/**
* This class attempts to abstract the generation and comparison of keys
@@ -41,12 +44,32 @@
public abstract class Indexer
{
/**
- * Get the comparator that must be used to compare index keys
- * generated by this class.
+ * The comparator for keys generated by this class.
+ */
+ private static final KeyComparator comparator = new KeyComparator();
+ private static final BSKeyComparator bsComparator = new BSKeyComparator();
+
+ /**
+ * Get the comparator that must be used to compare index keys generated by
+ * this class.
*
* @return A byte array comparator.
*/
- public abstract Comparator<byte[]> getComparator();
+ public final Comparator<byte[]> getComparator()
+ {
+ return comparator;
+ }
+
+ /**
+ * Get the comparator that must be used to compare index keys generated by
+ * this class.
+ *
+ * @return A byte string comparator.
+ */
+ public final Comparator<ByteString> getBSComparator()
+ {
+ return bsComparator;
+ }
/**
* Generate the set of index keys for an entry.
@@ -54,7 +77,7 @@
* @param entry The entry.
* @param keys The set into which the generated keys will be inserted.
*/
- public abstract void indexEntry(Entry entry, Set<byte[]> keys);
+ public abstract void indexEntry(Entry entry, Set<ByteString> keys);
/**
* Generate the set of index keys to be added and the set of index keys
@@ -65,7 +88,7 @@
* @param modifiedKeys The map into which the modified keys will be inserted.
*/
public abstract void replaceEntry(Entry oldEntry, Entry newEntry,
- Map<byte[], Boolean> modifiedKeys);
+ Map<ByteString, Boolean> modifiedKeys);
/**
* Generate the set of index keys to be added and the set of index keys
@@ -78,5 +101,6 @@
*/
public abstract void modifyEntry(Entry oldEntry, Entry newEntry,
List<Modification> mods,
- Map<byte[], Boolean> modifiedKeys);
+ Map<ByteString, Boolean> modifiedKeys);
+
}
--
Gitblit v1.10.0