org.apache.ldap.server.db.jdbm
Class JdbmDatabase

java.lang.Object
  extended byorg.apache.ldap.server.db.jdbm.JdbmDatabase
All Implemented Interfaces:
Database

public class JdbmDatabase
extends java.lang.Object
implements Database

A Database implementation based on JDBM B+Tree implementation.

Version:
$Rev: 164286 $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from interface org.apache.ldap.server.db.Database
ALIAS_ATTRIBUTE, ALIAS_OBJECT
 
Constructor Summary
JdbmDatabase(javax.naming.Name upSuffix, javax.naming.Name normSuffix, java.lang.String wkdirPath)
          Creates a Databased based on JDBM B+Trees.
 
Method Summary
 void add(java.lang.String updn, javax.naming.Name dn, javax.naming.directory.Attributes entry)
          TODO Document me!
 void addIndexOn(org.apache.ldap.common.schema.AttributeType spec)
          TODO Document me!
 void close()
          TODO Document me!
 int count()
          Gets the count of the total number of entries in the database.
 void delete(java.math.BigInteger id)
          TODO Document me!
 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)
          TODO Document me!
 java.lang.String getEntryDn(java.math.BigInteger id)
          TODO Document me!
 java.math.BigInteger getEntryId(java.lang.String dn)
          TODO Document me!
 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()
          Gets the Index mapping the names of attributes as Strings to the BigInteger primary keys of entries containing one or more values of those attributes.
 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)
          TODO Document me!
 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)
          TODO Document me!
 java.math.BigInteger getParentId(java.lang.String dn)
          TODO Document me!
 java.lang.String getProperty(java.lang.String propertyName)
          TODO Document me!
 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.
 javax.naming.Name getSuffix()
           
 javax.naming.directory.Attributes getSuffixEntry()
          TODO Document me!
 Index getSystemIndex(java.lang.String indexName)
          TODO Document me!
 java.util.Iterator getSystemIndices()
          TODO Document me!
 Index getUpdnIndex()
          Gets the Index mapping user provided distinguished names of entries as Strings to the BigInteger primary keys of entries.
 Index getUserIndex(java.lang.String attribute)
          TODO Document me!
 java.util.Iterator getUserIndices()
          TODO Document me!
 boolean hasSystemIndexOn(java.lang.String attribute)
          TODO Document me!
 boolean hasUserIndexOn(java.lang.String attribute)
          TODO Document me!
 boolean isClosed()
          Checks to see if this BackingStore has been closed or shut down.
 javax.naming.NamingEnumeration list(java.math.BigInteger id)
          TODO Document me!
 javax.naming.directory.Attributes lookup(java.math.BigInteger id)
          TODO Document me!
 void modify(javax.naming.Name dn, int modOp, javax.naming.directory.Attributes mods)
          TODO Document me!
 void modify(javax.naming.Name dn, javax.naming.directory.ModificationItem[] mods)
          TODO Document me!
 void modifyRdn(javax.naming.Name 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(javax.naming.Name oldChildDn, javax.naming.Name newParentDn)
          Moves an entry under a new parent.
 void move(javax.naming.Name oldChildDn, javax.naming.Name newParentDn, java.lang.String newRdn, boolean deleteOldRdn)
          Moves a child from one location to another while changing the Rdn attribute used in the new location and optionally deleting the old Rdn attribute value pair.
 void setAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
          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.ldap.common.schema.AttributeType attrType)
          Sets the attribute existance Index.
 void setHierarchyIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
          Sets the hierarchy Index.
 void setNdnIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
          Sets the normalized distinguished name Index.
 void setOneAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
          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)
          TODO Document me!
 void setSubAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
          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.ldap.common.schema.AttributeType attrType)
          Sets the user provided distinguished name Index.
 void sync()
          TODO Document me!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbmDatabase

public JdbmDatabase(javax.naming.Name upSuffix,
                    javax.naming.Name normSuffix,
                    java.lang.String wkdirPath)
             throws javax.naming.NamingException
Creates a Databased based on JDBM B+Trees.

Parameters:
upSuffix - the user provided suffix name
normSuffix - the normalized suffix name
wkdirPath - the path to the working directory where the db resides
Throws:
javax.naming.NamingException - if db cannot be created
Method Detail

