EJBMethodPermission (Java EE 5)

Java EE API


javax.security.jacc Class EJBMethodPermission

java.lang.Object
  extended by java.security.Permission
      extended by javax.security.jacc.EJBMethodPermission
All Implemented Interfaces:
Serializable, Guard

public final class EJBMethodPermission
extends Permission
implements Serializable

Extends: java.security.Permission
Implements: java.io.Serializable

EJB 方法权限的类。

EJBMethodPermission 的名称包含在应用程序部署描述符中标识目标 EJB 的 ejb-name 元素的值。

EJBMethodPermission 的 actions 标识权限所应用到的 EJB 的方法。

此类的实现可能实现 newPermissionCollection,也可能从超类继承其实现。

英文文档:

Class for EJB method permissions.

The name of an EJBMethodPermission contains the value of the ejb-name element in the application's deployment descriptor that identifies the target EJB.

The actions of an EJBMethodPermission identifies the methods of the EJB to which the permission applies.

Implementations of this class MAY implement newPermissionCollection or inherit its implementation from the super class.

Author:
Ron Monzillo, Gary Ellison
See Also:
Permission, Serialized Form

Constructor Summary
 
Method Summary
 boolean
 String
 int
 boolean
 
Methods inherited from class java.security.Permission
 
Methods inherited from class java.lang.Object
 

Constructor Detail

public EJBMethodPermission(String name, String actions)
使用指定名称和操作创建新的 EJBMethodPermission。

该名称包含在应用程序的部署描述符中与 EJB 对应的 ejb-name 元素的值。

actions 包含一个 methodSpec。actions 参数的语法定义如下:

methodNameSpec ::= methodName | emptyString

methodInterfaceName ::= String

methodInterfaceSpec ::= methodInterfaceName | emptyString

typeName ::= typeName | typeName []

methodParams ::= typeName | methodParams comma typeName

methodParamsSpec ::= emptyString | methodParams

methodSpec ::= null |
methodNameSpec |
methodNameSpec comma methodInterfaceName |
methodNameSpec comma methodInterfaceSpec comma methodParamsSpec
 

MethodInterfaceName 是一个非空 String,并且应该包含一个为在 EJB 部署描述符中使用而定义的 method-intf 值。实现必须灵活,这样它才能支持其他接口名称,尤其是如果这些名称通过 EJB 规范进行了标准化。EJB 规范当前定义了以下 method-intf 值:

{ "Home", "LocalHome", "Remote", "Local", "ServiceEndpoint" }
 

methodSpec 为 null 或空字符串指示权限应用到所有 EJB 方法。methodNameSpec 为空字符串的 methodSpec 匹配与该 methodSpec 的 methodInterface 和 methodParams 元素匹配的所有 EJB 方法。

methodInterfaceSpec 为空字符串的 methodSpec 匹配与该 methodSpec 的 methodNameSpec 和 methodParamsSpec 元素匹配的所有 EJB 方法。

不带 methodParamsSpec 的 methodSpec 匹配与该 methodSpec 的 methodNameSpec 和 methodInterface 元素匹配的所有 EJB 方法。

methodParams 数组中 typeNames 的顺序必须与对应参数在目标方法的方法签名中出现的顺序相匹配。methodParams 中的每个 typeName 必须包含相应参数 typeName 的规范形式(如 getActions 方法定义的那样)。带有空 methodParamsSpec 的 methodSpec 匹配与该 methodSpec 的 methodNameSpec 和 methodInterfaceSpec 元素匹配的所有 0 参数 EJB 方法。

name EJB 的名称。

actions 标识应用权限的 EJB 方法。

英文文档:

EJBMethodPermission

public EJBMethodPermission(String name,
                           String actions)
Creates a new EJBMethodPermission with the specified name and actions.

The name contains the value of the ejb-name element corresponding to an EJB in the application's deployment descriptor.

The actions contains a methodSpec. The syntax of the actions parameter is defined as follows:

      methodNameSpec ::= methodName | emptyString

      methodInterfaceName ::= String

      methodInterfaceSpec ::= methodInterfaceName | emptyString

      typeName ::= typeName | typeName []

      methodParams ::= typeName | methodParams comma typeName

      methodParamsSpec ::= emptyString | methodParams

      methodSpec ::= null |
           methodNameSpec |
           methodNameSpec comma methodInterfaceName |
           methodNameSpec comma methodInterfaceSpec comma methodParamsSpec
 

