org.opends.server.admin.client
Class ClientConstraintHandler

java.lang.Object
  extended by org.opends.server.admin.client.ClientConstraintHandler

public abstract class ClientConstraintHandler
extends java.lang.Object

An interface for performing client-side constraint validation.

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 OperationRejectedException.

A client constraint handler must override at least one of the provided methods.

See Also:
Constraint

Constructor Summary
protected ClientConstraintHandler()
          Creates a new client constraint handler.
 
Method Summary
 boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject, java.util.Collection<Message> unacceptableReasons)
          Determines whether or not the newly created managed object which is about to be added to the server configuration satisfies this constraint.
 boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?,?> path, java.util.Collection<Message> unacceptableReasons)
          Determines whether or not the existing managed object which is about to be deleted from the server configuration satisfies this constraint.
 boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject, java.util.Collection<Message> unacceptableReasons)
          Determines whether or not the changes to an existing managed object which are about to be committed to the server configuration satisfies this constraint.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientConstraintHandler

protected ClientConstraintHandler()
Creates a new client constraint handler.

Method Detail

isAddAcceptable

public boolean isAddAcceptable(ManagementContext context,
                               ManagedObject<?> managedObject,
                               java.util.Collection<Message> unacceptableReasons)
                        throws AuthorizationException,
                               CommunicationException
Determines whether or not the newly created managed object which is about to be added to the server configuration satisfies this constraint.

If the constraint is not satisfied, the implementation must return false and add a message describing why the constraint was not satisfied.

The default implementation is to return true.

Parameters:
context - The management context.
managedObject - The new managed object.
unacceptableReasons - A list of messages to which error messages should be added.
Returns:
Returns true if this constraint is satisfied, or false if it is not.
Throws:
AuthorizationException - If an authorization failure prevented this constraint from being evaluated.
CommunicationException - If a communications problem prevented this constraint from being evaluated.

isModifyAcceptable

public boolean isModifyAcceptable(ManagementContext context,
                                  ManagedObject<?> managedObject,
                                  java.util.Collection<Message> unacceptableReasons)
                           throws AuthorizationException,
                                  CommunicationException
Determines whether or not the changes to an existing managed object which are about to be committed to the server configuration satisfies this constraint.

If the constraint is not satisfied, the implementation must return false and add a message describing why the constraint was not satisfied.

The default implementation is to return true.

Parameters:
context - The management context.
managedObject - The modified managed object.
unacceptableReasons - A list of messages to which error messages should be added.
Returns:
Returns true if this modify is satisfied, or false if it is not.
Throws:
AuthorizationException - If an authorization failure prevented this constraint from being evaluated.
CommunicationException - If a communications problem prevented this constraint from being evaluated.

isDeleteAcceptable

public boolean isDeleteAcceptable(ManagementContext context,
                                  ManagedObjectPath<?,?> path,
                                  java.util.Collection<Message> unacceptableReasons)
                           throws AuthorizationException,
                                  CommunicationException
Determines whether or not the existing managed object which is about to be deleted from the server configuration satisfies this constraint.

If the constraint is not satisfied, the implementation must return false and add a message describing why the constraint was not satisfied.

The default implementation is to return true.

Parameters:
context - The management context.
path - The path of the managed object which is about to be deleted.
unacceptableReasons - A list of messages to which error messages should be added.
Returns:
Returns true if this constraint is satisfied, or false if it is not.
Throws:
AuthorizationException - If an authorization failure prevented this constraint from being evaluated.
CommunicationException - If a communications problem prevented this constraint from being evaluated.