org.apache.directory.server.core.partition.impl.btree.jdbm
Class JdbmPartition

java.lang.Object
  extended by org.apache.directory.server.core.partition.impl.btree.BTreePartition
      extended by org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition
All Implemented Interfaces:
Partition

public class JdbmPartition
extends BTreePartition

A Partition that stores entries in JDBM database.

Version:
$Rev: 689396 $
Author:
Apache Directory Project
'XBean'

Field Summary
 
Fields inherited from class org.apache.directory.server.core.partition.impl.btree.BTreePartition
cacheSize, contextEntry, id, optimizer, registries, searchEngine, suffix, suffixDn, SYS_INDEX_OIDS
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
DEFAULT_CACHE_SIZE, DEFAULT_PARTITION_IMPLEMENTATION, SYSTEM_PARTITION_NAME
 
Constructor Summary
JdbmPartition()
          Creates a store based on JDBM B+Trees.
 
Method Summary
 void add(AddOperationContext addContext)
          Adds an entry to this ContextPartition.
 void addIndexOn(Index<java.lang.Long,ServerEntry> index)
           
 void bind(BindOperationContext bindContext)
          Represents a bind operation issued to authenticate a client.
 void bind(org.apache.directory.shared.ldap.name.LdapDN bindDn, byte[] credentials, java.util.List<java.lang.String> mechanisms, java.lang.String saslAuthId)
           
 int count()
          Gets the count of the total number of entries in the database.
 void delete(java.lang.Long id)
           
 void destroy()
          Deinitialized this partition.
 Index<java.lang.String,ServerEntry> getAliasIndex()
          Gets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would be the aliasedObjectName and for X.500 would be aliasedEntryName.
 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)
          Gets the user provided distinguished name.
 java.lang.String getEntryUpdn(java.lang.String dn)
          Gets the user provided distinguished name.
 Index<java.lang.String,ServerEntry> getExistanceIndex()
           
 java.util.Set<Index<?,ServerEntry>> getIndexedAttributes()
           
 Index<java.lang.String,ServerEntry> getNdnIndex()
          Gets the Index mapping the normalized distinguished names of entries as Strings to the BigInteger primary keys of entries.
 Index<java.lang.Long,ServerEntry> getOneAliasIndex()
          Gets the alias index mapping parent entries with scope expanding aliases children one level below them; this system index is used to dereference aliases on one/single level scoped searches.
 Index<java.lang.Long,ServerEntry> getOneLevelIndex()
          Gets the Index mapping the Long primary keys of parents to the Long primary keys of their children.
 java.lang.Long getParentId(java.lang.Long childId)
           
 java.lang.Long getParentId(java.lang.String dn)
           
 Index<java.lang.String,ServerEntry> getPresenceIndex()
           
 java.lang.String getProperty(java.lang.String propertyName)
           
 Index<java.lang.Long,ServerEntry> getSubAliasIndex()
          Gets the alias index mapping relative entries with scope expanding alias descendents; this system index is used to dereference aliases on subtree scoped searches.
 Index<java.lang.Long,ServerEntry> getSubLevelIndex()
          Gets the Index mapping the Long primary keys of ancestors to the Long primary keys of their descendants.
 java.lang.String getSuffix()
          Gets the non-normalized suffix for this Partition as a string.
 org.apache.directory.shared.ldap.name.LdapDN getSuffixDn()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 Index<?,ServerEntry> getSystemIndex(java.lang.String id)
           
 java.util.Iterator<java.lang.String> getSystemIndices()
           
 Index<java.lang.String,ServerEntry> getUpdnIndex()
          Gets the Index mapping user provided distinguished names of entries as Strings to the BigInteger primary keys of entries.
 org.apache.directory.shared.ldap.name.LdapDN getUpSuffixDn()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 Index<?,ServerEntry> getUserIndex(java.lang.String id)
           
 java.util.Iterator<java.lang.String> getUserIndices()
           
 boolean hasSystemIndexOn(java.lang.String id)
           
 boolean hasUserIndexOn(java.lang.String id)
           
 void init(DirectoryService directoryService)
          Initializes this partition.
