| | |
| | | if (entry != null) |
| | | { |
| | | boolean isInScope = false; |
| | | DN entryDN = entry.getDN(); |
| | | DN entryDN = entry.getName(); |
| | | |
| | | if (candidatesAreInScope) |
| | | { |
| | |
| | | throws DatabaseException, DirectoryException, CanceledOperationException |
| | | { |
| | | Transaction txn = beginTransaction(); |
| | | DN parentDN = getParentWithinBase(entry.getDN()); |
| | | DN parentDN = getParentWithinBase(entry.getName()); |
| | | |
| | | try |
| | | { |
| | | // Check whether the entry already exists. |
| | | if (dn2id.get(txn, entry.getDN(), LockMode.DEFAULT) != null) |
| | | if (dn2id.get(txn, entry.getName(), LockMode.DEFAULT) != null) |
| | | { |
| | | Message message = |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getDN().toString()); |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | if (parentDN != null) |
| | | { |
| | | // Check for referral entries above the target. |
| | | dn2uri.targetEntryReferrals(entry.getDN(), null); |
| | | dn2uri.targetEntryReferrals(entry.getName(), null); |
| | | |
| | | // Read the parent ID from dn2id. |
| | | parentID = dn2id.get(txn, parentDN, LockMode.DEFAULT); |
| | | if (parentID == null) |
| | | { |
| | | Message message = ERR_JEB_ADD_NO_SUCH_OBJECT.get( |
| | | entry.getDN().toString()); |
| | | entry.getName().toString()); |
| | | DN matchedDN = getMatchedDN(baseDN); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | message, matchedDN, null); |
| | |
| | | EntryID entryID = rootContainer.getNextEntryID(); |
| | | |
| | | // Insert into dn2id. |
| | | if (!dn2id.insert(txn, entry.getDN(), entryID)) |
| | | if (!dn2id.insert(txn, entry.getName(), entryID)) |
| | | { |
| | | // Do not ever expect to come through here. |
| | | Message message = |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getDN().toString()); |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | { |
| | | // Do not ever expect to come through here. |
| | | Message message = |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getDN().toString()); |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | { |
| | | // Do not ever expect to come through here. |
| | | Message message = |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getDN().toString()); |
| | | ERR_JEB_ADD_ENTRY_ALREADY_EXISTS.get(entry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | EntryCache<?> entryCache = DirectoryServer.getEntryCache(); |
| | | if (entryCache != null) |
| | | { |
| | | entryCache.removeEntry(entry.getDN()); |
| | | entryCache.removeEntry(entry.getName()); |
| | | } |
| | | } |
| | | |
| | |
| | | try |
| | | { |
| | | // Read dn2id. |
| | | EntryID entryID = dn2id.get(txn, newEntry.getDN(), LockMode.RMW); |
| | | EntryID entryID = dn2id.get(txn, newEntry.getName(), LockMode.RMW); |
| | | if (entryID == null) |
| | | { |
| | | // The entry does not exist. |
| | | Message message = |
| | | ERR_JEB_MODIFY_NO_SUCH_OBJECT.get(newEntry.getDN().toString()); |
| | | ERR_JEB_MODIFY_NO_SUCH_OBJECT.get(newEntry.getName().toString()); |
| | | DN matchedDN = getMatchedDN(baseDN); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | message, matchedDN, null); |
| | |
| | | { |
| | | Transaction txn = beginTransaction(); |
| | | DN oldSuperiorDN = getParentWithinBase(currentDN); |
| | | DN newSuperiorDN = getParentWithinBase(entry.getDN()); |
| | | DN newSuperiorDN = getParentWithinBase(entry.getName()); |
| | | boolean isApexEntryMoved; |
| | | |
| | | if(oldSuperiorDN != null) |
| | |
| | | try |
| | | { |
| | | // Check whether the renamed entry already exists. |
| | | if (!currentDN.equals(entry.getDN()) && |
| | | dn2id.get(txn, entry.getDN(), LockMode.DEFAULT) != null) |
| | | if (!currentDN.equals(entry.getName()) && |
| | | dn2id.get(txn, entry.getName(), LockMode.DEFAULT) != null) |
| | | { |
| | | Message message = ERR_JEB_MODIFYDN_ALREADY_EXISTS.get( |
| | | entry.getDN().toString()); |
| | | entry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | "Old entry ID: %d " + |
| | | "New entry ID: %d " + |
| | | "New Superior ID: %d" + |
| | | oldApexEntry.getDN(), entry.getDN(), |
| | | oldApexEntry.getName(), entry.getName(), |
| | | oldApexID.longValue(), newApexID.longValue(), |
| | | newSuperiorID.longValue()); |
| | | } |
| | |
| | | Entry oldEntry = id2entry.get(txn, oldID, LockMode.DEFAULT); |
| | | |
| | | // Construct the new DN of the entry. |
| | | DN newDN = modDN(oldEntry.getDN(), |
| | | DN newDN = modDN(oldEntry.getName(), |
| | | currentDN.size(), |
| | | entry.getDN()); |
| | | entry.getName()); |
| | | |
| | | // Assign a new entry ID if we are renumbering. |
| | | EntryID newID = oldID; |
| | |
| | | "New DN: %s " + |
| | | "Old entry ID: %d " + |
| | | "New entry ID: %d", |
| | | oldEntry.getDN(), newDN, oldID.longValue(), |
| | | oldEntry.getName(), newDN, oldID.longValue(), |
| | | newID.longValue()); |
| | | } |
| | | } |
| | |
| | | ModifyDNOperation modifyDNOperation) |
| | | throws DirectoryException, DatabaseException |
| | | { |
| | | if (!dn2id.insert(txn, newEntry.getDN(), newID)) |
| | | if (!dn2id.insert(txn, newEntry.getName(), newID)) |
| | | { |
| | | Message message = ERR_JEB_MODIFYDN_ALREADY_EXISTS.get( |
| | | newEntry.getDN().toString()); |
| | | newEntry.getName().toString()); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | message); |
| | | } |
| | |
| | | EntryID parentID; |
| | | byte[] parentIDKeyBytes; |
| | | boolean isParent = true; |
| | | for (DN dn = getParentWithinBase(newEntry.getDN()); dn != null; |
| | | for (DN dn = getParentWithinBase(newEntry.getName()); dn != null; |
| | | dn = getParentWithinBase(dn)) |
| | | { |
| | | parentID = dn2id.get(txn, dn, LockMode.DEFAULT); |
| | |
| | | MovedEntry tail) |
| | | throws DirectoryException, DatabaseException |
| | | { |
| | | DN oldDN = oldEntry.getDN(); |
| | | DN oldDN = oldEntry.getName(); |
| | | |
| | | // Remove the old DN from dn2id. |
| | | dn2id.remove(txn, oldDN); |
| | |
| | | MovedEntry tail) |
| | | throws DirectoryException, DatabaseException |
| | | { |
| | | DN oldDN = oldEntry.getDN(); |
| | | DN oldDN = oldEntry.getName(); |
| | | Entry newEntry = oldEntry.duplicate(false); |
| | | newEntry.setDN(newDN); |
| | | List<Modification> modifications = |