org.apache.directory.server.core.partition.avl
Class AvlStore<E>

java.lang.Object
  extended by org.apache.directory.server.core.partition.avl.AvlStore<E>
All Implemented Interfaces:
Store<E,java.lang.Long>

public class AvlStore<E>
extends java.lang.Object
implements Store<E,java.lang.Long>

A Store implementation backed by in memory AVL trees. TODO - this class is extremely like the JdbmStore implementation of the Store interface which tells us that it's best for us to have some kind of abstract class.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
AvlStore()
           
 
Method Summary
 void add(ServerEntry entry)
          
 void addIndex(Index<? extends java.lang.Object,E,java.lang.Long> index)
          
 int count()
          
 void delete(java.lang.Long id)
          
 void destroy()
          
 Index<java.lang.String,E,java.lang.Long> getAliasIndex()
          
 int getCacheSize()
          always returns 0 (zero), cause this is a inmemory store
 int getChildCount(java.lang.Long id)
          
 java.lang.Long getDefaultId()
           
 Index<java.lang.String,E,java.lang.Long> getEntryCsnIndex()
           
 java.lang.String getEntryDn(java.lang.Long id)
          
 java.lang.Long getEntryId(java.lang.String dn)
          
 java.lang.String getEntryUpdn(java.lang.Long id)
          
 java.lang.String getEntryUpdn(java.lang.String dn)
          
 Index<java.lang.String,E,java.lang.Long> getEntryUuidIndex()
           
 Index<?,E,java.lang.Long> getIndex(java.lang.String id)
          
 java.lang.String getName()
          
 Index<java.lang.String,E,java.lang.Long> getNdnIndex()
          
 Index<java.lang.String,E,java.lang.Long> getObjectClassIndex()
           
 Index<java.lang.Long,E,java.lang.Long> getOneAliasIndex()
          
 Index<java.lang.Long,E,java.lang.Long> getOneLevelIndex()
          
 java.lang.Long getParentId(java.lang.Long childId)
          
 java.lang.Long getParentId(java.lang.String dn)
          
 Index<java.lang.String,E,java.lang.Long> getPresenceIndex()
          
 java.lang.String getProperty(java.lang.String propertyName)
          
 Index<java.lang.Long,E,java.lang.Long> getSubAliasIndex()
          
 Index<java.lang.Long,E,java.lang.Long> getSubLevelIndex()
          
 org.apache.directory.shared.ldap.name.DN getSuffix()
          
 java.lang.String getSuffixDn()
           
 Index<?,E,java.lang.Long> getSystemIndex(java.lang.String id)
          
 Index<java.lang.String,E,java.lang.Long> getUpdnIndex()
          
 org.apache.directory.shared.ldap.name.DN getUpSuffix()
          
 Index<? extends java.lang.Object,E,java.lang.Long> getUserIndex(java.lang.String id)
          
 java.util.Set<Index<? extends java.lang.Object,E,java.lang.Long>> getUserIndices()
          
 java.io.File getWorkingDirectory()
           
 boolean hasIndexOn(java.lang.String id)
          
 boolean hasSystemIndexOn(java.lang.String id)
          
 boolean hasUserIndexOn(java.lang.String id)
          
 void init(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
           TODO why this and initRegistries on Store interface ???
 boolean isInitialized()
          
 boolean isSyncOnWrite()
           
 IndexCursor<java.lang.Long,E,java.lang.Long> list(java.lang.Long id)
          
 ServerEntry lookup(java.lang.Long id)
          
 void modify(org.apache.directory.shared.ldap.name.DN dn, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
           
 void modify(org.apache.directory.shared.ldap.name.DN dn, org.apache.directory.shared.ldap.entry.ModificationOperation modOp, ServerEntry mods)
           
 void modify(long entryId, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
           
 void move(org.apache.directory.shared.ldap.name.DN oldChildDn, org.apache.directory.shared.ldap.name.DN newParentDn)
           
 void move(org.apache.directory.shared.ldap.name.DN oldChildDn, org.apache.directory.shared.ldap.name.DN newParentDn, org.apache.directory.shared.ldap.name.RDN newRdn, boolean deleteOldRdn)
           
 void rename(org.apache.directory.shared.ldap.name.DN dn, org.apache.directory.shared.ldap.name.RDN newRdn, boolean deleteOldRdn)
          Changes the relative distinguished name of an entry specified by a distinguished name with the optional removal of the old RDN attribute value from the entry.
 void setAliasIndex(Index<java.lang.String,E,java.lang.Long> index)
          
 void setCacheSize(int size)
           
 void setEntryCsnIndex(Index<java.lang.String,E,java.lang.Long> index)
           
 void setEntryUuidIndex(Index<java.lang.String,E,java.lang.Long> index)
           
 void setName(java.lang.String name)
          
 void setNdnIndex(Index<java.lang.String,E,java.lang.Long> index)
          
 void setObjectClassIndex(Index<java.lang.String,E,java.lang.Long> index)
           
 void setOneAliasIndex(Index<java.lang.Long,E,java.lang.Long> index)
          
 void setOneLevelIndex(Index<java.lang.Long,E,java.lang.Long> index)
          
 void setPresenceIndex(Index<java.lang.String,E,java.lang.Long> index)
          
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
          
 void setSubAliasIndex(Index<java.lang.Long,E,java.lang.Long> index)
          
 void setSubLevelIndex(Index<java.lang.Long,E,java.lang.Long> index)
          
 void setSuffixDn(java.lang.String suffixDn)
          
 void setSyncOnWrite(boolean sync)
           
 void setUpdnIndex(Index<java.lang.String,E,java.lang.Long> index)
          
 void setUserIndices(java.util.Set<Index<? extends java.lang.Object,E,java.lang.Long>> userIndices)
          
 void setWorkingDirectory(java.io.File wkDir)
           
 void sync()
           
 java.util.Iterator<java.lang.String> systemIndices()
          
 java.util.Iterator<java.lang.String> userIndices()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AvlStore

public AvlStore()
Method Detail

add

public void add(ServerEntry entry)
         throws java.lang.Exception

Specified by:
add in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

addIndex

public void addIndex(Index<? extends java.lang.Object,E,java.lang.Long> index)
              throws java.lang.Exception

Specified by:
addIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

count

public int count()
          throws java.lang.Exception

Specified by:
count in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

delete

public void delete(java.lang.Long id)
            throws java.lang.Exception

Specified by:
delete in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception

Specified by:
destroy in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getAliasIndex

public Index<java.lang.String,E,java.lang.Long> getAliasIndex()

Specified by:
getAliasIndex in interface Store<E,java.lang.Long>

getChildCount

public int getChildCount(java.lang.Long id)
                  throws java.lang.Exception

Specified by:
getChildCount in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getEntryDn

public java.lang.String getEntryDn(java.lang.Long id)
                            throws java.lang.Exception

Specified by:
getEntryDn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getEntryId

public java.lang.Long getEntryId(java.lang.String dn)
                          throws java.lang.Exception

Specified by:
getEntryId in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getEntryUpdn

public java.lang.String getEntryUpdn(java.lang.Long id)
                              throws java.lang.Exception

Specified by:
getEntryUpdn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getEntryUpdn

public java.lang.String getEntryUpdn(java.lang.String dn)
                              throws java.lang.Exception

Specified by:
getEntryUpdn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getName

public java.lang.String getName()

Specified by:
getName in interface Store<E,java.lang.Long>

getNdnIndex

public Index<java.lang.String,E,java.lang.Long> getNdnIndex()

Specified by:
getNdnIndex in interface Store<E,java.lang.Long>

getOneAliasIndex

public Index<java.lang.Long,E,java.lang.Long> getOneAliasIndex()

Specified by:
getOneAliasIndex in interface Store<E,java.lang.Long>

getOneLevelIndex

public Index<java.lang.Long,E,java.lang.Long> getOneLevelIndex()

Specified by:
getOneLevelIndex in interface Store<E,java.lang.Long>

getParentId

public java.lang.Long getParentId(java.lang.String dn)
                           throws java.lang.Exception

Specified by:
getParentId in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getParentId

public java.lang.Long getParentId(java.lang.Long childId)
                           throws java.lang.Exception

Specified by:
getParentId in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getPresenceIndex

public Index<java.lang.String,E,java.lang.Long> getPresenceIndex()

Specified by:
getPresenceIndex in interface Store<E,java.lang.Long>

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
                             throws java.lang.Exception

Specified by:
getProperty in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getSubAliasIndex

public Index<java.lang.Long,E,java.lang.Long> getSubAliasIndex()

Specified by:
getSubAliasIndex in interface Store<E,java.lang.Long>

getSubLevelIndex

public Index<java.lang.Long,E,java.lang.Long> getSubLevelIndex()

Specified by:
getSubLevelIndex in interface Store<E,java.lang.Long>

getSuffix

public org.apache.directory.shared.ldap.name.DN getSuffix()

Specified by:
getSuffix in interface Store<E,java.lang.Long>

getUpSuffix

public org.apache.directory.shared.ldap.name.DN getUpSuffix()

Specified by:
getUpSuffix in interface Store<E,java.lang.Long>

getSuffixDn

public java.lang.String getSuffixDn()
Specified by:
getSuffixDn in interface Store<E,java.lang.Long>

getSystemIndex

public Index<?,E,java.lang.Long> getSystemIndex(java.lang.String id)
                                         throws IndexNotFoundException

Specified by:
getSystemIndex in interface Store<E,java.lang.Long>
Throws:
IndexNotFoundException

getIndex

public Index<?,E,java.lang.Long> getIndex(java.lang.String id)
                                   throws IndexNotFoundException

Specified by:
getIndex in interface Store<E,java.lang.Long>
Throws:
IndexNotFoundException

getUpdnIndex

public Index<java.lang.String,E,java.lang.Long> getUpdnIndex()

Specified by:
getUpdnIndex in interface Store<E,java.lang.Long>

getUserIndex

public Index<? extends java.lang.Object,E,java.lang.Long> getUserIndex(java.lang.String id)
                                                                throws IndexNotFoundException

Specified by:
getUserIndex in interface Store<E,java.lang.Long>
Throws:
IndexNotFoundException

getUserIndices

public java.util.Set<Index<? extends java.lang.Object,E,java.lang.Long>> getUserIndices()

Specified by:
getUserIndices in interface Store<E,java.lang.Long>

hasIndexOn

public boolean hasIndexOn(java.lang.String id)
                   throws java.lang.Exception

Specified by:
hasIndexOn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

hasSystemIndexOn

public boolean hasSystemIndexOn(java.lang.String id)
                         throws java.lang.Exception

Specified by:
hasSystemIndexOn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

hasUserIndexOn

public boolean hasUserIndexOn(java.lang.String id)
                       throws java.lang.Exception

Specified by:
hasUserIndexOn in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

init

public void init(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
          throws java.lang.Exception
TODO why this and initRegistries on Store interface ???

Specified by:
init in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

isInitialized

public boolean isInitialized()

Specified by:
isInitialized in interface Store<E,java.lang.Long>

list

public IndexCursor<java.lang.Long,E,java.lang.Long> list(java.lang.Long id)
                                                  throws java.lang.Exception

Specified by:
list in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

lookup

public ServerEntry lookup(java.lang.Long id)
                   throws java.lang.Exception

Specified by:
lookup in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

modify

public void modify(org.apache.directory.shared.ldap.name.DN dn,
                   org.apache.directory.shared.ldap.entry.ModificationOperation modOp,
                   ServerEntry mods)
            throws java.lang.Exception
Specified by:
modify in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

modify

public void modify(org.apache.directory.shared.ldap.name.DN dn,
                   java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
            throws java.lang.Exception
Specified by:
modify in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

modify

public void modify(long entryId,
                   java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
            throws java.lang.Exception
Throws:
java.lang.Exception

move

public void move(org.apache.directory.shared.ldap.name.DN oldChildDn,
                 org.apache.directory.shared.ldap.name.DN newParentDn,
                 org.apache.directory.shared.ldap.name.RDN newRdn,
                 boolean deleteOldRdn)
          throws java.lang.Exception
Specified by:
move in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

move

public void move(org.apache.directory.shared.ldap.name.DN oldChildDn,
                 org.apache.directory.shared.ldap.name.DN newParentDn)
          throws java.lang.Exception
Specified by:
move in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

rename

public void rename(org.apache.directory.shared.ldap.name.DN dn,
                   org.apache.directory.shared.ldap.name.RDN newRdn,
                   boolean deleteOldRdn)
            throws java.lang.Exception
Changes the relative distinguished name of an entry specified by a distinguished name with the optional removal of the old RDN attribute value from the entry. Name changes propagate down as dn changes to the descendants of the entry where the RDN changed. An RDN change operation does not change parent child relationships. It merely propagates a name change at a point in the DIT where the RDN is changed. The change propagates down the subtree rooted at the distinguished name specified.

Specified by:
rename in interface Store<E,java.lang.Long>
Parameters:
dn - the normalized distinguished name of the entry to alter
newRdn - the new RDN to set
deleteOldRdn - whether or not to remove the old RDN attr/val
Throws:
java.lang.Exception - if there are any errors propagating the name changes

setAliasIndex

public void setAliasIndex(Index<java.lang.String,E,java.lang.Long> index)
                   throws java.lang.Exception

Specified by:
setAliasIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setName

public void setName(java.lang.String name)

Specified by:
setName in interface Store<E,java.lang.Long>

setNdnIndex

public void setNdnIndex(Index<java.lang.String,E,java.lang.Long> index)
                 throws java.lang.Exception

Specified by:
setNdnIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setOneAliasIndex

public void setOneAliasIndex(Index<java.lang.Long,E,java.lang.Long> index)
                      throws java.lang.Exception

Specified by:
setOneAliasIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setOneLevelIndex

public void setOneLevelIndex(Index<java.lang.Long,E,java.lang.Long> index)
                      throws java.lang.Exception

Specified by:
setOneLevelIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setPresenceIndex

public void setPresenceIndex(Index<java.lang.String,E,java.lang.Long> index)
                      throws java.lang.Exception

Specified by:
setPresenceIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
                 throws java.lang.Exception

Specified by:
setProperty in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setSubAliasIndex

public void setSubAliasIndex(Index<java.lang.Long,E,java.lang.Long> index)
                      throws java.lang.Exception

Specified by:
setSubAliasIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setSubLevelIndex

public void setSubLevelIndex(Index<java.lang.Long,E,java.lang.Long> index)
                      throws java.lang.Exception

Specified by:
setSubLevelIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setSuffixDn

public void setSuffixDn(java.lang.String suffixDn)

Specified by:
setSuffixDn in interface Store<E,java.lang.Long>

setUpdnIndex

public void setUpdnIndex(Index<java.lang.String,E,java.lang.Long> index)
                  throws java.lang.Exception

Specified by:
setUpdnIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setUserIndices

public void setUserIndices(java.util.Set<Index<? extends java.lang.Object,E,java.lang.Long>> userIndices)

Specified by:
setUserIndices in interface Store<E,java.lang.Long>

systemIndices

public java.util.Iterator<java.lang.String> systemIndices()

Specified by:
systemIndices in interface Store<E,java.lang.Long>

userIndices

public java.util.Iterator<java.lang.String> userIndices()

Specified by:
userIndices in interface Store<E,java.lang.Long>

getCacheSize

public int getCacheSize()
always returns 0 (zero), cause this is a inmemory store

Specified by:
getCacheSize in interface Store<E,java.lang.Long>

getEntryCsnIndex

public Index<java.lang.String,E,java.lang.Long> getEntryCsnIndex()
Specified by:
getEntryCsnIndex in interface Store<E,java.lang.Long>

getEntryUuidIndex

public Index<java.lang.String,E,java.lang.Long> getEntryUuidIndex()
Specified by:
getEntryUuidIndex in interface Store<E,java.lang.Long>

getObjectClassIndex

public Index<java.lang.String,E,java.lang.Long> getObjectClassIndex()
Specified by:
getObjectClassIndex in interface Store<E,java.lang.Long>

setEntryCsnIndex

public void setEntryCsnIndex(Index<java.lang.String,E,java.lang.Long> index)
                      throws java.lang.Exception
Specified by:
setEntryCsnIndex in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

setSyncOnWrite

public void setSyncOnWrite(boolean sync)
Specified by:
setSyncOnWrite in interface Store<E,java.lang.Long>

setWorkingDirectory

public void setWorkingDirectory(java.io.File wkDir)
Specified by:
setWorkingDirectory in interface Store<E,java.lang.Long>

getWorkingDirectory

public java.io.File getWorkingDirectory()
Specified by:
getWorkingDirectory in interface Store<E,java.lang.Long>

isSyncOnWrite

public boolean isSyncOnWrite()
Specified by:
isSyncOnWrite in interface Store<E,java.lang.Long>

setCacheSize

public void setCacheSize(int size)
Specified by:
setCacheSize in interface Store<E,java.lang.Long>

setObjectClassIndex

public void setObjectClassIndex(Index<java.lang.String,E,java.lang.Long> index)
                         throws javax.naming.NamingException
Specified by:
setObjectClassIndex in interface Store<E,java.lang.Long>
Throws:
javax.naming.NamingException

setEntryUuidIndex

public void setEntryUuidIndex(Index<java.lang.String,E,java.lang.Long> index)
                       throws javax.naming.NamingException
Specified by:
setEntryUuidIndex in interface Store<E,java.lang.Long>
Throws:
javax.naming.NamingException

sync

public void sync()
          throws java.lang.Exception
Specified by:
sync in interface Store<E,java.lang.Long>
Throws:
java.lang.Exception

getDefaultId

public java.lang.Long getDefaultId()
Specified by:
getDefaultId in interface Store<E,java.lang.Long>


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