| | |
| | | * |
| | | * |
| | | * 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 |
| | |
| | | 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. |
| | |
| | | * @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 |
| | |
| | | * @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 |
| | |
| | | */ |
| | | public abstract void modifyEntry(Entry oldEntry, Entry newEntry, |
| | | List<Modification> mods, |
| | | Map<byte[], Boolean> modifiedKeys); |
| | | Map<ByteString, Boolean> modifiedKeys); |
| | | |
| | | } |