Top Description Fields Constructors Methods
javax.security.jacc

public final Class EJBMethodPermission

extends Permission
Class Inheritance
Imports
java.io.IOException, .ObjectStreamField, java.lang.reflect.Method, java.security.Permission, java.util.HashMap

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.

Authors
Ron Monzillo, Gary Ellison
See Also
java.security.Permission

Field Summary

Modifier and TypeField and Description
private transient String
private transient int
private static HashMap<K, V>
private static final String[]
private transient int
private transient String
private transient String
private transient String
private static final ObjectStreamField[]
serialPersistentFields

The serialized fields of this permission are defined below.

private static final long

Constructor Summary

AccessConstructor and Description
public
EJBMethodPermission(String
of the EJB to which the permission pertains.

name
,
String
identifies the methods of the EJB to which the permission pertains.
actions
)

Creates a new EJBMethodPermission with the specified name and actions.

public
EJBMethodPermission(String
The string representation of the name of the EJB as it appears in the corresponding ejb-name element in the deployment descriptor.

EJBName
,
String
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.

methodName
,
String
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.

methodInterface
,
String[]
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.
methodParams
)

Creates a new EJBMethodPermission with name corresponding to the EJBName and actions composed from methodName, methodInterface, and methodParams.

public
EJBMethodPermission(String
The string representation of the name of the EJB as it appears in the corresponding ejb-name element in the deployment descriptor.

EJBName
,
String
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.

methodInterface
,
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
)

Creates a new EJBMethodPermission with name corresponding to the EJBName and actions composed from methodInterface, and the Method object.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the argument EJBMethodPermission object is equivalent to this EJBMethodPermission.
equals
(Object
the EJBMethodPermission object being tested for equality with this EJBMethodPermission

o
)

Implements abstract java.security.Permission.equals.

Checks two EJBMethodPermission objects for equality.
public String

Returns:

a String containing the canonicalized actions of this EJBMethodPermission.
getActions
()

Implements abstract java.security.Permission.getActions.

Returns a String containing a canonical representation of the actions of this EJBMethodPermission.
public int

Returns:

the integer hash code value for this object.
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this EJBMethodPermission.
public boolean

Returns:

true if the specified permission is implied by this object, false if not.
implies
(Permission
"this" EJBMethodPermission is checked to see if it implies the argument permission.

permission
)

Implements abstract java.security.Permission.implies.

Determines if the argument Permission is "implied by" this EJBMethodPermission.
private void
readObject(ObjectInputStream s)

readObject reads the serialized fields from the input stream and uses them to restore the permission.

private void
private void
setMethodSpec(String methodName, String mInterface, String[] methodParams)

private void
setMethodSpec(String mInterface, Method method)

private static int
validateInterface(String methodInterface)

private synchronized void
writeObject(ObjectOutputStream s)

writeObject is used to establish the values of the serialized fields before they are written to the output stream and need not be implemented if the values of the serialized fields are always available and up to date.

Inherited from java.security.Permission:
checkGuardgetNamenewPermissionCollectiontoString

Field Detail

actionsback to summary
private transient String actions
hashCodeValueback to summary
private transient int hashCodeValue
interfaceHashback to summary
private static HashMap<K, V> interfaceHash
interfaceKeysback to summary
private static final String[] interfaceKeys
methodInterfaceback to summary
private transient int methodInterface
methodNameback to summary
private transient String methodName
methodParamsback to summary
private transient String methodParams
otherMethodInterfaceback to summary
private transient String otherMethodInterface
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields

The serialized fields of this permission are defined below. Whether or not the serialized fields correspond to actual (private) fields is an implementation decision.

Serial Fields:
actions:String
the canonicalized actions string (as returned by getActions).
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Constructor Detail

EJBMethodPermissionback to summary
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:String

of the EJB to which the permission pertains.

actions:String

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

EJBMethodPermissionback to summary
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:String

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

methodName:String

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:String

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:String[]

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.

EJBMethodPermissionback to summary
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:String

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

methodInterface:String

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: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

equalsback to summary
public boolean equals(Object o)

Implements abstract java.security.Permission.equals.

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).

Parameters
o:Object

the EJBMethodPermission object being tested for equality with this EJBMethodPermission

Returns:boolean

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

getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.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" }

Returns:String

a String containing the canonicalized actions of this EJBMethodPermission.

hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.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).

Returns:int

the integer hash code value for this object.

impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.Permission.implies.

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.

Parameters
permission:Permission

"this" EJBMethodPermission is checked to see if it implies the argument permission.

Returns:boolean

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

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

readObject reads the serialized fields from the input stream and uses them to restore the permission. This method need not be implemented if establishing the values of the serialized fields (as is done by defaultReadObject) is sufficient to initialize the permission.

setMethodSpecback to summary
private void setMethodSpec(String actions)
setMethodSpecback to summary
private void setMethodSpec(String methodName, String mInterface, String[] methodParams)
setMethodSpecback to summary
private void setMethodSpec(String mInterface, Method method)
validateInterfaceback to summary
private static int validateInterface(String methodInterface)
writeObjectback to summary
private synchronized void writeObject(ObjectOutputStream s) throws IOException

writeObject is used to establish the values of the serialized fields before they are written to the output stream and need not be implemented if the values of the serialized fields are always available and up to date. The serialized fields are written to the output stream in the same form as they would be written by defaultWriteObject.