addIndexOn

public void addIndexOn(org.apache.ldap.common.schema.AttributeType spec)
                throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
addIndexOn in interface Database
Parameters:
spec - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.addIndexOn(AttributeType)

getExistanceIndex

public Index getExistanceIndex()
Description copied from interface: Database
Gets the Index mapping the names of attributes as Strings to the BigInteger primary keys of entries containing one or more values of those attributes.

Specified by:
getExistanceIndex in interface Database
Returns:
the existance Index
See Also:
Database.getExistanceIndex()

setExistanceIndexOn

public void setExistanceIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                         throws javax.naming.NamingException
Description copied from interface: Database
Sets the attribute existance Index.

Specified by:
setExistanceIndexOn in interface Database
Parameters:
attrType - the attribute existance Index
Throws:
javax.naming.NamingException
See Also:
Database.setExistanceIndexOn(AttributeType)

getHierarchyIndex

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

Specified by:
getHierarchyIndex in interface Database
Returns:
the hierarchy Index
See Also:
Database.getHierarchyIndex()

setHierarchyIndexOn

public void setHierarchyIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                         throws javax.naming.NamingException
Description copied from interface: Database
Sets the hierarchy Index.

Specified by:
setHierarchyIndexOn in interface Database
Parameters:
attrType - the hierarchy Index
Throws:
javax.naming.NamingException
See Also:
Database.setExistanceIndexOn(AttributeType)

getAliasIndex

public Index getAliasIndex()
Description copied from interface: Database
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 interface Database
Returns:
the index on the ALIAS_ATTRIBUTE
See Also:
Database.getAliasIndex()

setAliasIndexOn

public void setAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                     throws javax.naming.NamingException
Description copied from interface: Database
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 interface Database
Parameters:
attrType - the index on the ALIAS_ATTRIBUTE
Throws:
javax.naming.NamingException
See Also:
Database.setAliasIndexOn(AttributeType)

getOneAliasIndex

public Index getOneAliasIndex()
Description copied from interface: Database
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 interface Database
Returns:
the one alias index
See Also:
Database.getOneAliasIndex()

setOneAliasIndexOn

public void setOneAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                        throws javax.naming.NamingException
Description copied from interface: Database
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 interface Database
Parameters:
attrType - a one level alias index
Throws:
javax.naming.NamingException
See Also:
Database.setOneAliasIndexOn(AttributeType)

getSubAliasIndex

public Index getSubAliasIndex()
Description copied from interface: Database
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 interface Database
Returns:
the sub alias index
See Also:
Database.getSubAliasIndex()

setSubAliasIndexOn

public void setSubAliasIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                        throws javax.naming.NamingException
Description copied from interface: Database
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 interface Database
Parameters:
attrType - a subtree alias index
Throws:
javax.naming.NamingException
See Also:
Database.setSubAliasIndexOn(AttributeType)

getUpdnIndex

public Index getUpdnIndex()
Description copied from interface: Database
Gets the Index mapping user provided distinguished names of entries as Strings to the BigInteger primary keys of entries.

Specified by:
getUpdnIndex in interface Database
Returns:
the user provided distinguished name Index
See Also:
Database.getUpdnIndex()

setUpdnIndexOn

public void setUpdnIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                    throws javax.naming.NamingException
Description copied from interface: Database
Sets the user provided distinguished name Index.

Specified by:
setUpdnIndexOn in interface Database
Parameters:
attrType - the updn Index
Throws:
javax.naming.NamingException
See Also:
Database.setUpdnIndexOn(AttributeType)

getNdnIndex

public Index getNdnIndex()
Description copied from interface: Database
Gets the Index mapping the normalized distinguished names of entries as Strings to the BigInteger primary keys of entries.

Specified by:
getNdnIndex in interface Database
Returns:
the normalized distinguished name Index
See Also:
Database.getNdnIndex()

setNdnIndexOn

public void setNdnIndexOn(org.apache.ldap.common.schema.AttributeType attrType)
                   throws javax.naming.NamingException
Description copied from interface: Database
Sets the normalized distinguished name Index.

