Class PolicySet

  • All Implemented Interfaces:
    IPolicySet

    public class PolicySet
    extends java.lang.Object
    implements IPolicySet
    Implements a policy set per IPolicySet interface. This class uses a vector of ordered policies to enforce priority.
    Version:
    $Revision$, $Date$
    Author:
    kanda
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger logger  
    • Constructor Summary

      Constructors 
      Constructor Description
      PolicySet​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addRule​(java.lang.String ruleName, IPolicyRule rule)
      Add a policy rule.
      PolicyResult apply​(IRequest req)
      Apply policies on a given request from a rule set.
      int count()
      Returns the no of rules in a set.
      java.lang.String getName()
      Returns the name of the rule set.
      IPolicyRule getRule​(java.lang.String ruleName)
      Returns the rule identified by a given name.
      java.util.Enumeration<IPolicyRule> getRules()
      Returns an enumeration of rules.
      void printPolicies()  
      void removeRule​(java.lang.String ruleName)
      Removes a policy rule identified by the given name.
      void replaceRule​(java.lang.String ruleName, IPolicyRule rule)
      Remplaces a policy rule identified by the given name.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
    • Constructor Detail

      • PolicySet

        public PolicySet​(java.lang.String name)
    • Method Detail

      • getName

        public java.lang.String getName()
        Returns the name of the rule set.

        Specified by:
        getName in interface IPolicySet
        Returns:
        The name of the rule set.
      • count

        public int count()
        Returns the no of rules in a set.

        Specified by:
        count in interface IPolicySet
        Returns:
        the no of rules.
      • addRule

        public void addRule​(java.lang.String ruleName,
                            IPolicyRule rule)
        Add a policy rule.

        Specified by:
        addRule in interface IPolicySet
        Parameters:
        ruleName - The name of the rule to be added.
        rule - The rule to be added.
      • replaceRule

        public void replaceRule​(java.lang.String ruleName,
                                IPolicyRule rule)
        Remplaces a policy rule identified by the given name.
        Parameters:
        ruleName - The name of the rule to be replaced.
        rule - The rule to be replaced.
      • removeRule

        public void removeRule​(java.lang.String ruleName)
        Removes a policy rule identified by the given name.
        Specified by:
        removeRule in interface IPolicySet
        Parameters:
        ruleName - The name of the rule to be removed.
      • getRule

        public IPolicyRule getRule​(java.lang.String ruleName)
        Returns the rule identified by a given name.

        Specified by:
        getRule in interface IPolicySet
        Parameters:
        ruleName - The name of the rule to be return.
        Returns:
        The rule identified by the given name or null if none exists.
      • getRules

        public java.util.Enumeration<IPolicyRule> getRules()
        Returns an enumeration of rules.

        Specified by:
        getRules in interface IPolicySet
        Returns:
        An enumeration of rules.
      • apply

        public PolicyResult apply​(IRequest req)
        Apply policies on a given request from a rule set. The rules may modify the request.
        Specified by:
        apply in interface IPolicySet
        Parameters:
        req - The request to apply policies on.
        Returns:
        the PolicyResult.
      • printPolicies

        public void printPolicies()