| | |
| | | * Prevents name clashes for common indexes (like id2entry) across multiple suffixes. |
| | | * For example when a root container contains multiple suffixes. |
| | | */ |
| | | private String databasePrefix; |
| | | private final String databasePrefix; |
| | | |
| | | /** |
| | | * This class is responsible for managing the configuration for attribute |
| | |
| | | * @return A reference to the root container in which this entry container |
| | | * exists. |
| | | */ |
| | | public RootContainer getRootContainer() |
| | | RootContainer getRootContainer() |
| | | { |
| | | return rootContainer; |
| | | } |
| | |
| | | * |
| | | * @return The DN database. |
| | | */ |
| | | public DN2ID getDN2ID() |
| | | DN2ID getDN2ID() |
| | | { |
| | | return dn2id; |
| | | } |
| | |
| | | * |
| | | * @return The entry database. |
| | | */ |
| | | public ID2Entry getID2Entry() |
| | | ID2Entry getID2Entry() |
| | | { |
| | | return id2entry; |
| | | } |
| | |
| | | * |
| | | * @return The referral database. |
| | | */ |
| | | public DN2URI getDN2URI() |
| | | DN2URI getDN2URI() |
| | | { |
| | | return dn2uri; |
| | | } |
| | |
| | | * |
| | | * @return The children database. |
| | | */ |
| | | public Index getID2Children() |
| | | Index getID2Children() |
| | | { |
| | | return id2children; |
| | | } |
| | |
| | | * |
| | | * @return The subtree database. |
| | | */ |
| | | public Index getID2Subtree() |
| | | Index getID2Subtree() |
| | | { |
| | | return id2subtree; |
| | | } |
| | | |
| | | /** |
| | | * Get the state database used by this entry container. |
| | | * The entry container must have been opened. |
| | | * |
| | | * @return The state database. |
| | | */ |
| | | public State getState() |
| | | { |
| | | return state; |
| | | } |
| | | |
| | | /** |
| | | * 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 map. |
| | | */ |
| | | public Map<AttributeType, AttributeIndex> getAttributeIndexMap() { |
| | | Map<AttributeType, AttributeIndex> getAttributeIndexMap() |
| | | { |
| | | return attrIndexMap; |
| | | } |
| | | |
| | |
| | | * |
| | | * @return All attribute indexes defined in this entry container. |
| | | */ |
| | | public Collection<AttributeIndex> getAttributeIndexes() |
| | | Collection<AttributeIndex> getAttributeIndexes() |
| | | { |
| | | return attrIndexMap.values(); |
| | | } |
| | |
| | | * |
| | | * @return The collection of VLV indexes defined in this entry container. |
| | | */ |
| | | public Collection<VLVIndex> getVLVIndexes() |
| | | Collection<VLVIndex> getVLVIndexes() |
| | | { |
| | | return vlvIndexMap.values(); |
| | | } |
| | |
| | | Entry getEntry(ReadableStorage txn, EntryID entryID) throws DirectoryException |
| | | { |
| | | // Try the entry cache first. |
| | | final EntryCache entryCache = getEntryCache(); |
| | | final EntryCache<?> entryCache = getEntryCache(); |
| | | final Entry cacheEntry = entryCache.getEntry(backend, entryID.longValue()); |
| | | if (cacheEntry != null) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Get the number of values for which the entry limit has been exceeded |
| | | * since the entry container was opened. |
| | | * @return The number of values for which the entry limit has been exceeded. |
| | | */ |
| | | public int getEntryLimitExceededCount() |
| | | { |
| | | int count = 0; |
| | | count += id2children.getEntryLimitExceededCount(); |
| | | count += id2subtree.getEntryLimitExceededCount(); |
| | | for (AttributeIndex index : attrIndexMap.values()) |
| | | { |
| | | count += index.getEntryLimitExceededCount(); |
| | | } |
| | | return count; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Get a list of the databases opened by the entryContainer. |
| | |
| | | * |
| | | * @return The container name for the base DN. |
| | | */ |
| | | public String getDatabasePrefix() |
| | | String getDatabasePrefix() |
| | | { |
| | | return databasePrefix; |
| | | } |
| | |
| | | * @param newBaseDN The new database prefix to use. |
| | | * @throws StorageRuntimeException If an error occurs in the JE database. |
| | | */ |
| | | public void setDatabasePrefix(final String newBaseDN) throws StorageRuntimeException |
| | | void setDatabasePrefix(final String newBaseDN) throws StorageRuntimeException |
| | | { |
| | | final List<DatabaseContainer> databases = new ArrayList<DatabaseContainer>(); |
| | | listDatabases(databases); |
| | |
| | | * @param database The database to clear. |
| | | * @throws StorageRuntimeException if a JE database error occurs. |
| | | */ |
| | | public void clearDatabase(WriteableStorage txn, DatabaseContainer database) throws StorageRuntimeException |
| | | void clearDatabase(WriteableStorage txn, DatabaseContainer database) |
| | | throws StorageRuntimeException |
| | | { |
| | | database.close(); |
| | | try |
| | |
| | | } |
| | | |
| | | /** Get the exclusive lock. */ |
| | | public void lock() { |
| | | void lock() |
| | | { |
| | | exclusiveLock.lock(); |
| | | } |
| | | |
| | | /** Unlock the exclusive lock. */ |
| | | public void unlock() { |
| | | void unlock() |
| | | { |
| | | exclusiveLock.unlock(); |
| | | } |
| | | |