Package com.tangosol.net
Class CompositeActionPolicy
- java.lang.Object
-
- com.tangosol.net.CompositeActionPolicy
-
- All Implemented Interfaces:
ActionPolicy
public class CompositeActionPolicy extends Object implements ActionPolicy
CompositeActionPolicy represents the "intersection" of two policies. More formally, a given action isallowed
iff both component policies allow it.- Author:
- rhl 2012.09.20
-
-
Field Summary
Fields Modifier and Type Field Description protected ActionPolicy
f_policyPrimary
The primary ActionPolicy.protected ActionPolicy
f_policySecondary
The secondary ActionPolicy.
-
Constructor Summary
Constructors Constructor Description CompositeActionPolicy(ActionPolicy policyPrimary, ActionPolicy policySecondary)
Construct a CompositeActionPolicy representing the specified policies.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.tangosol.net.ActionPolicy
toString
-
-
-
-
Field Detail
-
f_policyPrimary
protected final ActionPolicy f_policyPrimary
The primary ActionPolicy.
-
f_policySecondary
protected final ActionPolicy f_policySecondary
The secondary ActionPolicy.
-
-
Constructor Detail
-
CompositeActionPolicy
public CompositeActionPolicy(ActionPolicy policyPrimary, ActionPolicy policySecondary)
Construct a CompositeActionPolicy representing the specified policies.- Parameters:
policyPrimary
- the first policy to consultpolicySecondary
- the second policy to consult
-
-
Method Detail
-
init
public void init(Service service)
Called when the specified service loads and configures this policy.Note: A policy could be applied to multiple services.
- Specified by:
init
in interfaceActionPolicy
- Parameters:
service
- the service that this policy applies to
-
isAllowed
public boolean isAllowed(Service service, Action action)
Evaluate if the specified action is currently allowed by this policy.Note: for forward compatibility, implementations should generally return true for actions that are not recognized.
- Specified by:
isAllowed
in interfaceActionPolicy
- Parameters:
service
- the service that is performing the actionaction
- the action that is being performed- Returns:
- true iff the specified action is currently allowed by this policy
-
getPrimaryPolicy
public ActionPolicy getPrimaryPolicy()
Return the primary policy.- Returns:
- the primary policy
-
getSecondaryPolicy
public ActionPolicy getSecondaryPolicy()
Return the secondary policy.- Returns:
- the secondary policy
-
-