Top Description Fields Constructors Methods
jakarta.security.jacc

public abstract Class PolicyFactory

extends Object
Class Inheritance

Abstract factory and finder class for obtaining the instance of the class that implements the PolicyFactory of a provider. The factory will be used to instantiate Policy objects.
Author
Arjan Tijms
See Also
Policy

Field Summary

Modifier and TypeField and Description
public static final String
private static volatile PolicyFactory
private PolicyFactory

Constructor Summary

AccessConstructor and Description
public
PolicyFactory()

Default constructor for if no wrapping is needed

public
PolicyFactory(PolicyFactory
The implementation being wrapped.
wrapped
)

If this factory has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor.

Method Summary

Modifier and TypeMethod and Description
public Policy

Returns:

an Object that implements the Policy interface corresponding to the identified policy context, or a null if such an Object is not present.
getPolicy
()

This method is used to obtain an instance of the provider specific class that implements the Policy interface that corresponds to policy context within the provider.

public abstract Policy

Returns:

an Object that implements the Policy interface corresponding to the identified policy context, or a null if such an Object is not present.
getPolicy
(String
A String identifying the policy context whose Policy interface is to be returned. The value passed to this parameter can be null, which corresponds to the system-wide default Policy instance.
contextId
)

This method is used to obtain an instance of the provider specific class that implements the Policy interface that corresponds to policy context within the provider.

public static synchronized PolicyFactory

Returns:

the system-wide singleton instance of the provider specific PolicyFactory implementation class.
getPolicyFactory
()

Get the system-wide PolicyFactory implementation.

public PolicyFactory
getWrapped()

If this factory has been decorated, the implementation doing the decorating may override this method to provide access to the implementation being wrapped.

public void
setPolicy(Policy
The policy instance, which may be null.
policy
)

Set the context Policy implementation.

public abstract void
setPolicy(String
A String identifying the policy context whose Policy interface is to be returned. The value passed to this parameter can be null, which corresponds to the system-wide default Policy instance.
contextId
,
Policy
The policy instance, which may be null.
policy
)

Set the context Policy implementation.

public static synchronized void
setPolicyFactory(PolicyFactory
The PolicyFactory instance, which may be null.
policyFactory
)

Set the system-wide PolicyFactory implementation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FACTORY_NAMEback to summary
public static final String FACTORY_NAME
policyFactoryback to summary
private static volatile PolicyFactory policyFactory
wrappedback to summary
private PolicyFactory wrapped

Constructor Detail

PolicyFactoryback to summary
public PolicyFactory()

Default constructor for if no wrapping is needed

PolicyFactoryback to summary
public PolicyFactory(PolicyFactory wrapped)

If this factory has been decorated, the implementation doing the decorating should push the implementation being wrapped to this constructor. The getWrapped() will then return the implementation being wrapped.

Parameters
wrapped:PolicyFactory

The implementation being wrapped.

Method Detail

getPolicyback to summary
public Policy getPolicy()

This method is used to obtain an instance of the provider specific class that implements the Policy interface 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 Policy and there must be at most one actual instance of a Policy with a given policy context identifier (during a process context).

This method should be logically identical to calling PolicyFactory#getPolicy(String) with as input the value returned from PolicyContext#getContextID().

Returns:Policy

an Object that implements the Policy interface corresponding to the identified policy context, or a null if such an Object is not present.

getPolicyback to summary
public abstract Policy getPolicy(String contextId)

This method is used to obtain an instance of the provider specific class that implements the Policy interface 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 Policy and there must be at most one actual instance of a Policy with a given policy context identifier (during a process context).

Parameters
contextId:String

A String identifying the policy context whose Policy interface is to be returned. The value passed to this parameter can be null, which corresponds to the system-wide default Policy instance.

Returns:Policy

an Object that implements the Policy interface corresponding to the identified policy context, or a null if such an Object is not present.

getPolicyFactoryback to summary
public static synchronized PolicyFactory getPolicyFactory()

Get the system-wide PolicyFactory implementation.

The name of the factory implementation class is obtained from the value of the system property,

jakarta.security.jacc.PolicyFactory.provider

This value can also be retrieved from the field PolicyFactory.FACTORY_NAME.
Returns:PolicyFactory

the system-wide singleton instance of the provider specific PolicyFactory implementation class.

Exceptions
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.
getWrappedback to summary
public PolicyFactory getWrapped()

If this factory has been decorated, the implementation doing the decorating may override this method to provide access to the implementation being wrapped.

setPolicyback to summary
public void setPolicy(Policy policy)

Set the context Policy implementation.

If an implementation was set previously, it will be replaced.

This method should be logically identical to calling PolicyFactory#setPolicy(String, Policy) with as input for the first parameter the value returned from PolicyContext#getContextID().

Parameters
policy:Policy

The policy instance, which may be null.

setPolicyback to summary
public abstract void setPolicy(String contextId, Policy policy)

Set the context Policy implementation.

If an implementation was set previously, it will be replaced.

Parameters
contextId:String

A String identifying the policy context whose Policy interface is to be returned. The value passed to this parameter can be null, which corresponds to the system-wide default Policy instance.

policy:Policy

The policy instance, which may be null.

setPolicyFactoryback to summary
public static synchronized void setPolicyFactory(PolicyFactory policyFactory)

Set the system-wide PolicyFactory implementation.

If an implementation was set previously, it will be replaced.

Parameters
policyFactory:PolicyFactory

The PolicyFactory instance, which may be null.