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

java.lang.Object
  extended by org.apache.directory.server.xdbm.AbstractIndex<K,O,Long>
      extended by org.apache.directory.server.xdbm.impl.avl.AvlIndex<ParentIdAndRdn<Long>,E>
          extended by org.apache.directory.server.xdbm.impl.avl.AvlRdnIndex<E>
All Implemented Interfaces:
Index<ParentIdAndRdn<Long>,E,Long>

public class AvlRdnIndex<E>
extends AvlIndex<ParentIdAndRdn<Long>,E>

A special index which stores Rdn objects.

Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.server.xdbm.impl.avl.AvlIndex
forward, normalizer, reverse
 
Fields inherited from class org.apache.directory.server.xdbm.AbstractIndex
attributeId, attributeType, cacheSize, initialized
 
Fields inherited from interface org.apache.directory.server.xdbm.Index
DEFAULT_INDEX_CACHE_SIZE
 
Constructor Summary
AvlRdnIndex()
           
AvlRdnIndex(String attributeId)
           
 
Method Summary
 void add(ParentIdAndRdn<Long> rdn, Long entryId)
          Add an entry into the index, associated with the element ID.
 void drop(Long entryId)
          Remove all the reference to an entry from the index.
 void drop(ParentIdAndRdn<Long> rdn, Long id)
          Remove the pair from the index for the given value and id.
 ParentIdAndRdn<Long> getNormalized(ParentIdAndRdn<Long> rdn)
          Gets the normalized value for an attribute.
 void init(org.apache.directory.shared.ldap.model.schema.SchemaManager schemaManager, org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
           
 
Methods inherited from class org.apache.directory.server.xdbm.impl.avl.AvlIndex
close, count, count, forward, forward, forwardCursor, forwardCursor, forwardGreaterOrEq, forwardGreaterOrEq, forwardLessOrEq, forwardLessOrEq, forwardLookup, forwardValueCursor, getWkDirPath, greaterThanCount, isDupsEnabled, lessThanCount, reverse, reverse, reverseCursor, reverseCursor, reverseGreaterOrEq, reverseGreaterOrEq, reverseLessOrEq, reverseLessOrEq, reverseLookup, reverseValueCursor, setWkDirPath, sync
 
Methods inherited from class org.apache.directory.server.xdbm.AbstractIndex
getAttribute, getAttributeId, getCacheSize, protect, setAttributeId, setCacheSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvlRdnIndex

public AvlRdnIndex()

AvlRdnIndex

public AvlRdnIndex(String attributeId)
Method Detail

init

public void init(org.apache.directory.shared.ldap.model.schema.SchemaManager schemaManager,
                 org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          throws Exception
Overrides:
init in class AvlIndex<ParentIdAndRdn<Long>,E>
Throws:
Exception

add

public void add(ParentIdAndRdn<Long> rdn,
                Long entryId)
         throws Exception
Description copied from interface: Index
Add an entry into the index, associated with the element ID. The added value is the key to retrieve the element having the given ID.

Specified by:
add in interface Index<ParentIdAndRdn<Long>,E,Long>
Overrides:
add in class AvlIndex<ParentIdAndRdn<Long>,E>
Parameters:
rdn - The added value
entryId - The element ID pointed by the added value
Throws:
Exception - If the addition can't be done

drop

public void drop(Long entryId)
          throws Exception
Description copied from class: AvlIndex
Remove all the reference to an entry from the index.
As an entry might be referenced more than once in the forward index, depending on which index we are dealing with, we need to iterate over all the values contained into the reverse index for this entryId.
For instance, considering the ObjectClass index for an entry having three ObjectClasses (top, person, inetOrgPerson), then the reverse index will contain :
 [entryId, [top, person, inetOrgPerson]]
 
and the forward index will contain many entries like :
 [top, [..., entryId, ...]]
 [person,  [..., entryId, ...]]
 [inetOrgPerson,  [..., entryId, ...]]
 
So dropping the entryId means that we must first get all the values from the reverse index (and we will get [top, person, inetOrgPerson]) then to iterate through all those values to remove entryId from the associated list of entryIds.

Specified by:
drop in interface Index<ParentIdAndRdn<Long>,E,Long>
Overrides:
drop in class AvlIndex<ParentIdAndRdn<Long>,E>
Parameters:
entryId - The master table entry ID to remove
Throws:
Exception

drop

public void drop(ParentIdAndRdn<Long> rdn,
                 Long id)
          throws Exception
Description copied from class: AvlIndex
Remove the pair from the index for the given value and id.

Specified by:
drop in interface Index<ParentIdAndRdn<Long>,E,Long>
Overrides:
drop in class AvlIndex<ParentIdAndRdn<Long>,E>
Parameters:
rdn - The value we want to remove from the index
id - The associated ID
Throws:
Exception - If the removal can't be done

getNormalized

public ParentIdAndRdn<Long> getNormalized(ParentIdAndRdn<Long> rdn)
                                   throws Exception
Description copied from class: AvlIndex
Gets the normalized value for an attribute.

Specified by:
getNormalized in interface Index<ParentIdAndRdn<Long>,E,Long>
Overrides:
getNormalized in class AvlIndex<ParentIdAndRdn<Long>,E>
Parameters:
rdn - the user provided value to normalize
Returns:
the normalized value.
Throws:
Exception - if something goes wrong.


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