Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, Version 2.0 - Sun Microsystems.pdf
Скачиваний:
14
Добавлен:
24.05.2014
Размер:
2.71 Mб
Скачать

Sun Microsystems Inc.

EJB 1.1 Runtime environment

Enterprise JavaBeans 2.0, Public Draft

EJB 1.1 Container Provider’s responsibility

This function is reserved for the EJB Container. Allowing the enterprise bean to perform this function would create a security hole.

The enterprise bean must not attempt to access or modify the security configuration objects (Policy, Security, Provider, Signer, and Identity).

These functions are reserved for the EJB Container. Allowing the enterprise bean to use these functions could compromise security.

The enterprise bean must not attempt to use the subclass and object substitution features of the Java Serialization Protocol.

Allowing the enterprise bean to use these functions could compromise security.

The enterprise bean must not attempt to pass this as an argument or method result. The enterprise bean must pass the result of SessionContext.getEJBObject() or EntityContext.getEJBObject() instead.

To guarantee portability of the EJB 1.1 enterprise bean’s implementation across all compliant EJB 1.1 Containers, the Bean Provider should test the enterprise bean using a Container with the security settings defined in Table 17. The table defines the minimal functionality that a compliant EJB 1.1 Container must provide to the enterprise bean instances at runtime.

C.2 EJB 1.1 Container Provider’s responsibility

This section defines the EJB 1.1 Container’s responsibilities for providing the runtime environment to the enterprise bean instances. The requirements described here are considered to be the minimal requirements; a Container may choose to provide additional functionality that is not required by the EJB specification.

An EJB 1.1 Container must make the following APIs available to the enterprise bean instances at runtime:

Java 2 Platform, Standard Edition, v 1.2 (J2SE) APIs

EJB 1.1 APIs

JNDI 1.2

JTA 1.0.1, the UserTransaction interface only

JDBC™ 2.0 extension

JavaMail 1.1, sending mail only

The following subsections describes the requirements in more detail.

5/31/00

506

Sun Microsystems Inc

EJB 1.1 Container Provider’s responsibility

Enterprise JavaBeans 2.0, Public Draft

EJB 1.1 Runtime environment

C.2.1 Java 2 Platform, Standard Edition, v 1.2 (J2SE) APIs requirements

The Container must provide the full set of Java 2 Platform, Standard Edition, v 1.2 (J2SE) APIs. The Container is not allowed to subset the Java 2 platform APIs.

The EJB Container is allowed to make certain Java 2 platform functionality unavailable to the enterprise bean instances by using the Java 2 platform security policy mechanism. The primary reason for the Container to make certain functions unavailable to enterprise bean instances is to protect the security and integrity of the EJB Container environment, and to prevent the enterprise bean instances from interfering with the Container’s functions.

The following table defines the Java 2 platform security permissions that the EJB Container must be able to grant to the enterprise bean instances at runtime. The term “grant” means that the Container must be able to grant the permission, the term “deny” means that the Container should deny the permission.

Table 17

Java 2 Platform Security policy for a standard EJB Container

 

 

 

 

 

 

Permission name

EJB Container policy

 

 

 

 

 

 

 

 

 

 

java.security.AllPermission

deny

 

 

 

 

 

 

java.awt.AWTPermission

deny

 

 

 

 

 

 

java.io.FilePermission

deny

 

 

 

 

 

 

java.net.NetPermission

deny

 

 

 

 

 

 

java.util.PropertyPermission

grant “read”, “*”

 

 

 

deny all other

 

 

 

 

 

 

java.lang.reflect.ReflectPermission

deny

 

 

 

 

 

 

java.lang.RuntimePermission

grant “queuePrintJob”,

 

 

 

deny all other

 

 

 

 

 

 

java.lang.SecurityPermission

deny

 

 

 

 

 

 

java.io.SerializablePermission

deny

 

 

 

 

 

 

java.net.SocketPermission

grant “ connect”, “*” [Note A],

 

 

 

deny all other

 

 

 

 

 

Notes:

 

[A]This permission is necessary, for example, to allow enterprise beans to use the client functionality of the Java IDL API and RMI-IIOP packages that are part of Java 2 platform.

Some Containers may allow the Deployer to grant more, or fewer, permissions to the enterprise bean instances than specified in Table 17. Support for this is not required by the EJB specification. Enterprise beans that rely on more or fewer permissions will not be portable across all EJB Containers.

507

5/31/00

Sun Microsystems Inc.

EJB 1.1 Runtime environment

Enterprise JavaBeans 2.0, Public Draft

EJB 1.1 Container Provider’s responsibility

C.2.2 EJB 1.1 requirements

The container must implement the EJB 1.1 interfaces.

C.2.3 JNDI 1.2 requirements

At the minimum, the EJB Container must provide a JNDI API name space to the enterprise bean instances. The EJB Container must make the name space available to an instance when the instance invokes the javax.naming.InitialContext default (no-arg) constructor.

The EJB Container must make available at least the following objects in the name space:

The home interfaces of other enterprise beans.

The resource factories used by the enterprise beans.

The EJB specification does not require that all the enterprise beans deployed in a Container be presented with the same JNDI API name space. However, all the instances of the same enterprise bean must be presented with the same JNDI API name space.

C.2.4 JTA 1.0.1 requirements

The EJB Container must include the JTA 1.0.1 extension, and it must provide the javax.transaction.UserTransaction interface to enterprise beans with bean-managed transaction demarcation through the javax.ejb.EJBContext interface, and also in JNDI under the name java:comp/UserTransaction, in the cases required by the EJB specification.

The EJB Container is not required to implement the other interfaces defined in the JTA specification. The other JTA interfaces are low-level transaction manager and resource manager integration interfaces, and are not intended for direct use by enterprise beans.

C.2.5 JDBC™ 2.0 extension requirements

The EJB Container must include the JDBC 2.0 extension and provide its functionality to the enterprise bean instances, with the exception of the low-level XA and connection pooling interfaces. These low-level interfaces are intended for integration of a JDBC driver with an application server, not for direct use by enterprise beans.

C.2.6 Argument passing semantics

The enterprise bean’s home and remote interfaces are remote interfaces for Java RMI. The Container must ensure the semantics for passing arguments conform to Java RMI. Non-remote objects must be passed by value.

Specifically, the EJB Container is not allowed to pass non-remote objects by reference on inter-EJB invocations when the calling and called enterprise beans are collocated in the same JVM. Doing so could result in the multiple beans sharing the state of a Java object, which would break the enterprise bean’s semantics.

5/31/00

508