Class CompositeActionPolicy

  • All Implemented Interfaces:
    ActionPolicy

    public class CompositeActionPolicy
    extends Object
    implements ActionPolicy
    CompositeActionPolicy represents the "intersection" of two policies. More formally, a given action is allowed iff both component policies allow it.
    Author:
    rhl 2012.09.20
    • 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 consult
        policySecondary - 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 interface ActionPolicy
        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 interface ActionPolicy
        Parameters:
        service - the service that is performing the action
        action - 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