PolicyConfigurationFactory (Java EE 5)

Java EE API


javax.security.jacc Class PolicyConfigurationFactory

java.lang.Object
  extended by javax.security.jacc.PolicyConfigurationFactory

public abstract class PolicyConfigurationFactory
extends Object


抽象工厂和 finder 类,用于获取实现提供者的 PolicyConfigurationFactory 的类实例。该工厂将用于实例化 PolicyConfiguration 对象,容器的开发工具可使用该对象创建和管理 Policy Provider 的策略上下文。

实现类必须有一个不带参数的公共构造方法,可以使用此构造方法创建工厂实现类的操作实例。

英文文档:

Abstract factory and finder class for obtaining the instance of the class that implements the PolicyConfigurationFactory of a provider. The factory will be used to instantiate PolicyConfiguration objects that will be used by the deployment tools of the container to create and manage policy contexts within the Policy Provider.

Implementation classes must have a public no argument constructor that may be used to create an operational instance of the factory implementation class.

Author:
Ron Monzillo, Gary Ellison, Harpreet Singh
See Also:
Permission, PolicyConfiguration, PolicyContextException

Constructor Summary
 
Method Summary
abstract  PolicyConfiguration
static PolicyConfigurationFactory
abstract  boolean
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public PolicyConfigurationFactory()
英文文档:

PolicyConfigurationFactory

public PolicyConfigurationFactory()
Method Detail

public static PolicyConfigurationFactory getPolicyConfigurationFactory() throws ClassNotFoundException, PolicyContextException
此静态方法使用系统属性查找和实例化(通过公共构造方法)特定于提供者的工厂实现类。可从以下系统属性值中获取特定于提供者名称的工厂实现类:

javax.security.jacc.PolicyConfigurationFactory.provider。
 

return 特定于提供者单件实例的 PolicyConfigurationFactory 实现类。
ThrowsSecurityException: 如果由尚未授予 "setPolicy" SecurityPermission 的 AccessControlContext 调用。
ThrowsClassNotFoundException: 如果由于尚未设置系统属性的值而无法找到系统属性指定的类。
ThrowsPolicyContextException: 如果实现抛出 getPolicyConfigurationFactory 方法签名未知的经过检查的异常。实现类抛出的异常将封装(构造期间)在抛出的 PolicyContextException 中。

英文文档:

getPolicyConfigurationFactory

public static PolicyConfigurationFactory getPolicyConfigurationFactory()
                                                                throws ClassNotFoundException,
                                                                       PolicyContextException
This static method uses a system property to find and instantiate (via a public constructor) a provider specific factory implementation class. The name of the provider specific factory implementation class is obtained from the value of the system property,

     javax.security.jacc.PolicyConfigurationFactory.provider.
 

Returns:
the singleton instance of the provider specific PolicyConfigurationFactory implementation class.
Throws:
SecurityException - when called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
ClassNotFoundException - when the class named by the system property could not be found including because the value of the system property has not be set.
PolicyContextException - if the implementation throws a checked exception that has not been accounted for by the getPolicyConfigurationFactory method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException

abstract public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove) throws PolicyContextException
此方法用于获取特定于提供者实例的类,该类实现与提供者内已标识的策略上下文对应的 PolicyConfiguration 接口。PolicyConfiguration 接口的方法用于定义已标识策略上下文的策略语句。

如果在调用时,提供者中不存在已标识的策略上下文,则将在提供者中创建策略上下文,并返回实现上下文的 PolicyConfiguration 接口的对象。如果已标识的上下文的状态为 "deleted" 或 "inService",则在调用后该状态将转换为 "open" 状态。策略上下文生命周期中的状态由 PolicyConfiguration 接口定义。

对于策略上下文标识符的给定值,此方法必须总是返回相同的 PolicyConfiguration 实例,而且给定策略上下文标识符最多只能有一个实际的 PolicyConfiguration 实例(在进程上下文中)。

