| | |
| | | import org.opends.server.util.StaticUtils; |
| | | |
| | | /** |
| | | * This class represents the referral database which contains URIs from referral |
| | | * This class represents the referral tree which contains URIs from referral |
| | | * entries. |
| | | * <p> |
| | | * The key is the DN of the referral entry and the value is that of a pair |
| | |
| | | * duplicated in the value because the key is suitable for comparisons but is |
| | | * not reversible to a valid DN. 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. |
| | | * as in dn2id so that all referrals in a subtree can be retrieved by cursoring |
| | | * through a range of the records. |
| | | */ |
| | | class DN2URI extends AbstractDatabaseContainer |
| | | class DN2URI extends AbstractTree |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | |
| | | |
| | | /** |
| | | * A flag that indicates whether there are any referrals contained in this |
| | | * database. It should only be set to {@code false} when it is known that |
| | | * tree. It should only be set to {@code false} when it is known that |
| | | * there are no referrals. |
| | | */ |
| | | private volatile ConditionResult containsReferrals = |
| | |
| | | |
| | | |
| | | /** |
| | | * Create a new object representing a referral database in a given |
| | | * Create a new object representing a referral tree in a given |
| | | * entryContainer. |
| | | * |
| | | * @param treeName |
| | | * The name of the referral database. |
| | | * The name of the referral tree. |
| | | * @param entryContainer |
| | | * The entryContainer of the DN database. |
| | | * The entryContainer of the DN tree. |
| | | * @throws StorageRuntimeException |
| | | * If an error occurs in the database. |
| | | * If an error occurs in the storage. |
| | | */ |
| | | DN2URI(TreeName treeName, EntryContainer entryContainer) throws StorageRuntimeException |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Puts a URI value in the referral database. |
| | | * Puts a URI value in the referral tree. |
| | | * |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param dn The DN of the referral entry. |
| | | * @param labeledURIs The labeled URI value of the ref attribute. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | private void put(final WriteableTransaction txn, final DN dn, final Collection<String> labeledURIs) |
| | | throws StorageRuntimeException |
| | |
| | | } |
| | | |
| | | /** |
| | | * Delete URI values for a given referral entry from the referral database. |
| | | * Delete URI values for a given referral entry from the referral tree. |
| | | * |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param dn The DN of the referral entry for which URI values are to be |
| | | * deleted. |
| | | * @return true if the values were deleted, false if not. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | private boolean delete(WriteableTransaction txn, DN dn) throws StorageRuntimeException |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Delete a single URI value from the referral database. |
| | | * @param txn a non null database transaction |
| | | * Delete a single URI value from the referral tree. |
| | | * @param txn a non null transaction |
| | | * @param dn The DN of the referral entry. |
| | | * @param labeledURIs The URI value to be deleted. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | private void delete(final WriteableTransaction txn, final DN dn, final Collection<String> labeledURIs) |
| | | throws StorageRuntimeException |
| | |
| | | } |
| | | |
| | | /** |
| | | * Indicates whether the underlying database contains any referrals. |
| | | * Indicates whether the underlying tree contains any referrals. |
| | | * |
| | | * @param txn The transaction to use when making the determination. |
| | | * @return {@code true} if it is believed that the underlying database may |
| | | * @return {@code true} if it is believed that the underlying tree may |
| | | * contain at least one referral, or {@code false} if it is certain |
| | | * that it doesn't. |
| | | */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Update the referral database for an entry that has been modified. Does |
| | | * Update the referral tree 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. |
| | | * |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param before The entry before the modifications have been applied. |
| | | * @param after The entry after the modifications have been applied. |
| | | * @param mods The sequence of modifications made to the entry. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | void modifyEntry(WriteableTransaction txn, Entry before, Entry after, List<Modification> mods) |
| | | throws StorageRuntimeException |
| | |
| | | } |
| | | |
| | | /** |
| | | * Update the referral database for an entry that has been replaced. Does not |
| | | * Update the referral tree 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. |
| | | * |
| | | * @param txn |
| | | * A database transaction used for the update, or null if none is |
| | | * A transaction used for the update, or null if none is |
| | | * required. |
| | | * @param before |
| | | * The entry before it was replaced. |
| | | * @param after |
| | | * The entry after it was replaced. |
| | | * @throws StorageRuntimeException |
| | | * If an error occurs in the database. |
| | | * If an error occurs in the storage. |
| | | */ |
| | | void replaceEntry(WriteableTransaction txn, Entry before, Entry after) |
| | | throws StorageRuntimeException |
| | |
| | | } |
| | | |
| | | /** |
| | | * Update the referral database for a new entry. Does nothing if the entry |
| | | * Update the referral tree for a new entry. Does nothing if the entry |
| | | * is not a referral entry. |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param entry The entry to be added. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | void addEntry(WriteableTransaction txn, Entry entry) |
| | | throws StorageRuntimeException |
| | |
| | | } |
| | | |
| | | /** |
| | | * Update the referral database for a deleted entry. Does nothing if the entry |
| | | * Update the referral tree for a deleted entry. Does nothing if the entry |
| | | * was not a referral entry. |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param entry The entry to be deleted. |
| | | * @throws StorageRuntimeException If an error occurs in the database. |
| | | * @throws StorageRuntimeException If an error occurs in the storage. |
| | | */ |
| | | void deleteEntry(WriteableTransaction txn, Entry entry) throws StorageRuntimeException |
| | | { |
| | |
| | | |
| | | /** |
| | | * Process referral entries that are above the target DN of an operation. |
| | | * @param txn a non null database transaction |
| | | * @param txn a non null transaction |
| | | * @param targetDN The target DN of the operation, or the base object of a |
| | | * search operation. |
| | | * @param searchScope The scope of the search operation, or null if the |
| | |
| | | |
| | | /** |
| | | * Return search result references for a search operation using the referral |
| | | * database to find all referral entries within scope of the search. |
| | | * @param txn a non null database transaction |
| | | * tree to find all referral entries within scope of the search. |
| | | * @param txn a non null transaction |
| | | * @param searchOp The search operation for which search result references |
| | | * should be returned. |
| | | * @return <CODE>true</CODE> if the caller should continue processing the |