Class GenericPolicyProcessor

  • All Implemented Interfaces:
    IPolicy, IPolicyProcessor

    public class GenericPolicyProcessor
    extends java.lang.Object
    implements 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 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,​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.

      • 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​(IRequest request)
      • apply

        public PolicyResult apply​(IRequest request)
        Apply policies on the given request.
        Specified by:
        apply in interface 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: IPolicyProcessor
        Returns the policy substore id.
        Specified by:
        getPolicySubstoreId in interface IPolicyProcessor
        Returns:
        storeID The policy store id used by this processor.
      • getPolicyImpls

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

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

        public IPolicyRule getPolicyImpl​(java.lang.String id)
        Description copied from interface: IPolicyProcessor
        Returns an implementation identified by a given id.
        Specified by:
        getPolicyImpl in interface 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: IPolicyProcessor
        Returns configuration for an implmentation.
        Specified by:
        getPolicyImplConfig in interface 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: IPolicyProcessor
        Deletes a policy implementation identified by an impl id.
        Specified by:
        deletePolicyImpl in interface 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: IPolicyProcessor
        Adds a policy implementation identified by an impl id.
        Specified by:
        addPolicyImpl in interface 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<IPolicyRule> getPolicyInstances()
        Description copied from interface: IPolicyProcessor
        Returns policy instances registered with this processor.
        Specified by:
        getPolicyInstances in interface IPolicyProcessor
        Returns:
        An Enumeration of policy instances.
      • getPolicyInstancesInfo

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

        public IPolicyRule getPolicyInstance​(java.lang.String id)
        Description copied from interface: IPolicyProcessor
        Returns instance configuration for a given instance id.
        Specified by:
        getPolicyInstance in interface 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: IPolicyProcessor
        Returns instance configuration for a given instance id.
        Specified by:
        getPolicyInstanceConfig in interface 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: IPolicyProcessor
        Deletes a policy instance identified by an instance id.
        Specified by:
        deletePolicyInstance in interface 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: IPolicyProcessor
        Adds a policy instance
        Specified by:
        addPolicyInstance in interface 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: IPolicyProcessor
        Modifies a policy instance
        Specified by:
        modifyPolicyInstance in interface 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.