A MethodInterfaceName is a non-empty String and should contain a method-intf value as defined for use in EJB deployment descriptors. An implementation must be flexible such that it supports additional interface names especially if they are standardized by the EJB Specification. The EJB Specification currently defines the following method-intf values:

       { "Home", "LocalHome", "Remote", "Local", "ServiceEndpoint" }
 

A null or empty string methodSpec indicates that the permission applies to all methods of the EJB. A methodSpec with a methodNameSpec of the empty string matches all methods of the EJB that match the methodInterface and methodParams elements of the methodSpec.

A methodSpec with a methodInterfaceSpec of the empty string matches all methods of the EJB that match the methodNameSpec and methodParamsSpec elements of the methodSpec.

A methodSpec without a methodParamsSpec matches all methods of the EJB that match the methodNameSpec and methodInterface elements of the methodSpec.

The order of the typeNames in methodParams array must match the order of occurence of the corresponding parameters in the method signature of the target method(s). Each typeName in the methodParams must contain the canonical form of the corresponding parameter's typeName as defined by the getActions method. A methodSpec with an empty methodParamsSpec matches all 0 argument methods of the EJB that match the methodNameSpec and methodInterfaceSpec elements of the methodSpec.

Parameters:
name - of the EJB to which the permission pertains.

actions - identifies the methods of the EJB to which the permission pertains.


public EJBMethodPermission(String EJBName, String methodName, String methodInterface, String[] methodParams)
使用与 EJBName 相对应的名称,以及由 methodName、methodInterface 和 methodParams 组成的 actions 创建新的 EJBMethodPermission。

EJBName EJB 名称的字符串表示形式,出现在部署描述符中相应的 ejb-name 元素中。

methodName 可用于指示应用权限的 EJB 方法的字符串。null 或 "" 值指示权限属于所有匹配权限规范其他参数的方法,不考虑方法名称。

methodInterface 可用于指定应用权限的 EJB 接口的字符串。null 或 "" 值指示权限属于所有匹配权限规范其他参数的方法,不考虑它们出现的接口。

methodParams 可用于指定(按 typeNames)目标方法的参数签名的字符串数组。methodParams 数组中 typeNames 的顺序必须与对应参数在目标方法的方法签名中出现的顺序相匹配。methodParams 数组中的每个 typeName 必须包含相应参数 typeName 的规范形式(如 getActions 方法定义的那样)。空 methodParams 数组用于表示不带参数的方法签名。null 值指示权限属于所有匹配权限规范其他参数的方法,不考虑方法签名。

英文文档:

EJBMethodPermission

public EJBMethodPermission(String EJBName,
                           String methodName,
                           String methodInterface,
                           String[] methodParams)
Creates a new EJBMethodPermission with name corresponding to the EJBName and actions composed from methodName, methodInterface, and methodParams.

Parameters:
EJBName - The string representation of the name of the EJB as it appears in the corresponding ejb-name element in the deployment descriptor.

methodName - A string that may be used to indicate the method of the EJB to which the permission pertains. A value of null or "" indicates that the permission pertains to all methods that match the other parameters of the permission specification without consideration of method name.

methodInterface - A string that may be used to specify the EJB interface to which the permission pertains. A value of null or "", indicates that the permission pertains to all methods that match the other parameters of the permission specification without consideration of the interface they occur on.

methodParams - An array of strings that may be used to specify (by typeNames) the parameter signature of the target methods. The order of the typeNames in methodParams array must match the order of occurence of the corresponding parameters in the method signature of the target method(s). Each typeName in the methodParams array must contain the canonical form of the corresponding parameter's typeName as defined by the getActions method. An empty methodParams array is used to represent a method signature with no arguments. A value of null indicates that the permission pertains to all methods that match the other parameters of the permission specification without consideration of method signature.


public EJBMethodPermission(String EJBName, String methodInterface, Method method)
使用与 EJBName 相对应的名称、由 methodInterface 组成的 actions,以及 Method 对象创建新的 EJBMethodPermission。

容器在检查调用者是否有权限调用 EJB 的方法之前使用此构造方法。

