mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Nicolas Capponi
10.43.2013 70b0e3d553e5a2a896337730b6c0540488b78f08
OpenDJ 3 : config framework

Remove all remaining compilation errors in org.opends.server.admin packages

* Replace client.AuthorizationException and client.CommunicateException classes
by ErrorResultException from SDK
** Update stylesheets clientMO.xsl and metaMO.xsl to use ErrorResultException
in generated code

* Replace all javax.naming classes by SDK classes
** Remove JNDIDirContextAdaptor class

* Replace all remaining occurences of RDN, DN and Attribute classes from server
by SDK classes

* Other minor changes
3 files deleted
21 files modified
2620 ■■■■■ changed files
opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java 16 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java 13 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java 7 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/AuthorizationException.java 85 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java 119 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/CommunicationException.java 100 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java 716 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java 105 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java 290 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPConnection.java 83 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java 235 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java 243 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java 148 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java 66 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java 101 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/ANDCondition.java 6 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/Condition.java 42 ●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/Conditions.java 133 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java 9 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/IsPresentCondition.java 6 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/NOTCondition.java 6 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/condition/ORCondition.java 6 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/resources/stylesheets/clientMO.xsl 63 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/resources/stylesheets/metaMO.xsl 22 ●●●●● patch | view | raw | blame | history
opendj-admin/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
@@ -42,9 +42,7 @@
import java.util.MissingResourceException;
import java.util.SortedSet;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.ClientConstraintHandler;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
@@ -63,6 +61,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.admin.meta.RootCfgDefn;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ResultCode;
/**
@@ -495,7 +494,7 @@
         */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            // If all of this managed object's "enabled" properties are true
            // then any referenced managed objects must also be enabled.
            boolean needsEnabling = targetNeedsEnablingCondition.evaluate(context, managedObject);
@@ -547,7 +546,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            // The same constraint applies as for adds.
            return isAddAcceptable(context, managedObject, unacceptableReasons);
        }
@@ -566,7 +565,7 @@
         */
        @Override
        public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            // Any references to the deleted managed object should cause a
            // constraint violation.
            boolean isAcceptable = true;
