jawiro
Interface ConstraintStrategy

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
RoleChecker

public interface ConstraintStrategy
extends java.io.Serializable

Constraint manager classes need to implement this interface for enforcing domain specific rules. If a constraint manager is assigned via Actor.setConstraintStrategy method, it will be invoked before each addRole, resign, suspend and resume command to approve the operation. If the manager does not approve the operation, the operation is cancelled.

ConstraintStrategy interface also implements the java.io.Serializable interface in order to preserving the state of the persistence manager of a role hierarchy after the hierarchy is saved to secondary storage.

The following rules are hard-coded into JAWIRO so that the users do not need to worry about these:

The domain specific rules and the above precautions taken by JAWIRO prevent the role binding anomalies together.


Method Summary
 boolean approveAddRole(java.lang.String parentClassName, java.lang.String childClassName)
          Allows user to allow or disallow a role adding operation, e.g. the RoleInterface.addRole command.
 boolean approveResign(java.lang.String parentClassName, java.lang.String childClassName)
          Allows user to allow or disallow a role resigning operation, e.g. the Role.resign command.
 boolean approveResume(java.lang.String parentClassName, java.lang.String childClassName)
          Allows user to allow or disallow a role resuming operation, e.g. the Role.resume command.
 boolean approveSuspend(java.lang.String parentClassName, java.lang.String childClassName)
          Allows user to allow or disallow a role suspending operation, e.g. the Role.suspend command.
 void setActor(jawiro.Actor anActor)
          Allows a user to provide a reference to the root of the role hierarchy which is to be managed.
 

Method Detail

approveAddRole

boolean approveAddRole(java.lang.String parentClassName,
                       java.lang.String childClassName)
Allows user to allow or disallow a role adding operation, e.g. the RoleInterface.addRole command.

Parameters:
parentClassName - Type name of the object which will play the role instance to be added.
childClassName - Type name of the role instance which is to be played by an owner.
Returns:
true if the operation is allowed, false if otherwise.

approveResign

boolean approveResign(java.lang.String parentClassName,
                      java.lang.String childClassName)
Allows user to allow or disallow a role resigning operation, e.g. the Role.resign command.

Parameters:
parentClassName - Type name of the object which plays the role to be resigned.
childClassName - Type name of the role instance which is to be resigned.
Returns:
true if the operation is allowed, false if otherwise.

approveSuspend

boolean approveSuspend(java.lang.String parentClassName,
                       java.lang.String childClassName)
Allows user to allow or disallow a role suspending operation, e.g. the Role.suspend command.

Parameters:
parentClassName - Type name of the object which plays the role to be suspended.
childClassName - Type name of the role instance which is to be suspended.
Returns:
true if the operation is allowed, false if otherwise.

approveResume

boolean approveResume(java.lang.String parentClassName,
                      java.lang.String childClassName)
Allows user to allow or disallow a role resuming operation, e.g. the Role.resume command.

Parameters:
parentClassName - Type name of the object which was playing the role to be resumed.
childClassName - Type name of the role instance which is to be resumed.
Returns:
true if the operation is allowed, false if otherwise.

setActor

void setActor(jawiro.Actor anActor)
Allows a user to provide a reference to the root of the role hierarchy which is to be managed.

Parameters:
anActor - The root of the hierarchy be managed.