Package org.dogtagpki.legacy.core.policy
Class PolicySet
- java.lang.Object
-
- org.dogtagpki.legacy.core.policy.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.Loggerlogger
-
Constructor Summary
Constructors Constructor Description PolicySet(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRule(java.lang.String ruleName, IPolicyRule rule)Add a policy rule.PolicyResultapply(IRequest req)Apply policies on a given request from a rule set.intcount()Returns the no of rules in a set.java.lang.StringgetName()Returns the name of the rule set.IPolicyRulegetRule(java.lang.String ruleName)Returns the rule identified by a given name.java.util.Enumeration<IPolicyRule>getRules()Returns an enumeration of rules.voidprintPolicies()voidremoveRule(java.lang.String ruleName)Removes a policy rule identified by the given name.voidreplaceRule(java.lang.String ruleName, IPolicyRule rule)Remplaces a policy rule identified by the given name.
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the rule set.- Specified by:
getNamein interfaceIPolicySet- Returns:
- The name of the rule set.
-
count
public int count()
Returns the no of rules in a set.- Specified by:
countin interfaceIPolicySet- Returns:
- the no of rules.
-
addRule
public void addRule(java.lang.String ruleName, IPolicyRule rule)Add a policy rule.- Specified by:
addRulein interfaceIPolicySet- 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:
removeRulein interfaceIPolicySet- 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:
getRulein interfaceIPolicySet- 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:
getRulesin interfaceIPolicySet- 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:
applyin interfaceIPolicySet- Parameters:
req- The request to apply policies on.- Returns:
- the PolicyResult.
-
printPolicies
public void printPolicies()
-
-