EntryContainer.java revision 99faa045b6241c1d2843cce1b7a9d9c97055beae
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at
* trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
* add the following below this CDDL HEADER, with the fields enclosed
* by brackets "[]" replaced with your own identifying information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Portions Copyright 2006-2007 Sun Microsystems, Inc.
*/
/**
* Storage container for LDAP entries. Each base DN of a JE backend is given
* its own entry container. The entry container is the object that implements
* the guts of the backend API methods for LDAP operations.
*/
public class EntryContainer
{
/**
* The name of the entry database.
*/
/**
* The name of the DN database.
*/
/**
* The name of the children index database.
*/
/**
* The name of the subtree index database.
*/
/**
* The name of the referral database.
*/
/**
* The attribute used to return a search index debug string to the client.
*/
/**
* The backend to which this entry entryContainer belongs.
*/
/**
* The root container in which this entryContainer belongs.
*/
private RootContainer rootContainer;
/**
* The baseDN this entry container is responsible for.
*/
/**
* The backend configuration.
*/
/**
* A list of JE database handles opened through this entryContainer.
* They will be closed by the entryContainer.
*/
/**
* The JE database environment.
*/
private Environment env;
/**
* The DN database maps a normalized DN string to an entry ID (8 bytes).
*/
/**
* The key comparator used for the DN database.
*/
private Comparator<byte[]> dn2idComparator;
/**
* The entry database maps an entry ID (8 bytes) to a complete encoded entry.
*/
/**
* Compression and cryptographic options for the entry database.
*/
private DataConfig entryDataConfig;
/**
* Index maps entry ID to an entry ID list containing its children.
*/
private Index id2children;
/**
* Index maps entry ID to an entry ID list containing its subordinates.
*/
private Index id2subtree;
/**
* The referral database maps a normalized DN string to labeled URIs.
*/
/**
* The set of attribute indexes.
*/
/**
* Create a new entry entryContainer object.
*
* @param baseDN The baseDN this entry container will be responsible for
* storing on disk.
* @param backend A reference to the JE backend that is creating this entry
* container. It is needed by the Directory Server entry cache
* methods.
* @param config The configuration of the JE backend.
* @param env The JE environment to create this entryContainer in.
* @param rootContainer The root container this entry container is in.
*/
{
this.rootContainer = rootContainer;
// Instantiate the list of database handles.
// Instantiate indexes for id2children and id2subtree.
new ID2CIndexer(),
0);
new ID2SIndexer(),
0);
// Instantiate the attribute indexes.
{
{
}
}
entryDataConfig = new DataConfig();
}
/**
* Opens the entryContainer for reading and writing.
*
* @throws DatabaseException If an error occurs in the JE database.
*/
public void open()
throws DatabaseException
{
// Use this database config, duplicates are not allowed.
dbNodupsConfig.setAllowCreate(true);
dbNodupsConfig.setTransactional(true);
try
{
// Set the dn2id ordering so that we can iterate through a subtree.
dn2idComparator = new KeyReverseComparator();
dn2idConfig.setAllowCreate(true);
dn2idConfig.setTransactional(true);
dn2uriConfig.setSortedDuplicates(true);
dn2uriConfig.setAllowCreate(true);
dn2uriConfig.setTransactional(true);
{
}
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
close();
throw e;
}
}
/**
* Opens the entryContainer for reading and writing without transactions.
*
* @param deferredWrite Indicates whether to open the entryContainer using
* the deferred write mode.
*
* @throws DatabaseException If an error occurs in the JE database.
*/
public void openNonTransactional(boolean deferredWrite)
throws DatabaseException
{
// Use this database config, duplicates are not allowed.
dbNodupsConfig.setAllowCreate(true);
dbNodupsConfig.setTransactional(false);
try
{
// Set the dn2id ordering so that we can iterate through a subtree.
dn2idComparator = new KeyReverseComparator();
dn2idConfig.setAllowCreate(true);
dn2idConfig.setTransactional(false);
dn2uriConfig.setSortedDuplicates(true);
dn2uriConfig.setAllowCreate(true);
dn2uriConfig.setTransactional(false);
{
}
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
close();
throw e;
}
}
/**
* Opens the entryContainer for reading only.
*
* @throws DatabaseException If an error occurs in the JE database.
*/
public void openReadOnly()
throws DatabaseException
{
// Use this database config, duplicates are not allowed.
dbNodupsConfig.setReadOnly(true);
dbNodupsConfig.setAllowCreate(false);
dbNodupsConfig.setTransactional(false);
try
{
// Set the dn2id ordering so that we can iterate through a subtree.
dn2idComparator = new KeyReverseComparator();
dn2idConfig.setReadOnly(true);
dn2idConfig.setAllowCreate(false);
dn2idConfig.setTransactional(false);
dn2uriConfig.setReadOnly(true);
dn2uriConfig.setSortedDuplicates(true);
dn2uriConfig.setAllowCreate(false);
dn2uriConfig.setTransactional(false);
{
}
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
close();
throw e;
}
}
/**
* Closes the entry entryContainer.
*
* @throws DatabaseException If an error occurs in the JE database.
*/
public void close()
throws DatabaseException
{
// Close each database handle that has been opened.
{
{
}
}
{
}
}
/**
* Get the DN database used by this entry entryContainer. The entryContainer
* must have been opened.
*
* @return The DN database.
*/
{
return dn2id;
}
/**
* Get the entry database used by this entry entryContainer. The
* entryContainer must have been opened.
*
* @return The entry database.
*/
public ID2Entry getID2Entry()
{
return id2entry;
}
/**
* Get the referral database used by this entry entryContainer. The
* entryContainer must have been opened.
*
* @return The referral database.
*/
{
return dn2uri;
}
/**
* Get the children database used by this entry entryContainer.
* The entryContainer must have been opened.
*
* @return The children database.
*/
public Index getID2Children()
{
return id2children;
}
/**
* Get the subtree database used by this entry entryContainer.
* The entryContainer must have been opened.
*
* @return The subtree database.
*/
public Index getID2Subtree()
{
return id2subtree;
}
/**
* Look for an attribute index for the given attribute type.
*
* @param attrType The attribute type for which an attribute index is needed.
* @return The attribute index or null if there is none for that type.
*/
{
}
/**
* Determine the highest entryID in the entryContainer.
* The entryContainer must already be open.
*
* @return The highest entry ID.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
// Position a cursor on the last data item, and the key should
// give the highest ID.
try
{
{
}
}
finally
{
}
return entryID;
}
/**
* Processes the specified search in this entryContainer.
* Matching entries should be provided back to the core server using the
* <CODE>SearchOperation.returnEntry</CODE> method.
*
* @param searchOperation The search operation to be processed.
* @throws org.opends.server.types.DirectoryException
* If a problem occurs while processing the
* search.
* @throws DatabaseException If an error occurs in the JE database.
*/
throws DirectoryException, DatabaseException
{
{
{
{
// Ignore all but the first paged results control.
if (pageRequest == null)
{
try
{
}
catch (LDAPException e)
{
if (debugEnabled())
{
}
e.getMessage(), e.getMessageID(), e);
}
}
}
}
}
// Handle client abandon of paged results.
if (pageRequest != null)
{
{
new ASN1OctetString());
return;
}
}
// Handle base-object search first.
{
// Fetch the base entry.
try
{
}
catch (Exception e)
{
if (debugEnabled())
{
}
}
// The base entry must exist for a successful result.
{
// Check for referral entries above the base entry.
}
{
}
{
}
if (pageRequest != null)
{
// Indicate no more pages.
new ASN1OctetString());
}
return;
}
// Check whether the client requested debug information about the
// contribution of the indexes to the search.
{
debugBuffer = new StringBuilder();
}
// Create an index filter to get the search result candidate entries.
// Evaluate the filter against the attribute indexes.
// Evaluate the search scope against the id2children and id2subtree indexes.
boolean candidatesAreInScope = false;
if (entryIDList.isDefined() &&
{
// Read the ID from dn2id.
{
}
{
}
else
{
{
// The id2subtree list does not include the base entry ID.
}
}
if (debugBuffer != null)
{
}
{
// In this case we know that every candidate is in scope.
candidatesAreInScope = true;
}
}
// If requested, construct and return a fictitious entry containing
// debug information, and no other entries.
if (debugBuffer != null)
{
syntax);
new LinkedHashSet<AttributeValue>();
return;
}
if (entryIDList.isDefined())
{
}
else
{
}
}
/**
* We were not able to obtain a set of candidate entry IDs for the
* search from the indexes.
* <p>
* Here we are relying on the DN key order to ensure children are
* returned after their parents.
* <ul>
* <li>iterate through a subtree range of the DN database
* <li>discard non-children DNs if the search scope is single level
* <li>fetch the entry by ID from the entry cache or the entry database
* <li>return the entry if it matches the filter
* </ul>
*
* @param searchOperation The search operation.
* @param pageRequest A Paged Results control, or null if none.
* @throws DirectoryException If an error prevented the search from being
* processed.
*/
throws DirectoryException
{
// The base entry must already have been processed if this is
// a request for the next page in paged results. So we skip
// the base entry processing if the cookie is set.
{
// Fetch the base entry.
try
{
}
catch (Exception e)
{
if (debugEnabled())
{
}
}
// The base entry must exist for a successful result.
{
// Check for referral entries above the base entry.
}
if (!manageDsaIT)
{
}
/*
* The base entry is only included for whole subtree search.
*/
{
{
}
}
if (!manageDsaIT)
{
// Return any search result references.
{
if (pageRequest != null)
{
// Indicate no more pages.
new ASN1OctetString());
}
}
}
}
/*
* We will iterate forwards through a range of the dn2id keys to
* find subordinates of the target entry from the top of the tree
* downwards. For example, any subordinates of "dc=example,dc=com" appear
* in dn2id with a key ending in ",dc=example,dc=com". The entry
* "cn=joe,ou=people,dc=example,dc=com" will appear after the entry
* "ou=people,dc=example,dc=com".
*/
/*
* Set the ending value to a value of equal length but slightly
* greater than the suffix. Since keys are compared in
* reverse order we must set the first byte (the comma).
* No possibility of overflow here.
*/
// Set the starting value.
byte[] begin;
{
// The cookie contains the DN of the next entry to be returned.
try
{
}
catch (Exception e)
{
if (debugEnabled())
{
}
}
}
else
{
// Set the starting value to the suffix.
}
int lookthroughCount = 0;
int lookthroughLimit =
try
{
try
{
// Initialize the cursor very close to the starting value.
// Step forward until we pass the ending value.
{
{
//Lookthrough limit exceeded
return;
}
if (cmp >= 0)
{
// We have gone past the ending value.
break;
}
// We have found a subordinate entry.
boolean isInScope = true;
{
// Check if this entry is an immediate child.
if ((dn.getNumComponents() !=
{
isInScope = false;
}
}
if (isInScope)
{
// Try the entry cache first. Note no need to take a lock.
if (cacheEntry == null)
{
new GetEntryByIDOperation(entryID);
// Fetch the candidate entry from the database.
}
else
{
entry = cacheEntry;
}
// Process the candidate entry.
{
{
// Filter the entry.
{
if (pageRequest != null &&
{
// The current page is full.
// Set the cookie to remember where we were.
0, cookie);
return;
}
{
// We have been told to discontinue processing of the
// search. This could be due to size limit exceeded or
// operation cancelled.
return;
}
}
}
}
}
// Move to the next record.
}
}
finally
{
}
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
}
catch (JebException e)
{
if (debugEnabled())
{
}
}
if (pageRequest != null)
{
// Indicate no more pages.
new ASN1OctetString());
}
}
/**
* We were able to obtain a set of candidate entry IDs for the
* search from the indexes.
* <p>
* Here we are relying on ID order to ensure children are returned
* after their parents.
* <ul>
* <li>Iterate through the candidate IDs
* <li>fetch entry by ID from cache or id2entry
* <li>put the entry in the cache if not present
* <li>discard entries that are not in scope
* <li>return entry if it matches the filter
* </ul>
*
* @param entryIDList The candidate entry IDs.
* @param candidatesAreInScope true if it is certain that every candidate
* entry is in the search scope.
* @param searchOperation The search operation.
* @param pageRequest A Paged Results control, or null if none.
* @throws DirectoryException If an error prevented the search from being
* processed.
*/
boolean candidatesAreInScope,
throws DirectoryException
{
boolean continueSearch = true;
// Set the starting value.
{
// The cookie contains the ID of the next entry to be returned.
try
{
}
catch (Exception e)
{
if (debugEnabled())
{
}
}
}
else
{
if (!manageDsaIT)
{
// Return any search result references.
}
}
// Make sure the candidate list is smaller than the lookthrough limit
int lookthroughLimit =
{
//Lookthrough limit exceeded
continueSearch = false;
}
// Iterate through the index candidates.
if (continueSearch)
{
{
// Skip entry IDs in pages already returned.
{
continue;
}
// Try the entry cache first. Note no need to take a lock.
// Release any entry lock whatever happens during this block.
// (This is actually redundant since we did not take a lock).
try
{
if (cacheEntry == null)
{
// Fetch the candidate entry from the database.
try
{
}
catch (Exception e)
{
if (debugEnabled())
{
}
continue;
}
}
else
{
entry = cacheEntry;
}
// Process the candidate entry.
{
boolean isInScope = false;
if (candidatesAreInScope)
{
isInScope = true;
}
{
// Check if this entry is an immediate child.
if ((entryDN.getNumComponents() ==
{
isInScope = true;
}
}
{
{
isInScope = true;
}
}
{
if ((entryDN.getNumComponents() >
baseDN.getNumComponents()) &&
{
isInScope = true;
}
}
// Put this entry in the cache if it did not come from the cache.
if (cacheEntry == null)
{
// Put the entry in the cache making sure not to overwrite
// a newer copy that may have been inserted since the time
// we read the cache.
}
// Filter the entry if it is in scope.
if (isInScope)
{
{
{
if (pageRequest != null &&
{
// The current page is full.
// Set the cookie to remember where we were.
0, cookie);
return;
}
{
// We have been told to discontinue processing of the
// search. This could be due to size limit exceeded or
// operation cancelled.
break;
}
}
}
}
}
}
finally
{
// Release any entry lock acquired by the entry cache
// (This is actually redundant since we did not take a lock).
{
}
}
}
}
// Before we return success from the search we must ensure the base entry
// exists. However, if we have returned at least one entry or subordinate
// reference it implies the base does exist, so we can omit the check.
{
// Check for referral entries above the base entry.
if (!entryExists(baseDN))
{
}
}
if (pageRequest != null)
{
// Indicate no more pages.
new ASN1OctetString());
}
}
/**
* Adds the provided entry to this database. This method must ensure that the
* entry is appropriate for the database and that no entry already exists with
* the same DN. The caller must hold a write lock on the DN of the provided
* entry.
*
* @param entry The entry to add to this database.
* @param addOperation The add operation with which the new entry is
* associated. This may be <CODE>null</CODE> for adds
* performed internally.
* @throws DirectoryException If a problem occurs while trying to add the
* entry.
* @throws DatabaseException If an error occurs in the JE database.
* @throws JebException If an error occurs in the JE backend.
*/
{
new AddEntryTransaction(entry);
}
/**
* This method is common to all operations invoked under a database
* transaction. It retries the operation if the transaction is
* aborted due to a deadlock condition, up to a configured maximum
* number of retries.
*
* @param operation An object implementing the TransactedOperation interface.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Attempt the operation under a transaction until it fails or completes.
boolean completed = false;
while (!completed)
{
// Start a transaction.
try
{
// Invoke the operation.
// Commit the transaction.
completed = true;
}
catch (DeadlockException deadlockException)
{
if (retryRemaining-- <= 0)
{
throw deadlockException;
}
if (debugEnabled())
{
}
}
catch (DatabaseException databaseException)
{
throw databaseException;
}
catch (DirectoryException directoryException)
{
throw directoryException;
}
catch (JebException jebException)
{
throw jebException;
}
catch (Exception e)
{
}
}
// Do any actions necessary after successful commit,
// usually to update the entry cache.
}
/**
* This interface represents any kind of operation on the database
* that must be performed under a transaction. A class which implements
* this interface does not need to be concerned with creating the
* transaction nor retrying the transaction after deadlock.
*/
private interface TransactedOperation
{
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
public abstract Transaction beginOperationTransaction()
throws DatabaseException;
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
/**
* This method is called after the transaction has successfully
* committed.
*/
public abstract void postCommitAction();
}
/**
* This inner class implements the Add Entry operation through
* the TransactedOperation interface.
*/
private class AddEntryTransaction implements TransactedOperation
{
/**
* The entry to be added.
*/
/**
* The DN of the superior entry of the entry to be added. This can be
* null if the entry to be added is a base entry.
*/
/**
* The ID of the entry once it has been assigned.
*/
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
return beginTransaction();
}
/**
* Create a new Add Entry Transaction.
* @param entry The entry to be added.
*/
{
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Check whether the entry already exists.
{
}
// Check that the parent entry exists.
{
// Check for referral entries above the target.
// Read the parent ID from dn2id.
{
}
}
// First time through, assign the next entryID.
{
}
// Insert into dn2id.
{
// Do not ever expect to come through here.
}
// Update the referral database for referral entries.
{
// Do not ever expect to come through here.
}
// Insert into id2entry.
{
// Do not ever expect to come through here.
}
// Insert into the indexes, in index configuration order.
// Insert into id2children and id2subtree.
// The database transaction locks on these records will be hotly
// contested so we do them last so as to hold the locks for the
// shortest duration.
{
// Insert into id2children for parent ID.
// Insert into id2subtree for parent ID.
// Iterate up through the superior entries, starting above the parent.
{
// Read the ID from dn2id.
{
}
// Insert into id2subtree for this node.
}
}
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// Update the entry cache.
if (entryCache != null)
{
}
}
}
/**
* Removes the specified entry from this database. This method must ensure
* that the entry exists and that it does not have any subordinate entries
* (unless the database supports a subtree delete operation and the client
* included the appropriate information in the request). The caller must hold
* a write lock on the provided entry DN.
*
* @param entryDN The DN of the entry to remove from this database.
* @param deleteOperation The delete operation with which this action is
* associated. This may be <CODE>null</CODE> for
* deletes performed internally.
* @throws DirectoryException If a problem occurs while trying to remove the
* entry.
* @throws DatabaseException If an error occurs in the JE database.
* @throws JebException If an error occurs in the JE backend.
*/
{
if (operation.adminSizeLimitExceeded())
{
throw new DirectoryException(
}
}
/**
* Delete a leaf entry.
* The caller must be sure that the entry is indeed a leaf. We cannot
* rely on id2children to check for children since this entry may at
* one time have had enough children to exceed the index entry limit,
* after which the number of children IDs is unknown.
*
* @param id2cBuffered A buffered children index.
* @param id2sBuffered A buffered subtree index.
* @param txn The database transaction.
* @param leafDN The DN of the leaf entry to be deleted.
* @param leafID The ID of the leaf entry.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Check that the entry exists in id2entry and read its contents.
{
}
// Remove from dn2id.
{
// Do not expect to ever come through here.
}
// Update the referral database.
// Remove from id2entry.
{
}
// Remove from the indexes, in index config order.
// Make sure this entry either has no children in id2children,
// or that the index entry limit has been exceeded.
{
}
{
}
// Make sure this entry either has no subordinates in id2subtree,
// or that the index entry limit has been exceeded.
if (!subordinates.isDefined())
{
}
{
}
// Iterate up through the superior entries.
boolean isParent = true;
{
// Read the ID from dn2id.
{
}
// Remove from id2children.
if (isParent)
{
isParent = false;
}
// Remove from id2subtree for this node.
}
}
/**
* Delete the target entry of a delete operation, with appropriate handling
* of referral entries. The caller must be sure that the entry is indeed a
* leaf.
*
* @param manageDsaIT In the case where the target entry is a referral entry,
* this parameter should be true if the target is to be deleted, or false if
* the target should generate a referral.
* @param id2cBuffered A buffered children index.
* @param id2sBuffered A buffered subtree index.
* @param txn The database transaction.
* @param leafDN The DN of the target entry to be deleted.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
private void deleteTarget(boolean manageDsaIT,
{
// Read the entry ID from dn2id.
{
}
// Check that the entry exists in id2entry and read its contents.
{
}
if (!manageDsaIT)
{
}
// Remove from dn2id.
{
// Do not expect to ever come through here.
}
// Update the referral database.
// Remove from id2entry.
{
}
// Remove from the indexes, in index config order.
// Iterate up through the superior entries.
boolean isParent = true;
{
// Read the ID from dn2id.
{
}
// Remove from id2children.
if (isParent)
{
isParent = false;
}
// Remove from id2subtree for this node.
}
}
/**
* This inner class implements the Delete Entry operation through
* the TransactedOperation interface.
*/
private class DeleteEntryTransaction implements TransactedOperation
{
/**
* The DN of the entry or subtree to be deleted.
*/
/**
* The Delete operation.
*/
private DeleteOperation deleteOperation;
/**
* A list of the DNs of all entries deleted by this operation.
* The subtree delete control can cause multiple entries to be deleted.
*/
/**
* Indicates whether the subtree delete size limit has been exceeded.
*/
private boolean adminSizeLimitExceeded = false;
/**
* Create a new Delete Entry Transaction.
* @param entryDN The entry or subtree to be deleted.
* @param deleteOperation The Delete operation.
*/
{
this.deleteOperation = deleteOperation;
}
/**
* Determine whether the subtree delete size limit has been exceeded.
* @return true if the size limit has been exceeded.
*/
public boolean adminSizeLimitExceeded()
{
return adminSizeLimitExceeded;
}
/**
* Get the number of entries deleted during the operation.
* @return The number of entries deleted.
*/
public int getDeletedEntryCount()
{
return deletedDNList.size();
}
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
return beginTransaction();
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Check for referral entries above the target entry.
// Determine whether this is a subtree delete.
boolean isSubtreeDelete = false;
{
{
{
isSubtreeDelete = true;
}
}
}
/*
* We will iterate backwards through a range of the dn2id keys to
* find subordinates of the target entry from the bottom of the tree
* upwards. For example, any subordinates of "dc=example,dc=com" appear
* in dn2id with a key ending in ",dc=example,dc=com". The entry
* "cn=joe,ou=people,dc=example,dc=com" will appear after the entry
* "ou=people,dc=example,dc=com".
*/
/*
* Set the starting value to a value of equal length but slightly
* greater than the target DN. Since keys are compared in
* reverse order we must set the first byte (the comma).
* No possibility of overflow here.
*/
// Set the ending value to the suffix.
try
{
// Initialize the cursor very close to the starting value.
{
}
// Step back until the key is less than the beginning value
{
}
// Step back until we pass the ending value.
{
if (cmp < 0)
{
// We have gone past the ending value.
break;
}
// We have found a subordinate entry.
if (!isSubtreeDelete)
{
// The subtree delete control was not specified and
// the target entry is not a leaf.
}
// Enforce any subtree delete size limit.
{
adminSizeLimitExceeded = true;
break;
}
/*
* Delete this entry which by now must be a leaf because
* we have been deleting from the bottom of the tree upwards.
*/
}
}
finally
{
}
// Finally delete the target entry as it was not included
// in the dn2id iteration.
if (!adminSizeLimitExceeded)
{
// Enforce any subtree delete size limit.
{
adminSizeLimitExceeded = true;
}
else
{
boolean manageDsaIT;
if (isSubtreeDelete)
{
// draft-armijo-ldap-treedelete, 4.1 Tree Delete Semantics:
// The server MUST NOT chase referrals stored in the tree. If
// information about referrals is stored in this section of the
// tree, this pointer will be deleted.
manageDsaIT = true;
}
else
{
}
}
}
// Write out any buffered index values.
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// Update the entry cache.
if (entryCache != null)
{
{
}
}
}
}
/**
* Indicates whether an entry with the specified DN exists.
*
* @param entryDN The DN of the entry for which to determine existence.
*
* @return <CODE>true</CODE> if the specified entry exists,
* or <CODE>false</CODE> if it does not.
*
* @throws DirectoryException If a problem occurs while trying to make the
* determination.
*/
throws DirectoryException
{
// Try the entry cache first.
if (entryCache != null)
{
{
return true;
}
}
// Read the ID from dn2id.
try
{
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
}
}
/**
* Fetch an entry by DN, trying the entry cache first, then the database.
* Retrieves the requested entry, trying the entry cache first,
* then the database. Note that the caller must hold a read or write lock
* on the specified DN.
*
* @param entryDN The distinguished name of the entry to retrieve.
* @return The requested entry, or <CODE>null</CODE> if the entry does not
* exist.
* @throws DirectoryException If a problem occurs while trying to retrieve
* the entry.
* @throws JebException If an error occurs in the JE backend.
* @throws DatabaseException An error occurred during a database operation.
*/
{
// Try the entry cache first.
if (entryCache != null)
{
}
{
// Fetch the entry from the database.
// Put the entry in the cache making sure not to overwrite
// a newer copy that may have been inserted since the time
// we read the cache.
{
}
}
return entry;
}
/**
* This inner class gets an entry by DN through
* the TransactedOperation interface.
*/
private class GetEntryByDNOperation implements TransactedOperation
{
/**
* The retrieved entry.
*/
/**
* The ID of the retrieved entry.
*/
/**
* The DN of the entry to be retrieved.
*/
/**
* Create a new transacted operation to retrieve an entry by DN.
* @param entryDN The DN of the entry to be retrieved.
*/
{
}
/**
* Get the retrieved entry.
* @return The retrieved entry.
*/
{
return entry;
}
/**
* Get the ID of the retrieved entry.
* @return The ID of the retrieved entry.
*/
public EntryID getEntryID()
{
return entryID;
}
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
// For best performance queries do not use a transaction.
// We permit temporary inconsistencies between the multiple
// records that make up a single entry.
return null;
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Read dn2id.
{
// The entryDN does not exist.
// Check for referral entries above the target entry.
return;
}
// Read id2entry.
{
// The entryID does not exist.
}
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// No implementation required.
}
}
/**
* This inner class gets an entry by ID through
* the TransactedOperation interface.
*/
private class GetEntryByIDOperation implements TransactedOperation
{
/**
* The retrieved entry.
*/
/**
* The ID of the entry to be retrieved.
*/
/**
* Create a new transacted operation to retrieve an entry by ID.
* @param entryID The ID of the entry to be retrieved.
*/
{
}
/**
* Get the retrieved entry.
* @return The retrieved entry.
*/
{
return entry;
}
/**
* Get the ID of the retrieved entry.
* @return the ID of the retrieved entry.
*/
public EntryID getEntryID()
{
return entryID;
}
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
// For best performance queries do not use a transaction.
// We permit temporary inconsistencies between the multiple
// records that make up a single entry.
return null;
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Read id2entry.
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// No implementation required.
}
}
/**
* The simplest case of replacing an entry in which the entry DN has
* not changed.
*
* @param entry The new contents of the entry
* @param modifyOperation The modify operation with which this action is
* associated. This may be <CODE>null</CODE> for
* modifications performed internally.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
}
/**
* This inner class implements the Replace Entry operation through
* the TransactedOperation interface.
*/
private class ReplaceEntryTransaction implements TransactedOperation
{
/**
* The new contents of the entry.
*/
/**
* The Modify operation, or null if the replace is not due to a Modify
* operation.
*/
private ModifyOperation modifyOperation;
/**
* The ID of the entry that was replaced.
*/
/**
* Create a new transacted operation to replace an entry.
* @param entry The new contents of the entry.
* @param modifyOperation The Modify operation, or null if the replace is
* not due to a Modify operation.
*/
{
this.modifyOperation = modifyOperation;
}
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
return beginTransaction();
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
// Read dn2id.
{
// The entry does not exist.
}
// Read id2entry for the original entry.
if (originalEntry == null)
{
// The entry does not exist.
}
{
// Check if the entry is a referral entry.
}
// Update the referral database.
if (modifyOperation != null)
{
// In this case we know from the operation what the modifications were.
}
else
{
}
// Replace id2entry.
// Update the indexes.
if (modifyOperation != null)
{
// In this case we know from the operation what the modifications were.
}
else
{
// The most optimal would be to figure out what the modifications were.
}
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// Update the entry cache.
if (entryCache != null)
{
}
}
}
/**
* subordinate entries as necessary. This must ensure that an entry already
* exists with the provided current DN, and that no entry exists with the
* target DN of the provided entry. The caller must hold write locks on both
* the current DN and the new DN for the entry.
*
* @param currentDN The current DN of the entry to be replaced.
* @param entry The new content to use for the entry.
* @param modifyDNOperation The modify DN operation with which this action
* is associated. This may be <CODE>null</CODE>
* for modify DN operations performed internally.
* @throws org.opends.server.types.DirectoryException
* If a problem occurs while trying to perform
* the rename.
* @throws org.opends.server.types.CancelledOperationException
* If this backend noticed and reacted
* to a request to cancel or abandon the
* modify DN operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws JebException If an error occurs in the JE backend.
*/
{
}
/**
* This inner class implements the Modify DN operation through
* the TransactedOperation interface.
*/
private class RenameEntryTransaction implements TransactedOperation
{
/**
* The DN of the entry to be renamed.
*/
/**
* The DN of the superior entry of the entry to be renamed.
* This is null if the entry to be renamed is a base entry.
*/
private DN oldSuperiorDN;
/**
* The DN of the new superior entry, which can be the same
* as the current superior entry.
*/
private DN newSuperiorDN;
/**
* The new contents of the entry to be renamed.
*/
private Entry newApexEntry;
/**
* The Modify DN operation.
*/
private ModifyDNOperation modifyDNOperation;
/**
* A buffered children index.
*/
private BufferedIndex id2cBuffered;
/**
* A buffered subtree index.
*/
private BufferedIndex id2sBuffered;
/**
* Create a new transacted operation for a Modify DN operation.
* @param currentDN The DN of the entry to be renamed.
* @param entry The new contents of the entry.
* @param modifyDNOperation The Modify DN operation to be performed.
*/
{
this.newApexEntry = entry;
this.modifyDNOperation = modifyDNOperation;
}
/**
* Invoke the operation under the given transaction.
*
* @param txn The transaction to be used to perform the operation.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
if(modifyDNOperation != null)
{
}
// Check whether the renamed entry already exists.
{
}
{
// Check for referral entries above the target entry.
}
if (oldApexEntry == null)
{
}
{
}
if (newSuperiorDN != null)
{
/*
* We want to preserve the invariant that the ID of an
* entry is greater than its parent, since search
* results are returned in ID order.
*/
if (newSuperiorID == null)
{
}
{
// This move would break the above invariant so we must
// renumber every entry that moves. This is even more
// expensive since every entry has to be deleted from
// and added back into the attribute indexes.
}
}
// Move or rename the apex entry.
if (requestedNewSuperiorDN != null)
{
}
else
{
}
/*
* We will iterate forwards through a range of the dn2id keys to
* find subordinates of the target entry from the top of the tree
* downwards.
*/
/*
* Set the ending value to a value of equal length but slightly
* greater than the suffix.
*/
// Set the starting value to the suffix.
try
{
// Initialize the cursor very close to the starting value.
// Step forward until the key is greater than the starting value.
{
}
// Step forward until we pass the ending value.
{
if (cmp >= 0)
{
// We have gone past the ending value.
break;
}
// We have found a subordinate entry.
// Construct the new DN of the entry.
newApexEntry.getDN());
if (requestedNewSuperiorDN != null)
{
// Assign a new entry ID if we are renumbering.
{
}
// Move this entry.
}
else
{
// Rename this entry.
}
// Get the next DN.
}
}
finally
{
}
}
/**
* Begin a transaction for this operation.
*
* @return The transaction for the operation, or null if the operation
* will not use a transaction.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
return beginTransaction();
}
/**
* Update the database for the target entry of a ModDN operation
* specifying a new superior.
*
* @param txn The database transaction to be used for the updates.
* @param oldID The original ID of the target entry.
* @param newID The new ID of the target entry, or the original ID if
* the ID has not changed.
* @param oldEntry The original contents of the target entry.
* @param newEntry The new contents of the target entry.
* @throws JebException If an error occurs in the JE backend.
* @throws DirectoryException If a Directory Server error occurs.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
// Remove the old DN from dn2id.
// Insert the new DN in dn2id.
{
}
// Update any referral records.
// Remove the old ID from id2entry.
{
// Remove the old ID from the indexes.
// Insert the new ID into the indexes.
}
else
{
// Update indexes only for those attributes that changed.
}
// Put the new entry in id2entry.
// Remove the old parentID:ID from id2children.
if (oldParentDN != null)
{
oldID);
}
// Put the new parentID:ID in id2children.
if (newParentDN != null)
{
newID);
}
// Remove the old nodeID:ID from id2subtree.
{
}
// Put the new nodeID:ID in id2subtree.
{
}
{
// All the subordinates will be renumbered.
}
// Remove the entry from the entry cache.
if (entryCache != null)
{
}
}
/**
* Update the database for the target entry of a Modify DN operation
* not specifying a new superior.
*
* @param txn The database transaction to be used for the updates.
* @param entryID The ID of the target entry.
* @param oldEntry The original contents of the target entry.
* @param newEntry The new contents of the target entry.
* @throws DirectoryException If a Directory Server error occurs.
* @throws DatabaseException If an error occurs in the JE database.
* @throws JebException if an error occurs in the JE database.
*/
{
// Remove the old DN from dn2id.
// Insert the new DN in dn2id.
{
}
// Update any referral records.
// Replace the entry in id2entry.
if(modifyDNOperation == null)
{
// Remove the old ID from the indexes.
// Insert the new ID into the indexes.
}
else
{
// Update indexes only for those attributes that changed.
}
// Remove the entry from the entry cache.
if (entryCache != null)
{
}
}
/**
* Update the database for a subordinate entry of the target entry
* of a Modify DN operation specifying a new superior.
*
* @param txn The database transaction to be used for the updates.
* @param oldID The original ID of the subordinate entry.
* @param newID The new ID of the subordinate entry, or the original ID if
* the ID has not changed.
* @param oldEntry The original contents of the subordinate entry.
* @param newDN The new DN of the subordinate entry.
* @throws JebException If an error occurs in the JE backend.
* @throws DirectoryException If a Directory Server error occurs.
* @throws DatabaseException If an error occurs in the JE database.
*/
{
// Remove the old DN from dn2id.
// Put the new DN in dn2id.
{
}
// Delete any existing referral records for the old DN.
// Remove old ID from id2entry.
{
// Update the attribute indexes.
{
}
}
// Change the entry DN.
// Add any referral records for the new DN.
// Put the new entry (old entry with new DN) in id2entry.
{
// All the subordinates will be renumbered.
// Put the new parentID:ID in id2children.
if (newParentDN != null)
{
newID);
}
}
// Remove the old nodeID:ID from id2subtree
{
oldID);
}
// Put the new nodeID:ID in id2subtree.
{
{
}
}
// Remove the entry from the entry cache.
if (entryCache != null)
{
}
}
/**
* Update the database for a subordinate entry of the target entry
* of a Modify DN operation not specifying a new superior.
*
* @param txn The database transaction to be used for the updates.
* @param entryID The ID of the subordinate entry.
* @param oldEntry The original contents of the subordinate entry.
* @param newDN The new DN of the subordinate entry.
* @throws DirectoryException If a Directory Server error occurs.
* @throws DatabaseException If an error occurs in the JE database.
*/
throws DirectoryException, DatabaseException
{
// Remove the old DN from dn2id.
// Insert the new DN in dn2id.
{
}
// Delete any existing referral records for the old DN.
// Change the entry DN.
// Add any referral records for the new DN.
// Replace the entry in id2entry.
// Remove the entry from the entry cache.
if (entryCache != null)
{
}
}
/**
* This method is called after the transaction has successfully
* committed.
*/
public void postCommitAction()
{
// No implementation needed.
}
}
/**
* Make a new DN for a subordinate entry of a renamed or moved entry.
*
* @param oldDN The current DN of the subordinate entry.
* @param oldSuffixLen The current DN length of the renamed or moved entry.
* @param newSuffixDN The new DN of the renamed or moved entry.
* @return The new DN of the subordinate entry.
*/
{
for (int i=0; i < oldDNKeepComponents; i++)
{
}
{
}
return new DN(newDNComponents);
}
/**
* A lexicographic byte array comparator that compares in
* reverse byte order. This is used for the dn2id database.
* If we want to find all the entries in a subtree dc=com we know that
* all subordinate entries must have ,dc=com as a common suffix. In reversing
* the order of comparison we turn the subtree base into a common prefix
* and are able to iterate through the keys having that prefix.
*/
static public class KeyReverseComparator implements Comparator<byte[]>
{
/**
* Compares its two arguments for order. Returns a negative integer,
* zero, or a positive integer as the first argument is less than, equal
* to, or greater than the second.
*
* @param a the first object to be compared.
* @param b the second object to be compared.
* @return a negative integer, zero, or a positive integer as the
* first argument is less than, equal to, or greater than the
* second.
*/
public int compare(byte[] a, byte[] b)
{
{
{
return 1;
}
{
return -1;
}
}
{
return 0;
}
{
return 1;
}
else
{
return -1;
}
}
}
/**
* Insert a new entry into the attribute indexes.
*
* @param txn The database transaction to be used for the updates.
* @param entry The entry to be inserted into the indexes.
* @param entryID The ID of the entry to be inserted into the indexes.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
{
}
}
/**
* Remove an entry from the attribute indexes.
*
* @param txn The database transaction to be used for the updates.
* @param entry The entry to be removed from the indexes.
* @param entryID The ID of the entry to be removed from the indexes.
* @throws DatabaseException If an error occurs in the JE database.
* @throws DirectoryException If a Directory Server error occurs.
* @throws JebException If an error occurs in the JE backend.
*/
{
{
}
}
/**
* Update the attribute indexes to reflect the changes to the
* attributes of an entry resulting from a sequence of modifications.
*
* @param txn The database transaction to be used for the updates.
* @param oldEntry The contents of the entry before the change.
* @param newEntry The contents of the entry after the change.
* @param entryID The ID of the entry that was changed.
* @param mods The sequence of modifications made to the entry.
* @throws DatabaseException If an error occurs in the JE database.
*/
throws DatabaseException
{
// Process in index configuration order.
{
// Check whether any modifications apply to this indexed attribute.
boolean attributeModified = false;
{
{
attributeModified = true;
break;
}
}
if (attributeModified)
{
}
}
}
/**
* Get a count of the number of entries stored in this entry entryContainer.
*
* @return The number of entries stored in this entry entryContainer.
* @throws DatabaseException If an error occurs in the JE database.
*/
public long getEntryCount() throws DatabaseException
{
return id2entry.getRecordCount();
}
/**
* Remove the entry entryContainer from disk. The entryContainer must not be
* open.
*
* @throws DatabaseException If an error occurs in the JE database.
*/
public void removeContainer() throws DatabaseException
{
try
{
}
catch (DatabaseNotFoundException e)
{
if (debugEnabled())
{
}
}
try
{
}
catch (DatabaseNotFoundException e)
{
if (debugEnabled())
{
}
}
try
{
}
catch (DatabaseNotFoundException e)
{
if (debugEnabled())
{
}
}
try
{
}
catch (DatabaseNotFoundException e)
{
if (debugEnabled())
{
}
}
{
try
{
index.removeIndex();
}
catch (DatabaseNotFoundException e)
{
if (debugEnabled())
{
}
}
}
}
/**
* Get the number of values for which the entry limit has been exceeded
* since the entry entryContainer was opened.
* @return The number of values for which the entry limit has been exceeded.
*/
public int getEntryLimitExceededCount()
{
int count = 0;
{
}
return count;
}
/**
* Get a list of the databases opened by this entryContainer. There will be
* only one handle in the list for each database, regardless of the number
* of handles open for a given database.
* @param dbList A list of JE database handles.
*/
{
// There may be more than one handle open for a given database
// so we eliminate duplicates here.
{
try
{
{
}
}
catch (DatabaseException e)
{
if (debugEnabled())
{
}
}
}
}
/**
* Determine whether the provided operation has the ManageDsaIT request
* control.
* @param operation The operation for which the determination is to be made.
* @return true if the operation has the ManageDsaIT request control, or false
* if not.
*/
{
{
{
{
{
return true;
}
}
}
}
return false;
}
/**
* Constructs a full JE database name incorporating a entryContainer name.
*
* @param builder A string builder to which the full name will be appended.
* @param name The short database name.
*/
{
}
/**
* Opens a JE database in this entryContainer. The resulting database handle
* must not be closed by the caller, as it will be closed by the
* entryContainer. If the provided database configuration is transactional,
* a transaction will be created and used to perform the open.
* <p>
* Note that a database can be opened multiple times and will result in
* multiple unique handles to the database. This is used for example to
* give each server thread its own database handle to eliminate contention
* that could occur on a single handle.
*
* @param dbConfig The JE database configuration to be used to open the
* database.
* @param name The short database name, to which the entryContainer name
* will be added.
* @return A new JE database handle.
* @throws DatabaseException If an error occurs while attempting to open the
* database.
*/
throws DatabaseException
{
if (dbConfig.getTransactional())
{
// Open the database under a transaction.
try
{
if (debugEnabled())
{
}
}
catch (DatabaseException e)
{
throw e;
}
}
else
{
if (debugEnabled())
{
}
}
// Insert into the list of database handles.
return database;
}
/**
* Begin a leaf transaction using the default configuration.
* Provides assertion debug logging.
* @return A JE transaction handle.
* @throws DatabaseException If an error occurs while attempting to begin
* a new transaction.
*/
public Transaction beginTransaction()
throws DatabaseException
{
if (debugEnabled())
{
}
return txn;
}
/**
* Commit a transaction.
* Provides assertion debug logging.
* @param txn The JE transaction handle.
* @throws DatabaseException If an error occurs while attempting to commit
* the transaction.
*/
throws DatabaseException
{
{
if (debugEnabled())
{
}
}
}
/**
* Abort a transaction.
* Provides assertion debug logging.
* @param txn The JE transaction handle.
* @throws DatabaseException If an error occurs while attempting to abort the
* transaction.
*/
throws DatabaseException
{
{
if (debugEnabled())
{
}
}
}
/**
* Insert a record into a JE database, with optional debug logging. This is a
* simple wrapper around the JE Database.putNoOverwrite method.
* @param database The JE database handle.
* @param txn The JE transaction handle, or null if none.
* @param key The record key.
* @param data The record value.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Insert a record into a JE database through a cursor, with optional debug
* logging. This is a simple wrapper around the JE Cursor.putNoOverwrite
* method.
* @param cursor The JE cursor handle.
* @param key The record key.
* @param data The record value.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Replace or insert a record into a JE database, with optional debug logging.
* This is a simple wrapper around the JE Database.put method.
* @param database The JE database handle.
* @param txn The JE transaction handle, or null if none.
* @param key The record key.
* @param data The record value.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Replace or insert a record into a JE database through a cursor, with
* optional debug logging. This is a simple wrapper around the JE Cursor.put
* method.
* @param cursor The JE cursor handle.
* @param key The record key.
* @param data The record value.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Read a record from a JE database, with optional debug logging. This is a
* simple wrapper around the JE Database.get method.
* @param database The JE database handle.
* @param txn The JE transaction handle, or null if none.
* @param key The key of the record to be read.
* @param data The record value returned as output. Its byte array does not
* need to be initialized by the caller.
* @param lockMode The JE locking mode to be used for the read.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Read a record from a JE database through a cursor, with optional debug
* logging. This is a simple wrapper around the JE Cursor.getSearchKey method.
* @param cursor The JE cursor handle.
* @param key The key of the record to be read.
* @param data The record value returned as output. Its byte array does not
* need to be initialized by the caller.
* @param lockMode The JE locking mode to be used for the read.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* Delete a record from a JE database, with optional debug logging. This is a
* simple wrapper around the JE Database.delete method.
* @param database The JE database handle.
* @param txn The JE transaction handle, or null if none.
* @param key The key of the record to be read.
* @return The operation status.
* @throws DatabaseException If an error occurs in the JE operation.
*/
throws DatabaseException
{
if (debugEnabled())
{
}
return status;
}
/**
* This is a simple wrapper around the JE Database.count method.
* @param database the JE database handle.
* @throws DatabaseException If an error occurs in the JE operation.
*/
{
if (debugEnabled())
{
}
return count;
}
/**
* Remove a database from disk.
*
* @param name The short database name, to which the entryContainer name will
* be added.
* @throws DatabaseException If an error occurs while attempting to delete the
* database.
*/
{
}
/**
* This method constructs a container name from a base DN. Only alphanumeric
* characters are preserved, all other characters are replaced with an
* underscore.
*
* @return The container name for the base DN.
*/
public String getContainerName()
{
{
{
}
else
{
}
}
}
/**
* Get the baseDN this entry container is responsible for.
*
* @return The Base DN for this entry container.
*/
{
return baseDN;
}
/**
* Get the parent of a DN in the scope of the base DN.
*
* @param dn A DN which is in the scope of the base DN.
* @return The parent DN, or null if the given DN is the base DN.
*/
{
{
return null;
}
}
}