org.opends.server.backends.jeb
Class DN2URI

java.lang.Object
  extended by org.opends.server.backends.jeb.DatabaseContainer
      extended by org.opends.server.backends.jeb.DN2URI

public class DN2URI
extends DatabaseContainer

This class represents the referral database which contains URIs from referral entries. The key is the DN of the referral entry and the value is that of a labeled URI in the ref attribute for that entry. Duplicate keys are permitted since a referral entry can contain multiple values of the ref attribute. Key order is the same as in the DN database so that all referrals in a subtree can be retrieved by cursoring through a range of the records.


Field Summary
 
Fields inherited from class org.opends.server.backends.jeb.DatabaseContainer
dbConfig, entryContainer, name
 
Method Summary
 boolean addEntry(com.sleepycat.je.Transaction txn, Entry entry)
          Update the referral database for a new entry.
 void checkTargetForReferral(Entry entry, SearchScope searchScope)
          Checks whether the target of an operation is a referral entry and throws a Directory referral exception if it is.
 boolean delete(com.sleepycat.je.Transaction txn, DN dn)
          Delete URI values for a given referral entry from the referral database.
 boolean delete(com.sleepycat.je.Transaction txn, DN dn, java.lang.String labeledURI)
          Delete a single URI value from the referral database.
 void deleteEntry(com.sleepycat.je.Transaction txn, Entry entry)
          Update the referral database for a deleted entry.
 java.util.Comparator<byte[]> getComparator()
          Gets the comparator for records stored in this database.
 boolean insert(com.sleepycat.je.Transaction txn, DN dn, java.lang.String labeledURI)
          Insert a URI value in the referral database.
 void modifyEntry(com.sleepycat.je.Transaction txn, Entry before, Entry after, java.util.List<Modification> mods)
          Update the referral database for an entry that has been modified.
 void replaceEntry(com.sleepycat.je.Transaction txn, Entry before, Entry after)
          Update the referral database for an entry that has been replaced.
 boolean returnSearchReferences(SearchOperation searchOp)
          Return search result references for a search operation using the referral database to find all referral entries within scope of the search.
 void targetEntryReferrals(DN targetDN, SearchScope searchScope)
          Process referral entries that are above the target DN of an operation.
 void throwReferralException(DN targetDN, DN referralDN, java.util.Set<java.lang.String> labeledURIs, SearchScope searchScope)
          Throws a Directory referral exception for the case where a referral entry exists at or above the target DN of an operation.
 
Methods inherited from class org.opends.server.backends.jeb.DatabaseContainer
delete, getName, getRecordCount, insert, open, openCursor, preload, put, read, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

insert

public boolean insert(com.sleepycat.je.Transaction txn,
                      DN dn,
                      java.lang.String labeledURI)
               throws com.sleepycat.je.DatabaseException
Insert a URI value in the referral database.

Parameters:
txn - A database transaction used for the update, or null if none is required.
dn - The DN of the referral entry.
labeledURI - The labeled URI value of the ref attribute.
Returns:
true if the record was inserted, false if it was not.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

delete

public boolean delete(com.sleepycat.je.Transaction txn,
                      DN dn)
               throws com.sleepycat.je.DatabaseException
Delete URI values for a given referral entry from the referral database.

Parameters:
txn - A database transaction used for the update, or null if none is required.
dn - The DN of the referral entry for which URI values are to be deleted.
Returns:
true if the values were deleted, false if not.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

delete

public boolean delete(com.sleepycat.je.Transaction txn,
                      DN dn,
                      java.lang.String labeledURI)
               throws com.sleepycat.je.DatabaseException
Delete a single URI value from the referral database.

Parameters:
txn - A database transaction used for the update, or null if none is required.
dn - The DN of the referral entry.
labeledURI - The URI value to be deleted.
Returns:
true if the value was deleted, false if not.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

modifyEntry