要始终保持给定策略上下文最多只有一个 PolicyConfiguration 对象,此方法必须是线程安全的。

contextID 标识要返回其 PolicyConfiguration 接口的策略上下文的字符串。传递给此参数的值不得为 null。

remove 一个 boolean 值,指出在返回现有策略上下文的 PolicyConfiguration 对象之前是否要移除该策略上下文的策略语句。如果传递给此参数的值为 true,则现有策略上下文的策略语句将被移除。如果值为 false,则不移除。
return 实现与 Policy 提供者匹配并与标识策略上下文对应的 PolicyConfiguration 接口的对象。
ThrowsSecurityException: 如果由尚未授予 "setPolicy" SecurityPermission 的 AccessControlContext 调用。
ThrowsPolicyContextException: 如果实现抛出 getPolicyConfiguration 方法签名未知的经过检查的异常。实现类抛出的异常将封装(构造期间)在抛出的 PolicyContextException 中。

英文文档:

getPolicyConfiguration

public abstract PolicyConfiguration getPolicyConfiguration(String contextID,
                                                           boolean remove)
                                                    throws PolicyContextException
This method is used to obtain an instance of the provider specific class that implements the PolicyConfiguration interface that corresponds to the identified policy context within the provider. The methods of the PolicyConfiguration interface are used to define the policy statements of the identified policy context.

If at the time of the call, the identified policy context does not exist in the provider, then the policy context will be created in the provider and the Object that implements the context's PolicyConfiguration Interface will be returned. If the state of the identified context is "deleted" or "inService" it will be transitioned to the "open" state as a result of the call. The states in the lifecycle of a policy context are defined by the PolicyConfiguration interface.

For a given value of policy context identifier, this method must always return the same instance of PolicyConfiguration and there must be at most one actual instance of a PolicyConfiguration with a given policy context identifier (during a process context).

To preserve the invariant that there be at most one PolicyConfiguration object for a given policy context, it may be necessary for this method to be thread safe.

Parameters:
contextID - A String identifying the policy context whose PolicyConfiguration interface is to be returned. The value passed to this parameter must not be null.

remove - A boolean value that establishes whether or not the policy statements of an existing policy context are to be removed before its PolicyConfiguration object is returned. If the value passed to this parameter is true, the policy statements of an existing policy context will be removed. If the value is false, they will not be removed.
Returns:
an Object that implements the PolicyConfiguration Interface matched to the Policy provider and corresponding to the identified policy context.
Throws:
SecurityException - when called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
PolicyContextException - if the implementation throws a checked exception that has not been accounted for by the getPolicyConfiguration method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.

abstract public boolean inService(String contextID) throws PolicyContextException
此方法确定在与工厂关联的 Policy 提供者中是否存在状态为 "inService" 的已标识策略上下文。

contextID 标识策略上下文的字符串
return 如果在提供者中存在已标识的策略上下文且其状态为 "inService",则返回 true;否则返回 false。
ThrowsSecurityException: 如果由尚未授予 "setPolicy" SecurityPermission 的 AccessControlContext 调用。
ThrowsPolicyContextException: 如果实现抛出 inService 方法签名未知的经过检查的异常。实现类抛出的异常将封装(构造期间)在抛出的 PolicyContextException 中。

英文文档:

inService

public abstract boolean inService(String contextID)
                           throws PolicyContextException
This method determines if the identified policy context exists with state "inService" in the Policy provider associated with the factory.

Parameters:
contextID - A string identifying a policy context
Returns:
true if the identified policy context exists within the provider and its state is "inService", false otherwise.
Throws:
SecurityException - when called by an AccessControlContext that has not been granted the "setPolicy" SecurityPermission.
PolicyContextException - if the implementation throws a checked exception that has not been accounted for by the inService method signature. The exception thrown by the implementation class will be encapsulated (during construction) in the thrown PolicyContextException.


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!