| | |
| | | * |
| | | * |
| | | * Copyright 2007-2009 Sun Microsystems, Inc. |
| | | * Portions copyright 2014 ForgeRock AS. |
| | | * Portions Copyright 2014 ForgeRock AS |
| | | */ |
| | | |
| | | package org.forgerock.opendj.config.client.ldap; |
| | |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.Entry; |
| | | import org.forgerock.opendj.ldap.ErrorResultException; |
| | | import org.forgerock.opendj.ldap.LdapException; |
| | | import org.forgerock.opendj.ldap.LinkedAttribute; |
| | | import org.forgerock.opendj.ldap.LinkedHashMapEntry; |
| | | import org.forgerock.opendj.ldap.ModificationType; |
| | |
| | | * {@inheritDoc} |
| | | */ |
| | | @Override |
| | | protected void addNewManagedObject() throws ErrorResultException, OperationRejectedException, |
| | | protected void addNewManagedObject() throws LdapException, OperationRejectedException, |
| | | ConcurrentModificationException, ManagedObjectAlreadyExistsException { |
| | | // First make sure that the parent managed object still exists. |
| | | ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition(); |
| | |
| | | // Create the entry. |
| | | try { |
| | | driver.getLDAPConnection().add(entry); |
| | | } catch (ErrorResultException e) { |
| | | } catch (LdapException e) { |
| | | if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) { |
| | | LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage()); |
| | | throw new OperationRejectedException(OperationType.CREATE, d.getUserFriendlyName(), m); |
| | |
| | | try { |
| | | // Create the entry. |
| | | driver.getLDAPConnection().add(entry); |
| | | } catch (ErrorResultException e) { |
| | | } catch (LdapException e) { |
| | | if (e.getResult().getResultCode() == ResultCode.ENTRY_ALREADY_EXISTS) { |
| | | throw new ManagedObjectAlreadyExistsException(); |
| | | } else if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) { |
| | |
| | | */ |
| | | @Override |
| | | protected void modifyExistingManagedObject() throws ConcurrentModificationException, OperationRejectedException, |
| | | ErrorResultException { |
| | | LdapException { |
| | | // Build the modify request |
| | | ManagedObjectPath<?, ?> path = getManagedObjectPath(); |
| | | DN dn = DNBuilder.create(path, driver.getLDAPProfile()); |
| | |
| | | if (!request.getModifications().isEmpty()) { |
| | | try { |
| | | driver.getLDAPConnection().modify(request); |
| | | } catch (ErrorResultException e) { |
| | | } catch (LdapException e) { |
| | | if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) { |
| | | LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage()); |
| | | throw new OperationRejectedException(OperationType.MODIFY, d.getUserFriendlyName(), m); |