protected  void initRegistries(Registries registries)
           
 boolean isInitialized()
          Checks to see if this partition is initialized or not.
 boolean isOptimizerEnabled()
           
 boolean isSyncOnWrite()
           
 IndexCursor<java.lang.Long,ServerEntry> list(java.lang.Long id)
           
 ClonedServerEntry lookup(java.lang.Long id)
           
 void modify(ModifyOperationContext modifyContext)
          Modifies an entry by adding, removing or replacing a set of attributes.
 void move(MoveOperationContext moveContext)
          Transplants a child entry, to a position in the namespace under a new parent entry.
 void moveAndRename(MoveAndRenameOperationContext moveAndRenameContext)
          Transplants a child entry, to a position in the namespace under a new parent entry and changes the RN of the child entry which can optionally have its old RN attributes removed.
 void rename(RenameOperationContext renameContext)
          Modifies an entry by changing its relative name.
 void setAliasIndexOn(Index<java.lang.String,ServerEntry> index)
          Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would be the aliasedObjectName and for X.500 would be aliasedEntryName.
 void setIndexedAttributes(java.util.Set<Index<?,ServerEntry>> indexedAttributes)
           
 void setNdnIndexOn(Index<java.lang.String,ServerEntry> index)
          Sets the normalized distinguished name Index.
 void setOneAliasIndexOn(Index<java.lang.Long,ServerEntry> index)
          Sets the alias index mapping parent entries with scope expanding aliases children one level below them; this system index is used to dereference aliases on one/single level scoped searches.
 void setOneLevelIndexOn(Index<java.lang.Long,ServerEntry> index)
          Sets the one level Index.
 void setOptimizerEnabled(boolean optimizerEnabled)
           
 void setPresenceIndexOn(Index<java.lang.String,ServerEntry> index)
          Sets the attribute existance Index.
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
           
 void setRegistries(Registries registries)
          Allows for schema entity registries to be swapped out during runtime.
 void setSubAliasIndexOn(Index<java.lang.Long,ServerEntry> index)
          Sets the alias index mapping relative entries with scope expanding alias descendents; this system index is used to dereference aliases on subtree scoped searches.
 void setSuffix(java.lang.String suffix)
          Sets the non-normalized suffix for this Partition as a string.
 void setSyncOnWrite(boolean syncOnWrite)
           
 void setUpdnIndexOn(Index<java.lang.String,ServerEntry> index)
          Sets the user provided distinguished name Index.
 void sync()
          Flushes any changes made to this partition now.
 java.lang.String toString()
           
 void unbind(UnbindOperationContext unbindContext)
          Represents an unbind operation issued by an authenticated client.
 
Methods inherited from class org.apache.directory.server.core.partition.impl.btree.BTreePartition
delete, getCacheSize, getId, getSearchEngine, hasEntry, inspect, list, lookup, search, setCacheSize, setId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JdbmPartition

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

Method Detail

getSuffix

public java.lang.String getSuffix()
Description copied from interface: Partition
Gets the non-normalized suffix for this Partition as a string.

Returns:
the suffix string for this Partition.

setSuffix

public void setSuffix(java.lang.String suffix)
Description copied from interface: Partition
Sets the non-normalized suffix for this Partition as a string.

Parameters:
suffix - the suffix string for this Partition.

setIndexedAttributes

public void setIndexedAttributes(java.util.Set<Index<?,ServerEntry>> indexedAttributes)

getIndexedAttributes

public java.util.Set<Index<?,ServerEntry>> getIndexedAttributes()

isOptimizerEnabled

public boolean isOptimizerEnabled()

setOptimizerEnabled

public void setOptimizerEnabled(boolean optimizerEnabled)