public void modifyEntry(com.sleepycat.je.Transaction txn,
                        Entry before,
                        Entry after,
                        java.util.List<Modification> mods)
                 throws com.sleepycat.je.DatabaseException
Update the referral database for an entry that has been modified. Does not do anything unless the entry before the modification or the entry after the modification is a referral entry.

Parameters:
txn - A database transaction used for the update, or null if none is required.
before - The entry before the modifications have been applied.
after - The entry after the modifications have been applied.
mods - The sequence of modifications made to the entry.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

replaceEntry

public void replaceEntry(com.sleepycat.je.Transaction txn,
                         Entry before,
                         Entry after)
                  throws com.sleepycat.je.DatabaseException
Update the referral database for an entry that has been replaced. Does not do anything unless the entry before it was replaced or the entry after it was replaced is a referral entry.

Parameters:
txn - A database transaction used for the update, or null if none is required.
before - The entry before it was replaced.
after - The entry after it was replaced.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

addEntry

public boolean addEntry(com.sleepycat.je.Transaction txn,
                        Entry entry)
                 throws com.sleepycat.je.DatabaseException
Update the referral database for a new entry. Does nothing if the entry is not a referral entry.

Parameters:
txn - A database transaction used for the update, or null if none is required.
entry - The entry to be added.
Returns:
True if the entry was added successfully or False otherwise.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

deleteEntry

public void deleteEntry(com.sleepycat.je.Transaction txn,
                        Entry entry)
                 throws com.sleepycat.je.DatabaseException
Update the referral database for a deleted entry. Does nothing if the entry was not a referral entry.

Parameters:
txn - A database transaction used for the update, or null if none is required.
entry - The entry to be deleted.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE database.

checkTargetForReferral

public void checkTargetForReferral(Entry entry,
                                   SearchScope searchScope)
                            throws DirectoryException
Checks whether the target of an operation is a referral entry and throws a Directory referral exception if it is.

Parameters:
entry - The target entry of the operation, or the base entry of a search operation.
searchScope - The scope of the search operation, or null if the operation is not a search operation.
Throws:
DirectoryException - If a referral is found at or above the target DN. The referral URLs will be set appropriately for the references found in the referral entry.

throwReferralException

public void throwReferralException(DN targetDN,
                                   DN referralDN,
                                   java.util.Set<java.lang.String> labeledURIs,
                                   SearchScope searchScope)
                            throws DirectoryException
Throws a Directory referral exception for the case where a referral entry exists at or above the target DN of an operation.

Parameters:
targetDN - The target DN of the operation, or the base object of a search operation.
referralDN - The DN of the referral entry.
labeledURIs - The set of labeled URIs in the referral entry.
searchScope - The scope of the search operation, or null if the operation is not a search operation.
Throws:
DirectoryException - If a referral is found at or above the target DN. The referral URLs will be set appropriately for the references found in the referral entry.

targetEntryReferrals

public void targetEntryReferrals(DN targetDN,
                                 SearchScope searchScope)
                          throws DirectoryException
Process referral entries that are above the target DN of an operation.

Parameters:
targetDN - The target DN of the operation, or the base object of a search operation.
searchScope - The scope of the search operation, or null if the operation is not a search operation.
Throws:
DirectoryException - If a referral is found at or above the target DN. The referral URLs will be set appropriately for the references found in the referral entry.

returnSearchReferences

public boolean returnSearchReferences(SearchOperation searchOp)
                               throws DirectoryException
Return search result references for a search operation using the referral database to find all referral entries within scope of the search.

Parameters:
searchOp - The search operation for which search result references should be returned.
Returns:
true if the caller should continue processing the search request and sending additional entries and references, or false if not for some reason (e.g., the size limit has been reached or the search has been abandoned).
Throws:
DirectoryException - If a Directory Server error occurs.

getComparator

public java.util.Comparator<byte[]> getComparator()
Gets the comparator for records stored in this database.

Returns:
The comparator used for records stored in this database.