org.apache.directory.server.xdbm.impl.avl
Class AvlMasterTable<E>

java.lang.Object
  extended by org.apache.directory.server.xdbm.AbstractTable<K,V>
      extended by org.apache.directory.server.xdbm.impl.avl.AvlTable<Long,E>
          extended by org.apache.directory.server.xdbm.impl.avl.AvlMasterTable<E>
All Implemented Interfaces:
MasterTable<Long,E>, Table<Long,E>

public class AvlMasterTable<E>
extends AvlTable<Long,E>
implements MasterTable<Long,E>

TODO Make it so the master table does not extend table interface - not needed with this single use of delete so we should just use containment.

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.server.xdbm.AbstractTable
count, keyComparator, name, schemaManager, valueComparator
 
Fields inherited from interface org.apache.directory.server.xdbm.MasterTable
DBF, SEQPROP_KEY
 
Constructor Summary
AvlMasterTable(String name, Comparator<Long> keyComparator, Comparator<E> valComparator, boolean dupsEnabled)
           
 
Method Summary
 Long getNextId(E entry)
          Gets the next value from the sequence of this MasterTable.
 void resetCounter()
          Resets the root ID to 0, this method should be called after deleting the context entry of the partition
 
Methods inherited from class org.apache.directory.server.xdbm.impl.avl.AvlTable
close, count, cursor, cursor, get, greaterThanCount, has, has, hasGreaterOrEqual, hasGreaterOrEqual, hasLessOrEqual, hasLessOrEqual, isDupsEnabled, lessThanCount, put, remove, remove, valueCursor
 
Methods inherited from class org.apache.directory.server.xdbm.AbstractTable
count, getKeyComparator, getName, getValueComparator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.directory.server.xdbm.Table
close, count, count, cursor, cursor, get, getKeyComparator, getName, getValueComparator, greaterThanCount, has, has, hasGreaterOrEqual, hasGreaterOrEqual, hasLessOrEqual, hasLessOrEqual, isDupsEnabled, lessThanCount, put, remove, remove, valueCursor
 

Constructor Detail

AvlMasterTable

public AvlMasterTable(String name,
                      Comparator<Long> keyComparator,
                      Comparator<E> valComparator,
                      boolean dupsEnabled)
Method Detail

getNextId

public Long getNextId(E entry)
               throws Exception
Gets the next value from the sequence of this MasterTable. This has the side-effect of incrementing the sequence values permanently.

Specified by:
getNextId in interface MasterTable<Long,E>
Parameters:
entry - the entry in case the id is derived from the entry.
Returns:
the current value of this MasterTable's sequence incremented by one
Throws:
Exception - on failure to update the id sequence

resetCounter

public void resetCounter()
                  throws Exception
Resets the root ID to 0, this method should be called after deleting the context entry of the partition

Specified by:
resetCounter in interface MasterTable<Long,E>
Throws:
Exception - in case of any failure while resetting the root id value


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.