org.apache.directory.server.xdbm
Interface Store<E,ID extends Comparable<ID>>

All Known Implementing Classes:
AbstractBTreePartition, AvlPartition

public interface Store<E,ID extends Comparable<ID>>

Represents an entry store based on the Table, Index, and MasterTable database structure.

Author:
Apache Directory Project

Field Summary
static String[] SYS_INDEX_OID_ARRAY
           
static Set<String> SYS_INDEX_OIDS
           
 
Method Summary
 void addIndex(Index<?,E,ID> index)
          Adds a (system or user) index to the list of index for this store.
 int count()
          Gets the total count of entries within this store.
 void delete(ID id)
          Delete an entry from the store
 Index<String,E,ID> getAliasIndex()
           
 int getCacheSize()
          Gets the cache size for this store.
 int getChildCount(ID id)
          Gets the count of immediate children of the given entry ID.
 ID getDefaultId()
          Gets the default ID.
 Index<String,E,ID> getEntryCsnIndex()
           
 org.apache.directory.shared.ldap.model.name.Dn getEntryDn(ID id)
          Gets the Entry's Dn identified by the given id.
 ID getEntryId(org.apache.directory.shared.ldap.model.name.Dn dn)
          Gets the entry's id.
 Index<String,E,ID> getEntryUuidIndex()
           
 Index<?,E,ID> getIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Get the user or system index associated with the given attributeType
 Index<String,E,ID> getObjectClassIndex()
           
 Index<ID,E,ID> getOneAliasIndex()
           
 Index<ID,E,ID> getOneLevelIndex()
           
 ID getParentId(ID childId)
          Gets the ID of an entry's parent using the child entry's ID.
 URI getPartitionPath()
          Gets the partition path (working directory) for the store.
 Index<String,E,ID> getPresenceIndex()
           
 Index<ParentIdAndRdn<ID>,E,ID> getRdnIndex()
           
 ID getRootId()
          Gets the root ID of this store implementation.
 Index<ID,E,ID> getSubAliasIndex()
           
 Index<ID,E,ID> getSubLevelIndex()
           
 Index<?,E,ID> getSystemIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Get the system index associated with the given name
 Iterator<String> getSystemIndices()
          An iterator build on top of the System's index
 Index<?,E,ID> getUserIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Get the user index associated with the given name
 Iterator<String> getUserIndices()
          An iterator build on top of the User's index
 boolean hasIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Tells if an index is already present in the User's or System's index list
 boolean hasSystemIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Tells if an index is already present in the System's index list
 boolean hasUserIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
          Tells if an index is already present in the User's index list
 boolean isSyncOnWrite()
           
 IndexCursor<ID,E,ID> list(ID id)
          Gets an IndexEntry Cursor over the child nodes of an entry.
 org.apache.directory.shared.ldap.model.entry.Entry lookup(ID id)
          Get back an entry knowing its ID
 org.apache.directory.shared.ldap.model.entry.Entry modify(org.apache.directory.shared.ldap.model.name.Dn dn, org.apache.directory.shared.ldap.model.entry.Modification... mods)
          Modify an entry applying the given list of modifications.
 void move(org.apache.directory.shared.ldap.model.name.Dn oldDn, org.apache.directory.shared.ldap.model.name.Dn newSuperior, org.apache.directory.shared.ldap.model.name.Dn newDn, org.apache.directory.shared.ldap.model.entry.Entry entry)
          Move an entry from one place to the other.
 void moveAndRename(org.apache.directory.shared.ldap.model.name.Dn oldChildDn, org.apache.directory.shared.ldap.model.name.Dn newParentDn, org.apache.directory.shared.ldap.model.name.Rdn newRdn, org.apache.directory.shared.ldap.model.entry.Entry entry, boolean deleteOldRdn)
           
 void rename(org.apache.directory.shared.ldap.model.name.Dn dn, org.apache.directory.shared.ldap.model.name.Rdn newRdn, boolean deleteOldRdn, org.apache.directory.shared.ldap.model.entry.Entry entry)
          Changes the relative distinguished name of an entry specified by a distinguished name with the optional removal of the old Rdn attribute value from the entry.
 void setCacheSize(int cacheSize)
          Sets the cache size for this store.
 void setPartitionPath(URI partitionPath)
          Sets the partition path (working directory) for the store.
 void setSyncOnWrite(boolean isSyncOnWrite)
          Sets the flag telling the server to flush on disk when some modification has been done.
 

Field Detail

