| | |
| | | import org.opends.server.admin.client.ConcurrentModificationException; |
| | | import org.opends.server.admin.client.ManagedObject; |
| | | import org.opends.server.admin.client.OperationRejectedException; |
| | | import org.opends.server.admin.client.OperationRejectedException.OperationType; |
| | | import org.opends.server.admin.client.spi.AbstractManagedObject; |
| | | import org.opends.server.admin.client.spi.Driver; |
| | | import org.opends.server.admin.client.spi.Property; |
| | |
| | | CommunicationException, OperationRejectedException, |
| | | ConcurrentModificationException, ManagedObjectAlreadyExistsException { |
| | | // First make sure that the parent managed object still exists. |
| | | ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition(); |
| | | ManagedObjectPath<?, ?> path = getManagedObjectPath(); |
| | | ManagedObjectPath<?, ?> parent = path.parent(); |
| | | |
| | |
| | | // TODO: this implementation does not handle relations which |
| | | // comprise of more than one RDN arc (this will probably never |
| | | // be required anyway). |
| | | LdapName dn = LDAPNameBuilder |
| | | .create(parent, ir, driver.getLDAPProfile()); |
| | | LdapName dn = LDAPNameBuilder.create(parent, ir, driver.getLDAPProfile()); |
| | | if (!driver.entryExists(dn)) { |
| | | // We need to create the entry. |
| | | Attributes attributes = new BasicAttributes(); |
| | |
| | | } catch (OperationNotSupportedException e) { |
| | | // Unwilling to perform. |
| | | if (e.getMessage() == null) { |
| | | throw new OperationRejectedException(); |
| | | throw new OperationRejectedException(OperationType.CREATE, d |
| | | .getUserFriendlyName()); |
| | | } else { |
| | | Message m = Message.raw("%s", e.getMessage()); |
| | | throw new OperationRejectedException(m); |
| | | throw new OperationRejectedException(OperationType.CREATE, d |
| | | .getUserFriendlyName(), m); |
| | | } |
| | | } catch (NamingException e) { |
| | | driver.adaptNamingException(e); |
| | |
| | | } catch (OperationNotSupportedException e) { |
| | | // Unwilling to perform. |
| | | if (e.getMessage() == null) { |
| | | throw new OperationRejectedException(); |
| | | throw new OperationRejectedException(OperationType.CREATE, d |
| | | .getUserFriendlyName()); |
| | | } else { |
| | | Message m = Message.raw("%s", e.getMessage()); |
| | | throw new OperationRejectedException(m); |
| | | throw new OperationRejectedException(OperationType.CREATE, d |
| | | .getUserFriendlyName(), m); |
| | | } |
| | | } catch (NamingException e) { |
| | | driver.adaptNamingException(e); |
| | |
| | | AuthorizationException, CommunicationException { |
| | | // Build the list of modified attributes. |
| | | Attributes mods = new BasicAttributes(); |
| | | ManagedObjectDefinition<?, ?> definition = getManagedObjectDefinition(); |
| | | for (PropertyDefinition<?> pd : definition.getAllPropertyDefinitions()) { |
| | | ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition(); |
| | | for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) { |
| | | Property<?> p = getProperty(pd); |
| | | if (p.isModified()) { |
| | | String attrID = driver.getLDAPProfile().getAttributeName(definition, |
| | | pd); |
| | | String attrID = driver.getLDAPProfile().getAttributeName(d, pd); |
| | | Attribute attribute = new BasicAttribute(attrID); |
| | | encodeProperty(attribute, pd); |
| | | mods.put(attribute); |
| | |
| | | } catch (OperationNotSupportedException e) { |
| | | // Unwilling to perform. |
| | | if (e.getMessage() == null) { |
| | | throw new OperationRejectedException(); |
| | | throw new OperationRejectedException(OperationType.MODIFY, d |
| | | .getUserFriendlyName()); |
| | | } else { |
| | | Message m = Message.raw("%s", e.getMessage()); |
| | | throw new OperationRejectedException(m); |
| | | throw new OperationRejectedException(OperationType.MODIFY, d |
| | | .getUserFriendlyName(), m); |
| | | } |
| | | } catch (NamingException e) { |
| | | // Just treat it as a communication problem. |