Class ClientConstraintHandler
- java.lang.Object
-
- org.forgerock.opendj.config.client.ClientConstraintHandler
-
public abstract class ClientConstraintHandler extends 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
Constructors Modifier Constructor Description protectedClientConstraintHandler()Creates a new client constraint handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisAddAcceptable(ManagementContext context, ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)Determines whether the newly created managed object which is about to be added to the server configuration satisfies this constraint.booleanisDeleteAcceptable(ManagementContext context, ManagedObjectPath<?,?> path, Collection<LocalizableMessage> unacceptableReasons)Determines whether the existing managed object which is about to be deleted from the server configuration satisfies this constraint.booleanisModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons)Determines whether the changes to an existing managed object which are about to be committed to the server configuration satisfies this constraint.
-
-
-
Method Detail
-
isAddAcceptable
public boolean isAddAcceptable(ManagementContext context, ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons) throws LdapException
Determines whether 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
falseand 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
trueif this constraint is satisfied, orfalseif it is not. - Throws:
LdapException- If an error occurs.
-
isModifyAcceptable
public boolean isModifyAcceptable(ManagementContext context, ManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons) throws LdapException
Determines whether 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
falseand 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
trueif this modify is satisfied, orfalseif it is not. - Throws:
LdapException- If an error occurs.
-
isDeleteAcceptable
public boolean isDeleteAcceptable(ManagementContext context, ManagedObjectPath<?,?> path, Collection<LocalizableMessage> unacceptableReasons) throws LdapException
Determines whether 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
falseand 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
trueif this constraint is satisfied, orfalseif it is not. - Throws:
LdapException- If an error occurs.
-
-