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/ID2CIndexer.java | 41 +++++++++++++++--------------------------
1 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/ID2CIndexer.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/ID2CIndexer.java
index 04e66c7..4c2d6e5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/ID2CIndexer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/ID2CIndexer.java
@@ -22,28 +22,24 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.backends.jeb;
+import java.util.*;
+
+import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import com.sleepycat.je.DatabaseEntry;
-import java.util.*;
-
/**
* Implementation of an Indexer for the children index.
*/
public class ID2CIndexer extends Indexer
{
/**
- * The comparator for keys generated by this class.
- */
- private static final Comparator<byte[]> comparator =
- new AttributeIndex.KeyComparator();
-
- /**
* Create a new indexer for a children index.
*/
public ID2CIndexer()
@@ -56,42 +52,33 @@
* used to name an index created using this object.
* @return A string representation of this object.
*/
+ @Override
public String toString()
{
return "id2children";
}
/**
- * Get the comparator that must be used to compare index keys
- * generated by this class.
- *
- * @return A byte array comparator.
- */
- public Comparator<byte[]> getComparator()
- {
- return comparator;
- }
-
- /**
* Generate the set of index keys for an entry.
*
* @param entry The entry.
* @param addKeys The set into which the generated keys will be inserted.
*/
- public void indexEntry(Entry entry, Set<byte[]> addKeys)
+ @Override
+ public void indexEntry(Entry entry, Set<ByteString> addKeys)
{
// The superior entry IDs are in the entry attachment.
- ArrayList ids = (ArrayList)entry.getAttachment();
+ ArrayList<EntryID> ids = (ArrayList<EntryID>) entry.getAttachment();
// Skip the entry's own ID.
- Iterator iter = ids.iterator();
+ Iterator<EntryID> iter = ids.iterator();
iter.next();
// Get the parent ID.
if (iter.hasNext())
{
- DatabaseEntry nodeIDData = ((EntryID)iter.next()).getDatabaseEntry();
- addKeys.add(nodeIDData.getData());
+ DatabaseEntry nodeIDData = iter.next().getDatabaseEntry();
+ addKeys.add(ByteString.wrap(nodeIDData.getData()));
}
}
@@ -103,8 +90,9 @@
* @param newEntry The new entry contents.
* @param modifiedKeys The map into which the modified keys will be inserted.
*/
+ @Override
public void replaceEntry(Entry oldEntry, Entry newEntry,
- Map<byte[], Boolean> modifiedKeys)
+ Map<ByteString, Boolean> modifiedKeys)
{
// Nothing to do.
}
@@ -120,9 +108,10 @@
* @param mods The set of modifications that were applied to the entry.
* @param modifiedKeys The map into which the modified keys will be inserted.
*/
+ @Override
public void modifyEntry(Entry oldEntry, Entry newEntry,
List<Modification> mods,
- Map<byte[], Boolean> modifiedKeys)
+ Map<ByteString, Boolean> modifiedKeys)
{
// Nothing to do.
}
--
Gitblit v1.10.0