@@ -593,7 +592,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            // If the modified managed object is disabled and there are some
            // active references then refuse the change.
            if (targetIsEnabledCondition.evaluate(context, managedObject)) {
@@ -628,7 +627,7 @@
        // object using this property.
        private <CC extends ConfigurationClient> List<ManagedObject<? extends CC>> findReferences(
                ManagementContext context, AbstractManagedObjectDefinition<CC, ?> mod, String name)
                throws AuthorizationException, CommunicationException {
                throws ErrorResultException {
            List<ManagedObject<? extends CC>> instances = findInstances(context, mod);
            Iterator<ManagedObject<? extends CC>> i = instances.iterator();
@@ -654,8 +653,7 @@
        // Find all instances of a specific type of managed object.
        @SuppressWarnings("unchecked")
        private <CC extends ConfigurationClient> List<ManagedObject<? extends CC>> findInstances(
                ManagementContext context, AbstractManagedObjectDefinition<CC, ?> mod) throws AuthorizationException,
                CommunicationException {
                ManagementContext context, AbstractManagedObjectDefinition<CC, ?> mod) throws ErrorResultException {
            List<ManagedObject<? extends CC>> instances = new LinkedList<ManagedObject<? extends CC>>();
            if (mod == RootCfgDefn.getInstance()) {
opendj-admin/src/main/java/org/opends/server/admin/ConfigurationClient.java
@@ -27,8 +27,7 @@
package org.opends.server.admin;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.client.ConcurrentModificationException;
import org.opends.server.admin.client.MissingMandatoryPropertiesException;
import org.opends.server.admin.client.OperationRejectedException;
@@ -71,14 +70,10 @@
     * @throws OperationRejectedException
     *             If the server refuses to add or modify this configuration due
     *             to some server-side constraint which cannot be satisfied.
     * @throws AuthorizationException
     *             If the server refuses to add or modify this configuration
     *             because the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
            ConcurrentModificationException, OperationRejectedException, AuthorizationException, CommunicationException;
            ConcurrentModificationException, OperationRejectedException, ErrorResultException;
}
opendj-admin/src/main/java/org/opends/server/admin/GenericConstraint.java
@@ -31,9 +31,8 @@
import java.util.Locale;
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.client.AuthorizationException;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.client.ClientConstraintHandler;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.condition.Condition;
@@ -63,7 +62,7 @@
         */
        @Override
        public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            if (!condition.evaluate(context, managedObject)) {
                unacceptableReasons.add(getSynopsis());
                return false;
@@ -77,7 +76,7 @@
         */
        @Override
        public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
                Collection<LocalizableMessage> unacceptableReasons) throws AuthorizationException, CommunicationException {
                Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
            if (!condition.evaluate(context, managedObject)) {
                unacceptableReasons.add(getSynopsis());
                return false;
opendj-admin/src/main/java/org/opends/server/admin/client/AuthorizationException.java
File was deleted
opendj-admin/src/main/java/org/opends/server/admin/client/ClientConstraintHandler.java
@@ -26,25 +26,21 @@
 */
package org.opends.server.admin.client;
import java.util.Collection;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.ManagedObjectPath;
/**
 * An interface for performing client-side constraint validation.
 * <p>
 * Constraints are evaluated immediately before the client performs a
 * write operation. If one or more constraints fails, the write
 * operation is refused and fails with an
 * {@link OperationRejectedException}.
 * Constraints are evaluated immediately before the client performs a write
 * operation. If one or more constraints fails, the write operation is refused
 * and fails with an {@link OperationRejectedException}.
 * <p>
 * A client constraint handler must override at least one of the
 * provided methods.
 * A client constraint handler must override at least one of the provided
 * methods.
 *
 * @see org.opends.server.admin.Constraint
 */
@@ -57,16 +53,13 @@
    // No implementation required.
  }
  /**
   * Determines whether or not the newly created managed object which
   * is about to be added to the server configuration satisfies this
   * constraint.
     * Determines whether or not the newly created managed object which is about
     * to be added to the server configuration satisfies this constraint.
   * <p>
   * If the constraint is not satisfied, the implementation must
   * return <code>false</code> and add a message describing why the
   * constraint was not satisfied.
     * If the constraint is not satisfied, the implementation must return
     * <code>false</code> and add a message describing why the constraint was
     * not satisfied.
   * <p>
   * The default implementation is to return <code>true</code>.
   *
@@ -75,33 +68,29 @@
   * @param managedObject
   *          The new managed object.
   * @param unacceptableReasons
   *          A list of messages to which error messages should be
   *          added.
   * @return Returns <code>true</code> if this constraint is
   *         satisfied, or <code>false</code> if it is not.
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this constraint is satisfied, or
     *         <code>false</code> if it is not.
   * @throws AuthorizationException
   *           If an authorization failure prevented this constraint
   *           from being evaluated.
     *             If an authorization failure prevented this constraint from
     *             being evaluated.
   * @throws CommunicationException
   *           If a communications problem prevented this constraint
   *           from being evaluated.
     *             If a communications problem prevented this constraint from
     *             being evaluated.
   */
  public boolean isAddAcceptable(ManagementContext context,
      ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)
      throws AuthorizationException, CommunicationException {
    public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
    return true;
  }
  /**
   * Determines whether or not the changes to an existing managed
   * object which are about to be committed to the server
   * configuration satisfies this constraint.
     * Determines whether or not the changes to an existing managed object which
     * are about to be committed to the server configuration satisfies this
     * constraint.
   * <p>
   * If the constraint is not satisfied, the implementation must
   * return <code>false</code> and add a message describing why the
   * constraint was not satisfied.
     * If the constraint is not satisfied, the implementation must return
     * <code>false</code> and add a message describing why the constraint was
     * not satisfied.
   * <p>
   * The default implementation is to return <code>true</code>.
   *
@@ -110,56 +99,44 @@
   * @param managedObject
   *          The modified managed object.
   * @param unacceptableReasons
   *          A list of messages to which error messages should be
   *          added.
   * @return Returns <code>true</code> if this modify is satisfied,
   *         or <code>false</code> if it is not.
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this modify is satisfied, or
     *         <code>false</code> if it is not.
   * @throws AuthorizationException
   *           If an authorization failure prevented this constraint
   *           from being evaluated.
     *             If an authorization failure prevented this constraint from
     *             being evaluated.
   * @throws CommunicationException
   *           If a communications problem prevented this constraint
   *           from being evaluated.
     *             If a communications problem prevented this constraint from
     *             being evaluated.
   */
  public boolean isModifyAcceptable(ManagementContext context,
      ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)
      throws AuthorizationException, CommunicationException {
    public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
    return true;
  }
  /**
   * Determines whether or not the existing managed object which is
   * about to be deleted from the server configuration satisfies this
   * constraint.
     * Determines whether or not the existing managed object which is about to
     * be deleted from the server configuration satisfies this constraint.
   * <p>
   * If the constraint is not satisfied, the implementation must
   * return <code>false</code> and add a message describing why the
   * constraint was not satisfied.
     * If the constraint is not satisfied, the implementation must return
     * <code>false</code> and add a message describing why the constraint was
     * not satisfied.
   * <p>
   * The default implementation is to return <code>true</code>.
   *
   * @param context
   *          The management context.
   * @param path
   *          The path of the managed object which is about to be
   *          deleted.
     *            The path of the managed object which is about to be deleted.
   * @param unacceptableReasons
   *          A list of messages to which error messages should be
   *          added.
   * @return Returns <code>true</code> if this constraint is
   *         satisfied, or <code>false</code> if it is not.
   * @throws AuthorizationException
   *           If an authorization failure prevented this constraint
   *           from being evaluated.
   * @throws CommunicationException
   *           If a communications problem prevented this constraint
   *           from being evaluated.
     *            A list of messages to which error messages should be added.
     * @return Returns <code>true</code> if this constraint is satisfied, or
     *         <code>false</code> if it is not.
     * @throws ErrorResultException
     *             If an error occurs.
   */
  public boolean isDeleteAcceptable(ManagementContext context,
      ManagedObjectPath<?, ?> path, Collection<LocalizableMessage> unacceptableReasons)
      throws AuthorizationException, CommunicationException {
    public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?, ?> path,
            Collection<LocalizableMessage> unacceptableReasons) throws ErrorResultException {
    return true;
  }
}
opendj-admin/src/main/java/org/opends/server/admin/client/CommunicationException.java
File was deleted
opendj-admin/src/main/java/org/opends/server/admin/client/ManagedObject.java
@@ -27,11 +27,10 @@
package org.opends.server.admin.client;
import java.util.Collection;
import java.util.SortedSet;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.DefaultBehaviorException;
@@ -52,115 +51,99 @@
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
/**
 * A generic interface for accessing client-side managed objects.
 * <p>
 * A managed object comprises of zero or more properties. A property
 * has associated with it three sets of property value(s). These are:
 * A managed object comprises of zero or more properties. A property has
 * associated with it three sets of property value(s). These are:
 * <ul>
 * <li><i>default value(s)</i> - these value(s) represent the
 * default behavior for the property when it has no active values.
 * When a property inherits its default value(s) from elsewhere (i.e.
 * a property in another managed object), the default value(s)
 * represent the active value(s) of the inherited property at the time
 * the managed object was retrieved
 * <li><i>active value(s)</i> - these value(s) represent the state
 * of the property at the time the managed object was retrieved
 * <li><i>pending value(s)</i> - these value(s) represent any
 * modifications made to the property's value(s) since the managed
 * object object was retrieved and before the changes have been
 * committed using the {@link #commit()} method, the pending values
 * can be empty indicating that the property should be modified back
 * to its default values.
 * <li><i>default value(s)</i> - these value(s) represent the default behavior
 * for the property when it has no active values. When a property inherits its
 * default value(s) from elsewhere (i.e. a property in another managed object),
 * the default value(s) represent the active value(s) of the inherited property
 * at the time the managed object was retrieved
 * <li><i>active value(s)</i> - these value(s) represent the state of the
 * property at the time the managed object was retrieved
 * <li><i>pending value(s)</i> - these value(s) represent any modifications made
 * to the property's value(s) since the managed object object was retrieved and
 * before the changes have been committed using the {@link #commit()} method,
 * the pending values can be empty indicating that the property should be
 * modified back to its default values.
 * </ul>
 * In addition, a property has an <i>effective state</i> defined by
 * its <i>effective values</i> which are derived by evaluating the
 * following rules in the order presented:
 * In addition, a property has an <i>effective state</i> defined by its
 * <i>effective values</i> which are derived by evaluating the following rules
 * in the order presented:
 * <ul>
 * <li>the <i>pending values</i> if defined and non-empty
 * <li>or, the <i>default values</i> if the pending values are
 * defined but are empty
 * <li>or, the <i>default values</i> if the pending values are defined but are
 * empty
 * <li>or, the <i>active values</i> if defined and non-empty
 * <li>or, the <i>default values</i> if there are no active values
 * <li>or, an empty set of values, if there are no default values.
 * </ul>
 *
 * @param <T>
 *          The type of client configuration represented by the client
 *          managed object.
 *            The type of client configuration represented by the client managed
 *            object.
 */
public interface ManagedObject<T extends ConfigurationClient> extends
    PropertyProvider {
public interface ManagedObject<T extends ConfigurationClient> extends PropertyProvider {
  /**
   * Adds this managed object to the server or commits any changes
   * made to it depending on whether or not the managed object already
   * exists on the server. Pending property values will be committed
   * to the managed object. If successful, the pending values will
   * become active values.
     * Adds this managed object to the server or commits any changes made to it
     * depending on whether or not the managed object already exists on the
     * server. Pending property values will be committed to the managed object.
     * If successful, the pending values will become active values.
   * <p>
   * See the class description for more information regarding pending
   * and active values.
     * See the class description for more information regarding pending and
     * active values.
   *
   * @throws ManagedObjectAlreadyExistsException
   *           If the managed object cannot be added to the server
   *           because it already exists.
     *             If the managed object cannot be added to the server because
     *             it already exists.
   * @throws MissingMandatoryPropertiesException
   *           If the managed object contains some mandatory
   *           properties which have been left undefined.
     *             If the managed object contains some mandatory properties
     *             which have been left undefined.
   * @throws ConcurrentModificationException
   *           If the managed object is being added to the server but
   *           its parent has been removed by another client, or if
   *           this managed object is being modified but it has been
   *           removed from the server by another client.
     *             If the managed object is being added to the server but its
     *             parent has been removed by another client, or if this managed
     *             object is being modified but it has been removed from the
     *             server by another client.
   * @throws OperationRejectedException
   *           If this managed object cannot be added or modified due
   *           to some client-side or server-side constraint which
   *           cannot be satisfied.
   * @throws AuthorizationException
   *           If the server refuses to add or modify this managed
   *           object because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object cannot be added or modified due to
     *             some client-side or server-side constraint which cannot be
     *             satisfied.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  void commit() throws ManagedObjectAlreadyExistsException,
      MissingMandatoryPropertiesException, ConcurrentModificationException,
      OperationRejectedException, AuthorizationException,
      CommunicationException;
    void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
            ConcurrentModificationException, OperationRejectedException, ErrorResultException;
  /**
   * Determines whether or not this managed object has been modified since it
   * was constructed.
   * In other words, whether or not the set of pending values differs from
   * the set of active values.
     * was constructed. In other words, whether or not the set of pending values
     * differs from the set of active values.
   *
   * @return Returns <code>true</code> if this managed object has been
   *         modified since it was constructed.
   */
  boolean isModified();
  /**
   * Creates a new child managed object bound to the specified
   * instantiable relation. The new managed object will initially not
   * contain any property values (including mandatory properties).
   * Once the managed object has been configured it can be added to
   * the server using the {@link #commit()} method.
     * Creates a new child managed object bound to the specified instantiable
     * relation. The new managed object will initially not contain any property
     * values (including mandatory properties). Once the managed object has been
     * configured it can be added to the server using the {@link #commit()}
     * method.
   *
   * @param <C>
   *          The expected type of the child managed object
   *          configuration client.
     *            The expected type of the child managed object configuration
     *            client.
   * @param <S>
   *          The expected type of the child managed object
   *          server configuration.
     *            The expected type of the child managed object server
     *            configuration.
   * @param <CC>
   *          The actual type of the added managed object
   *          configuration client.
     *            The actual type of the added managed object configuration
     *            client.
   * @param r
   *          The instantiable relation definition.
   * @param d
@@ -170,8 +153,7 @@
   * @param exceptions
   *          A collection in which to place any
   *          {@link DefaultBehaviorException}s that occurred whilst
   *          attempting to determine the managed object's default
   *          values.
     *            attempting to determine the managed object's default values.
   * @return Returns a new child managed object bound to the specified
   *         instantiable relation.
   * @throws IllegalManagedObjectNameException
@@ -180,30 +162,27 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   */
  <C extends ConfigurationClient, S extends Configuration, CC extends C>
  ManagedObject<CC> createChild(InstantiableRelationDefinition<C, S> r,
      ManagedObjectDefinition<CC, ? extends S> d, String name,
      Collection<DefaultBehaviorException> exceptions)
      throws IllegalManagedObjectNameException, IllegalArgumentException;
    <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
            InstantiableRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d, String name,
            Collection<DefaultBehaviorException> exceptions) throws IllegalManagedObjectNameException,
            IllegalArgumentException;
  /**
   * Creates a new child managed object bound to the specified
   * optional relation. The new managed object will initially not
   * contain any property values (including mandatory properties).
   * Once the managed object has been configured it can be added to
   * the server using the {@link #commit()} method.
     * Creates a new child managed object bound to the specified optional
     * relation. The new managed object will initially not contain any property
     * values (including mandatory properties). Once the managed object has been
     * configured it can be added to the server using the {@link #commit()}
     * method.
   *
   * @param <C>
   *          The expected type of the child managed object
   *          configuration client.
     *            The expected type of the child managed object configuration
     *            client.
   * @param <S>
   *          The expected type of the child managed object
   *          server configuration.
     *            The expected type of the child managed object server
     *            configuration.
   * @param <CC>
   *          The actual type of the added managed object
   *          configuration client.
     *            The actual type of the added managed object configuration
     *            client.
   * @param r
   *          The optional relation definition.
   * @param d
@@ -211,38 +190,33 @@
   * @param exceptions
   *          A collection in which to place any
   *          {@link DefaultBehaviorException}s that occurred whilst
   *          attempting to determine the managed object's default
   *          values.
     *            attempting to determine the managed object's default values.
   * @return Returns a new child managed object bound to the specified
   *         optional relation.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   */
  <C extends ConfigurationClient, S extends Configuration, CC extends C>
  ManagedObject<CC> createChild(OptionalRelationDefinition<C, S> r,
      ManagedObjectDefinition<CC, ? extends S> d,
      Collection<DefaultBehaviorException> exceptions)
      throws IllegalArgumentException;
    <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
            OptionalRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
            Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException;
  /**
   * Creates a new child managed object bound to the specified
   * set relation. The new managed object will initially not
   * contain any property values (including mandatory properties).
   * Once the managed object has been configured it can be added to
   * the server using the {@link #commit()} method.
     * Creates a new child managed object bound to the specified set relation.
     * The new managed object will initially not contain any property values
     * (including mandatory properties). Once the managed object has been
     * configured it can be added to the server using the {@link #commit()}
     * method.
   *
   * @param <C>
   *          The expected type of the child managed object
   *          configuration client.
     *            The expected type of the child managed object configuration
     *            client.
   * @param <S>
   *          The expected type of the child managed object
   *          server configuration.
     *            The expected type of the child managed object server
     *            configuration.
   * @param <CC>
   *          The actual type of the added managed object
   *          configuration client.
     *            The actual type of the added managed object configuration
     *            client.
   * @param r
   *          The set relation definition.
   * @param d
@@ -250,28 +224,23 @@
   * @param exceptions
   *          A collection in which to place any
   *          {@link DefaultBehaviorException}s that occurred whilst
   *          attempting to determine the managed object's default
   *          values.
   * @return Returns a new child managed object bound to the specified
   *         set relation.
     *            attempting to determine the managed object's default values.
     * @return Returns a new child managed object bound to the specified set
     *         relation.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   */
  <C extends ConfigurationClient, S extends Configuration, CC extends C>
  ManagedObject<CC> createChild(SetRelationDefinition<C, S> r,
      ManagedObjectDefinition<CC, ? extends S> d,
      Collection<DefaultBehaviorException> exceptions)
      throws IllegalArgumentException;
    <C extends ConfigurationClient, S extends Configuration, CC extends C> ManagedObject<CC> createChild(
            SetRelationDefinition<C, S> r, ManagedObjectDefinition<CC, ? extends S> d,
            Collection<DefaultBehaviorException> exceptions) throws IllegalArgumentException;
  /**
   * Retrieves an instantiable child managed object.
   *
   * @param <C>
   *          The requested type of the child managed object
   *          configuration client.
     *            The requested type of the child managed object configuration
     *            client.
   * @param <S>
   *          The type of server managed object configuration that the
   *          relation definition refers to.
@@ -284,40 +253,31 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws DefinitionDecodingException
   *           If the managed object was found but its type could not
   *           be determined.
     *             If the managed object was found but its type could not be
     *             determined.
   * @throws ManagedObjectDecodingException
   *           If the managed object was found but one or more of its
   *           properties could not be decoded.
   * @throws ManagedObjectNotFoundException
   *           If the requested managed object could not be found on
   *           the server.
     *             If the requested managed object could not be found on the
     *             server.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to retrieve the managed object
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  ManagedObject<? extends C> getChild(InstantiableRelationDefinition<C, S> r,
      String name) throws IllegalArgumentException, DefinitionDecodingException,
      ManagedObjectDecodingException, ManagedObjectNotFoundException,
      ConcurrentModificationException, AuthorizationException,
      CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
            DefinitionDecodingException, ManagedObjectDecodingException, ManagedObjectNotFoundException,
            ConcurrentModificationException, ErrorResultException;
  /**
   * Retrieves an optional child managed object.
   *
   * @param <C>
   *          The requested type of the child managed object
   *          configuration client.
     *            The requested type of the child managed object configuration
     *            client.
   * @param <S>
   *          The type of server managed object configuration that the
   *          relation definition refers to.
@@ -328,40 +288,31 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws DefinitionDecodingException
   *           If the managed object was found but its type could not
   *           be determined.
     *             If the managed object was found but its type could not be
     *             determined.
   * @throws ManagedObjectDecodingException
   *           If the managed object was found but one or more of its
   *           properties could not be decoded.
   * @throws ManagedObjectNotFoundException
   *           If the requested managed object could not be found on
   *           the server.
     *             If the requested managed object could not be found on the
     *             server.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to retrieve the managed object
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  ManagedObject<? extends C> getChild(OptionalRelationDefinition<C, S> r)
      throws IllegalArgumentException, DefinitionDecodingException,
      ManagedObjectDecodingException, ManagedObjectNotFoundException,
      ConcurrentModificationException, AuthorizationException,
      CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
  /**
   * Retrieves a singleton child managed object.
   *
   * @param <C>
   *          The requested type of the child managed object
   *          configuration client.
     *            The requested type of the child managed object configuration
     *            client.
   * @param <S>
   *          The type of server managed object configuration that the
   *          relation definition refers to.
@@ -372,40 +323,31 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws DefinitionDecodingException
   *           If the managed object was found but its type could not
   *           be determined.
     *             If the managed object was found but its type could not be
     *             determined.
   * @throws ManagedObjectDecodingException
   *           If the managed object was found but one or more of its
   *           properties could not be decoded.
   * @throws ManagedObjectNotFoundException
   *           If the requested managed object could not be found on
   *           the server.
     *             If the requested managed object could not be found on the
     *             server.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to retrieve the managed object
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  ManagedObject<? extends C> getChild(SingletonRelationDefinition<C, S> r)
      throws IllegalArgumentException, DefinitionDecodingException,
      ManagedObjectDecodingException, ManagedObjectNotFoundException,
      ConcurrentModificationException, AuthorizationException,
      CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SingletonRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
  /**
   * Retrieves a set child managed object.
   *
   * @param <C>
   *          The requested type of the child managed object
   *          configuration client.
     *            The requested type of the child managed object configuration
     *            client.
   * @param <S>
   *          The type of server managed object configuration that the
   *          relation definition refers to.
@@ -418,56 +360,40 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws DefinitionDecodingException
   *           If the managed object was found but its type could not
   *           be determined.
     *             If the managed object was found but its type could not be
     *             determined.
   * @throws ManagedObjectDecodingException
   *           If the managed object was found but one or more of its
   *           properties could not be decoded.
   * @throws ManagedObjectNotFoundException
   *           If the requested managed object could not be found on
   *           the server.
     *             If the requested managed object could not be found on the
     *             server.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to retrieve the managed object
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  ManagedObject<? extends C> getChild(SetRelationDefinition<C, S> r,
      String name) throws IllegalArgumentException, DefinitionDecodingException,
      ManagedObjectDecodingException, ManagedObjectNotFoundException,
      ConcurrentModificationException, AuthorizationException,
      CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            ErrorResultException;
  /**
   * Creates a client configuration view of this managed object.
   * Modifications made to this managed object will be reflected in
   * the client configuration view and vice versa.
     * Creates a client configuration view of this managed object. Modifications
     * made to this managed object will be reflected in the client configuration
     * view and vice versa.
   *
   * @return Returns a client configuration view of this managed
   *         object.
     * @return Returns a client configuration view of this managed object.
   */
  T getConfiguration();
  /**
   * Gets the definition associated with this managed object.
   *
   * @return Returns the definition associated with this managed
   *         object.
     * @return Returns the definition associated with this managed object.
   */
  ManagedObjectDefinition<T, ? extends Configuration>
    getManagedObjectDefinition();
    ManagedObjectDefinition<T, ? extends Configuration> getManagedObjectDefinition();
  /**
   * Gets the path of this managed object.
@@ -476,93 +402,77 @@
   */
  ManagedObjectPath<T, ? extends Configuration> getManagedObjectPath();
  /**
   * Gets a mutable copy of the set of default values for the
   * specified property.
     * Gets a mutable copy of the set of default values for the specified
     * property.
   *
   * @param <PD>
   *          The type of the property to be retrieved.
   * @param pd
   *          The property to be retrieved.
   * @return Returns the property's default values, or an empty set if
   *         there are no default values defined.
     * @return Returns the property's default values, or an empty set if there
     *         are no default values defined.
   * @throws IllegalArgumentException
   *           If the property definition is not associated with this
   *           managed object's definition.
   */
  <PD> SortedSet<PD> getPropertyDefaultValues(PropertyDefinition<PD> pd)
      throws IllegalArgumentException;
    <PD> SortedSet<PD> getPropertyDefaultValues(PropertyDefinition<PD> pd) throws IllegalArgumentException;
  /**
   * Gets the effective value of the specified property.
   * <p>
   * See the class description for more information about how the
   * effective property value is derived.
     * See the class description for more information about how the effective
     * property value is derived.
   *
   * @param <PD>
   *          The type of the property to be retrieved.
   * @param pd
   *          The property to be retrieved.
   * @return Returns the property's effective value, or
   *         <code>null</code> if there is no effective value
   *         defined.
     * @return Returns the property's effective value, or <code>null</code> if
     *         there is no effective value defined.
   * @throws IllegalArgumentException
   *           If the property definition is not associated with this
   *           managed object's definition.
   */
  <PD> PD getPropertyValue(PropertyDefinition<PD> pd)
      throws IllegalArgumentException;
    <PD> PD getPropertyValue(PropertyDefinition<PD> pd) throws IllegalArgumentException;
  /**
   * Gets a mutable copy of the set of effective values for the
   * specified property.
     * Gets a mutable copy of the set of effective values for the specified
     * property.
   * <p>
   * See the class description for more information about how the
   * effective property values are derived.
     * See the class description for more information about how the effective
     * property values are derived.
   *
   * @param <PD>
   *          The type of the property to be retrieved.
   * @param pd
   *          The property to be retrieved.
   * @return Returns the property's effective values, or an empty set
   *         if there are no effective values defined.
     * @return Returns the property's effective values, or an empty set if there
     *         are no effective values defined.
   * @throws IllegalArgumentException
   *           If the property definition is not associated with this
   *           managed object's definition.
   */
  <PD> SortedSet<PD> getPropertyValues(PropertyDefinition<PD> pd)
      throws IllegalArgumentException;
    <PD> SortedSet<PD> getPropertyValues(PropertyDefinition<PD> pd) throws IllegalArgumentException;
  /**
   * Determines whether or not the specified property is set. If the
   * property is unset, then any default behavior associated with the
   * property applies.
     * Determines whether or not the specified property is set. If the property
     * is unset, then any default behavior associated with the property applies.
   *
   * @param pd
   *          The property definition.
   * @return Returns <code>true</code> if the property has been set,
   *         or <code>false</code> if it is unset and any default
   *         behavior associated with the property applies.
     * @return Returns <code>true</code> if the property has been set, or
     *         <code>false</code> if it is unset and any default behavior
     *         associated with the property applies.
   * @throws IllegalArgumentException
   *           If the property definition is not associated with this
   *           managed object's definition.
   */
  boolean isPropertyPresent(PropertyDefinition<?> pd)
      throws IllegalArgumentException;
    boolean isPropertyPresent(PropertyDefinition<?> pd) throws IllegalArgumentException;
  /**
   * Determines whether or not the optional managed object associated
   * with the specified optional relations exists.
     * Determines whether or not the optional managed object associated with the
     * specified optional relations exists.
   *
   * @param <C>
   *          The type of client managed object configuration that the
@@ -572,27 +482,19 @@
   *          relation definition refers to.
   * @param r
   *          The optional relation definition.
   * @return Returns <code>true</code> if the optional managed
   *         object exists, <code>false</code> otherwise.
     * @return Returns <code>true</code> if the optional managed object exists,
     *         <code>false</code> otherwise.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to make the determination because
   *           the client does not have the correct privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If there is any other error.
   */
  <C extends ConfigurationClient, S extends Configuration>
  boolean hasChild(OptionalRelationDefinition<C, S> r)
      throws IllegalArgumentException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> boolean hasChild(OptionalRelationDefinition<C, S> r)
            throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
  /**
   * Lists the child managed objects associated with the specified
@@ -611,27 +513,19 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to list the managed objects
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  String[] listChildren(InstantiableRelationDefinition<C, S> r)
      throws IllegalArgumentException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
            ErrorResultException;
  /**
   * Lists the child managed objects associated with the specified
   * instantiable relation which are a sub-type of the specified
   * managed object definition.
     * instantiable relation which are a sub-type of the specified managed
     * object definition.
   *
   * @param <C>
   *          The type of client managed object configuration that the
@@ -643,29 +537,20 @@
   *          The instantiable relation definition.
   * @param d
   *          The managed object definition.
   * @return Returns the names of the child managed objects which are
   *         a sub-type of the specified managed object definition.
     * @return Returns the names of the child managed objects which are a
     *         sub-type of the specified managed object definition.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to list the managed objects
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  String[] listChildren(InstantiableRelationDefinition<C, S> r,
      AbstractManagedObjectDefinition<? extends C, ? extends S> d)
      throws IllegalArgumentException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
  /**
   * Lists the child managed objects associated with the specified set
@@ -679,33 +564,23 @@
   *          relation definition refers to.
   * @param r
   *          The set relation definition.
   * @return Returns the names of the child managed objects which for
   *         set relations are the definition names of each managed
   *         object.
     * @return Returns the names of the child managed objects which for set
     *         relations are the definition names of each managed object.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to list the managed objects because
   *           the client does not have the correct privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  String[] listChildren(SetRelationDefinition<C, S> r)
      throws IllegalArgumentException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r)
            throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException;
  /**
   * Lists the child managed objects associated with the specified set
   * relation which are a sub-type of the specified managed object
   * definition.
     * relation which are a sub-type of the specified managed object definition.
   *
   * @param <C>
   *          The type of client managed object configuration that the
@@ -717,29 +592,20 @@
   *          The set relation definition.
   * @param d
   *          The managed object definition.
   * @return Returns the names of the child managed objects which for
   *         set relations are the definition names of each managed
   *         object.
     * @return Returns the names of the child managed objects which for set
     *         relations are the definition names of each managed object.
   * @throws IllegalArgumentException
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to list the managed objects because
   *           the client does not have the correct privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  String[] listChildren(SetRelationDefinition<C, S> r,
      AbstractManagedObjectDefinition<? extends C, ? extends S> d)
      throws IllegalArgumentException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> String[] listChildren(SetRelationDefinition<C, S> r,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ConcurrentModificationException, ErrorResultException;
  /**
   * Removes the named instantiable child managed object.
@@ -758,31 +624,22 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ManagedObjectNotFoundException
   *           If the managed object could not be removed because it
   *           could not found on the server.
     *             If the managed object could not be removed because it could
     *             not found on the server.
   * @throws OperationRejectedException
   *           If the managed object cannot be removed due to some
   *           client-side or server-side constraint which cannot be
   *           satisfied (for example, if it is referenced by another
   *           managed object).
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to remove the managed objects
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  void removeChild(InstantiableRelationDefinition<C, S> r, String name)
      throws IllegalArgumentException, ManagedObjectNotFoundException,
      OperationRejectedException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> void removeChild(InstantiableRelationDefinition<C, S> r,
            String name) throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
  /**
   * Removes an optional child managed object.
@@ -799,31 +656,22 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ManagedObjectNotFoundException
   *           If the managed object could not be removed because it
   *           could not found on the server.
     *             If the managed object could not be removed because it could
     *             not found on the server.
   * @throws OperationRejectedException
   *           If the managed object cannot be removed due to some
   *           client-side or server-side constraint which cannot be
   *           satisfied (for example, if it is referenced by another
   *           managed object).
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to remove the managed objects
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  void removeChild(OptionalRelationDefinition<C, S> r)
      throws IllegalArgumentException, ManagedObjectNotFoundException,
      OperationRejectedException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> void removeChild(OptionalRelationDefinition<C, S> r)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
  /**
   * Removes s set child managed object.
@@ -842,97 +690,81 @@
   *           If the relation definition is not associated with this
   *           managed object's definition.
   * @throws ManagedObjectNotFoundException
   *           If the managed object could not be removed because it
   *           could not found on the server.
     *             If the managed object could not be removed because it could
     *             not found on the server.
   * @throws OperationRejectedException
   *           If the managed object cannot be removed due to some
   *           client-side or server-side constraint which cannot be
   *           satisfied (for example, if it is referenced by another
   *           managed object).
   * @throws ConcurrentModificationException
   *           If this managed object has been removed from the server
   *           by another client.
   * @throws AuthorizationException
   *           If the server refuses to remove the managed objects
   *           because the client does not have the correct
   *           privileges.
   * @throws CommunicationException
   *           If the client cannot contact the server due to an
   *           underlying communication problem.
     *             If this managed object has been removed from the server by
     *             another client.
     * @throws ErrorResultException
     *             If any other error occurs.
   */
  <C extends ConfigurationClient, S extends Configuration>
  void removeChild(SetRelationDefinition<C, S> r, String name)
      throws IllegalArgumentException, ManagedObjectNotFoundException,
      OperationRejectedException, ConcurrentModificationException,
      AuthorizationException, CommunicationException;
    <C extends ConfigurationClient, S extends Configuration> void removeChild(SetRelationDefinition<C, S> r, String name)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            ConcurrentModificationException, ErrorResultException;
  /**
   * Sets a new pending value for the specified property.
   * <p>
   * See the class description for more information regarding pending
   * values.
     * See the class description for more information regarding pending values.
   *
   * @param <PD>
   *          The type of the property to be modified.
   * @param pd
   *          The property to be modified.
   * @param value
   *          The new pending value for the property, or
   *          <code>null</code> if the property should be reset to
   *          its default behavior.
     *            The new pending value for the property, or <code>null</code>
     *            if the property should be reset to its default behavior.
   * @throws IllegalPropertyValueException
   *           If the new pending value is deemed to be invalid
   *           according to the property definition.
     *             If the new pending value is deemed to be invalid according to
     *             the property definition.
   * @throws PropertyIsReadOnlyException
   *           If this is not a new managed object and the property is
   *           read-only or for monitoring purposes.
   * @throws PropertyIsMandatoryException
   *           If an attempt was made to remove a mandatory property.
   * @throws IllegalArgumentException
   *           If the specified property definition is not associated
   *           with this managed object.
     *             If the specified property definition is not associated with
     *             this managed object.
   */
  <PD> void setPropertyValue(PropertyDefinition<PD> pd, PD value)
      throws IllegalPropertyValueException, PropertyIsReadOnlyException,
      PropertyIsMandatoryException, IllegalArgumentException;
    <PD> void setPropertyValue(PropertyDefinition<PD> pd, PD value) throws IllegalPropertyValueException,
            PropertyIsReadOnlyException, PropertyIsMandatoryException, IllegalArgumentException;
  /**
   * Sets a new pending values for the specified property.
   * <p>
   * See the class description for more information regarding pending
   * values.
     * See the class description for more information regarding pending values.
   *
   * @param <PD>
   *          The type of the property to be modified.
   * @param pd
   *          The property to be modified.
   * @param values
   *          A non-<code>null</code> set of new pending values for
   *          the property (an empty set indicates that the property
   *          should be reset to its default behavior). The set will
   *          not be referenced by this managed object.
     *            A non-<code>null</code> set of new pending values for the
     *            property (an empty set indicates that the property should be
     *            reset to its default behavior). The set will not be referenced
     *            by this managed object.
   * @throws IllegalPropertyValueException
   *           If a new pending value is deemed to be invalid
   *           according to the property definition.
     *             If a new pending value is deemed to be invalid according to
     *             the property definition.
   * @throws PropertyIsSingleValuedException
   *           If an attempt was made to add multiple pending values
   *           to a single-valued property.
     *             If an attempt was made to add multiple pending values to a
     *             single-valued property.
   * @throws PropertyIsReadOnlyException
   *           If this is not a new managed object and the property is
   *           read-only or for monitoring purposes.
   * @throws PropertyIsMandatoryException
   *           If an attempt was made to remove a mandatory property.
   * @throws IllegalArgumentException
   *           If the specified property definition is not associated
   *           with this managed object.
     *             If the specified property definition is not associated with
     *             this managed object.
   */
  <PD> void setPropertyValues(PropertyDefinition<PD> pd, Collection<PD> values)
      throws IllegalPropertyValueException, PropertyIsSingleValuedException,
      PropertyIsReadOnlyException, PropertyIsMandatoryException,
    <PD> void setPropertyValues(PropertyDefinition<PD> pd, Collection<PD> values) throws IllegalPropertyValueException,
            PropertyIsSingleValuedException, PropertyIsReadOnlyException, PropertyIsMandatoryException,
      IllegalArgumentException;
}
opendj-admin/src/main/java/org/opends/server/admin/client/ManagementContext.java
@@ -31,6 +31,7 @@
import java.util.SortedSet;
import org.forgerock.opendj.admin.client.RootCfgClient;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
@@ -84,17 +85,13 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        return getDriver().deleteManagedObject(parent, rd, name);
    }
@@ -124,16 +121,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws IllegalArgumentException,
            ManagedObjectNotFoundException, OperationRejectedException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
        return getDriver().deleteManagedObject(parent, rd);
    }
@@ -164,17 +157,13 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        return getDriver().deleteManagedObject(parent, rd, name);
    }
@@ -199,17 +188,13 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws AuthorizationException
     *             If the server refuses to retrieve the managed object because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    @SuppressWarnings("unchecked")
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
            ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        // Be careful to handle the root configuration.
        if (path.isEmpty()) {
            return (ManagedObject<C>) getRootConfigurationManagedObject();
@@ -241,16 +226,12 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws AuthorizationException
     *             If the server refuses to retrieve the managed object because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <PD> PD getPropertyValue(ManagedObjectPath<?, ?> path, PropertyDefinition<PD> pd)
            throws IllegalArgumentException, DefinitionDecodingException, AuthorizationException,
            ManagedObjectNotFoundException, CommunicationException, PropertyException {
            throws IllegalArgumentException, DefinitionDecodingException, ErrorResultException,
            ManagedObjectNotFoundException, PropertyException {
        Set<PD> values = getPropertyValues(path, pd);
        if (values.isEmpty()) {
            return null;
@@ -282,16 +263,12 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws AuthorizationException
     *             If the server refuses to retrieve the managed object because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <PD> SortedSet<PD> getPropertyValues(ManagedObjectPath<?, ?> path, PropertyDefinition<PD> pd)
            throws IllegalArgumentException, DefinitionDecodingException, AuthorizationException,
            ManagedObjectNotFoundException, CommunicationException, PropertyException {
            throws IllegalArgumentException, DefinitionDecodingException, ErrorResultException,
            ManagedObjectNotFoundException, PropertyException {
        return getDriver().getPropertyValues(path, pd);
    }
@@ -336,16 +313,12 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to list the managed objects because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        return listManagedObjects(parent, rd, rd.getChildDefinition());
    }
@@ -372,17 +345,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to list the managed objects because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        return getDriver().listManagedObjects(parent, rd, d);
    }
@@ -405,16 +374,12 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to list the managed objects because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        return getDriver().listManagedObjects(parent, rd, rd.getChildDefinition());
    }
@@ -427,15 +392,11 @@
     *         <code>false</code> otherwise.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to make the determination because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        return getDriver().managedObjectExists(path);
    }
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/JNDIDirContextAdaptor.java
File was deleted
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPConnection.java
@@ -26,22 +26,21 @@
 */
package org.opends.server.admin.client.ldap;
import java.util.Collection;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapName;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Entry;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
/**
 * An LDAP connection adaptor interface which is used to perform LDAP
 * client operations.
 * An LDAP connection adaptor interface which is used to perform LDAP client
 * operations.
 * <p>
 * This interface is provided in order to make it easier to keep track
 * of which JNDI DirContext methods we require and also to facilitate
 * implementation of mock JNDI contexts for unit-testing.
 * This interface is provided in order to make it easier to keep track of which
 * JNDI DirContext methods we require and also to facilitate implementation of
 * mock JNDI contexts for unit-testing.
 */
public abstract class LDAPConnection {
@@ -52,34 +51,25 @@
    // No implementation required.
  }
  /**
   * Creates a new entry with the specified set of attributes.
     * Creates a new entry.
   *
   * @param dn
   *          The name of the entry to be created.
   * @param attributes
   *          The set of attributes.
   * @throws NamingException
     * @param entry
     *            The entry to create.
     * @throws ErrorResultException
   *           If an error occurred whilst creating the entry.
   */
  public abstract void createEntry(LdapName dn, Attributes attributes)
      throws NamingException;
    public abstract void createEntry(Entry entry) throws ErrorResultException;
  /**
   * Deletes the named subtree.
   *
   * @param dn
   *          The name of the subtree to be deleted.
   * @throws NamingException
     * @throws ErrorResultException
   *           If an error occurred whilst deleting the subtree.
   */
  public abstract void deleteSubtree(LdapName dn) throws NamingException;
    public abstract void deleteSubtree(DN dn) throws ErrorResultException;
  /**
   * Determines whether or not the named entry exists.
@@ -87,12 +77,10 @@
   * @param dn
   *          The name of the entry.
   * @return Returns <code>true</code> if the entry exists.
   * @throws NamingException
     * @throws ErrorResultException
   *           If an error occurred whilst making the determination.
   */
  public abstract boolean entryExists(LdapName dn) throws NamingException;
    public abstract boolean entryExists(DN dn) throws ErrorResultException;
  /**
   * Lists the children of the named entry.
@@ -100,31 +88,23 @@
   * @param dn
   *          The name of the entry to list.
   * @param filter
   *          An LDAP filter string, or <code>null</code> indicating
   *          the default filter of <code>(objectclass=*)</code>.
     *            An LDAP filter string, or <code>null</code> indicating the
     *            default filter of <code>(objectclass=*)</code>.
   * @return Returns the names of the children.
   * @throws NamingException
     * @throws ErrorResultException
   *           If an error occurred whilst listing the children.
   */
  public abstract Collection<LdapName> listEntries(LdapName dn, String filter)
      throws NamingException;
    public abstract Collection<DN> listEntries(DN dn, String filter) throws ErrorResultException;
  /**
   * Modifies the attributes of the named entry.
     * Modifies an entry according to the provided modify request.
   *
   * @param dn
   *          The name of the entry to be modified.
   * @param mods
   *          The list of attributes which need replacing.
   * @throws NamingException
     * @param request
     *            The modification request to perform.
     * @throws ErrorResultException
   *           If an error occurred whilst applying the modifications.
   */
  public abstract void modifyEntry(LdapName dn, Attributes mods)
      throws NamingException;
    public abstract void modifyEntry(ModifyRequest request) throws ErrorResultException;
  /**
   * Reads the attributes of the named entry.
@@ -134,13 +114,10 @@
   * @param attrIds
   *          The list of attributes to be retrievd.
   * @return Returns the attributes of the requested entry.
   * @throws NamingException
     * @throws ErrorResultException
   *           If an error occurred whilst reading the entry.
   */
  public abstract Attributes readEntry(LdapName dn, Collection<String> attrIds)
      throws NamingException;
    public abstract SearchResultEntry readEntry(DN dn, Collection<String> attrIds) throws ErrorResultException;
  /**
   * Closes the LDAP connection.
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
@@ -37,18 +37,15 @@
import java.util.SortedSet;
import java.util.TreeSet;
import javax.naming.NameNotFoundException;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.OperationNotSupportedException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapName;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.admin.client.RootCfgClient;
import org.forgerock.opendj.admin.meta.RootCfgDefn;
import org.forgerock.opendj.ldap.Attribute;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.responses.SearchResultEntry;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AggregationPropertyDefinition;
import org.opends.server.admin.Configuration;
@@ -73,8 +70,6 @@
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.UnknownPropertyDefinitionException;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.OperationRejectedException;
@@ -184,14 +179,14 @@
    @Override
    public <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
            ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        if (!managedObjectExists(path)) {
            throw new ManagedObjectNotFoundException();
        }
        try {
            // Read the entry associated with the managed object.
            LdapName dn = LDAPNameBuilder.create(path, profile);
            DN dn = LDAPNameBuilder.create(path, profile);
            AbstractManagedObjectDefinition<C, S> d = path.getManagedObjectDefinition();
            ManagedObjectDefinition<? extends C, ? extends S> mod = getEntryDefinition(d, dn);
@@ -201,14 +196,14 @@
                attrIds.add(attrId);
            }
            Attributes attributes = connection.readEntry(dn, attrIds);
            SearchResultEntry searchResultEntry = connection.readEntry(dn, attrIds);
            // Build the managed object's properties.
            List<PropertyException> exceptions = new LinkedList<PropertyException>();
            PropertySet newProperties = new PropertySet();
            for (PropertyDefinition<?> pd : mod.getAllPropertyDefinitions()) {
                String attrID = profile.getAttributeName(mod, pd);
                Attribute attribute = attributes.get(attrID);
                Attribute attribute = searchResultEntry.getAttribute(attrID);
                try {
                    decodeProperty(newProperties, path, pd, attribute);
                } catch (PropertyException e) {
@@ -224,12 +219,11 @@
            } else {
                throw new ManagedObjectDecodingException(mo, exceptions);
            }
        } catch (NameNotFoundException e) {
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
            throw new ManagedObjectNotFoundException();
        } catch (NoPermissionException e) {
            throw new AuthorizationException(e);
        } catch (NamingException e) {
            throw new CommunicationException(e);
            }
            throw e;
        }
    }
@@ -239,15 +233,14 @@
    @SuppressWarnings("unchecked")
    @Override
    public <C extends ConfigurationClient, S extends Configuration, PD> SortedSet<PD> getPropertyValues(
            ManagedObjectPath<C, S> path, PropertyDefinition<PD> pd) throws IllegalArgumentException,
            DefinitionDecodingException, AuthorizationException, ManagedObjectNotFoundException,
            CommunicationException, PropertyException {
            ManagedObjectPath<C, S> path, PropertyDefinition<PD> propertyDef) throws IllegalArgumentException,
            DefinitionDecodingException, ManagedObjectNotFoundException, ErrorResultException, PropertyException {
        // Check that the requested property is from the definition
        // associated with the path.
        AbstractManagedObjectDefinition<C, S> d = path.getManagedObjectDefinition();
        PropertyDefinition<?> tmp = d.getPropertyDefinition(pd.getName());
        if (tmp != pd) {
            throw new IllegalArgumentException("The property " + pd.getName() + " is not associated with a "
        PropertyDefinition<?> tmp = d.getPropertyDefinition(propertyDef.getName());
        if (tmp != propertyDef) {
            throw new IllegalArgumentException("The property " + propertyDef.getName() + " is not associated with a "
                    + d.getName());
        }
@@ -257,53 +250,47 @@
        try {
            // Read the entry associated with the managed object.
            LdapName dn = LDAPNameBuilder.create(path, profile);
            ManagedObjectDefinition<? extends C, ? extends S> mod;
            mod = getEntryDefinition(d, dn);
            DN dn = LDAPNameBuilder.create(path, profile);
            ManagedObjectDefinition<? extends C, ? extends S> objectDef = getEntryDefinition(d, dn);
            // Make sure we use the correct property definition, the
            // provided one might have been overridden in the resolved
            // definition.
            pd = (PropertyDefinition<PD>) mod.getPropertyDefinition(pd.getName());
            propertyDef = (PropertyDefinition<PD>) objectDef.getPropertyDefinition(propertyDef.getName());
            String attrID = profile.getAttributeName(mod, pd);
            Attributes attributes = connection.readEntry(dn, Collections.singleton(attrID));
            Attribute attribute = attributes.get(attrID);
            String attrID = profile.getAttributeName(objectDef, propertyDef);
            SearchResultEntry resultEntry = connection.readEntry(dn, Collections.singleton(attrID));
            Attribute attribute = resultEntry.getAttribute(attrID);
            // Decode the values.
            SortedSet<PD> values = new TreeSet<PD>(pd);
            SortedSet<PD> values = new TreeSet<PD>(propertyDef);
            if (attribute != null) {
                NamingEnumeration<?> ldapValues = attribute.getAll();
                while (ldapValues.hasMore()) {
                    Object obj = ldapValues.next();
                    if (obj != null) {
                        PD value = ValueDecoder.decode(pd, obj);
                for (ByteString byteValue : attribute) {
                    PD value = ValueDecoder.decode(propertyDef, byteValue);
                        values.add(value);
                    }
                }
            }
            // Sanity check the returned values.
            if (values.size() > 1 && !pd.hasOption(PropertyOption.MULTI_VALUED)) {
                throw new PropertyIsSingleValuedException(pd);
            if (values.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
                throw new PropertyIsSingleValuedException(propertyDef);
            }
            if (values.isEmpty() && pd.hasOption(PropertyOption.MANDATORY)) {
                throw new PropertyIsMandatoryException(pd);
            if (values.isEmpty() && propertyDef.hasOption(PropertyOption.MANDATORY)) {
                throw new PropertyIsMandatoryException(propertyDef);
            }
            if (values.isEmpty()) {
                // Use the property's default values.
                values.addAll(findDefaultValues(path.asSubType(mod), pd, false));
                values.addAll(findDefaultValues(path.asSubType(objectDef), propertyDef, false));
            }
            return values;
        } catch (NameNotFoundException e) {
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
            throw new ManagedObjectNotFoundException();
        } catch (NoPermissionException e) {
            throw new AuthorizationException(e);
        } catch (NamingException e) {
            throw new CommunicationException(e);
            }
            throw e;
        }
    }
@@ -323,7 +310,7 @@
    public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        validateRelationDefinition(parent, rd);
        if (!managedObjectExists(parent)) {
@@ -331,7 +318,7 @@
        }
        // Get the search base DN.
        LdapName dn = LDAPNameBuilder.create(parent, rd, profile);
        DN dn = LDAPNameBuilder.create(parent, rd, profile);
        // Retrieve only those entries which are sub-types of the
        // specified definition.
@@ -343,17 +330,18 @@
        List<String> children = new ArrayList<String>();
        try {
            for (LdapName child : connection.listEntries(dn, filter)) {
                children.add(child.getRdn(child.size() - 1).getValue().toString());
            for (DN child : connection.listEntries(dn, filter)) {
                children.add(child.rdn().getFirstAVA().getAttributeValue().toString());
            }
        } catch (NameNotFoundException e) {
            // Ignore this - it means that the base entry does not exist
            // (which it might not if this managed object has just been
            // created.
        } catch (NamingException e) {
            adaptNamingException(e);
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                // Ignore this
                // It means that the base entry does not exist
                // It might not if this managed object has just been created.
            } else {
                throw e;
        }
        }
        return children.toArray(new String[children.size()]);
    }
@@ -364,7 +352,7 @@
    public <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, ErrorResultException {
        validateRelationDefinition(parent, rd);
        if (!managedObjectExists(parent)) {
@@ -372,7 +360,7 @@
        }
        // Get the search base DN.
        LdapName dn = LDAPNameBuilder.create(parent, rd, profile);
        DN dn = LDAPNameBuilder.create(parent, rd, profile);
        // Retrieve only those entries which are sub-types of the
        // specified definition.
@@ -384,15 +372,17 @@
        List<String> children = new ArrayList<String>();
        try {
            for (LdapName child : connection.listEntries(dn, filter)) {
                children.add(child.getRdn(child.size() - 1).getValue().toString());
            for (DN child : connection.listEntries(dn, filter)) {
                children.add(child.rdn().getFirstAVA().getAttributeValue().toString());
            }
        } catch (NameNotFoundException e) {
            // Ignore this - it means that the base entry does not exist
            // (which it might not if this managed object has just been
            // created.
        } catch (NamingException e) {
            adaptNamingException(e);
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.NO_SUCH_OBJECT) {
                // Ignore this
                // It means that the base entry does not exist
                // It might not if this managed object has just been created.
            } else {
                throw e;
            }
        }
        return children.toArray(new String[children.size()]);
@@ -403,13 +393,13 @@
     */
    @Override
    public boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        if (path.isEmpty()) {
            return true;
        }
        ManagedObjectPath<?, ?> parent = path.parent();
        LdapName dn = LDAPNameBuilder.create(parent, profile);
        DN dn = LDAPNameBuilder.create(parent, profile);
        if (!entryExists(dn)) {
            throw new ManagedObjectNotFoundException();
        }
@@ -423,23 +413,18 @@
     */
    @Override
    protected <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
            ManagedObjectPath<C, S> path) throws OperationRejectedException, AuthorizationException,
            CommunicationException {
            ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException {
        // Delete the entry and any subordinate entries.
        LdapName dn = LDAPNameBuilder.create(path, profile);
        DN dn = LDAPNameBuilder.create(path, profile);
        try {
            connection.deleteSubtree(dn);
        } catch (OperationNotSupportedException e) {
            // Unwilling to perform.
        } catch(ErrorResultException e) {
            if (e.getResult().getResultCode()==ResultCode.UNWILLING_TO_PERFORM) {
            AbstractManagedObjectDefinition<?, ?> d = path.getManagedObjectDefinition();
            if (e.getMessage() == null) {
                throw new OperationRejectedException(OperationType.DELETE, d.getUserFriendlyName());
            } else {
                LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
                throw new OperationRejectedException(OperationType.DELETE, d.getUserFriendlyName(), m);
            }
        } catch (NamingException e) {
            adaptNamingException(e);
            throw e;
        }
    }
@@ -452,50 +437,16 @@
    }
    /**
     * Adapts a naming exception to an appropriate admin client exception.
     *
     * @param ne
     *            The naming exception.
     * @throws CommunicationException
     *             If the naming exception mapped to a communication exception.
     * @throws AuthorizationException
     *             If the naming exception mapped to an authorization exception.
     */
    void adaptNamingException(NamingException ne) throws CommunicationException, AuthorizationException {
        try {
            throw ne;
        } catch (javax.naming.CommunicationException e) {
            throw new CommunicationException(e);
        } catch (javax.naming.ServiceUnavailableException e) {
            throw new CommunicationException(e);
        } catch (javax.naming.NoPermissionException e) {
            throw new AuthorizationException(e);
        } catch (NamingException e) {
            // Just treat it as a communication problem.
            throw new CommunicationException(e);
        }
    }
    /**
     * Determines whether the named LDAP entry exists.
     *
     * @param dn
     *            The LDAP entry name.
     * @return Returns <code>true</code> if the named LDAP entry exists.
     * @throws AuthorizationException
     *             If the server refuses to make the determination because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             if a problem occurs.
     */
    boolean entryExists(LdapName dn) throws CommunicationException, AuthorizationException {
        try {
    boolean entryExists(DN dn) throws ErrorResultException {
            return connection.entryExists(dn);
        } catch (NamingException e) {
            adaptNamingException(e);
        }
        return false;
    }
    /**
@@ -531,26 +482,22 @@
    }
    // Create a property using the provided string values.
    private <PD> void decodeProperty(PropertySet newProperties, ManagedObjectPath<?, ?> p, PropertyDefinition<PD> pd,
            Attribute attribute) throws PropertyException, NamingException {
    private <PD> void decodeProperty(PropertySet newProperties, ManagedObjectPath<?, ?> path,
            PropertyDefinition<PD> propertyDef, Attribute attribute) throws PropertyException {
        PropertyException exception = null;
        // Get the property's active values.
        SortedSet<PD> activeValues = new TreeSet<PD>(pd);
        SortedSet<PD> activeValues = new TreeSet<PD>(propertyDef);
        if (attribute != null) {
            NamingEnumeration<?> ldapValues = attribute.getAll();
            while (ldapValues.hasMore()) {
                Object obj = ldapValues.next();
                if (obj != null) {
                    PD value = ValueDecoder.decode(pd, obj);
            for (ByteString byteValue : attribute) {
                PD value = ValueDecoder.decode(propertyDef, byteValue);
                    activeValues.add(value);
                }
            }
        }
        if (activeValues.size() > 1 && !pd.hasOption(PropertyOption.MULTI_VALUED)) {
        if (activeValues.size() > 1 && !propertyDef.hasOption(PropertyOption.MULTI_VALUED)) {
            // This exception takes precedence over previous exceptions.
            exception = new PropertyIsSingleValuedException(pd);
            exception = new PropertyIsSingleValuedException(propertyDef);
            PD value = activeValues.first();
            activeValues.clear();
            activeValues.add(value);
@@ -559,19 +506,19 @@
        // Get the property's default values.
        Collection<PD> defaultValues;
        try {
            defaultValues = findDefaultValues(p, pd, false);
            defaultValues = findDefaultValues(path, propertyDef, false);
        } catch (DefaultBehaviorException e) {
            defaultValues = Collections.emptySet();
            exception = e;
        }
        newProperties.addProperty(pd, defaultValues, activeValues);
        newProperties.addProperty(propertyDef, defaultValues, activeValues);
        if (activeValues.isEmpty() && defaultValues.isEmpty() && pd.hasOption(PropertyOption.MANDATORY)) {
        if (activeValues.isEmpty() && defaultValues.isEmpty() && propertyDef.hasOption(PropertyOption.MANDATORY)) {
            // The active values maybe empty because of a previous
            // exception.
            if (exception == null) {
                exception = new PropertyIsMandatoryException(pd);
                exception = new PropertyIsMandatoryException(propertyDef);
            }
        }
@@ -583,22 +530,18 @@
    // Determine the type of managed object associated with the named
    // entry.
    private <C extends ConfigurationClient, S extends Configuration> ManagedObjectDefinition<? extends C, ? extends S> getEntryDefinition(
            AbstractManagedObjectDefinition<C, S> d, LdapName dn) throws NamingException, DefinitionDecodingException {
        Attributes attributes = connection.readEntry(dn, Collections.singleton("objectclass"));
        Attribute oc = attributes.get("objectclass");
            AbstractManagedObjectDefinition<C, S> d, DN dn) throws ErrorResultException, DefinitionDecodingException {
        SearchResultEntry searchResultEntry = connection.readEntry(dn, Collections.singleton("objectclass"));
        Attribute objectClassAttr = searchResultEntry.getAttribute("objectclass");
        if (oc == null) {
        if (objectClassAttr == null) {
            // No object classes.
            throw new DefinitionDecodingException(d, Reason.NO_TYPE_INFORMATION);
        }
        final Set<String> objectClasses = new HashSet<String>();
        NamingEnumeration<?> values = oc.getAll();
        while (values.hasMore()) {
            Object value = values.next();
            if (value != null) {
                objectClasses.add(value.toString().toLowerCase().trim());
            }
        for (ByteString byteValue : objectClassAttr) {
            objectClasses.add(byteValue.toString().toLowerCase().trim());
        }
        if (objectClasses.isEmpty()) {
@@ -608,12 +551,10 @@
        // Resolve the appropriate sub-type based on the object classes.
        DefinitionResolver resolver = new DefinitionResolver() {
            public boolean matches(AbstractManagedObjectDefinition<?, ?> d) {
                String objectClass = profile.getObjectClass(d);
                return objectClasses.contains(objectClass);
            }
        };
        return d.resolveManagedObjectDefinition(resolver);
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPManagedObject.java
@@ -27,20 +27,21 @@
package org.opends.server.admin.client.ldap;
import javax.naming.NameAlreadyBoundException;
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.OperationNotSupportedException;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.BasicAttribute;
import javax.naming.directory.BasicAttributes;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.Attribute;
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.LinkedAttribute;
import org.forgerock.opendj.ldap.LinkedHashMapEntry;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.requests.Requests;
import org.opends.server.admin.AggregationPropertyDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
@@ -56,8 +57,6 @@
import org.opends.server.admin.RelationDefinition;
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.UnknownPropertyDefinitionException;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ConcurrentModificationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.OperationRejectedException;
@@ -67,47 +66,37 @@
import org.opends.server.admin.client.spi.Property;
import org.opends.server.admin.client.spi.PropertySet;
/**
 * A managed object bound to an LDAP connection.
 *
 * @param <T>
 *          The type of client configuration represented by the client
 *          managed object.
 *            The type of client configuration represented by the client managed
 *            object.
 */
final class LDAPManagedObject<T extends ConfigurationClient> extends
    AbstractManagedObject<T> {
final class LDAPManagedObject<T extends ConfigurationClient> extends AbstractManagedObject<T> {
  /**
   * A visitor which is used to encode property LDAP values.
   */
  private static final class ValueEncoder extends
      PropertyValueVisitor<Object, Void> {
    private static final class ValueEncoder extends PropertyValueVisitor<Object, Void> {
    // Prevent instantiation.
    private ValueEncoder() {
      // No implementation required.
    }
    /**
     * {@inheritDoc}
     */
    @Override
    public <C extends ConfigurationClient, S extends Configuration>
    Object visitAggregation(
        public <C extends ConfigurationClient, S extends Configuration> Object visitAggregation(
        AggregationPropertyDefinition<C, S> pd, String v, Void p) {
      // Aggregations values are stored as full DNs in LDAP, but
      // just their common name is exposed in the admin framework.
      Reference<C, S> reference = Reference.parseName(pd.getParentPath(), pd
          .getRelationDefinition(), v);
            Reference<C, S> reference = Reference.parseName(pd.getParentPath(), pd.getRelationDefinition(), v);
      return reference.toDN().toString();
    }
    /**
     * {@inheritDoc}
     */
@@ -118,13 +107,9 @@
    }
  }
  // The LDAP management driver associated with this managed object.
  private final LDAPDriver driver;
  /**
   * Creates a new LDAP managed object instance.
   *
@@ -137,29 +122,23 @@
   * @param properties
   *          The managed object's properties.
   * @param existsOnServer
   *          Indicates whether or not the managed object already
   *          exists.
     *            Indicates whether or not the managed object already exists.
   * @param namingPropertyDefinition
   *          The managed object's naming property definition if there
   *          is one.
     *            The managed object's naming property definition if there is
     *            one.
   */
  LDAPManagedObject(LDAPDriver driver,
      ManagedObjectDefinition<T, ? extends Configuration> d,
      ManagedObjectPath<T, ? extends Configuration> path,
      PropertySet properties, boolean existsOnServer,
    LDAPManagedObject(LDAPDriver driver, ManagedObjectDefinition<T, ? extends Configuration> d,
            ManagedObjectPath<T, ? extends Configuration> path, PropertySet properties, boolean existsOnServer,
      PropertyDefinition<?> namingPropertyDefinition) {
    super(d, path, properties, existsOnServer, namingPropertyDefinition);
    this.driver = driver;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  protected void addNewManagedObject() throws AuthorizationException,
      CommunicationException, OperationRejectedException,
    protected void addNewManagedObject() throws ErrorResultException, OperationRejectedException,
      ConcurrentModificationException, ManagedObjectAlreadyExistsException {
    // First make sure that the parent managed object still exists.
    ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition();
@@ -177,107 +156,91 @@
    // We may need to create the parent "relation" entry if this is a
    // child of an instantiable or set relation.
    RelationDefinition<?, ?> r = path.getRelationDefinition();
    if (r instanceof InstantiableRelationDefinition
        || r instanceof SetRelationDefinition) {
        if (r instanceof InstantiableRelationDefinition || r instanceof SetRelationDefinition) {
      // TODO: this implementation does not handle relations which
      // comprise of more than one RDN arc (this will probably never
      // be required anyway).
      LdapName dn;
            DN dn;
      if (r instanceof InstantiableRelationDefinition) {
        dn = LDAPNameBuilder.create(parent,
            (InstantiableRelationDefinition) r, driver.getLDAPProfile());
                dn = LDAPNameBuilder.create(parent, (InstantiableRelationDefinition) r, driver.getLDAPProfile());
      } else {
        dn = LDAPNameBuilder.create(parent,
            (SetRelationDefinition) r, driver.getLDAPProfile());
                dn = LDAPNameBuilder.create(parent, (SetRelationDefinition) r, driver.getLDAPProfile());
      }
      if (!driver.entryExists(dn)) {
        // We need to create the entry.
        Attributes attributes = new BasicAttributes();
                Entry entry = new LinkedHashMapEntry(dn);
        // Create the branch's object class attribute.
        Attribute oc = new BasicAttribute("objectClass");
        for (String objectClass : driver.getLDAPProfile()
            .getRelationObjectClasses(r)) {
          oc.add(objectClass);
        }
        attributes.put(oc);
                List<String> objectClasses = driver.getLDAPProfile().getRelationObjectClasses(r);
                addObjectClassesToEntry(objectClasses, entry);
        // Create the branch's naming attribute.
        Rdn rdn = dn.getRdn(dn.size() - 1);
        attributes.put(rdn.getType(), rdn.getValue().toString());
                RDN rdn = dn.parent(dn.size() - 1).rdn();
                entry.addAttribute(rdn.getFirstAVA().toAttribute());
        // Create the entry.
        try {
          driver.getLDAPConnection().createEntry(dn, attributes);
        } catch (OperationNotSupportedException e) {
          // Unwilling to perform.
          if (e.getMessage() == null) {
            throw new OperationRejectedException(OperationType.CREATE, d
                .getUserFriendlyName());
                    driver.getLDAPConnection().createEntry(entry);
                } catch (ErrorResultException e) {
                    if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                        LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage());
                        throw new OperationRejectedException(OperationType.CREATE, d.getUserFriendlyName(), m);
          } else {
            LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
            throw new OperationRejectedException(OperationType.CREATE, d
                .getUserFriendlyName(), m);
                        throw e;
          }
        } catch (NamingException e) {
          driver.adaptNamingException(e);
        }
      }
    }
    // Now add the entry representing this new managed object.
    LdapName dn = LDAPNameBuilder.create(path, driver.getLDAPProfile());
    Attributes attributes = new BasicAttributes(true);
        DN dn = LDAPNameBuilder.create(path, driver.getLDAPProfile());
        Entry entry = new LinkedHashMapEntry(dn);
    // Create the object class attribute.
    Attribute oc = new BasicAttribute("objectclass");
    ManagedObjectDefinition<?, ?> definition = getManagedObjectDefinition();
    for (String objectClass : driver.getLDAPProfile().getObjectClasses(
        definition)) {
      oc.add(objectClass);
    }
    attributes.put(oc);
        List<String> objectClasses = driver.getLDAPProfile().getObjectClasses(definition);
        addObjectClassesToEntry(objectClasses, entry);
    // Create the naming attribute if there is not naming property.
    PropertyDefinition<?> npd = getNamingPropertyDefinition();
    if (npd == null) {
      Rdn rdn = dn.getRdn(dn.size() - 1);
      attributes.put(rdn.getType(), rdn.getValue().toString());
        PropertyDefinition<?> namingPropertyDef = getNamingPropertyDefinition();
        if (namingPropertyDef == null) {
            RDN rdn = dn.parent(dn.size() - 1).rdn();
            entry.addAttribute(rdn.getFirstAVA().toAttribute());
    }
    // Create the remaining attributes.
    for (PropertyDefinition<?> pd : definition.getAllPropertyDefinitions()) {
      String attrID = driver.getLDAPProfile().getAttributeName(definition, pd);
      Attribute attribute = new BasicAttribute(attrID);
      encodeProperty(attribute, pd);
        for (PropertyDefinition<?> propertyDef : definition.getAllPropertyDefinitions()) {
            String attrID = driver.getLDAPProfile().getAttributeName(definition, propertyDef);
            Attribute attribute = new LinkedAttribute(attrID);
            encodeProperty(attribute, propertyDef);
      if (attribute.size() != 0) {
        attributes.put(attribute);
                entry.addAttribute(attribute);
      }
    }
    try {
      // Create the entry.
      driver.getLDAPConnection().createEntry(dn, attributes);
    } catch (NameAlreadyBoundException e) {
            driver.getLDAPConnection().createEntry(entry);
        } catch (ErrorResultException e) {
            if (e.getResult().getResultCode() == ResultCode.ENTRY_ALREADY_EXISTS) {
      throw new ManagedObjectAlreadyExistsException();
    } catch (OperationNotSupportedException e) {
      // Unwilling to perform.
      if (e.getMessage() == null) {
        throw new OperationRejectedException(OperationType.CREATE, d
            .getUserFriendlyName());
            } else if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage());
                throw new OperationRejectedException(OperationType.CREATE, d.getUserFriendlyName(), m);
      } else {
        LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
        throw new OperationRejectedException(OperationType.CREATE, d
            .getUserFriendlyName(), m);
                throw e;
      }
    } catch (NamingException e) {
      driver.adaptNamingException(e);
    }
  }
    private void addObjectClassesToEntry(List<String> objectClasses, Entry entry) {
        for (String objectClass : objectClasses) {
            Attribute attr = new LinkedAttribute("objectClass");
            attr.add(ByteString.valueOf(objectClass));
            entry.addAttribute(attr);
        }
    }
  /**
   * {@inheritDoc}
@@ -287,84 +250,68 @@
    return driver;
  }
  /**
   * {@inheritDoc}
   */
  @Override
  protected void modifyExistingManagedObject()
      throws ConcurrentModificationException, OperationRejectedException,
      AuthorizationException, CommunicationException {
    // Build the list of modified attributes.
    Attributes mods = new BasicAttributes();
    protected void modifyExistingManagedObject() throws ConcurrentModificationException, OperationRejectedException,
            ErrorResultException {
        // Build the modify request
        ManagedObjectPath<?, ?> path = getManagedObjectPath();
        DN dn = LDAPNameBuilder.create(path, driver.getLDAPProfile());
        ModifyRequest request = Requests.newModifyRequest(dn);
    ManagedObjectDefinition<?, ?> d = getManagedObjectDefinition();
    for (PropertyDefinition<?> pd : d.getAllPropertyDefinitions()) {
      Property<?> p = getProperty(pd);
      if (p.isModified()) {
        String attrID = driver.getLDAPProfile().getAttributeName(d, pd);
        Attribute attribute = new BasicAttribute(attrID);
                Attribute attribute = new LinkedAttribute(attrID);
        encodeProperty(attribute, pd);
        mods.put(attribute);
                request.addModification(ModificationType.REPLACE, attrID,
                        attribute.toArray(new Object[attribute.size()]));
      }
    }
    // Perform the LDAP modification if something has changed.
    if (mods.size() > 0) {
        if (!request.getModifications().isEmpty()) {
      try {
        ManagedObjectPath<?, ?> path = getManagedObjectPath();
        LdapName dn = LDAPNameBuilder.create(path, driver.getLDAPProfile());
        driver.getLDAPConnection().modifyEntry(dn, mods);
      } catch (NoPermissionException e) {
        throw new AuthorizationException(e);
      } catch (OperationNotSupportedException e) {
        // Unwilling to perform.
        if (e.getMessage() == null) {
          throw new OperationRejectedException(OperationType.MODIFY, d
              .getUserFriendlyName());
                driver.getLDAPConnection().modifyEntry(request);
            } catch (ErrorResultException e) {
                if (e.getResult().getResultCode() == ResultCode.UNWILLING_TO_PERFORM) {
                    LocalizableMessage m = LocalizableMessage.raw("%s", e.getLocalizedMessage());
                    throw new OperationRejectedException(OperationType.CREATE, d.getUserFriendlyName(), m);
        } else {
          LocalizableMessage m = LocalizableMessage.raw("%s", e.getMessage());
          throw new OperationRejectedException(OperationType.MODIFY, d
              .getUserFriendlyName(), m);
        }
      } catch (NamingException e) {
        // Just treat it as a communication problem.
        throw new CommunicationException(e);
      }
                    throw e;
    }
  }
        }
    }
  /**
   * {@inheritDoc}
   */
  @Override
  protected <M extends ConfigurationClient> ManagedObject<M> newInstance(
      ManagedObjectDefinition<M, ?> d, ManagedObjectPath<M, ?> path,
      PropertySet properties, boolean existsOnServer,
    protected <M extends ConfigurationClient> ManagedObject<M> newInstance(ManagedObjectDefinition<M, ?> d,
            ManagedObjectPath<M, ?> path, PropertySet properties, boolean existsOnServer,
      PropertyDefinition<?> namingPropertyDefinition) {
    return new LDAPManagedObject<M>(driver, d, path, properties,
        existsOnServer, namingPropertyDefinition);
        return new LDAPManagedObject<M>(driver, d, path, properties, existsOnServer, namingPropertyDefinition);
  }
  // Encode a property into LDAP string values.
  private <PD> void encodeProperty(Attribute attribute,
      PropertyDefinition<PD> pd) {
    private <PD> void encodeProperty(Attribute attribute, PropertyDefinition<PD> propertyDef) {
    PropertyValueVisitor<Object, Void> visitor = new ValueEncoder();
    Property<PD> p = getProperty(pd);
    if (pd.hasOption(PropertyOption.MANDATORY)) {
        Property<PD> property = getProperty(propertyDef);
        if (propertyDef.hasOption(PropertyOption.MANDATORY)) {
      // For mandatory properties we fall-back to the default values
      // if defined which can sometimes be the case e.g when a
      // mandatory property is overridden.
      for (PD value : p.getEffectiveValues()) {
        attribute.add(pd.accept(visitor, value, null));
            for (PD value : property.getEffectiveValues()) {
                attribute.add(propertyDef.accept(visitor, value, null));
      }
    } else {
      for (PD value : p.getPendingValues()) {
        attribute.add(pd.accept(visitor, value, null));
            for (PD value : property.getPendingValues()) {
                attribute.add(propertyDef.accept(visitor, value, null));
      }
    }
  }
opendj-admin/src/main/java/org/opends/server/admin/client/ldap/LDAPNameBuilder.java
@@ -27,14 +27,11 @@
package org.opends.server.admin.client.ldap;
import java.util.Collections;
import java.util.LinkedList;
import javax.naming.InvalidNameException;
import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.RDN;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
@@ -47,74 +44,61 @@
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
/**
 * A strategy for creating <code>LdapName</code>s from managed object paths.
 * A strategy for creating <code>DN</code>s from managed object paths.
 */
final class LDAPNameBuilder implements ManagedObjectPathSerializer {
  /**
   * Creates a new LDAP name representing the specified managed object
   * path.
     * Creates a new DN representing the specified managed object path.
   *
   * @param path
   *          The managed object path.
   * @param profile
   *          The LDAP profile which should be used to construct LDAP
   *          names.
   * @return Returns a new LDAP name representing the specified
   *         managed object path.
     *            The LDAP profile which should be used to construct LDAP names.
     * @return Returns a new DN representing the specified managed object path.
   */
  public static LdapName create(ManagedObjectPath<?, ?> path,
      LDAPProfile profile) {
    public static DN create(ManagedObjectPath<?, ?> path, LDAPProfile profile) {
    LDAPNameBuilder builder = new LDAPNameBuilder(profile);
    path.serialize(builder);
    return builder.getInstance();
  }
  /**
   * Creates a new LDAP name representing the specified managed object
   * path and instantiable relation.
     * Creates a new DN representing the specified managed object path and
     * instantiable relation.
   *
   * @param path
   *          The managed object path.
   * @param relation
   *          The child instantiable relation.
   * @param profile
   *          The LDAP profile which should be used to construct LDAP
   *          names.
   * @return Returns a new LDAP name representing the specified
   *         managed object path and instantiable relation.
     *            The LDAP profile which should be used to construct LDAP names.
     * @return Returns a new DN representing the specified managed object path
     *         and instantiable relation.
   */
  public static LdapName create(ManagedObjectPath<?, ?> path,
      InstantiableRelationDefinition<?, ?> relation, LDAPProfile profile) {
    public static DN create(ManagedObjectPath<?, ?> path, InstantiableRelationDefinition<?, ?> relation,
            LDAPProfile profile) {
    LDAPNameBuilder builder = new LDAPNameBuilder(profile);
    path.serialize(builder);
    builder.appendManagedObjectPathElement(relation);
    return builder.getInstance();
  }
  /**
   * Creates a new LDAP name representing the specified managed object
   * path and set relation.
     * Creates a new DN representing the specified managed object path and set
     * relation.
   *
   * @param path
   *          The managed object path.
   * @param relation
   *          The child set relation.
   * @param profile
   *          The LDAP profile which should be used to construct LDAP
   *          names.
   * @return Returns a new LDAP name representing the specified
   *         managed object path and set relation.
     *            The LDAP profile which should be used to construct LDAP names.
     * @return Returns a new DN representing the specified managed object path
     *         and set relation.
   */
  public static LdapName create(ManagedObjectPath<?, ?> path,
      SetRelationDefinition<?, ?> relation, LDAPProfile profile) {
    public static DN create(ManagedObjectPath<?, ?> path, SetRelationDefinition<?, ?> relation, LDAPProfile profile) {
    LDAPNameBuilder builder = new LDAPNameBuilder(profile);
    path.serialize(builder);
    builder.appendManagedObjectPathElement(relation);
@@ -122,49 +106,36 @@
  }
  // The list of RDNs in big-endian order.
  private final LinkedList<Rdn> rdns;
    private final LinkedList<RDN> rdns;
  // The LDAP profile.
  private final LDAPProfile profile;
  /**
   * Create a new JNDI LDAP name builder.
     * Create a new DN builder.
   *
   * @param profile
   *          The LDAP profile which should be used to construct LDAP
   *          names.
     *            The LDAP profile which should be used to construct DNs.
   */
  public LDAPNameBuilder(LDAPProfile profile) {
    this.rdns = new LinkedList<Rdn>();
        this.rdns = new LinkedList<RDN>();
    this.profile = profile;
  }
  /**
   * {@inheritDoc}
   */
  public <C extends ConfigurationClient, S extends Configuration>
      void appendManagedObjectPathElement(
          InstantiableRelationDefinition<? super C, ? super S> r,
          AbstractManagedObjectDefinition<C, S> d, String name) {
    public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
            InstantiableRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d, String name) {
    // Add the RDN sequence representing the relation.
    appendManagedObjectPathElement(r);
    // Now add the single RDN representing the named instance.
    String type = profile.getRelationChildRDNType(r);
    try {
      Rdn rdn = new Rdn(type, name.trim());
        RDN rdn = new RDN(type, name.trim());
      rdns.add(rdn);
    } catch (InvalidNameException e1) {
      // Should not happen.
      throw new RuntimeException(e1);
    }
  }
    }
  /**
   * Appends the RDN sequence representing the provided relation.
@@ -174,73 +145,60 @@
   */
  public void appendManagedObjectPathElement(RelationDefinition<?, ?> r) {
    // Add the RDN sequence representing the relation.
    try {
      LdapName tmp = new LdapName(profile.getRelationRDNSequence(r));
      rdns.addAll(tmp.getRdns());
    } catch (InvalidNameException e1) {
      // Should not happen.
      throw new RuntimeException(e1);
        DN dn = DN.valueOf(profile.getRelationRDNSequence(r));
        for (RDN rdn : dn) {
            rdns.add(rdn);
    }
  }
  /**
   * {@inheritDoc}
   */
  public <C extends ConfigurationClient, S extends Configuration>
      void appendManagedObjectPathElement(
          OptionalRelationDefinition<? super C, ? super S> r,
          AbstractManagedObjectDefinition<C, S> d) {
    public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
            OptionalRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
    // Add the RDN sequence representing the relation.
    appendManagedObjectPathElement(r);
  }
  /**
   * {@inheritDoc}
   */
  public <C extends ConfigurationClient, S extends Configuration>
      void appendManagedObjectPathElement(
          SingletonRelationDefinition<? super C, ? super S> r,
          AbstractManagedObjectDefinition<C, S> d) {
    public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
            SingletonRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
    // Add the RDN sequence representing the relation.
    appendManagedObjectPathElement(r);
  }
  /**
   * {@inheritDoc}
   */
  public <C extends ConfigurationClient, S extends Configuration>
      void appendManagedObjectPathElement(
          SetRelationDefinition<? super C, ? super S> r,
          AbstractManagedObjectDefinition<C, S> d) {
    public <C extends ConfigurationClient, S extends Configuration> void appendManagedObjectPathElement(
            SetRelationDefinition<? super C, ? super S> r, AbstractManagedObjectDefinition<C, S> d) {
    // Add the RDN sequence representing the relation.
    appendManagedObjectPathElement(r);
    // Now add the single RDN representing the named instance.
    String type = profile.getRelationChildRDNType(r);
    try {
      Rdn rdn = new Rdn(type, d.getName());
        RDN rdn = new RDN(type, d.getName());
      rdns.add(rdn);
    } catch (InvalidNameException e1) {
      // Should not happen.
      throw new RuntimeException(e1);
    }
  }
  /**
   * Create a new JNDI LDAP name using the current state of this LDAP name
   * builder.
     * Create a new DN using the current state of this builder.
   *
   * @return Returns the new JNDI LDAP name instance.
     * @return Returns the new DN instance.
   */
  public LdapName getInstance() {
    return new LdapName(rdns);
    public DN getInstance() {
        if (rdns.isEmpty()) {
            return DN.rootDN();
        }
        else {
            Collections.reverse(rdns);
            DN dn = DN.valueOf(rdns.removeFirst().toString());
            for (RDN rdn : rdns) {
                dn = dn.child(rdn);
            }
            return dn;
        }
  }
}
opendj-admin/src/main/java/org/opends/server/admin/client/spi/AbstractManagedObject.java
@@ -35,6 +35,7 @@
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
import org.opends.server.admin.ConfigurationClient;
@@ -60,9 +61,7 @@
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.SingletonRelationDefinition;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.ClientConstraintHandler;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ConcurrentModificationException;
import org.opends.server.admin.client.IllegalManagedObjectNameException;
import org.opends.server.admin.client.ManagedObject;
@@ -88,8 +87,6 @@
    private final class DefaultManagedObjectFactory implements RelationDefinitionVisitor<Void, Void> {
        // Possible exceptions.
        private AuthorizationException ae = null;
        private ManagedObjectAlreadyExistsException moaee = null;
        private MissingMandatoryPropertiesException mmpe = null;
@@ -98,7 +95,7 @@
        private OperationRejectedException ore = null;
        private CommunicationException ce = null;
        private ErrorResultException ere = null;
        /**
         * {@inheritDoc}
@@ -167,8 +164,6 @@
            try {
                child.commit();
            } catch (AuthorizationException e) {
                ae = e;
            } catch (ManagedObjectAlreadyExistsException e) {
                moaee = e;
            } catch (MissingMandatoryPropertiesException e) {
@@ -177,8 +172,8 @@
                cme = e;
            } catch (OperationRejectedException e) {
                ore = e;
            } catch (CommunicationException e) {
                ce = e;
            } catch (ErrorResultException e) {
                ere = e;
            }
        }
@@ -189,15 +184,13 @@
         * @param rd
         *            The relation definition.
         */
        private void createDefaultManagedObjects(RelationDefinition<?, ?> rd) throws AuthorizationException,
                CommunicationException, ConcurrentModificationException, MissingMandatoryPropertiesException,
        private void createDefaultManagedObjects(RelationDefinition<?, ?> rd) throws ErrorResultException,
                ConcurrentModificationException, MissingMandatoryPropertiesException,
                ManagedObjectAlreadyExistsException, OperationRejectedException {
            rd.accept(this, null);
            if (ae != null) {
                throw ae;
            } else if (ce != null) {
                throw ce;
            if (ere != null) {
                throw ere;
            } else if (cme != null) {
                throw cme;
            } else if (mmpe != null) {
@@ -264,7 +257,7 @@
     * {@inheritDoc}
     */
    public final void commit() throws ManagedObjectAlreadyExistsException, MissingMandatoryPropertiesException,
            ConcurrentModificationException, OperationRejectedException, AuthorizationException, CommunicationException {
            ConcurrentModificationException, OperationRejectedException, ErrorResultException {
        // First make sure all mandatory properties are defined.
        List<PropertyIsMandatoryException> exceptions = new LinkedList<PropertyIsMandatoryException>();
@@ -389,7 +382,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
            DefinitionDecodingException, ManagedObjectDecodingException, ManagedObjectNotFoundException,
            ConcurrentModificationException, AuthorizationException, CommunicationException {
            ConcurrentModificationException, ErrorResultException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -402,7 +395,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -415,7 +408,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SingletonRelationDefinition<C, S> r) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -428,7 +421,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getChild(
            SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException, DefinitionDecodingException,
            ManagedObjectDecodingException, ManagedObjectNotFoundException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        ensureThisManagedObjectExists();
        Driver ctx = getDriver();
@@ -499,7 +492,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean hasChild(
            OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -521,7 +514,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        return listChildren(r, r.getChildDefinition());
    }
@@ -530,8 +523,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            InstantiableRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws IllegalArgumentException, ConcurrentModificationException, AuthorizationException,
            CommunicationException {
            throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -546,7 +538,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            SetRelationDefinition<C, S> r) throws IllegalArgumentException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        return listChildren(r, r.getChildDefinition());
    }
@@ -555,8 +547,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> String[] listChildren(
            SetRelationDefinition<C, S> r, AbstractManagedObjectDefinition<? extends C, ? extends S> d)
            throws IllegalArgumentException, ConcurrentModificationException, AuthorizationException,
            CommunicationException {
            throws IllegalArgumentException, ConcurrentModificationException, ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        try {
@@ -572,7 +563,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
            InstantiableRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
            ManagedObjectNotFoundException, OperationRejectedException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -593,7 +584,7 @@
     */
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
            OptionalRelationDefinition<C, S> r) throws IllegalArgumentException, ManagedObjectNotFoundException,
            OperationRejectedException, ConcurrentModificationException, AuthorizationException, CommunicationException {
            OperationRejectedException, ConcurrentModificationException, ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -615,7 +606,7 @@
    public final <C extends ConfigurationClient, S extends Configuration> void removeChild(
            SetRelationDefinition<C, S> r, String name) throws IllegalArgumentException,
            ManagedObjectNotFoundException, OperationRejectedException, ConcurrentModificationException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(r);
        Driver ctx = getDriver();
        boolean found;
@@ -702,14 +693,10 @@
     * @throws OperationRejectedException
     *             If the managed object cannot be added due to some client-side
     *             or server-side constraint which cannot be satisfied.
     * @throws AuthorizationException
     *             If the server refuses to add this managed object because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    protected abstract void addNewManagedObject() throws AuthorizationException, CommunicationException,
    protected abstract void addNewManagedObject() throws ErrorResultException,
            OperationRejectedException, ConcurrentModificationException, ManagedObjectAlreadyExistsException;
    /**
@@ -765,7 +752,7 @@
     *             communication problem.
     */
    protected abstract void modifyExistingManagedObject() throws ConcurrentModificationException,
            OperationRejectedException, AuthorizationException, CommunicationException;
            OperationRejectedException, ErrorResultException;
    /**
     * Creates a new managed object.
@@ -833,8 +820,7 @@
    }
    // Makes sure that this managed object exists.
    private void ensureThisManagedObjectExists() throws ConcurrentModificationException, CommunicationException,
            AuthorizationException {
    private void ensureThisManagedObjectExists() throws ConcurrentModificationException, ErrorResultException {
        if (!path.isEmpty()) {
            Driver ctx = getDriver();
opendj-admin/src/main/java/org/opends/server/admin/client/spi/Driver.java
@@ -36,6 +36,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.admin.client.RootCfgClient;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbsoluteInheritedDefaultBehaviorProvider;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.AliasDefaultBehaviorProvider;
@@ -61,9 +62,7 @@
import org.opends.server.admin.SetRelationDefinition;
import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
import org.opends.server.admin.DefinitionDecodingException.Reason;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.ClientConstraintHandler;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
@@ -242,12 +241,10 @@
                throw new DefaultBehaviorException(pd1, e);
            } catch (PropertyNotFoundException e) {
                throw new DefaultBehaviorException(pd1, e);
            } catch (AuthorizationException e) {
            } catch (ErrorResultException e) {
                throw new DefaultBehaviorException(pd1, e);
            } catch (ManagedObjectNotFoundException e) {
                throw new DefaultBehaviorException(pd1, e);
            } catch (CommunicationException e) {
                throw new DefaultBehaviorException(pd1, e);
            } catch (PropertyException e) {
                throw new DefaultBehaviorException(pd1, e);
            }
@@ -296,17 +293,13 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd, String name)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd, name);
        return doDeleteManagedObject(child);
@@ -338,16 +331,12 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, OptionalRelationDefinition<C, S> rd) throws IllegalArgumentException,
            ManagedObjectNotFoundException, OperationRejectedException, AuthorizationException, CommunicationException {
            ManagedObjectNotFoundException, OperationRejectedException, ErrorResultException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd);
        return doDeleteManagedObject(child);
@@ -381,17 +370,13 @@
     *             client-side or server-side constraint which cannot be
     *             satisfied (for example, if it is referenced by another
     *             managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public final <C extends ConfigurationClient, S extends Configuration> boolean deleteManagedObject(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd, String name)
            throws IllegalArgumentException, ManagedObjectNotFoundException, OperationRejectedException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        validateRelationDefinition(parent, rd);
        ManagedObjectPath<?, ?> child = parent.child(rd, name);
        return doDeleteManagedObject(child);
@@ -419,16 +404,12 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws AuthorizationException
     *             If the server refuses to retrieve the managed object because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration> ManagedObject<? extends C> getManagedObject(
            ManagedObjectPath<C, S> path) throws DefinitionDecodingException, ManagedObjectDecodingException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException;
            ManagedObjectNotFoundException, ErrorResultException;
    /**
     * Gets the effective values of a property in the named managed object.
@@ -467,17 +448,12 @@
     * @throws ManagedObjectNotFoundException
     *             If the requested managed object could not be found on the
     *             server.
     * @throws AuthorizationException
     *             If the server refuses to retrieve the managed object because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration, PD> SortedSet<PD> getPropertyValues(
            ManagedObjectPath<C, S> path, PropertyDefinition<PD> pd) throws IllegalArgumentException,
            DefinitionDecodingException, AuthorizationException, ManagedObjectNotFoundException,
            CommunicationException, PropertyException;
            DefinitionDecodingException, ManagedObjectNotFoundException, ErrorResultException, PropertyException;
    /**
     * Gets the root configuration managed object associated with this
@@ -511,17 +487,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to list the managed objects because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, InstantiableRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException;
            ManagedObjectNotFoundException, ErrorResultException;
    /**
     * Lists the child managed objects of the named parent managed object which
@@ -546,17 +518,13 @@
     *             managed object's definition.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to list the managed objects because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public abstract <C extends ConfigurationClient, S extends Configuration> String[] listManagedObjects(
            ManagedObjectPath<?, ?> parent, SetRelationDefinition<C, S> rd,
            AbstractManagedObjectDefinition<? extends C, ? extends S> d) throws IllegalArgumentException,
            ManagedObjectNotFoundException, AuthorizationException, CommunicationException;
            ManagedObjectNotFoundException, ErrorResultException;
    /**
     * Determines whether or not the named managed object exists.
@@ -570,15 +538,11 @@
     *         <code>false</code> otherwise.
     * @throws ManagedObjectNotFoundException
     *             If the parent managed object could not be found.
     * @throws AuthorizationException
     *             If the server refuses to make the determination because the
     *             client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    public abstract boolean managedObjectExists(ManagedObjectPath<?, ?> path) throws ManagedObjectNotFoundException,
            AuthorizationException, CommunicationException;
            ErrorResultException;
    /**
     * Deletes the named managed object.
@@ -598,16 +562,11 @@
     *             If the managed object cannot be removed due to some
     *             server-side constraint which cannot be satisfied (for
     *             example, if it is referenced by another managed object).
     * @throws AuthorizationException
     *             If the server refuses to remove the managed objects because
     *             the client does not have the correct privileges.
     * @throws CommunicationException
     *             If the client cannot contact the server due to an underlying
     *             communication problem.
     * @throws ErrorResultException
     *             If any other error occurs.
     */
    protected abstract <C extends ConfigurationClient, S extends Configuration> void deleteManagedObject(
            ManagedObjectPath<C, S> path) throws OperationRejectedException, AuthorizationException,
            CommunicationException;
            ManagedObjectPath<C, S> path) throws OperationRejectedException, ErrorResultException;
    /**
     * Gets the default values for the specified property.
@@ -665,7 +624,7 @@
    // constraints are satisfied.
    private <C extends ConfigurationClient, S extends Configuration> boolean doDeleteManagedObject(
            ManagedObjectPath<C, S> path) throws ManagedObjectNotFoundException, OperationRejectedException,
            AuthorizationException, CommunicationException {
            ErrorResultException {
        // First make sure that the parent exists.
        if (!managedObjectExists(path.parent())) {
            throw new ManagedObjectNotFoundException();
opendj-admin/src/main/java/org/opends/server/admin/condition/ANDCondition.java
@@ -29,9 +29,8 @@
import java.util.Arrays;
import java.util.List;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
@@ -62,8 +61,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws AuthorizationException,
            CommunicationException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        for (Condition condition : conditions) {
            if (!condition.evaluate(context, managedObject)) {
                return false;
opendj-admin/src/main/java/org/opends/server/admin/condition/Condition.java
@@ -26,18 +26,13 @@
 */
package org.opends.server.admin.condition;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
/**
 * An interface for evaluating conditions.
 */
@@ -47,48 +42,35 @@
   * Initializes this condition.
   *
   * @param d
   *          The abstract managed object definition associated with
   *          this condition.
     *            The abstract managed object definition associated with this
     *            condition.
   * @throws Exception
   *           If this condition could not be initialized.
   */
  void initialize(AbstractManagedObjectDefinition<?, ?> d) throws Exception;
  /**
   * Evaluates this condition against the provided client managed
   * object.
     * Evaluates this condition against the provided client managed object.
   *
   * @param context
   *          The client management context.
   * @param managedObject
   *          The client managed object.
   * @return Returns <code>true</code> if this condition is
   *         satisfied.
   * @throws AuthorizationException
   *           If the condition could not be evaluated due to an
   *           authorization problem.
   * @throws CommunicationException
   *           If the condition could not be evaluated due to an
   *           communication problem.
     * @return Returns <code>true</code> if this condition is satisfied.
     * @throws ErrorResultException
     *             If the condition could not be evaluated.
   */
  boolean evaluate(ManagementContext context, ManagedObject<?> managedObject)
      throws AuthorizationException, CommunicationException;
    boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException;
  /**
   * Evaluates this condition against the provided server managed
   * object.
     * Evaluates this condition against the provided server managed object.
   *
   * @param managedObject
   *          The server managed object.
   * @return Returns <code>true</code> if this condition is
   *         satisfied.
     * @return Returns <code>true</code> if this condition is satisfied.
   * @throws ConfigException
   *           If the condition could not be evaluated due to an
   *           unexpected configuration exception.
     *             If the condition could not be evaluated due to an unexpected
     *             configuration exception.
   */
  boolean evaluate(ServerManagedObject<?> managedObject) throws ConfigException;
}
opendj-admin/src/main/java/org/opends/server/admin/condition/Conditions.java
@@ -26,21 +26,16 @@
 */
package org.opends.server.admin.condition;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
/**
 * This class consists exclusively of static methods that operate on
 * or return conditions.
 * This class consists exclusively of static methods that operate on or return
 * conditions.
 */
public final class Conditions {
@@ -52,29 +47,21 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context,
        ManagedObject<?> managedObject) throws AuthorizationException,
        CommunicationException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
      return false;
    }
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ServerManagedObject<?> managedObject)
        throws ConfigException {
        public boolean evaluate(ServerManagedObject<?> managedObject) throws ConfigException {
      return false;
    }
    /**
     * {@inheritDoc}
     */
    public void initialize(AbstractManagedObjectDefinition<?, ?> d)
        throws Exception {
        public void initialize(AbstractManagedObjectDefinition<?, ?> d) throws Exception {
      // No implementation required.
    }
@@ -88,147 +75,115 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context,
        ManagedObject<?> managedObject) throws AuthorizationException,
        CommunicationException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
      return true;
    }
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ServerManagedObject<?> managedObject)
        throws ConfigException {
        public boolean evaluate(ServerManagedObject<?> managedObject) throws ConfigException {
      return true;
    }
    /**
     * {@inheritDoc}
     */
    public void initialize(AbstractManagedObjectDefinition<?, ?> d)
        throws Exception {
        public void initialize(AbstractManagedObjectDefinition<?, ?> d) throws Exception {
      // No implementation required.
    }
  };
  /**
   * Creates a condition which evaluates to <code>true</code> if and
   * only if all of its sub-conditions are <code>true</code>.
     * Creates a condition which evaluates to <code>true</code> if and only if
     * all of its sub-conditions are <code>true</code>.
   *
   * @param conditions
   *          The sub-conditions which be combined using a logical
   *          AND.
   * @return Returns a condition which evaluates to <code>true</code>
   *         if and only if all of its sub-conditions are
   *         <code>true</code>.
     *            The sub-conditions which be combined using a logical AND.
     * @return Returns a condition which evaluates to <code>true</code> if and
     *         only if all of its sub-conditions are <code>true</code>.
   */
  public static Condition and(Condition... conditions) {
    return new ANDCondition(conditions);
  }
  /**
   * Creates a condition which evaluates to <code>true</code> if and
   * only if a property contains a particular value.
     * Creates a condition which evaluates to <code>true</code> if and only if a
     * property contains a particular value.
   *
   * @param propertyName
   *          The property name.
   * @param propertyStringValue
   *          The string representation of the required property
   *          value.
   * @return Returns a condition which evaluates to <code>true</code>
   *         if and only if a property contains a particular value.
     *            The string representation of the required property value.
     * @return Returns a condition which evaluates to <code>true</code> if and
     *         only if a property contains a particular value.
   */
  public static Condition contains(String propertyName,
      String propertyStringValue) {
    public static Condition contains(String propertyName, String propertyStringValue) {
    return new ContainsCondition(propertyName, propertyStringValue);
  }
  /**
   * Creates a condition which evaluates to <code>false</code> if
   * and only if the first sub-condition evaluates to
   * <code>true</code> and the second sub-condition evaluates to
   * <code>false</code>. This can be used to represent if-then
   * relationships.
     * Creates a condition which evaluates to <code>false</code> if and only if
     * the first sub-condition evaluates to <code>true</code> and the second
     * sub-condition evaluates to <code>false</code>. This can be used to
     * represent if-then relationships.
   *
   * @param premise
   *          The sub-condition which, when <code>true</code>
   *          implies that the implication sub-condition must also be
   *          <code>true</code>.
     *            The sub-condition which, when <code>true</code> implies that
     *            the implication sub-condition must also be <code>true</code>.
   * @param implication
   *          The sub-condition which, must be <code>true</code>
   *          when the premise is <code>true</code>.
   * @return Returns a condition which evaluates to <code>false</code>
   *         if and only if the first sub-condition evaluates to
   *         <code>true</code> and the second sub-condition
   *         evaluates to <code>false</code>.
     *            The sub-condition which, must be <code>true</code> when the
     *            premise is <code>true</code>.
     * @return Returns a condition which evaluates to <code>false</code> if and
     *         only if the first sub-condition evaluates to <code>true</code>
     *         and the second sub-condition evaluates to <code>false</code>.
   */
  public static Condition implies(Condition premise, Condition implication) {
    return or(not(premise), implication);
  }
  /**
   * Creates a condition which evaluates to <code>true</code> if and
   * only if a particular property has any values specified.
     * Creates a condition which evaluates to <code>true</code> if and only if a
     * particular property has any values specified.
   *
   * @param propertyName
   *          The property name.
   * @return Returns a condition which evaluates to <code>true</code>
   *         if and only if a particular property has any values
   *         specified.
     * @return Returns a condition which evaluates to <code>true</code> if and
     *         only if a particular property has any values specified.
   */
  public static Condition isPresent(String propertyName) {
    return new IsPresentCondition(propertyName);
  }
  /**
   * Creates a condition which evaluates to <code>true</code> if the
   * sub-condition is <code>false</code>, or <code>false</code>
   * if the sub-condition is <code>true</code>.
     * sub-condition is <code>false</code>, or <code>false</code> if the
     * sub-condition is <code>true</code>.
   *
   * @param condition
   *          The sub-condition which will be inverted.
   * @return Returns a condition which evaluates to <code>true</code>
   *         if the sub-condition is <code>false</code>, or
   *         <code>false</code> if the sub-condition is
   *         <code>true</code>.
     * @return Returns a condition which evaluates to <code>true</code> if the
     *         sub-condition is <code>false</code>, or <code>false</code> if the
     *         sub-condition is <code>true</code>.
   */
  public static Condition not(Condition condition) {
    return new NOTCondition(condition);
  }
  /**
   * Creates a condition which evaluates to <code>false</code> if
   * and only if all of its sub-conditions are <code>false</code>.
     * Creates a condition which evaluates to <code>false</code> if and only if
     * all of its sub-conditions are <code>false</code>.
   *
   * @param conditions
   *          The sub-conditions which be combined using a logical OR.
   * @return Returns a condition which evaluates to <code>false</code>
   *         if and only if all of its sub-conditions are
   *         <code>false</code>.
     * @return Returns a condition which evaluates to <code>false</code> if and
     *         only if all of its sub-conditions are <code>false</code>.
   */
  public static Condition or(Condition... conditions) {
    return new ORCondition(conditions);
  }
  // Prevent instantiation.
  private Conditions() {
    // No implementation required.
opendj-admin/src/main/java/org/opends/server/admin/condition/ContainsCondition.java
@@ -28,11 +28,10 @@
import java.util.SortedSet;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.IllegalPropertyValueStringException;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
@@ -69,8 +68,7 @@
        /**
         * {@inheritDoc}
         */
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject)
                throws AuthorizationException, CommunicationException {
        public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
            SortedSet<T> values = managedObject.getPropertyValues(pd);
            return values.contains(value);
        }
@@ -123,8 +121,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws AuthorizationException,
            CommunicationException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        return impl.evaluate(context, managedObject);
    }
opendj-admin/src/main/java/org/opends/server/admin/condition/IsPresentCondition.java
@@ -28,10 +28,9 @@
import java.util.SortedSet;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.PropertyDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
@@ -65,8 +64,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws AuthorizationException,
            CommunicationException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        SortedSet<?> values = managedObject.getPropertyValues(pd);
        return !values.isEmpty();
    }
opendj-admin/src/main/java/org/opends/server/admin/condition/NOTCondition.java
@@ -26,9 +26,8 @@
 */
package org.opends.server.admin.condition;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
@@ -60,8 +59,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws AuthorizationException,
            CommunicationException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        return !condition.evaluate(context, managedObject);
    }
opendj-admin/src/main/java/org/opends/server/admin/condition/ORCondition.java
@@ -29,9 +29,8 @@
import java.util.Arrays;
import java.util.List;
import org.forgerock.opendj.ldap.ErrorResultException;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.client.AuthorizationException;
import org.opends.server.admin.client.CommunicationException;
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
@@ -62,8 +61,7 @@
    /**
     * {@inheritDoc}
     */
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws AuthorizationException,
            CommunicationException {
    public boolean evaluate(ManagementContext context, ManagedObject<?> managedObject) throws ErrorResultException {
        for (Condition condition : conditions) {
            if (condition.evaluate(context, managedObject)) {
                return true;
opendj-admin/src/main/resources/stylesheets/clientMO.xsl
@@ -112,16 +112,14 @@
                       '          If the ', $ufn, ' could not be found on the server.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      AuthorizationException, CommunicationException;&#xa;')" />
                       '      ErrorResultException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-zero-or-one">
        <xsl:call-template name="add-java-comment2">
@@ -132,15 +130,13 @@
                       '@return Returns &lt;true&gt; if the ', $ufn,' exists.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to make the determination because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  boolean has',
                       $java-relation-name, '() throws ConcurrentModificationException,&#xa;',
                       '      AuthorizationException, CommunicationException;&#xa;')" />
                       '      ErrorResultException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -159,16 +155,14 @@
                       '          If the ', $ufn, ' is not present.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to retrieve the ', $ufn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      AuthorizationException, CommunicationException;&#xa;')" />
                       '      ErrorResultException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -211,16 +205,13 @@
                       '          If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  void remove', $java-relation-name, '()&#xa;',
                         '      throws ManagedObjectNotFoundException, OperationRejectedException,&#xa;',
                         '      ConcurrentModificationException, AuthorizationException,&#xa;',
                         '      CommunicationException;&#xa;')" />
                         '      ConcurrentModificationException, ErrorResultException;&#xa;')" />
      </xsl:when>
      <xsl:when test="adm:one-to-many">
        <xsl:variable name="plural-name"
@@ -243,15 +234,13 @@
                       '@return Returns an array containing the names of the ', $ufpn,'.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to list the ', $ufpn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  String[] list',
                       $java-relation-plural-name, '() throws ConcurrentModificationException,&#xa;',
                       '      AuthorizationException, CommunicationException;&#xa;')" />
                       '      ErrorResultException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -272,16 +261,14 @@
                       '          If the named ', $ufn, ' was not found on the server.&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to retrieve the named ', $ufn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)&#xa;',
                       '      throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                       '      ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                       '      AuthorizationException, CommunicationException;&#xa;')" />
                       '      ErrorResultException;&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
        <xsl:text>&#xa;</xsl:text>
@@ -360,16 +347,13 @@
                       '          If the server refuses to remove the ', $ufn, ' due to some server-side constraint which cannot be satisfied (for example, if it is referenced by another managed object).&#xa;',
                       '@throws ConcurrentModificationException&#xa;',
                       '          If this ', $this-ufn, ' has been removed from the server by another client.&#xa;',
                       '@throws AuthorizationException&#xa;',
                       '          If the server refuses to remove the ', $ufn, ' because the client does not have the correct privileges.&#xa;',
                       '@throws CommunicationException&#xa;',
                       '          If the client cannot contact the server due to an underlying communication problem.')" />
                       '@throws ErrorResultException&#xa;',
                       '          If any other error occurs.')" />
        </xsl:call-template>
        <xsl:value-of
          select="concat('  void remove', $java-relation-name, '(String name)&#xa;',
                         '      throws ManagedObjectNotFoundException, OperationRejectedException,&#xa;',
                         '      ConcurrentModificationException, AuthorizationException,&#xa;',
                         '      CommunicationException;&#xa;')" />
                         '      ConcurrentModificationException, ErrorResultException;&#xa;')" />
      </xsl:when>
      <xsl:otherwise>
        <xsl:message terminate="yes">
@@ -425,10 +409,7 @@
            org.opends.server.admin.client.ConcurrentModificationException
          </import>
          <import>
            org.opends.server.admin.client.AuthorizationException
          </import>
          <import>
            org.opends.server.admin.client.CommunicationException
            org.forgerock.opendj.ldap.ErrorResultException
          </import>
        </xsl:if>
        <xsl:for-each
opendj-admin/src/main/resources/stylesheets/metaMO.xsl
@@ -466,8 +466,7 @@
                     '     */&#xa;',
                     '    public void commit() throws ManagedObjectAlreadyExistsException,&#xa;',
                     '        MissingMandatoryPropertiesException, ConcurrentModificationException,&#xa;',
                     '        OperationRejectedException, AuthorizationException,&#xa;',
                     '        CommunicationException {&#xa;',
                     '        OperationRejectedException, ErrorResultException {&#xa;',
                     '      impl.commit();&#xa;',
                     '    }&#xa;')" />
    <xsl:text>&#xa;</xsl:text>
@@ -1193,7 +1192,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        AuthorizationException, CommunicationException {&#xa;',
                         '        ErrorResultException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1203,7 +1202,7 @@
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public boolean has', $java-relation-name, '() throws ConcurrentModificationException,&#xa;',
                         '        AuthorizationException, CommunicationException {&#xa;',
                         '        ErrorResultException {&#xa;',
                         '      return impl.hasChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1216,7 +1215,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '()&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        AuthorizationException, CommunicationException {&#xa;',
                         '        ErrorResultException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-name,'RelationDefinition()).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1239,7 +1238,7 @@
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, '()&#xa;',
                         '        throws ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        OperationRejectedException, AuthorizationException, CommunicationException {&#xa;',
                         '        OperationRejectedException, ErrorResultException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1256,7 +1255,7 @@
                         '     * {@inheritDoc}&#xa;',
                         '     */&#xa;',
                         '    public String[] list', $java-relation-plural-name, '() throws ConcurrentModificationException,&#xa;',
                         '        AuthorizationException, CommunicationException {&#xa;',
                         '        ErrorResultException {&#xa;',
                         '      return impl.listChildren(INSTANCE.get', $java-relation-plural-name,'RelationDefinition());&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1269,7 +1268,7 @@
                         '    public ', $java-class-name, 'CfgClient get', $java-relation-name, '(String name)&#xa;',
                         '        throws DefinitionDecodingException, ManagedObjectDecodingException,&#xa;',
                         '        ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        AuthorizationException, CommunicationException {&#xa;',
                         '        ErrorResultException {&#xa;',
                         '      return impl.getChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name).getConfiguration();&#xa;',
                         '    }&#xa;')" />
        <xsl:text>&#xa;</xsl:text>
@@ -1307,7 +1306,7 @@
                         '     */&#xa;',
                         '    public void remove', $java-relation-name, '(String name)&#xa;',
                         '        throws ManagedObjectNotFoundException, ConcurrentModificationException,&#xa;',
                         '        OperationRejectedException, AuthorizationException, CommunicationException {&#xa;',
                         '        OperationRejectedException, ErrorResultException {&#xa;',
                         '      impl.removeChild(INSTANCE.get', $java-relation-plural-name,'RelationDefinition(), name);&#xa;',
                         '    }&#xa;')" />
      </xsl:when>
@@ -1925,10 +1924,7 @@
              org.opends.server.admin.ManagedObjectAlreadyExistsException
            </import>
            <import>
              org.opends.server.admin.client.AuthorizationException
            </import>
            <import>
              org.opends.server.admin.client.CommunicationException
              org.forgerock.opendj.ldap.ErrorResultException
            </import>
            <import>
              org.opends.server.admin.client.ConcurrentModificationException