| | |
| | | import java.util.*; |
| | | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.ldap.ByteSequence; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.spi.IndexingOptions; |
| | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** The indexer object to construct index keys from LDAP attribute values. */ |
| | | public Indexer indexer; |
| | | |
| | | /** The comparator for index keys. */ |
| | | private final Comparator<byte[]> comparator; |
| | | /** The comparator for index keys. */ |
| | | private final Comparator<ByteSequence> bsComparator; |
| | | private Indexer indexer; |
| | | |
| | | /** The limit on the number of entry IDs that may be indexed by one key. */ |
| | | private int indexEntryLimit; |
| | |
| | | { |
| | | super(name, env, entryContainer); |
| | | this.indexer = indexer; |
| | | this.comparator = indexer.getComparator(); |
| | | this.bsComparator = indexer.getBSComparator(); |
| | | this.indexEntryLimit = indexEntryLimit; |
| | | this.cursorEntryLimit = cursorEntryLimit; |
| | | this.maintainCount = maintainCount; |
| | |
| | | this.dbConfig = JEBUtils.toDatabaseConfigNoDuplicates(env); |
| | | this.dbConfig.setOverrideBtreeComparator(true); |
| | | this.dbConfig.setBtreeComparator((Class<? extends Comparator<byte[]>>) |
| | | comparator.getClass()); |
| | | indexer.getComparator().getClass()); |
| | | |
| | | this.state = state; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options) |
| | | { |
| | | indexer.indexEntry(entry, keys, options); |
| | | } |
| | | |
| | | /** |
| | | * Add an add entry ID operation into a index buffer. |
| | | * |
| | |
| | | |
| | | private BufferedIndexValues getBufferedIndexValues(IndexBuffer buffer, ByteString keyBytes) |
| | | { |
| | | return buffer.getBufferedIndexValues(this, keyBytes, bsComparator); |
| | | return buffer.getBufferedIndexValues(this, keyBytes, indexer.getBSComparator()); |
| | | } |
| | | |
| | | /** |
| | |
| | | Cursor cursor = openCursor(null, CursorConfig.READ_COMMITTED); |
| | | try |
| | | { |
| | | final Comparator<byte[]> comparator = indexer.getComparator(); |
| | | OperationStatus status; |
| | | // Set the lower bound if necessary. |
| | | if(lower.length > 0) |
| | |
| | | */ |
| | | public Comparator<byte[]> getComparator() |
| | | { |
| | | return this.comparator; |
| | | return indexer.getComparator(); |
| | | } |
| | | } |