public abstract class ServerConstraintHandler extends Object
Constraints are evaluated immediately before and after write operations are
performed. Server-side constraints are evaluated in two phases: the first
phase determines if the proposed add, delete, or modification is acceptable
according to the constraint. If one or more constraints fails, the write
write operation is refused, and the client will receive an
OperationRejectedException
exception. The second phase is
invoked once the add, delete, or modification request has been allowed and
any changes applied. The second phase gives the constraint handler a chance
to register listener call-backs if required.
A server constraint handler must override at least one of the provided methods.
Constraint
Modifier | Constructor and Description |
---|---|
protected |
ServerConstraintHandler()
Creates a new server constraint handler.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isDeleteAllowed(ServerManagedObject<?> managedObject,
Collection<LocalizableMessage> unacceptableReasons)
Determines whether the existing managed object can be deleted from
the server's configuration.
|
boolean |
isUsable(ServerManagedObject<?> managedObject,
Collection<LocalizableMessage> unacceptableReasons)
Determines whether the provided managed object can be used by the
server.
|
void |
performPostAdd(ServerManagedObject<?> managedObject)
Performs any post-add processing required by this constraint.
|
void |
performPostDelete(ServerManagedObject<?> managedObject)
Performs any post-delete processing required by this constraint.
|
void |
performPostModify(ServerManagedObject<?> managedObject)
Performs any post-modify processing required by this constraint.
|
protected ServerConstraintHandler()
public boolean isDeleteAllowed(ServerManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons) throws ConfigException
If the constraint is not satisfied, the implementation must return
false
and add a message describing why the managed object
cannot be deleted.
The default implementation is to return true
.
managedObject
- The managed object which is about to be deleted.unacceptableReasons
- A list of messages to which error messages should be added.true
if this constraint is satisfied, or
false
if it is not and the managed object cannot be
deleted.ConfigException
- If an configuration exception prevented this constraint from
being evaluated.public boolean isUsable(ServerManagedObject<?> managedObject, Collection<LocalizableMessage> unacceptableReasons) throws ConfigException
If the constraint is not satisfied, the implementation must return
false
and add a message describing why the managed object is
not usable.
The default implementation is to return true
.
managedObject
- The new managed object.unacceptableReasons
- A list of messages to which error messages should be added.true
if this constraint is satisfied, or
false
if it is not and the managed object cannot be
used.ConfigException
- If an configuration exception prevented this constraint from
being evaluated.public void performPostAdd(ServerManagedObject<?> managedObject) throws ConfigException
The default implementation is to do nothing.
managedObject
- The managed object which has just been added to the server's
configuration.ConfigException
- If the post-add processing fails due to a configuration
exception.public void performPostDelete(ServerManagedObject<?> managedObject) throws ConfigException
The default implementation is to do nothing.
managedObject
- The managed object which was deleted.ConfigException
- If the post-delete processing fails due to a configuration
exception.public void performPostModify(ServerManagedObject<?> managedObject) throws ConfigException
The default implementation is to do nothing.
managedObject
- The managed object which was modified.ConfigException
- If the post-modify processing fails due to a configuration
exception.Copyright 2010-2022 ForgeRock AS.