setSyncOnWrite

public void setSyncOnWrite(boolean syncOnWrite)

isSyncOnWrite

public boolean isSyncOnWrite()

setRegistries

public void setRegistries(Registries registries)
                   throws java.lang.Exception
Description copied from class: BTreePartition
Allows for schema entity registries to be swapped out during runtime. This is primarily here to facilitate the swap out of a temporary bootstrap registry. Registry changes require swapping out the search engine used by a partition since the registries are used by elements in the search engine.

Specified by:
setRegistries in class BTreePartition
Parameters:
registries - the schema entity registries
Throws:
java.lang.Exception

initRegistries

protected void initRegistries(Registries registries)
                       throws java.lang.Exception
Throws:
java.lang.Exception

init

public final void init(DirectoryService directoryService)
                throws java.lang.Exception
Description copied from interface: Partition
Initializes this partition.

Parameters:
directoryService - the directory core for the server.
Throws:
java.lang.Exception - if initialization fails in any way

destroy

public final void destroy()
                   throws java.lang.Exception
Description copied from interface: Partition
Deinitialized this partition.

Specified by:
destroy in interface Partition
Specified by:
destroy in class BTreePartition
Throws:
java.lang.Exception

isInitialized

public final boolean isInitialized()
Description copied from interface: Partition
Checks to see if this partition is initialized or not.

Specified by:
isInitialized in interface Partition
Specified by:
isInitialized in class BTreePartition
Returns:
true if the partition is initialized, false otherwise

sync

public final void sync()
                throws java.lang.Exception
Description copied from interface: Partition
Flushes any changes made to this partition now.

Specified by:
sync in interface Partition
Specified by:
sync in class BTreePartition
Throws:
java.lang.Exception - if buffers cannot be flushed to disk

addIndexOn

public final void addIndexOn(Index<java.lang.Long,ServerEntry> index)
                      throws java.lang.Exception
Specified by:
addIndexOn in class BTreePartition
Throws:
java.lang.Exception

getExistanceIndex

public final Index<java.lang.String,ServerEntry> getExistanceIndex()

setPresenceIndexOn

public final void setPresenceIndexOn(Index<java.lang.String,ServerEntry> index)
                              throws java.lang.Exception
Description copied from class: BTreePartition
Sets the attribute existance Index.

Specified by:
setPresenceIndexOn in class BTreePartition
Parameters:
index - the attribute existance Index
Throws:
java.lang.Exception - if there is a problem setting up the index

getOneLevelIndex

public final Index<java.lang.Long,ServerEntry> getOneLevelIndex()
Description copied from class: BTreePartition
Gets the Index mapping the Long primary keys of parents to the Long primary keys of their children.

Specified by:
getOneLevelIndex in class BTreePartition
Returns:
the one level Index

setOneLevelIndexOn

public final void setOneLevelIndexOn(Index<java.lang.Long,ServerEntry> index)
                              throws java.lang.Exception
Description copied from class: BTreePartition
Sets the one level Index.

Specified by:
setOneLevelIndexOn in class BTreePartition
Parameters:
index - the one level Index
Throws:
java.lang.Exception - if there is a problem setting up the index

getAliasIndex

public final Index<java.lang.String,ServerEntry> getAliasIndex()
Description copied from class: BTreePartition
Gets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would be the aliasedObjectName and for X.500 would be aliasedEntryName.

Specified by:
getAliasIndex in class BTreePartition
Returns:
the index on the ALIAS_ATTRIBUTE

setAliasIndexOn

public final void setAliasIndexOn(Index<java.lang.String,ServerEntry> index)
                           throws java.lang.Exception
Description copied from class: BTreePartition
Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would be the aliasedObjectName and for X.500 would be aliasedEntryName.

Specified by:
setAliasIndexOn in class BTreePartition
Parameters:
index - the index on the ALIAS_ATTRIBUTE
Throws:
java.lang.Exception - if there is a problem setting up the index

