org.apache.directory.server.core.partition.impl.btree.jdbm
Class JdbmStore<E>

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmStore<E>
All Implemented Interfaces:
Store<E>

public class JdbmStore<E>
extends java.lang.Object
implements Store<E>


Field Summary
 
Fields inherited from interface org.apache.directory.server.xdbm.Store
ALIAS, NDN, ONEALIAS, ONELEVEL, PRESENCE, SUBALIAS, SUBLEVEL, UPDN
 
Constructor Summary
JdbmStore()
          Creates a store based on JDBM B+Trees.
 
Method Summary
 void add(org.apache.directory.shared.ldap.name.LdapDN normName, ServerEntry entry)
           
 void addIndex(Index<?,E> index)
           
 int count()
           
 void delete(java.lang.Long id)
           
 void destroy()
          Close the parttion : we have to close all the userIndices and the master table.
 Index<java.lang.String,E> getAliasIndex()
           
 int getCacheSize()
           
 int getChildCount(java.lang.Long id)
           
 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)
           
 java.lang.String getName()
           
 Index<java.lang.String,E> getNdnIndex()
           
 Index<java.lang.Long,E> getOneAliasIndex()
           
 Index<java.lang.Long,E> getOneLevelIndex()
           
 java.lang.Long getParentId(java.lang.Long childId)
           
 java.lang.Long getParentId(java.lang.String dn)
          Gets the Long id of an entry's parent using the child entry's normalized DN.
 Index<java.lang.String,E> getPresenceIndex()
           
 java.lang.String getProperty(java.lang.String propertyName)
           
 Index<java.lang.Long,E> getSubAliasIndex()
           
 Index<java.lang.Long,E> getSubLevelIndex()
           
 org.apache.directory.shared.ldap.name.LdapDN getSuffix()
           
 java.lang.String getSuffixDn()
           
 Index<?,E> getSystemIndex(java.lang.String id)
           
 Index<java.lang.String,E> getUpdnIndex()
           
 org.apache.directory.shared.ldap.name.LdapDN getUpSuffix()
           
 Index<?,E> getUserIndex(java.lang.String id)
           
 java.util.Set<Index<?,E>> getUserIndices()
           
 java.io.File getWorkingDirectory()
           
 boolean hasSystemIndexOn(java.lang.String id)
           
 boolean hasUserIndexOn(java.lang.String id)
           
 void init(Registries registries)
          Initialize the JDBM storage system.
 void initRegistries(Registries registries)
           
 boolean isInitialized()
          Gets whether the store is initialized.
 boolean isSyncOnWrite()
           
 IndexCursor<java.lang.Long,E> list(java.lang.Long id)
          Gets an IndexEntry Cursor over the child nodes of an entry.
 ServerEntry lookup(java.lang.Long id)
           
 void modify(org.apache.directory.shared.ldap.name.LdapDN dn, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
           
 void modify(org.apache.directory.shared.ldap.name.LdapDN dn, org.apache.directory.shared.ldap.entry.ModificationOperation modOp, ServerEntry mods)
           
 void move(org.apache.directory.shared.ldap.name.LdapDN oldChildDn, org.apache.directory.shared.ldap.name.LdapDN newParentDn)
           
 void move(org.apache.directory.shared.ldap.name.LdapDN oldChildDn, org.apache.directory.shared.ldap.name.LdapDN newParentDn, org.apache.directory.shared.ldap.name.Rdn newRdn, boolean deleteOldRdn)
           
 void rename(org.apache.directory.shared.ldap.name.LdapDN 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> index)
           
 void setCacheSize(int cacheSize)
           
 void setName(java.lang.String name)
           
 void setNdnIndex(Index<java.lang.String,E> index)
           
 void setOneAliasIndex(Index<java.lang.Long,E> index)
           
 void setOneLevelIndex(Index<java.lang.Long,E> index)
           
 void setPresenceIndex(Index<java.lang.String,E> index)
           
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
           
 void setSubAliasIndex(Index<java.lang.Long,E> index)
           
 void setSubLevelIndex(Index<java.lang.Long,E> index)
           
 void setSuffixDn(java.lang.String suffixDn)
           
 void setSyncOnWrite(boolean isSyncOnWrite)
           
 void setUpdnIndex(Index<java.lang.String,E> index)
           
 void setUserIndices(java.util.Set<Index<?,E>> userIndices)
           
 void setWorkingDirectory(java.io.File workingDirectory)
           
 void sync()
          This method is called when the synch thread is waking up, to write the modified data.
 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

JdbmStore

public JdbmStore()
Creates a store based on JDBM B+Trees.

Method Detail

setWorkingDirectory

public void setWorkingDirectory(java.io.File workingDirectory)
Specified by:
setWorkingDirectory in interface Store<E>

getWorkingDirectory

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

setSuffixDn

public void setSuffixDn(java.lang.String suffixDn)
Specified by:
setSuffixDn in interface Store<E>

getSuffixDn

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

setSyncOnWrite

public void setSyncOnWrite(boolean isSyncOnWrite)
Specified by:
setSyncOnWrite in interface Store<E>

isSyncOnWrite

public boolean isSyncOnWrite()
Specified by:
isSyncOnWrite in interface Store<E>

setCacheSize

public void setCacheSize(int cacheSize)
Specified by:
setCacheSize in interface Store<E>

getCacheSize

public int getCacheSize()
Specified by:
getCacheSize in interface Store<E>

setName

public void setName(java.lang.String name)
Specified by:
setName in interface Store<E>

getName

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

init

public void init(Registries registries)
          throws java.lang.Exception
Initialize the JDBM storage system.

Specified by:
init in interface Store<E>
Parameters:
registries - the schema registries
Throws:
java.lang.Exception - on failure to lookup elements in registries or create database files

destroy

public void destroy()
             throws java.lang.Exception
Close the parttion : we have to close all the userIndices and the master table.

Specified by:
destroy in interface Store<E>
Throws:
java.lang.Exception - lazily thrown on any closer failures to avoid leaving open files

isInitialized

public boolean isInitialized()
Gets whether the store is initialized.

Specified by:
isInitialized in interface Store<E>
Returns:
true if the partition store is initialized

sync

public void sync()
          throws java.lang.Exception
This method is called when the synch thread is waking up, to write the modified data.

Specified by:
sync in interface Store<E>
Throws:
java.lang.Exception - on failures to sync database files to disk

setUserIndices

public void setUserIndices(java.util.Set<Index<?,E>> userIndices)
Specified by:
setUserIndices in interface Store<E>

getUserIndices

public java.util.Set<Index<?,E>> getUserIndices()
Specified by:
getUserIndices in interface Store<E>

addIndex

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

getPresenceIndex

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

setPresenceIndex

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

getOneLevelIndex

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

setOneLevelIndex

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

getAliasIndex

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

setAliasIndex

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

getOneAliasIndex

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

setOneAliasIndex

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

getSubAliasIndex

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

setSubAliasIndex

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

getUpdnIndex

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

setUpdnIndex

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

getNdnIndex

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

setNdnIndex

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

getSubLevelIndex

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

setSubLevelIndex

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

userIndices

public java.util.Iterator<java.lang.String> userIndices()
Specified by:
userIndices in interface Store<E>

systemIndices

public java.util.Iterator<java.lang.String> systemIndices()
Specified by:
systemIndices in interface Store<E>

hasUserIndexOn

public boolean hasUserIndexOn(java.lang.String id)
                       throws javax.naming.NamingException
Specified by:
hasUserIndexOn in interface Store<E>
Throws:
javax.naming.NamingException

hasSystemIndexOn

public boolean hasSystemIndexOn(java.lang.String id)
                         throws javax.naming.NamingException
Specified by:
hasSystemIndexOn in interface Store<E>
Throws:
javax.naming.NamingException

getUserIndex

public Index<?,E> getUserIndex(java.lang.String id)
                        throws IndexNotFoundException
Specified by:
getUserIndex in interface Store<E>
Throws:
IndexNotFoundException

getSystemIndex

public Index<?,E> getSystemIndex(java.lang.String id)
                          throws IndexNotFoundException
Specified by:
getSystemIndex in interface Store<E>
Throws:
IndexNotFoundException

getEntryId

public java.lang.Long getEntryId(java.lang.String dn)
                          throws java.lang.Exception
Specified by:
getEntryId in interface Store<E>
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>
Throws:
java.lang.Exception

getParentId

public java.lang.Long getParentId(java.lang.String dn)
                           throws java.lang.Exception
Gets the Long id of an entry's parent using the child entry's normalized DN. Note that the suffix entry returns 0, which does not map to any entry.

Specified by:
getParentId in interface Store<E>
Parameters:
dn - the normalized distinguished name of the child
Returns:
the id of the parent entry or zero if the suffix entry the normalized suffix DN string is used
Throws:
java.lang.Exception - on failures to access the underlying store

getParentId

public java.lang.Long getParentId(java.lang.Long childId)
                           throws java.lang.Exception
Specified by:
getParentId in interface Store<E>
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>
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>
Throws:
java.lang.Exception

count

public int count()
          throws java.lang.Exception
Specified by:
count in interface Store<E>
Throws:
java.lang.Exception

add

public void add(org.apache.directory.shared.ldap.name.LdapDN normName,
                ServerEntry entry)
         throws java.lang.Exception
Specified by:
add in interface Store<E>
Throws:
java.lang.Exception

lookup

public ServerEntry lookup(java.lang.Long id)
                   throws java.lang.Exception
Specified by:
lookup in interface Store<E>
Throws:
java.lang.Exception

delete

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

list

public IndexCursor<java.lang.Long,E> list(java.lang.Long id)
                                   throws java.lang.Exception
Gets an IndexEntry Cursor over the child nodes of an entry.

Specified by:
list in interface Store<E>
Parameters:
id - the id of the parent entry
Returns:
an IndexEntry Cursor over the child entries
Throws:
java.lang.Exception - on failures to access the underlying store

getChildCount

public int getChildCount(java.lang.Long id)
                  throws java.lang.Exception
Specified by:
getChildCount in interface Store<E>
Throws:
java.lang.Exception

getSuffix

public org.apache.directory.shared.ldap.name.LdapDN getSuffix()
Specified by:
getSuffix in interface Store<E>

getUpSuffix

public org.apache.directory.shared.ldap.name.LdapDN getUpSuffix()
Specified by:
getUpSuffix in interface Store<E>

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
                 throws java.lang.Exception
Specified by:
setProperty in interface Store<E>
Throws:
java.lang.Exception

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
                             throws java.lang.Exception
Specified by:
getProperty in interface Store<E>
Throws:
java.lang.Exception

modify

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

modify

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

rename

public void rename(org.apache.directory.shared.ldap.name.LdapDN 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>
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

move

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

move

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

initRegistries

public void initRegistries(Registries registries)
Specified by:
initRegistries in interface Store<E>


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.