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: 499773 $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from interface org.apache.directory.server.core.partition.Partition
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
JdbmPartition()
          Creates a store based on JDBM B+Trees.
 
Method Summary
 void add(org.apache.directory.shared.ldap.name.LdapDN normName, javax.naming.directory.Attributes entry)
          Adds an entry to this ContextPartition.
 void addIndexOn(org.apache.directory.shared.ldap.schema.AttributeType spec, int cacheSize, int numDupLimit)
           
 void bind(org.apache.directory.shared.ldap.name.LdapDN bindDn, byte[] credentials, java.util.List mechanisms, java.lang.String saslAuthId)
          Represents a bind operation issued to authenticate a client.
 int count()
          Gets the count of the total number of entries in the database.
 void delete(java.math.BigInteger id)
           
 void destroy()
          Deinitialized this partition.
 Index 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.math.BigInteger id)
           
 java.lang.String getEntryDn(java.math.BigInteger id)
           
 java.math.BigInteger getEntryId(java.lang.String dn)
           
 java.lang.String getEntryUpdn(java.math.BigInteger id)
          Gets the user provided distinguished name.
 java.lang.String getEntryUpdn(java.lang.String dn)
          Gets the user provided distinguished name.
 Index getExistanceIndex()
           
 Index getHierarchyIndex()
          Gets the Index mapping the BigInteger primary keys of parents to the BigInteger primary keys of their children.
 javax.naming.directory.Attributes getIndices(java.math.BigInteger id)
           
 Index getNdnIndex()
          Gets the Index mapping the normalized distinguished names of entries as Strings to the BigInteger primary keys of entries.
 Index 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.
 java.math.BigInteger getParentId(java.math.BigInteger childId)
           
 java.math.BigInteger getParentId(java.lang.String dn)
           
 java.lang.String getProperty(java.lang.String propertyName)
           
 Index 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.
 org.apache.directory.shared.ldap.name.LdapDN getSuffix()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 javax.naming.directory.Attributes getSuffixEntry()
           
 Index getSystemIndex(java.lang.String id)
           
 java.util.Iterator getSystemIndices()
           
 Index 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 getUpSuffix()
          Gets the distinguished/absolute name of the suffix for all entries stored within this ContextPartition.
 Index getUserIndex(java.lang.String id)
           
 java.util.Iterator getUserIndices()
           
 boolean hasSystemIndexOn(java.lang.String id)
           
 boolean hasUserIndexOn(java.lang.String id)
           
 void init(DirectoryServiceConfiguration factoryCfg, PartitionConfiguration cfg)
          Initializes this partition.
 boolean isInitialized()
          Checks to see if this partition is initialized or not.
 javax.naming.NamingEnumeration list(java.math.BigInteger id)
           
 javax.naming.directory.Attributes lookup(java.math.BigInteger id)
           
 void modify(org.apache.directory.shared.ldap.name.LdapDN dn, int modOp, javax.naming.directory.Attributes mods)
          Modifies an entry by adding, removing or replacing a set of attributes.
 void modify(org.apache.directory.shared.ldap.name.LdapDN dn, org.apache.directory.shared.ldap.message.ModificationItemImpl[] mods)
          Modifies an entry by using a combination of adds, removes or replace operations using a set of ModificationItems.
 void modifyRn(org.apache.directory.shared.ldap.name.LdapDN dn, java.lang.String newRdn, boolean deleteOldRdn)
          Changes the relative distinuished name of an entry specified by a distinguished name with the optional removal of the old Rdn attribute value from the entry.
 void move(org.apache.directory.shared.ldap.name.LdapDN oldChildDn, org.apache.directory.shared.ldap.name.LdapDN newParentDn)
          Transplants a child entry, to a position in the namespace under a new parent entry.
 void move(org.apache.directory.shared.ldap.name.LdapDN oldChildDn, org.apache.directory.shared.ldap.name.LdapDN newParentDn, java.lang.String newRdn, boolean deleteOldRdn)
          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 setAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          Sets the system index defined on the ALIAS_ATTRIBUTE which for LDAP would be the aliasedObjectName and for X.500 would be aliasedEntryName.
 void setExistanceIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          Sets the attribute existance Index.
 void setHierarchyIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          Sets the hierarchy Index.
 void setNdnIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          Sets the normalized distinguished name Index.
 void setOneAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          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 setProperty(java.lang.String propertyName, java.lang.String propertyValue)
           
 void setSubAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          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 setUpdnIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType, int cacheSize, int numDupLimit)
          Sets the user provided distinguished name Index.
 void sync()
          Flushes any changes made to this partition now.
 void unbind(org.apache.directory.shared.ldap.name.LdapDN bindDn)
          Represents an unbind operation issued by an authenticated client.
 
Methods inherited from class org.apache.directory.server.core.partition.impl.btree.BTreePartition
delete, getSearchEngine, hasEntry, inspect, isSuffix, list, lookup, lookup, search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbmPartition

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

Method Detail

init

public void init(DirectoryServiceConfiguration factoryCfg,
                 PartitionConfiguration cfg)
          throws javax.naming.NamingException
