mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
14.31.2014 2f13f91c158747ca997a44d8e61830f46b77dd82
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);
}