Suffix.java revision f0a048d41a13eca4cba405da9403c2469ca3d1ea
/*
* 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 legal-notices/CDDLv1_0.txt
* 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 legal-notices/CDDLv1_0.txt.
* 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
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
* Portions Copyright 2014-2015 ForgeRock AS
*/
/**
* The class represents a suffix that is to be loaded during an import, or
* rebuild index process. Multiple instances of this class can be instantiated
* during and import to support multiple suffixes in a backend. A rebuild
* index has only one of these instances.
*/
class Suffix
{
private final EntryContainer srcEntryContainer;
private final EntryContainer entryContainer;
/**
* Creates a suffix instance using the specified parameters.
*
* @param entryContainer The entry container pertaining to the suffix.
* @param srcEntryContainer The original entry container.
* @param includeBranches The include branches.
* @param excludeBranches The exclude branches.
*/
{
this.entryContainer = entryContainer;
this.srcEntryContainer = srcEntryContainer;
if (includeBranches != null)
{
this.includeBranches = includeBranches;
}
else
{
}
if (excludeBranches != null)
{
this.excludeBranches = excludeBranches;
}
else
{
}
}
/**
* Returns the DN2ID instance pertaining to a suffix instance.
*
* @return A DN2ID instance that can be used to manipulate the DN2ID database.
*/
{
return entryContainer.getDN2ID();
}
/**
* Returns the ID2Entry instance pertaining to a suffix instance.
*
* @return A ID2Entry instance that can be used to manipulate the ID2Entry
* database.
*/
public ID2Entry getID2Entry()
{
return entryContainer.getID2Entry();
}
/**
* Returns the DN2URI instance pertaining to a suffix instance.
*
* @return A DN2URI instance that can be used to manipulate the DN2URI
* database.
*/
{
return entryContainer.getDN2URI();
}
/**
* Returns the entry container pertaining to a suffix instance.
*
* @return The entry container used to create a suffix instance.
*/
public EntryContainer getEntryContainer()
{
return entryContainer;
}
/**
* Return the Attribute Type - Index map used to map an attribute type to an
* index instance.
*
* @return A suffixes Attribute Type - Index map.
*/
{
return entryContainer.getAttributeIndexMap();
}
/**
* Make sure the specified parent DN is not in the pending map.
*
* @param parentDN The DN of the parent.
*/
{
if (l != null)
{
l.await();
}
}
/**
* Add specified DN to the pending map.
*
* @param dn The DN to add to the map.
*/
{
}
/**
* Remove the specified DN from the pending map, it may not exist if the
* entries are being migrated so just return.
*
* @param dn The DN to remove from the map.
*/
{
if(l != null)
{
l.countDown();
}
}
/**
* Return {@code true} if the specified dn is contained in the parent set, or
* in the specified DN cache. This would indicate that the parent has already
* been processed. It returns {@code false} otherwise.
*
* It will optionally check the dn2id database for the dn if the specified
* cleared backend boolean is {@code true}.
*
* @param txn a non null database transaction
* @param dn The DN to check for.
* @param dnCache The importer DN cache.
* @param clearedBackend Set to {@code true} if the import process cleared the
* backend before processing.
* @return {@code true} if the dn is contained in the parent ID, or
* {@code false} otherwise.
* @throws StorageRuntimeException If an error occurred searching the DN cache, or
* dn2id database.
* @throws InterruptedException If an error occurred processing the pending map
*/
public boolean isParentProcessed(ReadableTransaction txn, DN dn, DNCache dnCache, boolean clearedBackend)
throws StorageRuntimeException, InterruptedException {
synchronized(synchObject) {
{
return true;
}
}
//The DN was not in the parent set. Make sure it isn't pending.
try {
} catch (InterruptedException e) {
throw e;
}
// Either parent is in the DN cache,
// or else check the dn2id database for the DN (only if backend wasn't cleared)
|| (!clearedBackend
//Add the DN to the parent set if needed.
if (parentThere) {
synchronized(synchObject) {
}
}
}
return parentThere;
}
/**
* Sets the trusted status of all of the indexes and vlvIndexes.
*
* @param txn a non null database transaction
* @param trusted True if the indexes should be trusted or false otherwise.
* @throws StorageRuntimeException If an error occurred setting the indexes to trusted.
*/
public void setIndexesTrusted(WriteableTransaction txn, boolean trusted) throws StorageRuntimeException
{
{
}
{
}
}
private void setTrusted(WriteableTransaction txn, Collection<MatchingRuleIndex> indexes, boolean trusted)
{
{
{
}
}
}
/**
* Return a src entry container.
*
* @return The src entry container.
*/
public EntryContainer getSrcEntryContainer()
{
return this.srcEntryContainer;
}
/**
* Return include branches.
*
* @return The include branches.
*/
{
return this.includeBranches;
}
/**
* Return exclude branches.
*
* @return the exclude branches.
*/
{
return this.excludeBranches;
}
/**
* Return base DN.
*
* @return The base DN.
*/
{
return this.baseDN;
}
}