Specified by:
setNdnIndexOn in interface Database
Parameters:
attrType - the ndn Index
Throws:
javax.naming.NamingException
See Also:
Database.setNdnIndexOn(AttributeType)

getUserIndices

public java.util.Iterator getUserIndices()
Description copied from interface: Database
TODO Document me!

Specified by:
getUserIndices in interface Database
Returns:
TODO
See Also:
Database.getUserIndices()

getSystemIndices

public java.util.Iterator getSystemIndices()
Description copied from interface: Database
TODO Document me!

Specified by:
getSystemIndices in interface Database
Returns:
TODO
See Also:
Database.getSystemIndices()

hasUserIndexOn

public boolean hasUserIndexOn(java.lang.String attribute)
Description copied from interface: Database
TODO Document me!

Specified by:
hasUserIndexOn in interface Database
Parameters:
attribute - TODO
Returns:
TODO
See Also:
Database.hasUserIndexOn(String)

hasSystemIndexOn

public boolean hasSystemIndexOn(java.lang.String attribute)
Description copied from interface: Database
TODO Document me!

Specified by:
hasSystemIndexOn in interface Database
Parameters:
attribute - TODO
Returns:
TODO
See Also:
Database.hasSystemIndexOn(String)

getUserIndex

public Index getUserIndex(java.lang.String attribute)
                   throws IndexNotFoundException
Description copied from interface: Database
TODO Document me!

Specified by:
getUserIndex in interface Database
Parameters:
attribute - TODO
Returns:
TODO
Throws:
IndexNotFoundException - TODO
See Also:
Database.getUserIndex(String)

getSystemIndex

public Index getSystemIndex(java.lang.String indexName)
                     throws IndexNotFoundException
Description copied from interface: Database
TODO Document me!

Specified by:
getSystemIndex in interface Database
Parameters:
indexName - TODO
Returns:
TODO
Throws:
IndexNotFoundException - TODO
See Also:
Database.getEntryId(String)

getEntryId

public java.math.BigInteger getEntryId(java.lang.String dn)
                                throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getEntryId in interface Database
Parameters:
dn - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getEntryId(String)

getEntryDn

public java.lang.String getEntryDn(java.math.BigInteger id)
                            throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getEntryDn in interface Database
Parameters:
id - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getEntryDn(java.math.BigInteger)

getParentId

public java.math.BigInteger getParentId(java.lang.String dn)
                                 throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getParentId in interface Database
Parameters:
dn - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getParentId(String)

getParentId

public java.math.BigInteger getParentId(java.math.BigInteger childId)
                                 throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getParentId in interface Database
Parameters:
childId - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getParentId(BigInteger)

getEntryUpdn

public java.lang.String getEntryUpdn(java.math.BigInteger id)
                              throws javax.naming.NamingException
Description copied from interface: Database
Gets the user provided distinguished name.

Specified by:
getEntryUpdn in interface Database
Parameters:
id - the entry id
Returns:
the user provided distinguished name
Throws:
javax.naming.NamingException - if the updn index cannot be accessed
See Also:
Database.getEntryUpdn(BigInteger)

getEntryUpdn

public java.lang.String getEntryUpdn(java.lang.String dn)
                              throws javax.naming.NamingException
Description copied from interface: Database
Gets the user provided distinguished name.

Specified by:
getEntryUpdn in interface Database
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
See Also:
Database.getEntryUpdn(String)

count

public int count()
          throws javax.naming.NamingException
Description copied from interface: Database
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 interface Database
Returns:
the number of entries in the database
Throws:
javax.naming.NamingException - if there is a failure to read the count
See Also:
Database.count()

add