SYS_INDEX_OID_ARRAY

static final String[] SYS_INDEX_OID_ARRAY

SYS_INDEX_OIDS

static final Set<String> SYS_INDEX_OIDS
Method Detail

setPartitionPath

void setPartitionPath(URI partitionPath)
Sets the partition path (working directory) for the store.

Parameters:
partitionDir - the new partition path

getPartitionPath

URI getPartitionPath()
Gets the partition path (working directory) for the store.

Returns:
The current partition path (working directory) for the store

getRootId

ID getRootId()
Gets the root ID of this store implementation.

Returns:
the root ID

setSyncOnWrite

void setSyncOnWrite(boolean isSyncOnWrite)
Sets the flag telling the server to flush on disk when some modification has been done.

Parameters:
isSyncOnWrite - A boolean set to true if we have to flush on disk when a modification occurs

isSyncOnWrite

boolean isSyncOnWrite()
Returns:
true if we write to disk for every modification

setCacheSize

void setCacheSize(int cacheSize)
Sets the cache size for this store.

Parameters:
cacheSize - The cache size

getCacheSize

int getCacheSize()
Gets the cache size for this store.

Returns:
The cache size

addIndex

void addIndex(Index<?,E,ID> index)
              throws Exception
Adds a (system or user) index to the list of index for this store. Note that the attribute id returned by Index.getAttributeId() must be the numeric OID.

Parameters:
index - The index to add
Throws:
Exception - If the addition failed

getPresenceIndex

Index<String,E,ID> getPresenceIndex()
Returns:
The Presence system index

getOneLevelIndex

Index<ID,E,ID> getOneLevelIndex()
Returns:
The OneLevel system index

getSubLevelIndex

Index<ID,E,ID> getSubLevelIndex()
Returns:
The SubLevel system index

getAliasIndex

Index<String,E,ID> getAliasIndex()
Returns:
The Alias system index

getOneAliasIndex

Index<ID,E,ID> getOneAliasIndex()
Returns:
The OneAlias system index

getSubAliasIndex

Index<ID,E,ID> getSubAliasIndex()
Returns:
The SubAlias system index

getRdnIndex

Index<ParentIdAndRdn<ID>,E,ID> getRdnIndex()
Returns:
The Rdn system index

getObjectClassIndex

Index<String,E,ID> getObjectClassIndex()
Returns:
The ObjectClass system index

getEntryUuidIndex

Index<String,E,ID> getEntryUuidIndex()
Returns:
The EntryUUID system index

getEntryCsnIndex

Index<String,E,ID> getEntryCsnIndex()
Returns:
The EntryCSN system index

getUserIndices

Iterator<String> getUserIndices()
An iterator build on top of the User's index


getSystemIndices

Iterator<String> getSystemIndices()
An iterator build on top of the System's index


hasIndexOn

boolean hasIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                   throws Exception
Tells if an index is already present in the User's or System's index list

Parameters:
id - The index we are looking for
Returns:
true if the index is already present in the User's or System's index list
Throws:
Exception - If something went wrong

hasUserIndexOn

boolean hasUserIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                       throws Exception
Tells if an index is already present in the User's index list

Parameters:
attributeType - The attributeType index we are looking for
Returns:
true if the index is already present in the User's index list
Throws:
Exception - If something went wrong

hasSystemIndexOn