getOneAliasIndex

public final Index<java.lang.Long,ServerEntry> getOneAliasIndex()
Description copied from class: BTreePartition
Gets the alias index mapping parent entries with scope expanding aliases children one level below them; this system index is used to dereference aliases on one/single level scoped searches.

Specified by:
getOneAliasIndex in class BTreePartition
Returns:
the one alias index

setOneAliasIndexOn

public final void setOneAliasIndexOn(Index<java.lang.Long,ServerEntry> index)
                              throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the alias index mapping parent entries with scope expanding aliases children one level below them; this system index is used to dereference aliases on one/single level scoped searches.

Specified by:
setOneAliasIndexOn in class BTreePartition
Parameters:
index - a one level alias index
Throws:
javax.naming.NamingException

getSubAliasIndex

public final Index<java.lang.Long,ServerEntry> getSubAliasIndex()
Description copied from class: BTreePartition
Gets the alias index mapping relative entries with scope expanding alias descendents; this system index is used to dereference aliases on subtree scoped searches.

Specified by:
getSubAliasIndex in class BTreePartition
Returns:
the sub alias index

setSubAliasIndexOn

public final void setSubAliasIndexOn(Index<java.lang.Long,ServerEntry> index)
                              throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the alias index mapping relative entries with scope expanding alias descendents; this system index is used to dereference aliases on subtree scoped searches.

Specified by:
setSubAliasIndexOn in class BTreePartition
Parameters:
index - a subtree alias index
Throws:
javax.naming.NamingException

getUpdnIndex

public final Index<java.lang.String,ServerEntry> getUpdnIndex()
Description copied from class: BTreePartition
Gets the Index mapping user provided distinguished names of entries as Strings to the BigInteger primary keys of entries.

Specified by:
getUpdnIndex in class BTreePartition
Returns:
the user provided distinguished name Index

setUpdnIndexOn

public final void setUpdnIndexOn(Index<java.lang.String,ServerEntry> index)
                          throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the user provided distinguished name Index.

Specified by:
setUpdnIndexOn in class BTreePartition
Parameters:
index - the updn Index
Throws:
javax.naming.NamingException

getNdnIndex

public final Index<java.lang.String,ServerEntry> getNdnIndex()
Description copied from class: BTreePartition
Gets the Index mapping the normalized distinguished names of entries as Strings to the BigInteger primary keys of entries.

Specified by:
getNdnIndex in class BTreePartition
Returns:
the normalized distinguished name Index

setNdnIndexOn

public final void setNdnIndexOn(Index<java.lang.String,ServerEntry> index)
                         throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the normalized distinguished name Index.

Specified by:
setNdnIndexOn in class BTreePartition
Parameters:
index - the ndn Index
Throws:
javax.naming.NamingException

getUserIndices

public final java.util.Iterator<java.lang.String> getUserIndices()
Specified by:
getUserIndices in class BTreePartition

getSystemIndices

public final java.util.Iterator<java.lang.String> getSystemIndices()
Specified by:
getSystemIndices in class BTreePartition

hasUserIndexOn

public final boolean hasUserIndexOn(java.lang.String id)
                             throws javax.naming.NamingException
Specified by:
hasUserIndexOn in class BTreePartition
Throws:
javax.naming.NamingException

hasSystemIndexOn

public final boolean hasSystemIndexOn(java.lang.String id)
                               throws javax.naming.NamingException
Specified by:
hasSystemIndexOn in class BTreePartition
Throws:
javax.naming.NamingException

getUserIndex

public final Index<?,ServerEntry> getUserIndex(java.lang.String id)
                                        throws IndexNotFoundException
Specified by:
getUserIndex in class BTreePartition
Throws:
IndexNotFoundException
See Also:
BTreePartition.getUserIndex(String)

getSystemIndex

