| | |
| | | private Backend backend; |
| | | |
| | | /** |
| | | * The root container in which this entryContainer belongs. |
| | | */ |
| | | private RootContainer rootContainer; |
| | | |
| | | /** |
| | | * The baseDN this entry container is responsible for. |
| | | */ |
| | | private DN baseDN; |
| | |
| | | * 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 env The JE environment to create this entryContainer in. |
| | | * @param rootContainer The root container this entry container is in. |
| | | */ |
| | | public EntryContainer(DN baseDN, Backend backend, Config config, |
| | | Environment env) |
| | | Environment env, RootContainer rootContainer) |
| | | { |
| | | this.backend = backend; |
| | | this.baseDN = baseDN; |
| | | this.config = config; |
| | | this.env = env; |
| | | this.rootContainer = rootContainer; |
| | | |
| | | // Instantiate the list of database handles. |
| | | databases = new ArrayList<Database>(); |
| | |
| | | * The entryContainer must already be open. |
| | | * |
| | | * @return The highest entry ID. |
| | | * @throws JebException If an error occurs in the JE backend. |
| | | * @throws DatabaseException If an error occurs in the JE database. |
| | | */ |
| | | public EntryID getHighestEntryID() throws JebException, DatabaseException |
| | | public EntryID getHighestEntryID() throws DatabaseException |
| | | { |
| | | EntryID entryID = new EntryID(0); |
| | | Cursor cursor = id2entry.openCursor(null, null); |
| | |
| | | // First time through, assign the next entryID. |
| | | if (entryID == null) |
| | | { |
| | | entryID = EntryID.assignNext(); |
| | | entryID = rootContainer.getNextEntryID(); |
| | | } |
| | | |
| | | // Insert into dn2id. |
| | |
| | | DirectoryException, |
| | | JebException |
| | | { |
| | | DN requestedNewSuperiorDN = modifyDNOperation.getNewSuperior(); |
| | | DN requestedNewSuperiorDN = null; |
| | | |
| | | if(modifyDNOperation != null) |
| | | { |
| | | requestedNewSuperiorDN = modifyDNOperation.getNewSuperior(); |
| | | } |
| | | |
| | | // Check whether the renamed entry already exists. |
| | | if (dn2id.get(txn, newApexEntry.getDN()) != null) |
| | |
| | | // 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. |
| | | newApexID = EntryID.assignNext(); |
| | | newApexID = rootContainer.getNextEntryID(); |
| | | } |
| | | } |
| | | |
| | |
| | | EntryID newID = oldID; |
| | | if (!newApexID.equals(oldApexID)) |
| | | { |
| | | newID = EntryID.assignNext(); |
| | | newID = rootContainer.getNextEntryID(); |
| | | } |
| | | |
| | | // Move this entry. |
| | |
| | | dn2uri.replaceEntry(txn, oldEntry, newEntry); |
| | | |
| | | // Remove the old ID from id2entry. |
| | | if (!newID.equals(oldID)) |
| | | if (!newID.equals(oldID) || modifyDNOperation == null) |
| | | { |
| | | id2entry.remove(txn, oldID); |
| | | |
| | |
| | | * @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. |
| | | */ |
| | | private void renameApexEntry(Transaction txn, EntryID entryID, |
| | | Entry oldEntry, Entry newEntry) |
| | | throws DirectoryException, DatabaseException |
| | | throws DirectoryException, DatabaseException, JebException |
| | | { |
| | | DN oldDN = oldEntry.getDN(); |
| | | DN newDN = newEntry.getDN(); |
| | |
| | | // Replace the entry in id2entry. |
| | | id2entry.put(txn, entryID, newEntry); |
| | | |
| | | // Update indexes only for those attributes that changed. |
| | | indexModifications(txn, oldEntry, newEntry, entryID, |
| | | modifyDNOperation.getModifications()); |
| | | if(modifyDNOperation == null) |
| | | { |
| | | // Remove the old ID from the indexes. |
| | | indexRemoveEntry(txn, oldEntry, entryID); |
| | | |
| | | // Insert the new ID into the indexes. |
| | | indexInsertEntry(txn, newEntry, entryID); |
| | | } |
| | | else |
| | | { |
| | | // Update indexes only for those attributes that changed. |
| | | indexModifications(txn, oldEntry, newEntry, entryID, |
| | | modifyDNOperation.getModifications()); |
| | | } |
| | | |
| | | // Remove the entry from the entry cache. |
| | | EntryCache entryCache = DirectoryServer.getEntryCache(); |
| | |
| | | */ |
| | | public static boolean isManageDsaITOperation(Operation operation) |
| | | { |
| | | List<Control> controls = operation.getRequestControls(); |
| | | if (controls != null) |
| | | if(operation != null) |
| | | { |
| | | for (Control control : controls) |
| | | List<Control> controls = operation.getRequestControls(); |
| | | if (controls != null) |
| | | { |
| | | if (control.getOID().equals(ServerConstants.OID_MANAGE_DSAIT_CONTROL)) |
| | | for (Control control : controls) |
| | | { |
| | | return true; |
| | | if (control.getOID().equals(ServerConstants.OID_MANAGE_DSAIT_CONTROL)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | } |