org.apache.directory.server.xdbm
Class AbstractXdbmPartition<ID>

java.lang.Object
  extended by org.apache.directory.server.core.partition.AbstractPartition
      extended by org.apache.directory.server.core.partition.impl.btree.BTreePartition<ID>
          extended by org.apache.directory.server.xdbm.AbstractXdbmPartition<ID>
All Implemented Interfaces:
Partition
Direct Known Subclasses:
AvlPartition, JdbmPartition

public abstract class AbstractXdbmPartition<ID>
extends BTreePartition<ID>

Base class for XDBM partitions that use an Store.

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

Field Summary
protected  boolean optimizerEnabled
           
protected  Store<org.apache.directory.shared.ldap.entry.ServerEntry,ID> store
          The store.
 
Fields inherited from class org.apache.directory.server.core.partition.impl.btree.BTreePartition
cacheSize, contextEntry, id, optimizer, schemaManager, searchEngine, suffix, SYS_INDEX_OIDS
 
Fields inherited from class org.apache.directory.server.core.partition.AbstractPartition
initialized
 
Constructor Summary
protected AbstractXdbmPartition(Store<org.apache.directory.shared.ldap.entry.ServerEntry,ID> store)
           
 
Method Summary
 void add(AddOperationContext addContext)
          Adds an entry to this ContextPartition.
 void addIndexOn(Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
           
 void bind(BindOperationContext bindContext)
          Represents a bind operation issued to authenticate a client.
 void bind(org.apache.directory.shared.ldap.name.DN 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(ID id)
           
protected  void doDestroy()
          Override this method to put your initialization code.
 Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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(ID id)
           
 java.lang.String getEntryDn(ID id)
           
 ID getEntryId(java.lang.String dn)
           
 java.lang.String getEntryUpdn(ID 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,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getExistenceIndex()
           
 Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getNdnIndex()
          Gets the Index mapping the normalized distinguished names of entries as Strings to the BigInteger primary keys of entries.
 Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getOneLevelIndex()
          Gets the Index mapping the primary keys of parents to the primary keys of their children.
 ID getParentId(ID childId)
           
 ID getParentId(java.lang.String dn)
           
 Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getPresenceIndex()
           
 java.lang.String getProperty(java.lang.String propertyName)
           
 Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSubLevelIndex()
          Gets the Index mapping the primary keys of ancestors to the primary keys of their descendants.
 Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSystemIndex(java.lang.String id)
           
 java.util.Iterator<java.lang.String> getSystemIndices()
           
 Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getUpdnIndex()
          Gets the Index mapping user provided distinguished names of entries as Strings to the BigInteger primary keys of entries.
 Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getUserIndex(java.lang.String id)
           
 java.util.Iterator<java.lang.String> getUserIndices()
           
 boolean hasSystemIndexOn(java.lang.String id)
           
 boolean hasUserIndexOn(java.lang.String id)
           
 boolean isInitialized()
          Returns true if this context partition is initialized successfully.
 boolean isOptimizerEnabled()
           
 boolean isSyncOnWrite()
           
 IndexCursor<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> list(ID id)
           
 ClonedServerEntry lookup(ID 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,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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 setNdnIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
          Sets the normalized distinguished name Index.
 void setOneAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
          Sets the one level Index.
 void setOptimizerEnabled(boolean optimizerEnabled)
           
 void setPresenceIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
          Sets the attribute existence Index.
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
           
 void setSubAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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 setSyncOnWrite(boolean syncOnWrite)
           
 void setUpdnIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
          Sets the user provided distinguished name Index.
 void sync()
          This method does nothing by default.
 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
addIndexedAttributes, delete, getCacheSize, getId, getIndexedAttributes, getPartitionDir, getSchemaManager, getSearchEngine, getSuffix, getSuffixDn, hasEntry, list, lookup, search, setCacheSize, setId, setIndexedAttributes, setPartitionDir, setSchemaManager, setSuffix
 
Methods inherited from class org.apache.directory.server.core.partition.AbstractPartition
destroy, doInit, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

optimizerEnabled

protected boolean optimizerEnabled

store

protected Store<org.apache.directory.shared.ldap.entry.ServerEntry,ID> store
The store.

Constructor Detail

AbstractXdbmPartition

protected AbstractXdbmPartition(Store<org.apache.directory.shared.ldap.entry.ServerEntry,ID> store)
Method Detail

doDestroy

protected void doDestroy()
                  throws java.lang.Exception
Override this method to put your initialization code.

Specified by:
doDestroy in class AbstractPartition
Throws:
java.lang.Exception

isInitialized

public final boolean isInitialized()
Returns true if this context partition is initialized successfully.

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

sync

public final void sync()
                throws java.lang.Exception
This method does nothing by default.

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

isOptimizerEnabled

public boolean isOptimizerEnabled()

setOptimizerEnabled

public void setOptimizerEnabled(boolean optimizerEnabled)

setSyncOnWrite

public void setSyncOnWrite(boolean syncOnWrite)

isSyncOnWrite

public boolean isSyncOnWrite()

addIndexOn

public final void addIndexOn(Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                      throws java.lang.Exception
Specified by:
addIndexOn in class BTreePartition<ID>
Throws:
java.lang.Exception

getExistenceIndex

public final Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getExistenceIndex()

setPresenceIndexOn

public final void setPresenceIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                              throws java.lang.Exception
Description copied from class: BTreePartition
Sets the attribute existence Index.

Specified by:
setPresenceIndexOn in class BTreePartition<ID>
Parameters:
index - the attribute existence Index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getOneLevelIndex

public final Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getOneLevelIndex()
Description copied from class: BTreePartition
Gets the Index mapping the primary keys of parents to the primary keys of their children.

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

setOneLevelIndexOn

public final void setOneLevelIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                              throws java.lang.Exception
Description copied from class: BTreePartition
Sets the one level Index.

Specified by:
setOneLevelIndexOn in class BTreePartition<ID>
Parameters:
index - the one level Index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getAliasIndex

public final Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Returns:
the index on the ALIAS_ATTRIBUTE

setAliasIndexOn

public final void setAliasIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Parameters:
index - the index on the ALIAS_ATTRIBUTE
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getOneAliasIndex

public final Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Returns:
the one alias index

setOneAliasIndexOn

public final void setOneAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                              throws java.lang.Exception
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<ID>
Parameters:
index - a one level alias index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getSubAliasIndex

public final Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Returns:
the sub alias index

setSubAliasIndexOn

public final void setSubAliasIndexOn(Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                              throws java.lang.Exception
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<ID>
Parameters:
index - a subtree alias index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getUpdnIndex

public final Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Returns:
the user provided distinguished name Index

setUpdnIndexOn

public final void setUpdnIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                          throws java.lang.Exception
Description copied from class: BTreePartition
Sets the user provided distinguished name Index.

Specified by:
setUpdnIndexOn in class BTreePartition<ID>
Parameters:
index - the updn Index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getNdnIndex

public final Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> 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<ID>
Returns:
the normalized distinguished name Index

setNdnIndexOn

public final void setNdnIndexOn(Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> index)
                         throws java.lang.Exception
Description copied from class: BTreePartition
Sets the normalized distinguished name Index.

Specified by:
setNdnIndexOn in class BTreePartition<ID>
Parameters:
index - the ndn Index
Throws:
java.lang.Exception - if there is a problem setting up the index
XBean Property
hidden="true"

getUserIndices

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

getSystemIndices

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

hasUserIndexOn

public final boolean hasUserIndexOn(java.lang.String id)
                             throws java.lang.Exception
Specified by:
hasUserIndexOn in class BTreePartition<ID>
Throws:
java.lang.Exception

hasSystemIndexOn

public final boolean hasSystemIndexOn(java.lang.String id)
                               throws java.lang.Exception
Specified by:
hasSystemIndexOn in class BTreePartition<ID>
Throws:
java.lang.Exception

getUserIndex

public final Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getUserIndex(java.lang.String id)
                                                                                                           throws IndexNotFoundException
Specified by:
getUserIndex in class BTreePartition<ID>
Throws:
IndexNotFoundException
See Also:
BTreePartition.getUserIndex(String)

getSystemIndex

public final Index<? extends java.lang.Object,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSystemIndex(java.lang.String id)
                                                                                                             throws IndexNotFoundException
Specified by:
getSystemIndex in class BTreePartition<ID>
Throws:
IndexNotFoundException
See Also:
BTreePartition.getEntryId(String)

getEntryId

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

getEntryDn

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

getParentId

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

getParentId

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

getEntryUpdn

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

Specified by:
getEntryUpdn in class BTreePartition<ID>
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<ID>
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<ID>
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<ID>
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(ID id)
                               throws java.lang.Exception
Specified by:
lookup in class BTreePartition<ID>
Throws:
java.lang.Exception

delete

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

list

public final IndexCursor<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> list(ID id)
                                                                                 throws java.lang.Exception
Specified by:
list in class BTreePartition<ID>
Throws:
java.lang.Exception

getChildCount

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

setProperty

public final void setProperty(java.lang.String propertyName,
                              java.lang.String propertyValue)
                       throws java.lang.Exception
Specified by:
setProperty in class BTreePartition<ID>
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<ID>
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<ID>
Parameters:
modifyContext - The context containing 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 irrelevant.

Specified by:
rename in interface Partition
Specified by:
rename in class BTreePartition<ID>
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<ID>
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<ID>
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.DN 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 final Index<java.lang.String,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getPresenceIndex()
Specified by:
getPresenceIndex in class BTreePartition<ID>

getSubLevelIndex

public final Index<ID,org.apache.directory.shared.ldap.entry.ServerEntry,ID> getSubLevelIndex()
Description copied from class: BTreePartition
Gets the Index mapping the primary keys of ancestors to the primary keys of their descendants.

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

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object


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