public final Index<?,ServerEntry> getSystemIndex(java.lang.String id)
                                          throws IndexNotFoundException
Specified by:
getSystemIndex in class BTreePartition
Throws:
IndexNotFoundException
See Also:
BTreePartition.getEntryId(String)

getEntryId

public final java.lang.Long getEntryId(java.lang.String dn)
                                throws java.lang.Exception
Specified by:
getEntryId in class BTreePartition
Throws:
java.lang.Exception

getEntryDn

public final java.lang.String getEntryDn(java.lang.Long id)
                                  throws java.lang.Exception
Specified by:
getEntryDn in class BTreePartition
Throws:
java.lang.Exception

getParentId

public final java.lang.Long getParentId(java.lang.String dn)
                                 throws java.lang.Exception
Specified by:
getParentId in class BTreePartition
Throws:
java.lang.Exception

getParentId

public final java.lang.Long getParentId(java.lang.Long childId)
                                 throws java.lang.Exception
Specified by:
getParentId in class BTreePartition
Throws:
java.lang.Exception

getEntryUpdn

public final java.lang.String getEntryUpdn(java.lang.Long id)
                                    throws java.lang.Exception
Description copied from class: BTreePartition
Gets the user provided distinguished name.

Specified by:
getEntryUpdn in class BTreePartition
Parameters:
id - the entry id
Returns:
the user provided distinguished name
Throws:
java.lang.Exception - if the updn index cannot be accessed

getEntryUpdn

public final java.lang.String getEntryUpdn(java.lang.String dn)
                                    throws java.lang.Exception
Description copied from class: BTreePartition
Gets the user provided distinguished name.

Specified by:
getEntryUpdn in class BTreePartition
Parameters:
dn - the normalized distinguished name
Returns:
the user provided distinguished name
Throws:
java.lang.Exception - if the updn and ndn indices cannot be accessed

count

public final int count()
                throws java.lang.Exception
Description copied from class: BTreePartition
Gets the count of the total number of entries in the database. TODO shouldn't this be a BigInteger instead of an int?

Specified by:
count in class BTreePartition
Returns:
the number of entries in the database
Throws:
java.lang.Exception - if there is a failure to read the count

add

public final void add(AddOperationContext addContext)
               throws java.lang.Exception
Description copied from interface: Partition
Adds an entry to this ContextPartition.

Specified by:
add in interface Partition
Specified by:
add in class BTreePartition
Parameters:
addContext - the context used to add and entry to this ContextPartition
Throws:
java.lang.Exception - if there are any problems

lookup

public final ClonedServerEntry lookup(java.lang.Long id)
                               throws java.lang.Exception
Specified by:
lookup in interface Partition
Specified by:
lookup in class BTreePartition
Throws:
java.lang.Exception

delete

public final void delete(java.lang.Long id)
                  throws java.lang.Exception
Specified by:
delete in class BTreePartition
Throws:
java.lang.Exception

list

public final IndexCursor<java.lang.Long,ServerEntry> list(java.lang.Long id)
                                                   throws java.lang.Exception
Specified by:
list in class BTreePartition
Throws:
java.lang.Exception

getChildCount

public final int getChildCount(java.lang.Long id)
                        throws java.lang.Exception
Specified by:
getChildCount in class BTreePartition
Throws:
java.lang.Exception

getSuffixDn

public final org.apache.directory.shared.ldap.name.LdapDN getSuffixDn()
Description copied from interface: Partition
Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.

Returns:
Name representing the distinguished/absolute name of this ContextPartitions root context.

getUpSuffixDn

public final org.apache.directory.shared.ldap.name.LdapDN getUpSuffixDn()
Description copied from interface: Partition
Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.

Returns:
Name representing the distinguished/absolute name of this ContextPartitions root context.

setProperty

public final void setProperty(java.lang.String propertyName,
                              java.lang.String propertyValue)
                       throws java.lang.Exception
Specified by:
setProperty in class BTreePartition
Throws:
java.lang.Exception

