Class GenericPolicyProcessor

  • All Implemented Interfaces:
    com.netscape.certsrv.request.IPolicy, org.dogtagpki.legacy.policy.IPolicyProcessor

    public class GenericPolicyProcessor
    extends java.lang.Object
    implements org.dogtagpki.legacy.policy.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

      Fields 
      Modifier and Type Field Description
      static java.lang.String[] DEF_POLICIES  
      static java.util.Hashtable<java.lang.String,​org.dogtagpki.legacy.policy.IExpression> DEF_UNDELETABLE_POLICIES  
      static org.slf4j.Logger logger  
      protected IAuthority mAuthority  
      protected IConfigStore mConfig  
      protected EngineConfig mGlobalStore  
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPolicyImpl​(java.lang.String id, java.lang.String classPath)
      Adds a policy implementation identified by an impl id.
      void addPolicyInstance​(java.lang.String id, java.util.Hashtable<java.lang.String,​java.lang.String> ht)
      Adds a policy instance
      com.netscape.certsrv.request.PolicyResult apply​(com.netscape.certsrv.request.IRequest request)
      Apply policies on the given request.
      void changePolicyInstanceOrdering​(java.lang.String policyOrderStr)
      Modifies policy ordering.
      void deletePolicyImpl​(java.lang.String id)
      Deletes a policy implementation identified by an impl id.
      void deletePolicyInstance​(java.lang.String id)
      Deletes a policy instance identified by an instance id.
      ISubsystem getAuthority()  
      IConfigStore getConfigStore()
      Returns the configuration store.
      java.lang.String getId()  
      org.dogtagpki.legacy.policy.IPolicyRule getPolicyImpl​(java.lang.String id)
      Returns an implementation identified by a given id.
      java.util.Vector<java.lang.String> getPolicyImplConfig​(java.lang.String id)
      Returns configuration for an implmentation.
      java.util.Enumeration<org.dogtagpki.legacy.policy.IPolicyRule> getPolicyImpls()
      Returns the rule implementations registered with this processor.
      java.util.Enumeration<java.lang.String> getPolicyImplsInfo()
      Returns information on Policy impls.
      org.dogtagpki.legacy.policy.IPolicyRule getPolicyInstance​(java.lang.String id)
      Returns instance configuration for a given instance id.
      java.util.Vector<java.lang.String> getPolicyInstanceConfig​(java.lang.String id)
      Returns instance configuration for a given instance id.
      java.util.Enumeration<org.dogtagpki.legacy.policy.IPolicyRule> getPolicyInstances()
      Returns policy instances registered with this processor.
      java.util.Enumeration<java.lang.String> getPolicyInstancesInfo()
      Returns information on Policy instances.
      java.lang.String getPolicySubstoreId()
      Returns the policy substore id.
      void init​(IAuthority owner, IConfigStore config)
      Initializes the PolicyProcessor
      boolean isProfileRequest​(com.netscape.certsrv.request.IRequest request)  
      void modifyPolicyInstance​(java.lang.String id, java.util.Hashtable<java.lang.String,​java.lang.String> ht)
      Modifies a policy instance
      void printPolicies()  
      void setId​(java.lang.String id)  
      void shutdown()
      Shuts down this subsystem.
      void startup()  
      • 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
      • DEF_POLICIES

        public static final java.lang.String[] DEF_POLICIES
      • DEF_UNDELETABLE_POLICIES

        public static final java.util.Hashtable<java.lang.String,​org.dogtagpki.legacy.policy.IExpression> DEF_UNDELETABLE_POLICIES
    • Constructor Detail

      • GenericPolicyProcessor

        public GenericPolicyProcessor()
      • GenericPolicyProcessor

        public GenericPolicyProcessor​(boolean initSystemPolicies)
    • Method Detail

      • getId

        public java.lang.String getId()
      • shutdown

        public void shutdown()
        Shuts down this subsystem.

      • getAuthority

        public ISubsystem getAuthority()
        Specified by:
        getAuthority in interface org.dogtagpki.legacy.policy.IPolicyProcessor
      • getConfigStore

        public IConfigStore getConfigStore()
        Returns the configuration store.

        Returns:
        configuration store
      • init

        public void init​(IAuthority owner,
                         IConfigStore config)
                  throws EBaseException
        Initializes the PolicyProcessor

        Parameters:
        owner - owner of this subsystem
        config - configuration of this subsystem
        Throws:
        EBaseException - failed to initialize this Subsystem.
      • isProfileRequest

        public boolean isProfileRequest​(com.netscape.certsrv.request.IRequest request)
      • apply

        public com.netscape.certsrv.request.PolicyResult apply​(com.netscape.certsrv.request.IRequest request)
        Apply policies on the given request.
        Specified by:
        apply in interface com.netscape.certsrv.request.IPolicy
        Parameters:
        request - The given request
        Returns:
        The policy result object.
      • printPolicies

        public void printPolicies()
      • getPolicySubstoreId

        public java.lang.String getPolicySubstoreId()
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns the policy substore id.
        Specified by:
        getPolicySubstoreId in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns:
        storeID The policy store id used by this processor.
      • getPolicyImpls

        public java.util.Enumeration<org.dogtagpki.legacy.policy.IPolicyRule> getPolicyImpls()
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns the rule implementations registered with this processor.
        Specified by:
        getPolicyImpls in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns:
        An Enumeration of uninitialized IPolicyRule objects.
      • getPolicyImplsInfo

        public java.util.Enumeration<java.lang.String> getPolicyImplsInfo()
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns information on Policy impls.
        Specified by:
        getPolicyImplsInfo in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns:
        An enumeration of strings describing the information about policy implementations. Currently only the the implementation id is expected.
      • getPolicyImpl

        public org.dogtagpki.legacy.policy.IPolicyRule getPolicyImpl​(java.lang.String id)
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns an implementation identified by a given id.
        Specified by:
        getPolicyImpl in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        id - The implementation id.
        Returns:
        The uninitialized instance of the policy rule.
      • getPolicyImplConfig

        public java.util.Vector<java.lang.String> getPolicyImplConfig​(java.lang.String id)
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns configuration for an implmentation.
        Specified by:
        getPolicyImplConfig in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        id - The implementation id.
        Returns:
        A vector of name/value pairs in the form of name=value.
      • deletePolicyImpl

        public void deletePolicyImpl​(java.lang.String id)
                              throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Deletes a policy implementation identified by an impl id.
        Specified by:
        deletePolicyImpl in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        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

        public void addPolicyImpl​(java.lang.String id,
                                  java.lang.String classPath)
                           throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Adds a policy implementation identified by an impl id.
        Specified by:
        addPolicyImpl in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        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

        public java.util.Enumeration<org.dogtagpki.legacy.policy.IPolicyRule> getPolicyInstances()
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns policy instances registered with this processor.
        Specified by:
        getPolicyInstances in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns:
        An Enumeration of policy instances.
      • getPolicyInstancesInfo

        public java.util.Enumeration<java.lang.String> getPolicyInstancesInfo()
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns information on Policy instances.
        Specified by:
        getPolicyInstancesInfo in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns:
        An Enumeration of Strings describing the information about policy rule instances.
      • getPolicyInstance

        public org.dogtagpki.legacy.policy.IPolicyRule getPolicyInstance​(java.lang.String id)
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns instance configuration for a given instance id.
        Specified by:
        getPolicyInstance in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        id - The rule id.
        Returns:
        the policy instance identified by the id.
      • getPolicyInstanceConfig

        public java.util.Vector<java.lang.String> getPolicyInstanceConfig​(java.lang.String id)
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Returns instance configuration for a given instance id.
        Specified by:
        getPolicyInstanceConfig in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        id - The rule id.
        Returns:
        A vector of name/value pairs in the form of name=value.
      • deletePolicyInstance

        public void deletePolicyInstance​(java.lang.String id)
                                  throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Deletes a policy instance identified by an instance id.
        Specified by:
        deletePolicyInstance in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        id - The instance id of the policy to be deleted.
        Throws:
        EBaseException - is thrown if an error occurs in deletion.
      • addPolicyInstance

        public void addPolicyInstance​(java.lang.String id,
                                      java.util.Hashtable<java.lang.String,​java.lang.String> ht)
                               throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Adds a policy instance
        Specified by:
        addPolicyInstance in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        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

        public void modifyPolicyInstance​(java.lang.String id,
                                         java.util.Hashtable<java.lang.String,​java.lang.String> ht)
                                  throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Modifies a policy instance
        Specified by:
        modifyPolicyInstance in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        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

        public void changePolicyInstanceOrdering​(java.lang.String policyOrderStr)
                                          throws EBaseException
        Description copied from interface: org.dogtagpki.legacy.policy.IPolicyProcessor
        Modifies policy ordering.
        Specified by:
        changePolicyInstanceOrdering in interface org.dogtagpki.legacy.policy.IPolicyProcessor
        Parameters:
        policyOrderStr - The comma separated list of instance ids.
        Throws:
        EBaseException