EJBName EJB 名称的字符串表示形式,出现在部署描述符中相应的 ejb-name 元素中。

methodInterface 可用于指定应用权限的 EJB 接口的字符串。null 或 "" 值指示权限属于所有匹配权限规范其他参数的方法,不考虑它们出现的接口。

method Java.lang.reflect.Method 类的实例,该类对应于容器要确定调用者是否有权限访问的方法。此值不得为 null。

英文文档:

EJBMethodPermission

public EJBMethodPermission(String EJBName,
                           String methodInterface,
                           Method method)
Creates a new EJBMethodPermission with name corresponding to the EJBName and actions composed from methodInterface, and the Method object.

A container uses this constructor prior to checking if a caller has permission to call the method of an EJB.

Parameters:
EJBName - The string representation of the name of the EJB as it appears in the corresponding ejb-name element in the deployment descriptor.

methodInterface - A string that may be used to specify the EJB interface to which the permission pertains. A value of null or "", indicates that the permission pertains to all methods that match the other parameters of the permission specification without consideration of the interface they occur on.

method - an instance of the Java.lang.reflect.Method class corresponding to the method that the container is trying to determine whether the caller has permission to access. This value must not be null.

Method Detail

public boolean equals(Object o)
检查两个 EJBMethodPermission 对象是否相等。如果 EJBMethodPermission 对象具有相同的名称和 actions 值(区分大小写),则它们相等。

当且仅当 P1.implies(P2) && P2.implies(P1) 时,这两个 Permission 对象(P1 和 P2)才是相等的。

o 要测试是否与此 EJBMethodPermission 相等的 EJBMethodPermission 对象

return 如果参数 EJBMethodPermission 对象与此 EJBMethodPermission 相等,则返回 true。

英文文档:

equals

public boolean equals(Object o)
Checks two EJBMethodPermission objects for equality. EJBMethodPermission objects are equivalent if they have case sensitive equivalent name and actions values.

Two Permission objects, P1 and P2, are equivalent if and only if P1.implies(P2) && P2.implies(P1).

Specified by:
equals in class Permission
Parameters:
o - the EJBMethodPermission object being tested for equality with this EJBMethodPermission

Returns:
true if the argument EJBMethodPermission object is equivalent to this EJBMethodPermission.

public String getActions()
返回包含此 EJBMethodPermission 的 actions 的规范表示形式的 String。下列语法描述介绍了 EJBMethodPermission 的 actions 的规范形式。

methodNameSpec ::= methodName | emptyString

methodInterfaceName ::= String

methodInterfaceSpec ::= methodInterfaceName | emptyString

typeName ::= typeName | typeName []

methodParams ::= typeName | methodParams comma typeName

methodParamsSpec ::= emptyString | methodParams

methodSpec ::= null |
methodName |
methodNameSpec comma methodInterfaceName |
methodNameSpec comma methodInterfaceSpec comma methodParamsSpec
 

每个 typeName 的规范形式必须以相应参数类型的完全限定 Java 名称开头。数组参数的 typeName 的规范形式是数组组件类型的完全限定 Java 名称,后接与数组维数一样多的字符串 "[]" 形式的实例。规范形式中不存在其他字符(例如空白)。

MethodInterfaceName 是一个非空 String,并且应该包含一个为在 EJB 部署描述符中使用而定义的 method-intf 值。实现必须灵活,这样它才能支持其他接口名称,尤其是如果这些名称通过 EJB 规范进行了标准化。EJB 规范当前定义了以下 method-intf 值:

{ "Home", "LocalHome", "Remote", "Local", "ServiceEndpoint" }
 

return 返回包含此 EJBMethodPermission 的规范化的 actions 的 String。

英文文档:

getActions

public String getActions()
Returns a String containing a canonical representation of the actions of this EJBMethodPermission. The Canonical form of the actions of an EJBMethodPermission is described by the following syntax description.

      methodNameSpec ::= methodName | emptyString

      methodInterfaceName ::= String

      methodInterfaceSpec ::= methodInterfaceName | emptyString

      typeName ::= typeName | typeName []

      methodParams ::= typeName | methodParams comma typeName

      methodParamsSpec ::= emptyString | methodParams

      methodSpec ::= null |
           methodName |
           methodNameSpec comma methodInterfaceName |
           methodNameSpec comma methodInterfaceSpec comma methodParamsSpec
 