getProperty

public final java.lang.String getProperty(java.lang.String propertyName)
                                   throws java.lang.Exception
Specified by:
getProperty in class BTreePartition
Throws:
java.lang.Exception

modify

public final void modify(ModifyOperationContext modifyContext)
                  throws java.lang.Exception
Description copied from interface: Partition
Modifies an entry by adding, removing or replacing a set of attributes.

Specified by:
modify in interface Partition
Specified by:
modify in class BTreePartition
Parameters:
modifyContext - The contetx containin the modification operation to perform on the entry which is one of constants specified by the DirContext interface: ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE.
Throws:
java.lang.Exception - if there are any problems
See Also:
DirContext, DirContext.ADD_ATTRIBUTE, DirContext.REMOVE_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE

rename

public final void rename(RenameOperationContext renameContext)
                  throws java.lang.Exception
Description copied from interface: Partition
Modifies an entry by changing its relative name. Optionally attributes associated with the old relative name can be removed from the entry. This makes sense only in certain namespaces like LDAP and will be ignored if it is irrelavent.

Specified by:
rename in interface Partition
Specified by:
rename in class BTreePartition
Parameters:
renameContext - the modify DN context
Throws:
java.lang.Exception - if there are any problems

moveAndRename

public final void moveAndRename(MoveAndRenameOperationContext moveAndRenameContext)
                         throws java.lang.Exception
Description copied from interface: Partition
Transplants a child entry, to a position in the namespace under a new parent entry and changes the RN of the child entry which can optionally have its old RN attributes removed. The removal of old RN attributes may not make sense in all namespaces. If the concept is undefined in a namespace this parameters is ignored. An example of a namespace where this parameter is significant is the LDAP namespace.

Specified by:
moveAndRename in interface Partition
Specified by:
moveAndRename in class BTreePartition
Parameters:
moveAndRenameContext - The context contain all the information about the modifyDN operation
Throws:
java.lang.Exception - if there are any problems

move

public final void move(MoveOperationContext moveContext)
                throws java.lang.Exception
Description copied from interface: Partition
Transplants a child entry, to a position in the namespace under a new parent entry.

Specified by:
move in interface Partition
Specified by:
move in class BTreePartition
Parameters:
moveContext - The context containing the DNs to move
Throws:
java.lang.Exception - if there are any problems

bind

public final void bind(org.apache.directory.shared.ldap.name.LdapDN bindDn,
                       byte[] credentials,
                       java.util.List<java.lang.String> mechanisms,
                       java.lang.String saslAuthId)
                throws java.lang.Exception
Throws:
java.lang.Exception

bind

public final void bind(BindOperationContext bindContext)
                throws java.lang.Exception
Description copied from interface: Partition
Represents a bind operation issued to authenticate a client. Partitions need not support this operation. This operation is here to enable those interested in implementing virtual directories with ApacheDS.

Parameters:
bindContext - the bind context, containing all the needed informations to bind
Throws:
java.lang.Exception - if something goes wrong

unbind

public final void unbind(UnbindOperationContext unbindContext)
                  throws java.lang.Exception
Description copied from interface: Partition
Represents an unbind operation issued by an authenticated client. Partitions need not support this operation. This operation is here to enable those interested in implementing virtual directories with ApacheDS.

Parameters:
unbindContext - the context used to unbind
Throws:
java.lang.Exception - if something goes wrong

getPresenceIndex

public Index<java.lang.String,ServerEntry> getPresenceIndex()
Specified by:
getPresenceIndex in class BTreePartition

getSubLevelIndex

public Index<java.lang.Long,ServerEntry> getSubLevelIndex()
Description copied from class: BTreePartition
Gets the Index mapping the Long primary keys of ancestors to the Long primary keys of their descendants.

Specified by:
getSubLevelIndex in class BTreePartition
Returns:
the sub tree level Index

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


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