public class CompositeActionPolicy extends Object implements ActionPolicy
allowed
iff both component policies allow it.Modifier and Type | Field and Description |
---|---|
protected ActionPolicy |
f_policyPrimary
The primary ActionPolicy.
|
protected ActionPolicy |
f_policySecondary
The secondary ActionPolicy.
|
Constructor and Description |
---|
CompositeActionPolicy(ActionPolicy policyPrimary, ActionPolicy policySecondary)
Construct a CompositeActionPolicy representing the specified policies.
|
Modifier and Type | Method and Description |
---|---|
ActionPolicy |
getPrimaryPolicy()
Return the primary policy.
|
ActionPolicy |
getSecondaryPolicy()
Return the secondary policy.
|
void |
init(Service service)
Called when the specified service loads and configures this policy.
|
boolean |
isAllowed(Service service, Action action)
Evaluate if the specified action is currently allowed by this policy.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
protected final ActionPolicy f_policyPrimary
protected final ActionPolicy f_policySecondary
public CompositeActionPolicy(ActionPolicy policyPrimary, ActionPolicy policySecondary)
policyPrimary
- the first policy to consultpolicySecondary
- the second policy to consultpublic void init(Service service)
Note: A policy could be applied to multiple services.
init
in interface ActionPolicy
service
- the service that this policy applies topublic boolean isAllowed(Service service, Action action)
Note: for forward compatibility, implementations should generally return true for actions that are not recognized.
isAllowed
in interface ActionPolicy
service
- the service that is performing the actionaction
- the action that is being performedpublic ActionPolicy getPrimaryPolicy()
public ActionPolicy getSecondaryPolicy()