Package org.dogtagpki.legacy.core.policy
Class GenericPolicyProcessor
java.lang.Object
org.dogtagpki.legacy.policy.PolicyProcessor
org.dogtagpki.legacy.core.policy.GenericPolicyProcessor
This is a Generic policy processor. The three main functions of
this class are:
1. To initialize policies by reading policy configuration from the
config file, and maintain 5 sets of policies - viz Enrollment,
Renewal, Revocation and KeyRecovery and KeyArchival.
2. To apply the configured policies on the given request.
3. To enable policy listing/configuration via MCC console.
Since the policy processor also implements the IPolicy interface
the processor itself presents itself as one big policy to the
request processor.
- Version:
- $Revision$, $Date$
- Author:
- kanda
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String[]
static final Hashtable<String,
IExpression> protected CMSEngine
static org.slf4j.Logger
protected IAuthority
protected ConfigStore
protected EngineConfig
Fields inherited from class org.dogtagpki.legacy.policy.PolicyProcessor
PROP_CLASS, PROP_DEF_POLICIES, PROP_ENABLE, PROP_IMPL, PROP_IMPL_NAME, PROP_ORDER, PROP_PREDICATE, PROP_RULE, PROP_UNDELETABLE_POLICIES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPolicyImpl
(String id, String classPath) Adds a policy implementation identified by an impl id.void
addPolicyInstance
(String id, Hashtable<String, String> ht) Adds a policy instanceApply policies on the given request.void
changePolicyInstanceOrdering
(String policyOrderStr) Modifies policy ordering.void
Deletes a policy implementation identified by an impl id.void
Deletes a policy instance identified by an instance id.Returns the configuration store.getId()
getPolicyImpl
(String id) Returns an implementation identified by a given id.Returns configuration for an implmentation.Returns the rule implementations registered with this processor.Returns information on Policy impls.Returns instance configuration for a given instance id.Returns instance configuration for a given instance id.Returns policy instances registered with this processor.Returns information on Policy instances.Returns the policy substore id.void
init
(IAuthority owner, ConfigStore config) Initializes the PolicyProcessorboolean
isProfileRequest
(Request request) void
modifyPolicyInstance
(String id, Hashtable<String, String> ht) Modifies a policy instancevoid
void
setCMSEngine
(CMSEngine engine) void
void
shutdown()
Shuts down this subsystem.void
startup()
-
Field Details
-
logger
public static org.slf4j.Logger logger -
engine
-
mConfig
-
mGlobalStore
-
mAuthority
-
DEF_POLICIES
-
DEF_UNDELETABLE_POLICIES
-
-
Constructor Details
-
GenericPolicyProcessor
public GenericPolicyProcessor() -
GenericPolicyProcessor
public GenericPolicyProcessor(boolean initSystemPolicies)
-
-
Method Details
-
getCMSEngine
-
setCMSEngine
-
setId
- Throws:
EBaseException
-
getId
-
startup
- Throws:
EBaseException
-
shutdown
public void shutdown()Shuts down this subsystem. -
getAuthority
- Specified by:
getAuthority
in classPolicyProcessor
-
getConfigStore
Returns the configuration store.- Returns:
- configuration store
-
init
Initializes the PolicyProcessor- Parameters:
owner
- owner of this subsystemconfig
- configuration of this subsystem- Throws:
EBaseException
- failed to initialize this Subsystem.
-
isProfileRequest
-
apply
Apply policies on the given request.- Parameters:
request
- The given request- Returns:
- The policy result object.
-
printPolicies
public void printPolicies() -
getPolicySubstoreId
Description copied from class:PolicyProcessor
Returns the policy substore id.- Specified by:
getPolicySubstoreId
in classPolicyProcessor
- Returns:
- storeID The policy store id used by this processor.
-
getPolicyImpls
Description copied from class:PolicyProcessor
Returns the rule implementations registered with this processor.- Specified by:
getPolicyImpls
in classPolicyProcessor
- Returns:
- An Enumeration of uninitialized IPolicyRule objects.
-
getPolicyImplsInfo
Description copied from class:PolicyProcessor
Returns information on Policy impls.- Specified by:
getPolicyImplsInfo
in classPolicyProcessor
- Returns:
- An enumeration of strings describing the information about policy implementations. Currently only the the implementation id is expected.
-
getPolicyImpl
Description copied from class:PolicyProcessor
Returns an implementation identified by a given id.- Specified by:
getPolicyImpl
in classPolicyProcessor
- Parameters:
id
- The implementation id.- Returns:
- The uninitialized instance of the policy rule.
-
getPolicyImplConfig
Description copied from class:PolicyProcessor
Returns configuration for an implmentation.- Specified by:
getPolicyImplConfig
in classPolicyProcessor
- Parameters:
id
- The implementation id.- Returns:
- A vector of name/value pairs in the form of name=value.
-
deletePolicyImpl
Description copied from class:PolicyProcessor
Deletes a policy implementation identified by an impl id.- Specified by:
deletePolicyImpl
in classPolicyProcessor
- Parameters:
id
- The impl id of the policy to be deleted. There shouldn't be any active instance for this implementation.- Throws:
EBaseException
- is thrown if an error occurs in deletion.
-
addPolicyImpl
Description copied from class:PolicyProcessor
Adds a policy implementation identified by an impl id.- Specified by:
addPolicyImpl
in classPolicyProcessor
- Parameters:
id
- The impl id of the policy to be added. The id should be unique.classPath
- The fully qualified path for the implementation.- Throws:
EBaseException
- is thrown if an error occurs in addition.
-
getPolicyInstances
Description copied from class:PolicyProcessor
Returns policy instances registered with this processor.- Specified by:
getPolicyInstances
in classPolicyProcessor
- Returns:
- An Enumeration of policy instances.
-
getPolicyInstancesInfo
Description copied from class:PolicyProcessor
Returns information on Policy instances.- Specified by:
getPolicyInstancesInfo
in classPolicyProcessor
- Returns:
- An Enumeration of Strings describing the information about policy rule instances.
-
getPolicyInstance
Description copied from class:PolicyProcessor
Returns instance configuration for a given instance id.- Specified by:
getPolicyInstance
in classPolicyProcessor
- Parameters:
id
- The rule id.- Returns:
- the policy instance identified by the id.
-
getPolicyInstanceConfig
Description copied from class:PolicyProcessor
Returns instance configuration for a given instance id.- Specified by:
getPolicyInstanceConfig
in classPolicyProcessor
- Parameters:
id
- The rule id.- Returns:
- A vector of name/value pairs in the form of name=value.
-
deletePolicyInstance
Description copied from class:PolicyProcessor
Deletes a policy instance identified by an instance id.- Specified by:
deletePolicyInstance
in classPolicyProcessor
- Parameters:
id
- The instance id of the policy to be deleted.- Throws:
EBaseException
- is thrown if an error occurs in deletion.
-
addPolicyInstance
Description copied from class:PolicyProcessor
Adds a policy instance- Specified by:
addPolicyInstance
in classPolicyProcessor
- Parameters:
id
- The impl id of the policy to be added. The id should be unique.ht
- a Hashtable of config params.- Throws:
EBaseException
- is thrown if an error occurs in addition.
-
modifyPolicyInstance
Description copied from class:PolicyProcessor
Modifies a policy instance- Specified by:
modifyPolicyInstance
in classPolicyProcessor
- Parameters:
id
- The impl id of the policy to be modified. The policy instance with this id should be present.ht
- a Hashtable of config params.- Throws:
EBaseException
- is thrown if an error occurs in addition.
-
changePolicyInstanceOrdering
Description copied from class:PolicyProcessor
Modifies policy ordering.- Specified by:
changePolicyInstanceOrdering
in classPolicyProcessor
- Parameters:
policyOrderStr
- The comma separated list of instance ids.- Throws:
EBaseException
-