Class PolicyFactory
NOTE: DRAFT API. SUBJECT TO CHANGE
- Author:
- Arjan Tijms
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method is used to obtain an instance of the provider specific class that implements thePolicyinterface that corresponds to policy context within the provider.abstract PolicyThis method is used to obtain an instance of the provider specific class that implements thePolicyinterface that corresponds to policy context within the provider.static PolicyFactoryGet the system-wide PolicyFactory implementation.voidSet the context Policy implementation.abstract voidSet the context Policy implementation.static voidsetPolicyFactory(PolicyFactory policyFactory) Set the system-wide PolicyFactory implementation.
-
Field Details
-
FACTORY_NAME
- See Also:
-
-
Constructor Details
-
PolicyFactory
public PolicyFactory()
-
-
Method Details
-
getPolicyFactory
Get the system-wide PolicyFactory implementation.The name of the factory implementation class is obtained from the value of the system property,
This value can also be retrieved from the fieldjakarta.security.jacc.PolicyFactory.providerPolicyFactory.FACTORY_NAME.- Returns:
- the system-wide singleton instance of the provider specific PolicyFactory implementation class.
- Throws:
SecurityException- If an exception was thrown during the class loading, or construction of the default PolicyFactory implementation class; in which case the SecurityException will contain the root Exception as its cause.
-
setPolicyFactory
Set the system-wide PolicyFactory implementation.If an implementation was set previously, it will be replaced.
- Parameters:
policyFactory- The PolicyFactory instance, which may be null.
-
getPolicy
This method is used to obtain an instance of the provider specific class that implements thePolicyinterface that corresponds to policy context within the provider. The policy context is identified by the value of the policy context identifier associated with the thread on which the accessor is called.For a given determined value of the policy context identifier, this method must always return the same instance of
Policyand there must be at most one actual instance of aPolicywith a given policy context identifier (during a process context).This method should be logically identical to calling
getPolicy(String)with as input the value returned fromPolicyContext.getContextID().- Returns:
- an Object that implements the
Policyinterface corresponding to the identified policy context, or a null if such an Object is not present.
-
setPolicy
Set the context Policy implementation.If an implementation was set previously, it will be replaced.
This method should be logically identical to calling
setPolicy(String, Policy)with as input for the first parameter the value returned fromPolicyContext.getContextID().- Parameters:
policy- The policy instance, which may be null.
-
getPolicy
This method is used to obtain an instance of the provider specific class that implements thePolicyinterface that corresponds to policy context within the provider. The policy context is identified by the value of the policy context identifier associated with the thread on which the accessor is called.For a given determined value of the policy context identifier, this method must always return the same instance of
Policyand there must be at most one actual instance of aPolicywith a given policy context identifier (during a process context).- Parameters:
contextId- A String identifying the policy context whosePolicyinterface is to be returned. The value passed to this parameter can be null, which corresponds to the system-wide defaultPolicyinstance.- Returns:
- an Object that implements the
Policyinterface corresponding to the identified policy context, or a null if such an Object is not present.
-
setPolicy
Set the context Policy implementation.If an implementation was set previously, it will be replaced.
-