Package org.dogtagpki.legacy.core.policy
Class GenericPolicyProcessor
java.lang.Object
org.dogtagpki.legacy.core.policy.GenericPolicyProcessor
- All Implemented Interfaces:
IPolicy
,IPolicyProcessor
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> static org.slf4j.Logger
protected IAuthority
protected ConfigStore
protected EngineConfig
Fields inherited from interface org.dogtagpki.legacy.policy.IPolicyProcessor
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
void
shutdown()
Shuts down this subsystem.void
startup()
-
Field Details
-
logger
public static org.slf4j.Logger logger -
mConfig
-
mGlobalStore
-
mAuthority
-
DEF_POLICIES
-
DEF_UNDELETABLE_POLICIES
-
-
Constructor Details
-
GenericPolicyProcessor
public GenericPolicyProcessor() -
GenericPolicyProcessor
public GenericPolicyProcessor(boolean initSystemPolicies)
-
-
Method Details
-
setId
- Throws:
EBaseException
-
getId
-
startup
- Throws:
EBaseException
-
shutdown
public void shutdown()Shuts down this subsystem. -
getAuthority
- Specified by:
getAuthority
in interfaceIPolicyProcessor
-
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. -
printPolicies
public void printPolicies() -
getPolicySubstoreId
Description copied from interface:IPolicyProcessor
Returns the policy substore id.- Specified by:
getPolicySubstoreId
in interfaceIPolicyProcessor
- Returns:
- storeID The policy store id used by this processor.
-
getPolicyImpls
Description copied from interface:IPolicyProcessor
Returns the rule implementations registered with this processor.- Specified by:
getPolicyImpls
in interfaceIPolicyProcessor
- Returns:
- An Enumeration of uninitialized IPolicyRule objects.
-
getPolicyImplsInfo
Description copied from interface:IPolicyProcessor
Returns information on Policy impls.- Specified by:
getPolicyImplsInfo
in interfaceIPolicyProcessor
- Returns:
- An enumeration of strings describing the information about policy implementations. Currently only the the implementation id is expected.
-
getPolicyImpl
Description copied from interface:IPolicyProcessor
Returns an implementation identified by a given id.- Specified by:
getPolicyImpl
in interfaceIPolicyProcessor
- Parameters:
id
- The implementation id.- Returns:
- The uninitialized instance of the policy rule.
-
getPolicyImplConfig
Description copied from interface:IPolicyProcessor
Returns configuration for an implmentation.- Specified by:
getPolicyImplConfig
in interfaceIPolicyProcessor
- Parameters:
id
- The implementation id.- Returns:
- A vector of name/value pairs in the form of name=value.
-
deletePolicyImpl
Description copied from interface:IPolicyProcessor
Deletes a policy implementation identified by an impl id.- Specified by:
deletePolicyImpl
in interfaceIPolicyProcessor
- 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 interface:IPolicyProcessor
Adds a policy implementation identified by an impl id.- Specified by:
addPolicyImpl
in interfaceIPolicyProcessor
- 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 interface:IPolicyProcessor
Returns policy instances registered with this processor.- Specified by:
getPolicyInstances
in interfaceIPolicyProcessor
- Returns:
- An Enumeration of policy instances.
-
getPolicyInstancesInfo
Description copied from interface:IPolicyProcessor
Returns information on Policy instances.- Specified by:
getPolicyInstancesInfo
in interfaceIPolicyProcessor
- Returns:
- An Enumeration of Strings describing the information about policy rule instances.
-
getPolicyInstance
Description copied from interface:IPolicyProcessor
Returns instance configuration for a given instance id.- Specified by:
getPolicyInstance
in interfaceIPolicyProcessor
- Parameters:
id
- The rule id.- Returns:
- the policy instance identified by the id.
-
getPolicyInstanceConfig
Description copied from interface:IPolicyProcessor
Returns instance configuration for a given instance id.- Specified by:
getPolicyInstanceConfig
in interfaceIPolicyProcessor
- Parameters:
id
- The rule id.- Returns:
- A vector of name/value pairs in the form of name=value.
-
deletePolicyInstance
Description copied from interface:IPolicyProcessor
Deletes a policy instance identified by an instance id.- Specified by:
deletePolicyInstance
in interfaceIPolicyProcessor
- 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 interface:IPolicyProcessor
Adds a policy instance- Specified by:
addPolicyInstance
in interfaceIPolicyProcessor
- 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 interface:IPolicyProcessor
Modifies a policy instance- Specified by:
modifyPolicyInstance
in interfaceIPolicyProcessor
- 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 interface:IPolicyProcessor
Modifies policy ordering.- Specified by:
changePolicyInstanceOrdering
in interfaceIPolicyProcessor
- Parameters:
policyOrderStr
- The comma separated list of instance ids.- Throws:
EBaseException
-