Class PolicySet

java.lang.Object
org.dogtagpki.legacy.core.policy.PolicySet

public class PolicySet extends Object
Represents a set of policy rules. Policy rules are ordered from lowest priority to highest priority. The priority assignment for rules is not enforced by this interface. Various implementation may use different mechanisms such as a linear ordering of rules in a configuration file or explicit assignment of priority levels ..etc. The policy system initialization needs to deal with reading the rules, sorting them in increasing order of priority and presenting an ordered vector of rules.
Author:
kanda
  • Field Details

    • logger

      public static org.slf4j.Logger logger
  • Constructor Details

    • PolicySet

      public PolicySet(String name)
  • Method Details

    • getName

      public String getName()
      Returns the name of the rule set.
      Returns:
      The name of the rule set.
    • count

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

      public void addRule(String ruleName, PolicyRule rule)
      Add a policy rule.
      Parameters:
      ruleName - The name of the rule to be added.
      rule - The rule to be added.
    • replaceRule

      public void replaceRule(String ruleName, PolicyRule rule)
      Replaces 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(String ruleName)
      Removes a policy rule identified by the given name.
      Parameters:
      ruleName - The name of the rule to be removed.
    • getRule

      public PolicyRule getRule(String ruleName)
      Returns the rule identified by a given name.
      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 Enumeration<PolicyRule> getRules()
      Returns an enumeration of rules.
      Returns:
      An enumeration of rules.
    • apply

      public PolicyResult apply(Request req)
      Apply policies on a given request from a rule set. The rules may modify the request.
      Parameters:
      req - The request to apply policies on.
      Returns:
      the PolicyResult.
    • printPolicies

      public void printPolicies()