public void add(java.lang.String updn,
                javax.naming.Name dn,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
add in interface Database
Parameters:
updn - the user provided distinguished name of the entry
dn - TODO
entry - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.add(String,Name,Attributes)

lookup

public javax.naming.directory.Attributes lookup(java.math.BigInteger id)
                                         throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
lookup in interface Database
Parameters:
id - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.lookup(BigInteger)

delete

public void delete(java.math.BigInteger id)
            throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
delete in interface Database
Parameters:
id - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.delete(BigInteger)

list

public javax.naming.NamingEnumeration list(java.math.BigInteger id)
                                    throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
list in interface Database
Parameters:
id - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.list(java.math.BigInteger)

getChildCount

public int getChildCount(java.math.BigInteger id)
                  throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getChildCount in interface Database
Parameters:
id - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getChildCount(java.math.BigInteger)

getSuffix

public javax.naming.Name getSuffix()
Specified by:
getSuffix in interface Database
Returns:
TODO
See Also:
Database.getSuffix()

getSuffixEntry

public javax.naming.directory.Attributes getSuffixEntry()
                                                 throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getSuffixEntry in interface Database
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getSuffixEntry()

sync

public void sync()
          throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
sync in interface Database
Throws:
javax.naming.NamingException - TODO
See Also:
Database.sync()

close

public void close()
           throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
close in interface Database
Throws:
javax.naming.NamingException - TODO
See Also:
Database.close()

isClosed

public boolean isClosed()
Description copied from interface: Database
Checks to see if this BackingStore has been closed or shut down. Operations against closed BackingStores will fail.

Specified by:
isClosed in interface Database
Returns:
true if shut down, false otherwise
See Also:
Database.isClosed()

setProperty

public void setProperty(java.lang.String propertyName,
                        java.lang.String propertyValue)
                 throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
setProperty in interface Database
Parameters:
propertyName - TODO
propertyValue - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.setProperty(String, String)

getProperty

public java.lang.String getProperty(java.lang.String propertyName)
                             throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getProperty in interface Database
Parameters:
propertyName - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getProperty(String)

getIndices

public javax.naming.directory.Attributes getIndices(java.math.BigInteger id)
                                             throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
getIndices in interface Database
Parameters:
id - TODO
Returns:
TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.getIndices(java.math.BigInteger)

modify

public void modify(javax.naming.Name dn,
                   int modOp,
                   javax.naming.directory.Attributes mods)
            throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
modify in interface Database
Parameters:
dn - TODO
modOp - TODO
mods - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.modify(javax.naming.Name, int, javax.naming.directory.Attributes)

modify

public void modify(javax.naming.Name dn,
                   javax.naming.directory.ModificationItem[] mods)
            throws javax.naming.NamingException
Description copied from interface: Database
TODO Document me!

Specified by:
modify in interface Database
Parameters:
dn - TODO
mods - TODO
Throws:
javax.naming.NamingException - TODO
See Also:
Database.modify(javax.naming.Name, javax.naming.directory.ModificationItem[])

modifyRdn

public void modifyRdn(javax.naming.Name 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:
modifyRdn in interface Database
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.
See Also:
Database.modifyRdn(javax.naming.Name, String, boolean)

move

public void move(javax.naming.Name oldChildDn,
                 javax.naming.Name newParentDn,
                 java.lang.String newRdn,
                 boolean deleteOldRdn)
          throws javax.naming.NamingException
Description copied from interface: Database
Moves a child from one location to another while changing the Rdn attribute used in the new location and optionally deleting the old Rdn attribute value pair.

Specified by:
move in interface Database
Parameters:
oldChildDn - the normalized child dn to move
newParentDn - the normalized new parent dn to move the child to
newRdn - the new rdn of the child at its new location
deleteOldRdn - switch to remove the old rdn attribute/value pair
Throws:
javax.naming.NamingException - if a database failure results
See Also:
Database.move(javax.naming.Name, javax.naming.Name, String, boolean)

move

public void move(javax.naming.Name oldChildDn,
                 javax.naming.Name newParentDn)
          throws javax.naming.NamingException
Moves an entry under a new parent. The operation causes a shift in the parent child relationships between the old parent, new parent and the child moved. All other descendant entries under the child never change their direct parent child relationships. Hence after the parent child relationship changes are broken at the old parent and set at the new parent a modifyDn operation is conducted to handle name changes propagating down through the moved child and its descendants.

Specified by:
move in interface Database
Parameters:
oldChildDn - the normalized dn of the child to be moved
newParentDn - the normalized dn of the new parent for the child
Throws:
javax.naming.NamingException - if something goes wrong
See Also:
Database.move(javax.naming.Name, javax.naming.Name)


Copyright © 2002-2005 . All Rights Reserved.