Description copied from interface: Partition
Initializes this partition.

Specified by:
init in interface Partition
Overrides:
init in class BTreePartition
Throws:
javax.naming.NamingException

destroy

public void destroy()
Description copied from interface: Partition
Deinitialized this partition.

Specified by:
destroy in interface Partition
Specified by:
destroy in class BTreePartition

isInitialized

public 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

sync

public void sync()
          throws javax.naming.NamingException
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:
javax.naming.NamingException

addIndexOn

public void addIndexOn(org.apache.directory.shared.ldap.schema.AttributeType spec,
                       int cacheSize,
                       int numDupLimit)
                throws javax.naming.NamingException
Specified by:
addIndexOn in class BTreePartition
Throws:
javax.naming.NamingException

getExistanceIndex

public Index getExistanceIndex()
Specified by:
getExistanceIndex in class BTreePartition

setExistanceIndexOn

public void setExistanceIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                                int cacheSize,
                                int numDupLimit)
                         throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the attribute existance Index.

Specified by:
setExistanceIndexOn in class BTreePartition
Parameters:
attrType - the attribute existance Index
Throws:
javax.naming.NamingException

getHierarchyIndex

public Index getHierarchyIndex()
Description copied from class: BTreePartition
Gets the Index mapping the BigInteger primary keys of parents to the BigInteger primary keys of their children.

Specified by:
getHierarchyIndex in class BTreePartition
Returns:
the hierarchy Index

setHierarchyIndexOn

public void setHierarchyIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                                int cacheSize,
                                int numDupLimit)
                         throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the hierarchy Index.

Specified by:
setHierarchyIndexOn in class BTreePartition
Parameters:
attrType - the hierarchy Index
Throws:
javax.naming.NamingException

getAliasIndex

public Index 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 void setAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                            int cacheSize,
                            int numDupLimit)
                     throws javax.naming.NamingException
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:
attrType - the index on the ALIAS_ATTRIBUTE
Throws:
javax.naming.NamingException

getOneAliasIndex

public Index 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 void setOneAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                               int cacheSize,
                               int numDupLimit)
                        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:
attrType - a one level alias index
Throws:
javax.naming.NamingException

getSubAliasIndex

public Index 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 void setSubAliasIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                               int cacheSize,
                               int numDupLimit)
                        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:
attrType - a subtree alias index
Throws:
javax.naming.NamingException

getUpdnIndex

public Index 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 void setUpdnIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                           int cacheSize,
                           int numDupLimit)
                    throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the user provided distinguished name Index.

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

getNdnIndex

public Index 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 void setNdnIndexOn(org.apache.directory.shared.ldap.schema.AttributeType attrType,
                          int cacheSize,
                          int numDupLimit)
                   throws javax.naming.NamingException
Description copied from class: BTreePartition
Sets the normalized distinguished name Index.

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

getUserIndices

public java.util.Iterator getUserIndices()
Specified by:
getUserIndices in class BTreePartition

getSystemIndices

public java.util.Iterator getSystemIndices()
Specified by:
getSystemIndices in class BTreePartition

hasUserIndexOn

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

hasSystemIndexOn

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

getUserIndex

public Index getUserIndex(java.lang.String id)
                   throws IndexNotFoundException
Specified by:
getUserIndex in class BTreePartition
Throws:
IndexNotFoundException
See Also:
BTreePartition.getUserIndex(String)

getSystemIndex

public Index getSystemIndex(java.lang.String id)
                     throws IndexNotFoundException
Specified by:
getSystemIndex in class BTreePartition
Throws:
IndexNotFoundException
See Also:
BTreePartition.getEntryId(String)

getEntryId

public java.math.BigInteger getEntryId(java.lang.String dn)
                                throws javax.naming.NamingException
Specified by:
getEntryId in class BTreePartition
Throws:
javax.naming.NamingException

getEntryDn

public java.lang.String getEntryDn(java.math.BigInteger id)
                            throws javax.naming.NamingException
Specified by:
getEntryDn in class BTreePartition
Throws:
javax.naming.NamingException

getParentId

public java.math.BigInteger getParentId(java.lang.String dn)
                                 throws javax.naming.NamingException
Specified by:
getParentId in class BTreePartition
Throws:
javax.naming.NamingException

getParentId

public java.math.BigInteger getParentId(java.math.BigInteger childId)
                                 throws javax.naming.NamingException
Specified by:
getParentId in class BTreePartition
Throws:
javax.naming.NamingException

getEntryUpdn

public java.lang.String getEntryUpdn(java.math.BigInteger id)
                              throws javax.naming.NamingException
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:
javax.naming.NamingException - if the updn index cannot be accessed

getEntryUpdn

public java.lang.String getEntryUpdn(java.lang.String dn)
                              throws javax.naming.NamingException
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:
javax.naming.NamingException - if the updn and ndn indices cannot be accessed

count

public int count()
          throws javax.naming.NamingException
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:
javax.naming.NamingException - if there is a failure to read the count

add

