public abstract class AbstractBTreePartition extends AbstractPartition implements Store
Partition that uses general BTree operations.| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
ADD_CHILD |
protected org.apache.directory.api.ldap.model.schema.AttributeType |
administrativeRoleAT |
protected Index<java.lang.String,java.lang.String> |
adminRoleIdx
a system index on administrativeRole attribute
|
protected net.sf.ehcache.Cache |
aliasCache
The alias cache
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
aliasedObjectNameAT |
protected Index<org.apache.directory.api.ldap.model.name.Dn,java.lang.String> |
aliasIdx
a system index on aliasedObjectName attribute
|
protected int |
cacheSize
The Entry cache size for this partition
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
contextCsnAT |
private java.util.concurrent.Semaphore |
ctxCsnSemaphore
a semaphore to serialize the writes on context entry while updating contextCSN attribute
|
static int |
DEFAULT_CACHE_SIZE
The default cache size is set to 10 000 objects
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
entryCsnAT |
protected Index<java.lang.String,java.lang.String> |
entryCsnIdx
a system index on entryCSN attribute
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
entryDnAT |
private net.sf.ehcache.Cache |
entryDnCache
a cache to hold
|
protected org.apache.directory.api.ldap.model.schema.AttributeType |
entryUuidAT |
private java.util.Set<Index<?,java.lang.String>> |
indexedAttributes
The set of indexed attributes
|
protected java.util.concurrent.atomic.AtomicBoolean |
isSyncOnWrite
true if we sync disks on every write operation
|
private static org.slf4j.Logger |
LOG
static logger
|
protected MasterTable |
master
the master table storing entries by primary key
|
private static boolean |
NO_REVERSE |
protected org.apache.directory.api.ldap.model.schema.AttributeType |
objectClassAT
Cached attributes types to avoid lookup all over the code
|
protected Index<java.lang.String,java.lang.String> |
objectClassIdx
a system index on objectClass attribute
|
protected Index<java.lang.String,java.lang.String> |
oneAliasIdx
the one level scope alias index
|
private Optimizer |
optimizer
The optimizer to use during search operation
|
protected boolean |
optimizerEnabled
Tells if the Optimizer is enabled
|
protected java.net.URI |
partitionPath
The path in which this Partition stores files
|
protected net.sf.ehcache.Cache |
piarCache
The ParentIdAndRdn cache
|
protected Index<java.lang.String,java.lang.String> |
presenceIdx
the attribute presence index
|
protected Index<ParentIdAndRdn,java.lang.String> |
rdnIdx
the relative distinguished name index
|
protected static boolean |
REMOVE_CHILD |
private java.util.concurrent.locks.ReadWriteLock |
rwLock
A lock to protect the backend from concurrent reads/writes
|
private SearchEngine |
searchEngine
the search engine used to search the database
|
protected Index<java.lang.String,java.lang.String> |
subAliasIdx
the subtree scope alias index
|
private java.lang.String |
suffixId
The suffix UUID
|
protected java.util.Map<java.lang.String,Index<?,java.lang.String>> |
systemIndices
a map of attributeType numeric UUID to system userIndices
|
protected java.util.Map<java.lang.String,Index<?,java.lang.String>> |
userIndices
a map of attributeType numeric UUID to user userIndices
|
private static boolean |
WITH_REVERSE |
cacheService, contextEntry, ctxCsnChanged, dnFactory, id, initialized, schemaManager, suffixDnSYS_INDEX_OID_ARRAY, SYS_INDEX_OIDSDEFAULT_ID, ROOT_ID| Modifier | Constructor and Description |
|---|---|
protected |
AbstractBTreePartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
Creates a B-tree based context partition.
|
protected |
AbstractBTreePartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
DnFactory dnFactory)
Creates a B-tree based context partition.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AddOperationContext addContext)
Adds an entry to this ContextPartition.
|
protected void |
addAliasIndices(java.lang.String aliasId,
org.apache.directory.api.ldap.model.name.Dn aliasDn,
org.apache.directory.api.ldap.model.name.Dn aliasTarget)
Adds userIndices for an aliasEntry to be added to the database while checking
for constrained alias constructs like alias cycles and chaining.
|
void |
addIndex(Index<?,java.lang.String> index)
Adds a (system or user) index to the list of index for this store.
|
void |
addIndexedAttributes(Index<?,java.lang.String>... indexes)
Add some new indexes
|
void |
addToCache(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry)
adds the given entry to cache
Note: this method is not called during add operation to avoid filling the cache
with all the added entries
|
protected org.apache.directory.api.ldap.model.name.Dn |
buildEntryDn(java.lang.String id)
builds the Dn of the entry identified by the given id
|
protected abstract Index<?,java.lang.String> |
convertAndInit(Index<?,java.lang.String> index)
Convert and initialize an index for a specific store implementation.
|
long |
count()
Gets the total count of entries within this store.
|
protected abstract Index |
createSystemIndex(java.lang.String indexOid,
java.net.URI path,
boolean withReverse)
Create a new Index for a given OID
|
org.apache.directory.api.ldap.model.entry.Entry |
delete(DeleteOperationContext deleteContext)
Deletes a leaf entry from this ContextPartition: non-leaf entries cannot be
deleted until this operation has been applied to their children.
|
org.apache.directory.api.ldap.model.entry.Entry |
delete(java.lang.String id)
Delete the entry associated with a given Id
|
protected void |
doDestroy()
Override this method to put your initialization code.
|
protected void |
doInit()
Override this method to put your initialization code.
|
protected void |
dropAliasIndices(java.lang.String aliasId)
Removes the index entries for an alias before the entry is deleted from
the master table.
|
protected void |
dropMovedAliasIndices(org.apache.directory.api.ldap.model.name.Dn movedBase)
For all aliases including and under the moved base, this method removes
one and subtree alias index tuples for old ancestors above the moved base
that will no longer be ancestors after the move.
|
private void |
dumpAllRdnIdx() |
private void |
dumpIndex(java.io.OutputStream stream,
Index<?,java.lang.String> index) |
void |
dumpIndex(java.io.OutputStream stream,
java.lang.String name)
Dump the requested index to a given stream
|
private void |
dumpRdnIdx() |
private void |
dumpRdnIdx(java.lang.String id,
int nbSibbling,
java.lang.String tabs) |
void |
dumpRdnIdx(java.lang.String id,
java.lang.String tabs) |
org.apache.directory.api.ldap.model.entry.Entry |
fetch(java.lang.String id)
Get back an entry knowing its UUID
|
org.apache.directory.api.ldap.model.entry.Entry |
fetch(java.lang.String id,
org.apache.directory.api.ldap.model.name.Dn dn)
Get back an entry knowing its UUID
|
Index<java.lang.String,java.lang.String> |
getAdministrativeRoleIndex() |
net.sf.ehcache.Cache |
getAliasCache() |
Index<org.apache.directory.api.ldap.model.name.Dn,java.lang.String> |
getAliasIndex() |
int |
getCacheSize()
Gets the entry cache size for this BTreePartition.
|
long |
getChildCount(java.lang.String id)
Gets the count of immediate children of the given entry UUID.
|
java.lang.String |
getContextCsn() |
Index<java.lang.String,java.lang.String> |
getEntryCsnIndex() |
org.apache.directory.api.ldap.model.name.Dn |
getEntryDn(java.lang.String id)
Gets the Entry's Dn identified by the given id.
|
java.lang.String |
getEntryId(org.apache.directory.api.ldap.model.name.Dn dn)
Gets the entry's id.
|
Index<?,java.lang.String> |
getIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
Get the user or system index associated with the given attributeType
|
java.util.Set<Index<?,java.lang.String>> |
getIndexedAttributes() |
MasterTable |
getMasterTable()
Expose the Master table
|
Index<java.lang.String,java.lang.String> |
getObjectClassIndex() |
Index<java.lang.String,java.lang.String> |
getOneAliasIndex() |
Optimizer |
getOptimizer() |
java.lang.String |
getParentId(java.lang.String childId)
Gets the UUID of an entry's parent using the child entry's UUID.
|
java.net.URI |
getPartitionPath()
Gets the path in which this Partition stores data.
|
Index<java.lang.String,java.lang.String> |
getPresenceIndex() |
Index<ParentIdAndRdn,java.lang.String> |
getRdnIndex() |
java.util.concurrent.locks.ReadWriteLock |
getReadWriteLock() |
SearchEngine |
getSearchEngine()
Gets the DefaultSearchEngine used by this ContextPartition to search the
Database.
|
Index<java.lang.String,java.lang.String> |
getSubAliasIndex() |
protected java.lang.String |
getSuffixId()
Retrieve the SuffixID
|
Index<?,java.lang.String> |
getSystemIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
Get the system index associated with the given name
|
java.util.Iterator<java.lang.String> |
getSystemIndices()
An iterator build on top of the System's index
|
Index<?,java.lang.String> |
getUserIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
Get the user index associated with the given name
|
java.util.Iterator<java.lang.String> |
getUserIndices()
An iterator build on top of the User's index
|
boolean |
hasEntry(HasEntryOperationContext entryContext)
This method calls
Partition.lookup(LookupOperationContext) and return true
if it returns an entry by default. |
boolean |
hasIndexOn(org.apache.directory.api.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.api.ldap.model.schema.AttributeType attributeType)
Tells if an index is already present in the System's index list
|
boolean |
hasUserIndexOn(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
Tells if an index is already present in the User's index list
|
private void |
initInstance()
Intializes the instance.
|
boolean |
isOptimizerEnabled()
Tells if the Optimizer is enabled or not
|
boolean |
isSyncOnWrite() |
protected void |
loadContextCsn()
Loads the current context CSN present in the context entry of the partition
|
private void |
lockRead()
Acquire a Read lock
|
private void |
lockWrite()
Acquire a Write lock
|
org.apache.directory.api.ldap.model.entry.Entry |
lookup(LookupOperationContext lookupContext)
Looks up an entry by distinguished/absolute name.
|
org.apache.directory.api.ldap.model.entry.Entry |
lookupCache(java.lang.String id)
looks up for the entry with the given ID in the cache
|
org.apache.directory.api.ldap.model.entry.Entry |
modify(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Modification... mods)
Modify an entry applying the given list of modifications.
|
void |
modify(ModifyOperationContext modifyContext)
Modifies an entry by adding, removing or replacing a set of attributes.
|
private void |
modifyAdd(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
Adds a set of attribute values while affecting the appropriate userIndices.
|
private void |
modifyRemove(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
Completely removes the set of values for an attribute having the values
supplied while affecting the appropriate userIndices.
|
private void |
modifyReplace(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
Completely replaces the existing set of values for an attribute with the
modified values supplied affecting the appropriate userIndices.
|
void |
move(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry)
Move an entry from one place to the other.
|
void |
move(MoveOperationContext moveContext)
Transplants a child entry, to a position in the namespace under a new
parent entry.
|
void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry,
boolean deleteOldRdn) |
private void |
moveAndRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
java.lang.String entryId,
org.apache.directory.api.ldap.model.name.Dn newSuperior,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry)
Moves an entry under a new parent.
|
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(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn,
org.apache.directory.api.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 |
rename(RenameOperationContext renameContext)
Modifies an entry by changing its relative name.
|
private void |
rename(java.lang.String oldId,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn,
org.apache.directory.api.ldap.model.entry.Entry entry)
This will rename the entry, and deal with the deleteOldRdn flag.
|
void |
saveContextCsn()
saves the context CSN value in the context entry of the partition
|
EntryFilteringCursor |
search(SearchOperationContext searchContext)
Conducts a search against this ContextPartition.
|
void |
setCacheSize(int cacheSize)
Used to specify the entry cache size for a Partition.
|
void |
setIndexedAttributes(java.util.Set<Index<?,java.lang.String>> indexedAttributes)
Set the list of indexes for this partition
|
void |
setOptimizer(Optimizer optimizer) |
void |
setOptimizerEnabled(boolean optimizerEnabled)
Set the optimizer flag
|
void |
setPartitionPath(java.net.URI partitionPath)
Sets the path in which this Partition stores data.
|
private void |
setRWLock(OperationContext operationContext)
Set and return the ReadWrite lock we use to protect the backend against concurrent modifications
|
void |
setSearchEngine(SearchEngine searchEngine) |
void |
setSyncOnWrite(boolean isSyncOnWrite)
Sets the flag telling the server to flush on disk when some
modification has been done.
|
protected void |
setupSystemIndices()
Sets up the system indices.
|
protected void |
setupUserIndices()
Sets up the user indices.
|
java.lang.String |
toString() |
void |
unbind(UnbindOperationContext unbindContext)
Represents an unbind operation issued by an authenticated client.
|
private void |
unlockRead()
Release a Read lock
|
private void |
unlockWrite()
Release a Write lock
|
void |
updateCache(OperationContext opCtx)
updates the cache based on the type of OperationContext
|
private void |
updateCsnIndex(org.apache.directory.api.ldap.model.entry.Entry entry,
java.lang.String id)
updates the CSN index
|
protected void |
updateRdnIdx(java.lang.String parentId,
boolean addRemove,
int nbDescendant) |
checkInitialized, destroy, getContextEntry, getId, getSchemaManager, getSuffixDn, initialize, isInitialized, setCacheService, setContextCsn, setContextEntry, setId, setSchemaManager, setSuffixDnprivate static final org.slf4j.Logger LOG
private SearchEngine searchEngine
private Optimizer optimizer
protected boolean optimizerEnabled
public static final int DEFAULT_CACHE_SIZE
protected int cacheSize
protected net.sf.ehcache.Cache aliasCache
protected net.sf.ehcache.Cache piarCache
protected java.util.concurrent.atomic.AtomicBoolean isSyncOnWrite
private volatile java.lang.String suffixId
protected java.net.URI partitionPath
private java.util.Set<Index<?,java.lang.String>> indexedAttributes
protected MasterTable master
protected java.util.Map<java.lang.String,Index<?,java.lang.String>> userIndices
protected java.util.Map<java.lang.String,Index<?,java.lang.String>> systemIndices
protected Index<ParentIdAndRdn,java.lang.String> rdnIdx
protected Index<java.lang.String,java.lang.String> objectClassIdx
protected Index<java.lang.String,java.lang.String> presenceIdx
protected Index<java.lang.String,java.lang.String> entryCsnIdx
protected Index<org.apache.directory.api.ldap.model.name.Dn,java.lang.String> aliasIdx
protected Index<java.lang.String,java.lang.String> subAliasIdx
protected Index<java.lang.String,java.lang.String> oneAliasIdx
protected Index<java.lang.String,java.lang.String> adminRoleIdx
protected org.apache.directory.api.ldap.model.schema.AttributeType objectClassAT
protected org.apache.directory.api.ldap.model.schema.AttributeType entryCsnAT
protected org.apache.directory.api.ldap.model.schema.AttributeType entryDnAT
protected org.apache.directory.api.ldap.model.schema.AttributeType entryUuidAT
protected org.apache.directory.api.ldap.model.schema.AttributeType aliasedObjectNameAT
protected org.apache.directory.api.ldap.model.schema.AttributeType administrativeRoleAT
protected org.apache.directory.api.ldap.model.schema.AttributeType contextCsnAT
private static final boolean NO_REVERSE
private static final boolean WITH_REVERSE
protected static final boolean ADD_CHILD
protected static final boolean REMOVE_CHILD
private java.util.concurrent.locks.ReadWriteLock rwLock
private net.sf.ehcache.Cache entryDnCache
private java.util.concurrent.Semaphore ctxCsnSemaphore
protected AbstractBTreePartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager)
schemaManager - the schema managerprotected AbstractBTreePartition(org.apache.directory.api.ldap.model.schema.SchemaManager schemaManager,
DnFactory dnFactory)
schemaManager - the schema managerdnFactory - the DN factoryprivate void initInstance()
public int getCacheSize()
getCacheSize in interface Storepublic void setCacheSize(int cacheSize)
setCacheSize in interface StorecacheSize - the maximum size of the cache in the number of entriespublic boolean isOptimizerEnabled()
public void setOptimizerEnabled(boolean optimizerEnabled)
optimizerEnabled - The flagpublic void setPartitionPath(java.net.URI partitionPath)
setPartitionPath in interface StorepartitionDir - the path in which this Partition stores data.public boolean isSyncOnWrite()
isSyncOnWrite in interface Storetrue if we write to disk for every modificationpublic void setSyncOnWrite(boolean isSyncOnWrite)
setSyncOnWrite in interface StoreisSyncOnWrite - A boolean set to true if we have to flush on disk
when a modification occursprotected void setupSystemIndices()
throws java.lang.Exception
java.lang.Exceptionprotected void setupUserIndices()
throws java.lang.Exception
java.lang.Exceptionpublic SearchEngine getSearchEngine()
protected abstract Index<?,java.lang.String> convertAndInit(Index<?,java.lang.String> index) throws java.lang.Exception
index - the indexjava.lang.Exceptionpublic java.net.URI getPartitionPath()
getPartitionPath in interface Storeprotected void doDestroy()
throws org.apache.directory.api.ldap.model.exception.LdapException,
java.lang.Exception
doDestroy in class AbstractPartitionorg.apache.directory.api.ldap.model.exception.LdapExceptionjava.lang.Exceptionprotected void doInit()
throws java.lang.Exception
doInit in class AbstractPartitionjava.lang.Exceptionprivate void dumpAllRdnIdx()
throws java.lang.Exception
java.lang.Exceptionprivate void dumpRdnIdx()
throws java.lang.Exception
java.lang.Exceptionpublic void dumpRdnIdx(java.lang.String id,
java.lang.String tabs)
throws java.lang.Exception
java.lang.Exceptionprivate void dumpRdnIdx(java.lang.String id,
int nbSibbling,
java.lang.String tabs)
throws java.lang.Exception
java.lang.Exceptionpublic void add(AddOperationContext addContext) throws org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.entry.Entry delete(DeleteOperationContext deleteContext) throws org.apache.directory.api.ldap.model.exception.LdapException
protected void updateRdnIdx(java.lang.String parentId,
boolean addRemove,
int nbDescendant)
throws java.lang.Exception
java.lang.Exceptionpublic org.apache.directory.api.ldap.model.entry.Entry delete(java.lang.String id)
throws org.apache.directory.api.ldap.model.exception.LdapException
public EntryFilteringCursor search(SearchOperationContext searchContext) throws org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.entry.Entry lookup(LookupOperationContext lookupContext) throws org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.entry.Entry fetch(java.lang.String id)
throws org.apache.directory.api.ldap.model.exception.LdapException
public org.apache.directory.api.ldap.model.entry.Entry fetch(java.lang.String id,
org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
fetch in interface Storeid - The Entry UUID we want to get backdn - The entry DN when we have itjava.lang.Exception - If the lookup failed for any reason (except a not found entry)org.apache.directory.api.ldap.model.exception.LdapExceptionpublic void modify(ModifyOperationContext modifyContext) throws org.apache.directory.api.ldap.model.exception.LdapException
modify in interface PartitionmodifyContext - 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.org.apache.directory.api.ldap.model.exception.LdapExceptionDirContext,
DirContext.ADD_ATTRIBUTE,
DirContext.REMOVE_ATTRIBUTE,
DirContext.REPLACE_ATTRIBUTEpublic final org.apache.directory.api.ldap.model.entry.Entry modify(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.entry.Modification... mods)
throws java.lang.Exception
private void modifyAdd(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
throws java.lang.Exception
id - the primary key of the entryentry - the entry to altermods - the attribute and values to addjava.lang.Exception - if index alteration or attribute addition failsprivate void modifyReplace(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
throws java.lang.Exception
id - the primary key of the entryentry - the entry to altermods - the replacement attribute and valuesjava.lang.Exception - if index alteration or attribute modification
fails.private void modifyRemove(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry,
org.apache.directory.api.ldap.model.entry.Attribute mods)
throws java.lang.Exception
id - the primary key of the entryentry - the entry to altermods - the attribute and its values to deletejava.lang.Exception - if index alteration or attribute modification fails.public void move(MoveOperationContext moveContext) throws org.apache.directory.api.ldap.model.exception.LdapException
public final void move(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn,
org.apache.directory.api.ldap.model.name.Dn newDn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry)
throws java.lang.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 UUID won't change.
We have a few check we must do before moving the entry :
public void moveAndRename(MoveAndRenameOperationContext moveAndRenameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
moveAndRename in interface PartitionmoveAndRenameContext - The context contain all the information about
the modifyDN operationorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic final void moveAndRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
org.apache.directory.api.ldap.model.name.Dn newSuperiorDn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry,
boolean deleteOldRdn)
throws java.lang.Exception
moveAndRename in interface Storejava.lang.Exceptionprivate void moveAndRename(org.apache.directory.api.ldap.model.name.Dn oldDn,
java.lang.String entryId,
org.apache.directory.api.ldap.model.name.Dn newSuperior,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
org.apache.directory.api.ldap.model.entry.Entry modifiedEntry)
throws java.lang.Exception
oldDn - the normalized dn of the child to be movedchildId - the id of the child being movednewRdn - the normalized dn of the new parent for the childmodifiedEntry - the modified entryjava.lang.Exception - if something goes wrongpublic void rename(RenameOperationContext renameContext) throws org.apache.directory.api.ldap.model.exception.LdapException
private void rename(java.lang.String oldId,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws java.lang.Exception
java.lang.Exceptionpublic final void rename(org.apache.directory.api.ldap.model.name.Dn dn,
org.apache.directory.api.ldap.model.name.Rdn newRdn,
boolean deleteOldRdn,
org.apache.directory.api.ldap.model.entry.Entry entry)
throws java.lang.Exception
rename in interface Storedn - the normalized distinguished name of the entry to alternewRdn - the new Rdn to setdeleteOldRdn - whether or not to remove the old Rdn attr/valentry - the modified entryjava.lang.Exception - if there are any errors propagating the name changespublic final void unbind(UnbindOperationContext unbindContext) throws org.apache.directory.api.ldap.model.exception.LdapException
public boolean hasEntry(HasEntryOperationContext entryContext) throws org.apache.directory.api.ldap.model.exception.LdapException
Partition.lookup(LookupOperationContext) and return true
if it returns an entry by default. Please override this method if
there is more effective way for your implementation.private void updateCsnIndex(org.apache.directory.api.ldap.model.entry.Entry entry,
java.lang.String id)
throws java.lang.Exception
entry - the entry having entryCSN attributeid - UUID of the entryjava.lang.Exceptionprotected org.apache.directory.api.ldap.model.name.Dn buildEntryDn(java.lang.String id)
throws java.lang.Exception
id - the entry's idjava.lang.Exceptionpublic long count()
throws java.lang.Exception
public final long getChildCount(java.lang.String id)
throws org.apache.directory.api.ldap.model.exception.LdapException
getChildCount in interface Storeid - the entry UUIDorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic final org.apache.directory.api.ldap.model.name.Dn getEntryDn(java.lang.String id)
throws java.lang.Exception
getEntryDn in interface Storeid - the entry's idjava.lang.Exceptionpublic final java.lang.String getEntryId(org.apache.directory.api.ldap.model.name.Dn dn)
throws org.apache.directory.api.ldap.model.exception.LdapException
null if the Dn doesn't exist in this store.
Note that the Dn must be normalized!getEntryId in interface Storedn - the normalized entry Dnnull if the Dn doesn't existsorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic java.lang.String getParentId(java.lang.String childId)
throws java.lang.Exception
getParentId in interface StorechildId - the UUID of the entryjava.lang.Exception - on failures to access the underlying storeprotected java.lang.String getSuffixId()
throws java.lang.Exception
java.lang.Exceptionpublic void addIndex(Index<?,java.lang.String> index) throws java.lang.Exception
public void addIndexedAttributes(Index<?,java.lang.String>... indexes)
indexes - The added indexespublic void setIndexedAttributes(java.util.Set<Index<?,java.lang.String>> indexedAttributes)
indexedAttributes - The list of indexespublic java.util.Set<Index<?,java.lang.String>> getIndexedAttributes()
public java.util.Iterator<java.lang.String> getUserIndices()
getUserIndices in interface Storepublic java.util.Iterator<java.lang.String> getSystemIndices()
getSystemIndices in interface Storepublic Index<?,java.lang.String> getIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType) throws IndexNotFoundException
getIndex in interface StoreattributeType - The index attributeType we are looking forIndexNotFoundException - If the index does not existpublic Index<?,java.lang.String> getUserIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType) throws IndexNotFoundException
getUserIndex in interface StoreattributeType - The index name we are looking forIndexNotFoundException - If the index does not existpublic Index<?,java.lang.String> getSystemIndex(org.apache.directory.api.ldap.model.schema.AttributeType attributeType) throws IndexNotFoundException
getSystemIndex in interface StoreattributeType - The index name we are looking forIndexNotFoundException - If the index does not existpublic Index<org.apache.directory.api.ldap.model.name.Dn,java.lang.String> getAliasIndex()
getAliasIndex in interface Storepublic Index<java.lang.String,java.lang.String> getOneAliasIndex()
getOneAliasIndex in interface Storepublic Index<java.lang.String,java.lang.String> getSubAliasIndex()
getSubAliasIndex in interface Storepublic Index<java.lang.String,java.lang.String> getObjectClassIndex()
getObjectClassIndex in interface Storepublic Index<java.lang.String,java.lang.String> getEntryCsnIndex()
getEntryCsnIndex in interface Storepublic Index<java.lang.String,java.lang.String> getAdministrativeRoleIndex()
public Index<java.lang.String,java.lang.String> getPresenceIndex()
getPresenceIndex in interface Storepublic Index<ParentIdAndRdn,java.lang.String> getRdnIndex()
getRdnIndex in interface Storepublic boolean hasUserIndexOn(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
throws org.apache.directory.api.ldap.model.exception.LdapException
hasUserIndexOn in interface StoreattributeType - The attributeType index we are looking fortrue if the index is already present in the
User's index listorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean hasSystemIndexOn(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
throws org.apache.directory.api.ldap.model.exception.LdapException
hasSystemIndexOn in interface StoreattributeType - The index we are looking fortrue if the index is already present in the
System's index listorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean hasIndexOn(org.apache.directory.api.ldap.model.schema.AttributeType attributeType)
throws org.apache.directory.api.ldap.model.exception.LdapException
hasIndexOn in interface Storetrue if the index is already present in the
User's or System's index listorg.apache.directory.api.ldap.model.exception.LdapExceptionprotected void addAliasIndices(java.lang.String aliasId,
org.apache.directory.api.ldap.model.name.Dn aliasDn,
org.apache.directory.api.ldap.model.name.Dn aliasTarget)
throws java.lang.Exception
aliasDn - normalized distinguished name for the alias entryaliasTarget - the user provided aliased entry dn as a stringaliasId - the id of alias entry to addorg.apache.directory.api.ldap.model.exception.LdapException - if index addition fails, and if the alias is
not allowed due to chaining or cycle formation.java.lang.Exception - if the wrappedCursor btrees cannot be alteredprotected void dropAliasIndices(java.lang.String aliasId)
throws java.lang.Exception
aliasId - the id of the alias entry in the master tableorg.apache.directory.api.ldap.model.exception.LdapException - if we cannot parse ldap namesjava.lang.Exception - if we cannot delete index values in the databaseprotected void dropMovedAliasIndices(org.apache.directory.api.ldap.model.name.Dn movedBase)
throws java.lang.Exception
movedBase - the base at which the move occurred - the moved nodejava.lang.Exception - if system userIndices failprivate void dumpIndex(java.io.OutputStream stream,
Index<?,java.lang.String> index)
public void dumpIndex(java.io.OutputStream stream,
java.lang.String name)
throws java.io.IOException
dumpIndex in interface PartitiondumpIndex in class AbstractPartitionname - The index to dump to stdoutjava.io.IOException - if we can't write the datapublic java.lang.String toString()
toString in class java.lang.Objectprotected abstract Index createSystemIndex(java.lang.String indexOid, java.net.URI path, boolean withReverse) throws java.lang.Exception
indexOid - The Attribute OIDpath - The working directory where this indew will be storedjava.lang.Exception - If the index can't be createdpublic MasterTable getMasterTable()
getMasterTable in interface Storeprivate void lockRead()
private void unlockRead()
private void lockWrite()
private void unlockWrite()
public void updateCache(OperationContext opCtx)
opCtx - the operation's contextpublic org.apache.directory.api.ldap.model.entry.Entry lookupCache(java.lang.String id)
id - the ID of the entrypublic void addToCache(java.lang.String id,
org.apache.directory.api.ldap.model.entry.Entry entry)
id - ID of the entryentry - the Entrypublic Optimizer getOptimizer()
public void setOptimizer(Optimizer optimizer)
optimizer - the optimizer to setpublic void setSearchEngine(SearchEngine searchEngine)
searchEngine - the searchEngine to setprivate void setRWLock(OperationContext operationContext)
operationContext - The OperationContext which contain the reference to the OperationManagerpublic java.util.concurrent.locks.ReadWriteLock getReadWriteLock()
getReadWriteLock in interface Storepublic net.sf.ehcache.Cache getAliasCache()
getAliasCache in interface Storepublic java.lang.String getContextCsn()
AbstractPartitiongetContextCsn in interface PartitiongetContextCsn in class AbstractPartitionprotected void loadContextCsn()
org.apache.directory.api.ldap.model.exception.LdapExceptionpublic void saveContextCsn()
throws org.apache.directory.api.ldap.model.exception.LdapException
saveContextCsn in interface Partitionorg.apache.directory.api.ldap.model.exception.LdapException