The canonical form of each typeName must begin with the fully qualified Java name of the corresponding parameter's type. The canonical form of a typeName for an array parameter is the fully qualified Java name of the array's component type followed by as many instances of the string "[]" as there are dimensions to the array. No additional characters (e.g. blanks) may occur in the canonical form.

A MethodInterfaceName is a non-empty String and should contain a method-intf value as defined for use in EJB deployment descriptors. An implementation must be flexible such that it supports additional interface names especially if they are standardized by the EJB Specification. The EJB Specification currently defines the following method-intf values:

       { "Home", "LocalHome", "Remote", "Local", "ServiceEndpoint" }
 

Specified by:
getActions in class Permission
Returns:
a String containing the canonicalized actions of this EJBMethodPermission.

public int hashCode()
返回此 EJBMethodPermission 的哈希码值。所返回哈希码的属性必须如下所示:

  • 在 Java 应用程序的生命周期中,每次对 EJBMethodPermission 对象调用 hashCode 方法,该方法都必须返回相同的整数值。应用程序每次对特定 EJBMethodPermission 对象执行 hashCode 调用所返回的值不必保持一致。
  • 如果根据 equals 方法,两个 EJBMethodPermission 对象是相等的,那么对两个 Permission 对象中的每个对象调用 hashCode 方法必须生成相同的整数结果(在应用程序内)。

return 此对象的整数哈希码值。

英文文档:

hashCode

public int hashCode()
Returns the hash code value for this EJBMethodPermission. The properties of the returned hash code must be as follows:

  • During the lifetime of a Java application, the hashCode method must return the same integer value every time it is called on a EJBMethodPermission object. The value returned by hashCode for a particular EJBMethodPermission need not remain consistent from one execution of an application to another.
  • If two EJBMethodPermission objects are equal according to the equals method, then calling the hashCode method on each of the two Permission objects must produce the same integer result (within an application).

Specified by:
hashCode in class Permission
Returns:
the integer hash code value for this object.

public boolean implies(java.security.Permission permission)
确定此 EJBMethodPermission 是否“隐含有”参数 Permission。要实现这一点:

  • 参数必须是 EJBMethodPermission 的实例
  • 名称等于此 EJBMethodPermission 的名称,并且
  • 参数 Permission 应用到的方法(如其 actions 中定义的)必须是此 EJBMethodPermission 应用到的方法(如其 actions 中定义的)的子集。

如果满足下列所有条件,则参数 Permission 应用到此权限所应用到的方法的子集。

  • 此权限的 methodNameSpec 的方法名称组件为 null、空字符串,或等于参数 Permission 的方法名称,且
  • 此权限的 methodNameSpec 的方法接口组件为 null、空字符串,或等于参数 Permission 的方法接口,且
  • 此权限的 methodNameSpec 的方法参数列表组件为 null、空字符串,或等于参数 permission 的方法参数列表。

上述名称和 actions 比较是区分大小写的。

permission 检查“此”EJBMethodPermission,了解它是否隐含有参数 Permission。

return 如果对象隐含指定的权限,则返回 true;否则返回 false。

英文文档:

implies

public boolean implies(Permission permission)
Determines if the argument Permission is "implied by" this EJBMethodPermission. For this to be the case,

  • The argument must be an instanceof EJBMethodPermission
  • with name equivalent to that of this EJBMethodPermission, and
  • the methods to which the argument permission applies (as defined in its actions) must be a subset of the methods to which this EJBMethodPermission applies (as defined in its actions).

The argument permission applies to a subset of the methods to which this permission applies if all of the following conditions are met.

  • the method name component of the methodNameSpec of this permission is null, the empty string, or equivalent to the method name of the argument permission, and
  • the method interface component of the methodNameSpec of this permission is null, the empty string, or equivalent to the method interface of the argument permission, and
  • the method parameter list component of the methodNameSpec of this permission is null, the empty string, or equivalent to the method parameter list of the argument permission.

The name and actions comparisons described above are case sensitive.

Specified by:
implies in class Permission
Parameters:
permission - "this" EJBMethodPermission is checked to see if it implies the argument permission.

Returns:
true if the specified permission is implied by this object, false if not.


Submit a bug or feature

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

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

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