public void add(org.apache.directory.shared.ldap.name.LdapDN normName,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Description copied from interface: Partition
Adds an entry to this ContextPartition.

Specified by:
add in interface Partition
Specified by:
add in class BTreePartition
entry - the entry to add to this ContextPartition
Throws:
javax.naming.NamingException - if there are any problems

lookup

public javax.naming.directory.Attributes lookup(java.math.BigInteger id)
                                         throws javax.naming.NamingException
Specified by:
lookup in class BTreePartition
Throws:
javax.naming.NamingException

delete

public void delete(java.math.BigInteger id)
            throws javax.naming.NamingException
Specified by:
delete in class BTreePartition
Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration list(java.math.BigInteger id)
                                    throws javax.naming.NamingException
Specified by:
list in class BTreePartition
Throws:
javax.naming.NamingException

getChildCount

public int getChildCount(java.math.BigInteger id)
                  throws javax.naming.NamingException
Specified by:
getChildCount in class BTreePartition
Throws:
javax.naming.NamingException

getSuffix

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

getUpSuffix

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

getSuffixEntry

public javax.naming.directory.Attributes getSuffixEntry()
                                                 throws javax.naming.NamingException
Specified by:
getSuffixEntry in class BTreePartition
Throws:
javax.naming.NamingException

setProperty

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

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
                             throws javax.naming.NamingException
Specified by:
getProperty in class BTreePartition
Throws:
javax.naming.NamingException

getIndices

public javax.naming.directory.Attributes getIndices(java.math.BigInteger id)
                                             throws javax.naming.NamingException
Specified by:
getIndices in class BTreePartition
Throws:
javax.naming.NamingException

modify

public void modify(org.apache.directory.shared.ldap.name.LdapDN dn,
                   int modOp,
                   javax.naming.directory.Attributes mods)
            throws javax.naming.NamingException
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:
dn - the normalized distinguished/absolute name of the entry to modify
modOp - the modification operation to perform on the entry which is one of constants specified by the DirContext interface: ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE.
mods - the attributes and their values used to affect the modification with.
Throws:
javax.naming.NamingException - if there are any problems
See Also:
DirContext, DirContext.ADD_ATTRIBUTE, DirContext.REMOVE_ATTRIBUTE, DirContext.REPLACE_ATTRIBUTE

modify

public void modify(org.apache.directory.shared.ldap.name.LdapDN dn,
                   org.apache.directory.shared.ldap.message.ModificationItemImpl[] mods)
            throws javax.naming.NamingException
Description copied from interface: Partition
Modifies an entry by using a combination of adds, removes or replace operations using a set of ModificationItems.

Specified by:
modify in interface Partition
Specified by:
modify in class BTreePartition
Parameters:
dn - the normalized distinguished/absolute name of the entry to modify
mods - the ModificationItems used to affect the modification with
Throws:
javax.naming.NamingException - if there are any problems
See Also:
ModificationItem

modifyRn

public void modifyRn(org.apache.directory.shared.ldap.name.LdapDN dn,
                     java.lang.String newRdn,
                     boolean deleteOldRdn)
              throws javax.naming.NamingException
Changes the relative distinuished 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:
modifyRn in interface Partition
Specified by:
modifyRn in class BTreePartition
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:
javax.naming.NamingException - 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,
                 java.lang.String newRdn,
                 boolean deleteOldRdn)
          throws javax.naming.NamingException
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:
move in interface Partition
Specified by:
move in class BTreePartition
Parameters:
oldChildDn - the normalized distinguished/absolute name of the original child name representing the child entry to move
newParentDn - the normalized distinguished/absolute name of the new parent to move the targeted entry to
newRdn - the new RN of the entry
deleteOldRdn - boolean flag which removes the old RN attribute from the entry if set to true, and has no affect if set to false
Throws:
javax.naming.NamingException - if there are any problems

move

public void move(org.apache.directory.shared.ldap.name.LdapDN oldChildDn,
                 org.apache.directory.shared.ldap.name.LdapDN newParentDn)
          throws javax.naming.NamingException
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:
oldChildDn - the normalized distinguished/absolute name of the original child name representing the child entry to move
newParentDn - the normalized distinguished/absolute name of the new parent to move the target entry to
Throws:
javax.naming.NamingException - if there are any problems

bind

public void bind(org.apache.directory.shared.ldap.name.LdapDN bindDn,
                 byte[] credentials,
                 java.util.List mechanisms,
                 java.lang.String saslAuthId)
          throws javax.naming.NamingException
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:
bindDn - the normalized dn of the principal
credentials - the credentials of the principal
mechanisms - the mechanisms requested by the JNDI caller or a single mechanism representing the SASL bind mechanism used by a networked client (Strings)
saslAuthId - the SASL authentication (may be null)
Throws:
javax.naming.NamingException - if something goes wrong

unbind

public void unbind(org.apache.directory.shared.ldap.name.LdapDN bindDn)
            throws javax.naming.NamingException
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:
bindDn - the normalized dn of the principal attempting to unbind
Throws:
javax.naming.NamingException - if something goes wrong


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