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

All Known Implementing Classes:
AvlStore, JdbmStore, LdifStore

public interface Store<E,ID>

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

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

Method Summary
 void add(org.apache.directory.shared.ldap.entry.ServerEntry entry)
          Add an entry into the store.
 void addIndex(Index<?,E,ID> index)
          Adds a user index to the list of index for this store
 int count()
           
 void delete(ID id)
          Delete the entry associated with a given Id
 void destroy()
          Close the parttion : we have to close all the userIndices and the master table.
 Index<java.lang.String,E,ID> getAliasIndex()
           
 int getCacheSize()
           
 int getChildCount(ID id)
           
 ID getDefaultId()
          Gets the default ID.
 Index<java.lang.String,E,ID> getEntryCsnIndex()
           
 java.lang.String getEntryDn(ID id)
           
 ID getEntryId(java.lang.String dn)
           
 java.lang.String getEntryUpdn(ID id)
           
 java.lang.String getEntryUpdn(java.lang.String dn)
           
 Index<java.lang.String,E,ID> getEntryUuidIndex()
           
 Index<?,E,ID> getIndex(java.lang.String id)
          Get the user or system index associated with the given name
 java.lang.String getName()
           
 Index<java.lang.String,E,ID> getNdnIndex()
           
 Index<java.lang.String,E,ID> getObjectClassIndex()
           
 Index<ID,E,ID> getOneAliasIndex()
           
 Index<ID,E,ID> getOneLevelIndex()
           
 ID getParentId(ID childId)
           
 ID getParentId(java.lang.String dn)
          Gets the Long id of an entry's parent using the child entry's normalized dn.
 Index<java.lang.String,E,ID> getPresenceIndex()
           
 java.lang.String getProperty(java.lang.String propertyName)
           
 Index<ID,E,ID> getSubAliasIndex()
           
 Index<ID,E,ID> getSubLevelIndex()
           
 org.apache.directory.shared.ldap.name.DN getSuffix()
           
 java.lang.String getSuffixDn()
           
 Index<?,E,ID> getSystemIndex(java.lang.String id)
          Get the system index associated with the given name
 Index<java.lang.String,E,ID> getUpdnIndex()
           
 org.apache.directory.shared.ldap.name.DN getUpSuffix()
           
 Index<?,E,ID> getUserIndex(java.lang.String id)
          Get the user index associated with the given name
 java.util.Set<Index<?,E,ID>> getUserIndices()
           
 java.io.File getWorkingDirectory()
           
 boolean hasIndexOn(java.lang.String id)
          Tells if an index is already present in the User's or System's index list
 boolean hasSystemIndexOn(java.lang.String id)
          Tells if an index is already present in the System's index list
 boolean hasUserIndexOn(java.lang.String id)
          Tells if an index is already present in the User's index list
 void init(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
          Initialize the JDBM storage system.
 boolean isInitialized()
          Gets whether the store is initialized.
 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.entry.ServerEntry lookup(ID id)
           
 void modify(org.apache.directory.shared.ldap.name.DN dn, java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
           
 void modify(org.apache.directory.shared.ldap.name.DN dn, org.apache.directory.shared.ldap.entry.ModificationOperation modOp, org.apache.directory.shared.ldap.entry.ServerEntry mods)
           
 void move(org.apache.directory.shared.ldap.name.DN oldChildDn, org.apache.directory.shared.ldap.name.DN newParentDn)
           
 void move(org.apache.directory.shared.ldap.name.DN oldChildDn, org.apache.directory.shared.ldap.name.DN newParentDn, org.apache.directory.shared.ldap.name.RDN newRdn, boolean deleteOldRdn)
           
 void rename(org.apache.directory.shared.ldap.name.DN dn, org.apache.directory.shared.ldap.name.RDN newRdn, boolean deleteOldRdn)
          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 setAliasIndex(Index<java.lang.String,E,ID> index)
          Set the Alias index
 void setCacheSize(int cacheSize)
          Sets the cache size for this store
 void setEntryCsnIndex(Index<java.lang.String,E,ID> index)
          Set the EntryCSN index
 void setEntryUuidIndex(Index<java.lang.String,E,ID> index)
          Set the EntryUUID index
 void setName(java.lang.String name)
          Sets the store's name
 void setNdnIndex(Index<java.lang.String,E,ID> index)
          Set the NDN index
 void setObjectClassIndex(Index<java.lang.String,E,ID> index)
          Set the ObjectClass index
 void setOneAliasIndex(Index<ID,E,ID> index)
          Set the OneAlias index
 void setOneLevelIndex(Index<ID,E,ID> index)
          Set the OneLevel index
 void setPresenceIndex(Index<java.lang.String,E,ID> index)
          Set the Presence index
 void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
           
 void setSubAliasIndex(Index<ID,E,ID> index)
          Set the SubAlias index
 void setSubLevelIndex(Index<ID,E,ID> index)
          Set the SubLevel index
 void setSuffixDn(java.lang.String suffixDn)
           
 void setSyncOnWrite(boolean isSyncOnWrite)
          Sets the flag telling the server to flush on disk when some modification has been done.
 void setUpdnIndex(Index<java.lang.String,E,ID> index)
          Set the UpDn index
 void setUserIndices(java.util.Set<Index<?,E,ID>> userIndices)
          Stores the list of user index
 void setWorkingDirectory(java.io.File workingDirectory)
          Sets the working directory for the store
 void sync()
          This method is called when the synch thread is waking up, to write the modified data.
 java.util.Iterator<java.lang.String> systemIndices()
          An iterator build on top of the System's index
 java.util.Iterator<java.lang.String> userIndices()
          An iterator build on top of the User's index
 

Method Detail

setWorkingDirectory

void setWorkingDirectory(java.io.File workingDirectory)
Sets the working directory for the store


getWorkingDirectory

java.io.File getWorkingDirectory()
Returns:
The current working directory for the store

setUserIndices

void setUserIndices(java.util.Set<Index<?,E,ID>> userIndices)
Stores the list of user index

Parameters:
userIndices - The list of user index

getUserIndices

java.util.Set<Index<?,E,ID>> getUserIndices()
Returns:
The list of user index

setSuffixDn

void setSuffixDn(java.lang.String suffixDn)

getSuffixDn

java.lang.String getSuffixDn()

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()
Returns:
The cache size

setName

void setName(java.lang.String name)
Sets the store's name

Parameters:
name - The store's name

getName

java.lang.String getName()
Returns:
The store's name

init

void init(org.apache.directory.shared.ldap.schema.SchemaManager schemaManager)
          throws java.lang.Exception
Initialize the JDBM storage system.

Parameters:
schemaManager - the schema schemaManager
Throws:
java.lang.Exception - on failure to lookup elements in schemaManager
java.lang.Exception - on failure to create database files

destroy

void destroy()
             throws java.lang.Exception
Close the parttion : we have to close all the userIndices and the master table.

Throws:
java.lang.Exception - lazily thrown on any closer failures to avoid leaving open files

isInitialized

boolean isInitialized()
Gets whether the store is initialized.

Returns:
true if the partition store is initialized

sync

void sync()
          throws java.lang.Exception
This method is called when the synch thread is waking up, to write the modified data.

Throws:
java.lang.Exception - on failures to sync database files to disk

addIndex

void addIndex(Index<?,E,ID> index)
              throws java.lang.Exception
Adds a user index to the list of index for this store

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

getPresenceIndex

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

setPresenceIndex

void setPresenceIndex(Index<java.lang.String,E,ID> index)
                      throws java.lang.Exception
Set the Presence index

Parameters:
index - The Presence index
Throws:
java.lang.Exception - If the addition failed

getOneLevelIndex

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

setOneLevelIndex

void setOneLevelIndex(Index<ID,E,ID> index)
                      throws java.lang.Exception
Set the OneLevel index

Parameters:
index - The OneLevel index
Throws:
java.lang.Exception - If the addition failed

getSubLevelIndex

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

setSubLevelIndex

void setSubLevelIndex(Index<ID,E,ID> index)
                      throws java.lang.Exception
Set the SubLevel index

Parameters:
index - The SubLevel index
Throws:
java.lang.Exception - If the addition failed

getAliasIndex

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

setAliasIndex

void setAliasIndex(Index<java.lang.String,E,ID> index)
                   throws java.lang.Exception
Set the Alias index

Parameters:
index - The Alias index
Throws:
java.lang.Exception - If the addition failed

getOneAliasIndex

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

setOneAliasIndex

void setOneAliasIndex(Index<ID,E,ID> index)
                      throws java.lang.Exception
Set the OneAlias index

Parameters:
index - The OneAlias index
Throws:
java.lang.Exception - If the addition failed

getSubAliasIndex

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

setSubAliasIndex

void setSubAliasIndex(Index<ID,E,ID> index)
                      throws java.lang.Exception
Set the SubAlias index

Parameters:
index - The SubAlias index
Throws:
java.lang.Exception - If the addition failed

getUpdnIndex

Index<java.lang.String,E,ID> getUpdnIndex()
Returns:
The UpDN system index

setUpdnIndex

void setUpdnIndex(Index<java.lang.String,E,ID> index)
                  throws java.lang.Exception
Set the UpDn index

Parameters:
index - The UpDn index
Throws:
java.lang.Exception - If the addition failed

getNdnIndex

Index<java.lang.String,E,ID> getNdnIndex()
Returns:
The Ndn system index

setNdnIndex

void setNdnIndex(Index<java.lang.String,E,ID> index)
                 throws java.lang.Exception
Set the NDN index

Parameters:
index - The NDN index
Throws:
java.lang.Exception - If the addition failed

getObjectClassIndex

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

setObjectClassIndex

void setObjectClassIndex(Index<java.lang.String,E,ID> index)
                         throws java.lang.Exception
Set the ObjectClass index

Parameters:
index - The ObjectClass index
Throws:
java.lang.Exception - If the addition failed

getEntryUuidIndex

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

setEntryUuidIndex

void setEntryUuidIndex(Index<java.lang.String,E,ID> index)
                       throws java.lang.Exception
Set the EntryUUID index

Parameters:
index - The EntryUUID index
Throws:
java.lang.Exception - If the addition failed

getEntryCsnIndex

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

setEntryCsnIndex

void setEntryCsnIndex(Index<java.lang.String,E,ID> index)
                      throws java.lang.Exception
Set the EntryCSN index

Parameters:
index - The EntryCSN index
Throws:
java.lang.Exception - If the addition failed

userIndices

java.util.Iterator<java.lang.String> userIndices()
An iterator build on top of the User's index


systemIndices

java.util.Iterator<java.lang.String> systemIndices()
An iterator build on top of the System's index


hasIndexOn

boolean hasIndexOn(java.lang.String id)
                   throws java.lang.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:
java.lang.Exception - If something went wrong

hasUserIndexOn

boolean hasUserIndexOn(java.lang.String id)
                       throws java.lang.Exception
Tells if an index is already present in the User's index list

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

hasSystemIndexOn

boolean hasSystemIndexOn(java.lang.String id)
                         throws java.lang.Exception
Tells if an index is already present in the System's index list

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

getIndex

Index<?,E,ID> getIndex(java.lang.String id)
                       throws IndexNotFoundException
Get the user or system index associated with the given name

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

getUserIndex

Index<?,E,ID> getUserIndex(java.lang.String id)
                           throws IndexNotFoundException
Get the user index associated with the given name

Parameters:
id - 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(java.lang.String id)
                             throws IndexNotFoundException
Get the system index associated with the given name

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

getEntryId

ID getEntryId(java.lang.String dn)
              throws java.lang.Exception
Throws:
java.lang.Exception

getEntryDn

java.lang.String getEntryDn(ID id)
                            throws java.lang.Exception
Throws:
java.lang.Exception

getParentId

ID getParentId(java.lang.String dn)
               throws java.lang.Exception
Gets the Long id of an entry's parent using the child entry's normalized dn. Note that the suffix entry returns 0, which does not map to any entry.

Parameters:
dn - the normalized distinguished name of the child
Returns:
the id of the parent entry or zero if the suffix entry the normalized suffix dn string is used
Throws:
java.lang.Exception - on failures to access the underlying store

getParentId

ID getParentId(ID childId)
               throws java.lang.Exception
Throws:
java.lang.Exception

getEntryUpdn

java.lang.String getEntryUpdn(ID id)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getEntryUpdn

java.lang.String getEntryUpdn(java.lang.String dn)
                              throws java.lang.Exception
Throws:
java.lang.Exception

count

int count()
          throws java.lang.Exception
Throws:
java.lang.Exception

add

void add(org.apache.directory.shared.ldap.entry.ServerEntry entry)
         throws java.lang.Exception
Add an entry into the store.

Parameters:
entry - The entry to add
Throws:
java.lang.Exception - If the addition failed.

lookup

org.apache.directory.shared.ldap.entry.ServerEntry lookup(ID id)
                                                          throws java.lang.Exception
Throws:
java.lang.Exception

delete

void delete(ID id)
            throws java.lang.Exception
Delete the entry associated with a given Id

Parameters:
id - The id of the entry to delete
Throws:
java.lang.Exception - If the deletion failed

list

IndexCursor<ID,E,ID> list(ID id)
                          throws java.lang.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:
java.lang.Exception - on failures to access the underlying store

getChildCount

int getChildCount(ID id)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getSuffix

org.apache.directory.shared.ldap.name.DN getSuffix()

getUpSuffix

org.apache.directory.shared.ldap.name.DN getUpSuffix()

setProperty

void setProperty(java.lang.String propertyName,
                 java.lang.String propertyValue)
                 throws java.lang.Exception
Throws:
java.lang.Exception

getProperty

java.lang.String getProperty(java.lang.String propertyName)
                             throws java.lang.Exception
Throws:
java.lang.Exception

modify

void modify(org.apache.directory.shared.ldap.name.DN dn,
            org.apache.directory.shared.ldap.entry.ModificationOperation modOp,
            org.apache.directory.shared.ldap.entry.ServerEntry mods)
            throws java.lang.Exception
Throws:
java.lang.Exception

modify

void modify(org.apache.directory.shared.ldap.name.DN dn,
            java.util.List<org.apache.directory.shared.ldap.entry.Modification> mods)
            throws java.lang.Exception
Throws:
java.lang.Exception

rename

void rename(org.apache.directory.shared.ldap.name.DN dn,
            org.apache.directory.shared.ldap.name.RDN newRdn,
            boolean deleteOldRdn)
            throws java.lang.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
Throws:
java.lang.Exception - if there are any errors propagating the name changes

move

void move(org.apache.directory.shared.ldap.name.DN oldChildDn,
          org.apache.directory.shared.ldap.name.DN newParentDn,
          org.apache.directory.shared.ldap.name.RDN newRdn,
          boolean deleteOldRdn)
          throws java.lang.Exception
Throws:
java.lang.Exception

move

void move(org.apache.directory.shared.ldap.name.DN oldChildDn,
          org.apache.directory.shared.ldap.name.DN newParentDn)
          throws java.lang.Exception
Throws:
java.lang.Exception

getDefaultId

ID getDefaultId()
                throws java.lang.Exception
Gets the default ID.

Returns:
the default ID.
Throws:
java.lang.Exception


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