boolean hasSystemIndexOn(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                         throws Exception
Tells if an index is already present in the System's index list

Parameters:
attributeType - The index we are looking for
Returns:
true if the index is already present in the System's index list
Throws:
Exception - If something went wrong

getIndex

Index<?,E,ID> getIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                                              throws IndexNotFoundException
Get the user or system index associated with the given attributeType

Parameters:
attributeType - The index attributeType we are looking for
Returns:
The associated user or system index
Throws:
IndexNotFoundException - If the index does not exist

getUserIndex

Index<?,E,ID> getUserIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                                                  throws IndexNotFoundException
Get the user index associated with the given name

Parameters:
attributeType - The index name we are looking for
Returns:
The associated user index
Throws:
IndexNotFoundException - If the index does not exist

getSystemIndex

Index<?,E,ID> getSystemIndex(org.apache.directory.shared.ldap.model.schema.AttributeType attributeType)
                                                    throws IndexNotFoundException
Get the system index associated with the given name

Parameters:
attributeType - The index name we are looking for
Returns:
The associated system index
Throws:
IndexNotFoundException - If the index does not exist

getEntryId

ID getEntryId(org.apache.directory.shared.ldap.model.name.Dn dn)
                                     throws Exception
Gets the entry's id. Returns null if the Dn doesn't exist in this store. Note that the Dn must be normalized!

Parameters:
dn - the normalized entry Dn
Returns:
the entry's id, or null if the Dn doesn't exists
Throws:
Exception

getEntryDn

org.apache.directory.shared.ldap.model.name.Dn getEntryDn(ID id)
                                                          throws Exception
Gets the Entry's Dn identified by the given id.

Parameters:
id - the entry's id
Returns:
the entry's Dn
Throws:
Exception

getParentId

ID getParentId(ID childId)
                                      throws Exception
Gets the ID of an entry's parent using the child entry's ID. Note that the suffix entry returns 0, which does not map to any entry.

Parameters:
childId - the ID of the entry
Returns:
the id of the parent entry or zero if the suffix entry ID is used
Throws:
Exception - on failures to access the underlying store

count

int count()
          throws Exception
Gets the total count of entries within this store.

Returns:
the total count of entries within this store
Throws:
Exception - on failures to access the underlying store

delete

void delete(ID id)
            throws Exception
Delete an entry from the store

Parameters:
id - The Entry ID we want to delete
Throws:
Exception - If the deletion failed for any reason

list

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

Parameters:
id - the id of the parent entry
Returns:
an IndexEntry Cursor over the child entries
Throws:
Exception - on failures to access the underlying store

lookup

org.apache.directory.shared.ldap.model.entry.Entry lookup(ID id)
                                                          throws Exception
Get back an entry knowing its ID

Parameters:
id - The Entry ID we want to get back
Returns:
The found Entry, or null if not found
Throws:
Exception - If the lookup failed for any reason (except a not found entry)

getChildCount

int getChildCount(ID id)
                  throws Exception
Gets the count of immediate children of the given entry ID.

Parameters:
id - the entry ID
Returns:
the child count
Throws:
Exception - on failures to access the underlying store

modify

org.apache.directory.shared.ldap.model.entry.Entry modify(org.apache.directory.shared.ldap.model.name.Dn dn,
                                                          org.apache.directory.shared.ldap.model.entry.Modification... mods)
                                                          throws Exception
Modify an entry applying the given list of modifications.

Parameters:
dn - The Entry's Dn
mods - The list of modifications
Returns:
The modified entry
Throws:
Exception - If the modification failed

rename

void rename(org.apache.directory.shared.ldap.model.name.Dn dn,
            org.apache.directory.shared.ldap.model.name.Rdn newRdn,
            boolean deleteOldRdn,
            org.apache.directory.shared.ldap.model.entry.Entry entry)
            throws Exception
Changes the relative distinguished name of an entry specified by a distinguished name with the optional removal of the old Rdn attribute value from the entry. Name changes propagate down as dn changes to the descendants of the entry where the Rdn changed. An Rdn change operation does not change parent child relationships. It merely propagates a name change at a point in the DIT where the Rdn is changed. The change propagates down the subtree rooted at the distinguished name specified.

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
entry - the modified entry
Throws:
Exception - if there are any errors propagating the name changes

moveAndRename

void moveAndRename(org.apache.directory.shared.ldap.model.name.Dn oldChildDn,
                   org.apache.directory.shared.ldap.model.name.Dn newParentDn,
                   org.apache.directory.shared.ldap.model.name.Rdn newRdn,
                   org.apache.directory.shared.ldap.model.entry.Entry entry,
                   boolean deleteOldRdn)
                   throws Exception
Throws:
Exception

move

void move(org.apache.directory.shared.ldap.model.name.Dn oldDn,
          org.apache.directory.shared.ldap.model.name.Dn newSuperior,
          org.apache.directory.shared.ldap.model.name.Dn newDn,
          org.apache.directory.shared.ldap.model.entry.Entry entry)
          throws Exception

Move an entry from one place to the other. The Rdn remains unchanged, the parent Dn changes

We have to update some of the index when moving an entry. Assuming that the target destination does not exist, the following index must be updated :

If the moved entry is an alias, then we also have to update the following index :

The Alias index is not updated, as the entry ID won't change.

We have a few check we must do before moving the entry :

Parameters:
oldDn - The previous entry Dn
newSuperior - The new superior Dn
newDn - The new Dn
entry - The entry to move
Throws:
Exception - If the move failed

getDefaultId

ID getDefaultId()
                                       throws Exception
Gets the default ID.

Returns:
the default ID.
Throws:
Exception


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.