| | |
| | | DN entryDN = e.getName(); |
| | | if (entryMap.containsKey(entryDN)) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_ALREADY_EXISTS.get(String.valueOf(entryDN)); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, message); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | ERR_MEMORYBACKEND_ENTRY_ALREADY_EXISTS.get(entryDN)); |
| | | } |
| | | |
| | | |
| | |
| | | DN parentDN = entryDN.getParentDNInSuffix(); |
| | | if (parentDN == null) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_BELONG.get(String.valueOf(entryDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_BELONG.get(entryDN)); |
| | | } |
| | | else if (! entryMap.containsKey(parentDN)) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_PARENT_DOESNT_EXIST.get( |
| | | String.valueOf(entryDN), String.valueOf(parentDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_PARENT_DOESNT_EXIST.get(entryDN, parentDN)); |
| | | } |
| | | |
| | | entryMap.put(entryDN, e); |
| | |
| | | // Make sure the entry exists. If not, then throw an exception. |
| | | if (! entryMap.containsKey(entryDN)) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(String.valueOf(entryDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(entryDN)); |
| | | } |
| | | |
| | | |
| | |
| | | // an exception. |
| | | if ((children != null) && (! children.isEmpty())) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_CANNOT_DELETE_ENTRY_WITH_CHILDREN. |
| | | get(String.valueOf(entryDN)); |
| | | throw new DirectoryException( |
| | | ResultCode.NOT_ALLOWED_ON_NONLEAF, message); |
| | | throw new DirectoryException(ResultCode.NOT_ALLOWED_ON_NONLEAF, |
| | | ERR_MEMORYBACKEND_CANNOT_DELETE_ENTRY_WITH_CHILDREN.get(entryDN)); |
| | | } |
| | | } |
| | | |
| | |
| | | DN entryDN = e.getName(); |
| | | if (! entryMap.containsKey(entryDN)) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(String.valueOf(entryDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(entryDN)); |
| | | } |
| | | |
| | | |
| | |
| | | // Make sure that the target entry exists. |
| | | if (! entryMap.containsKey(currentDN)) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(String.valueOf(currentDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(currentDN)); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | else |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_CANNOT_RENAME_ENRY_WITH_CHILDREN. |
| | | get(String.valueOf(currentDN)); |
| | | throw new DirectoryException( |
| | | ResultCode.NOT_ALLOWED_ON_NONLEAF, message); |
| | | throw new DirectoryException(ResultCode.NOT_ALLOWED_ON_NONLEAF, |
| | | ERR_MEMORYBACKEND_CANNOT_RENAME_ENRY_WITH_CHILDREN.get(currentDN)); |
| | | } |
| | | } |
| | | |
| | |
| | | // Make sure that no entry exists with the new DN. |
| | | if (entryMap.containsKey(e.getName())) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_ENTRY_ALREADY_EXISTS.get( |
| | | String.valueOf(e.getName())); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, message); |
| | | throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, |
| | | ERR_MEMORYBACKEND_ENTRY_ALREADY_EXISTS.get(e.getName())); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (! matchFound) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_CANNOT_RENAME_TO_ANOTHER_BACKEND.get( |
| | | String.valueOf(currentDN)); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message); |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, |
| | | ERR_MEMORYBACKEND_CANNOT_RENAME_TO_ANOTHER_BACKEND.get(currentDN)); |
| | | } |
| | | |
| | | |
| | |
| | | DN parentDN = e.getName().getParentDNInSuffix(); |
| | | if ((parentDN == null) || (! entryMap.containsKey(parentDN))) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_RENAME_PARENT_DOESNT_EXIST.get( |
| | | String.valueOf(currentDN), String.valueOf(parentDN)); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message); |
| | | throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, |
| | | ERR_MEMORYBACKEND_RENAME_PARENT_DOESNT_EXIST.get(currentDN, parentDN)); |
| | | } |
| | | |
| | | |
| | |
| | | matchedDN = matchedDN.getParentDNInSuffix(); |
| | | } |
| | | |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(String.valueOf(baseDN)); |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_ENTRY_DOESNT_EXIST.get(baseDN); |
| | | throw new DirectoryException( |
| | | ResultCode.NO_SUCH_OBJECT, message, matchedDN, null); |
| | | } |
| | |
| | | { |
| | | logger.traceException(e); |
| | | |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_CANNOT_CREATE_LDIF_WRITER.get(String.valueOf(e)); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | ERR_MEMORYBACKEND_CANNOT_CREATE_LDIF_WRITER.get(e), e); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = ERR_MEMORYBACKEND_CANNOT_WRITE_ENTRY_TO_LDIF.get( |
| | | String.valueOf(entryDN), String.valueOf(e)); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | ERR_MEMORYBACKEND_CANNOT_WRITE_ENTRY_TO_LDIF.get(entryDN, e), e); |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_CANNOT_CREATE_LDIF_READER.get(String.valueOf(e)); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | ERR_MEMORYBACKEND_CANNOT_CREATE_LDIF_READER.get(e), e); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | if (! le.canContinueReading()) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ERROR_READING_LDIF.get(String.valueOf(e)); |
| | | throw new DirectoryException( |
| | | DirectoryServer.getServerErrorResultCode(), |
| | | message, le); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | ERR_MEMORYBACKEND_ERROR_READING_LDIF.get(e), le); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LocalizableMessage message = |
| | | ERR_MEMORYBACKEND_ERROR_DURING_IMPORT.get(String.valueOf(e)); |
| | | throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), |
| | | message, e); |
| | | ERR_MEMORYBACKEND_ERROR_DURING_IMPORT.get(e), e); |
| | | } |
| | | finally |
| | | { |