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

Sun Microsystems Inc

Object interaction diagrams

Enterprise JavaBeans 2.0, Public Draft

Entity Bean Component Contract for Bean

11.3.6 Meta-data class

The deployment tools are responsible for implementing the class that provides meta-data information to the client view contract. The class must be a valid RMI-IIOP Value Type, and must implement the javax.ejb.EJBMetaData interface.

Because the meta-data class is not entity bean specific, the container may, but is not required to, use a single class for all deployed enterprise beans.

11.3.7 Instance’s re-entrance

The container runtime must enforce the rules defined in Section 11.1.12.

11.3.8 Transaction scoping, security, exceptions

The container runtime must follow the rules on transaction scoping, security checking, and exception handling described in Chapters 16, 20, and 17.

11.3.9 Implementation of object references

The container should implement the distribution protocol between the client and the container such that the object references of the home and remote interfaces used by entity bean clients are usable for a long period of time. Ideally, a client should be able to use an object reference across a server crash and restart. An object reference should become invalid only when the entity object has been removed, or after a reconfiguration of the server environment (for example, when the entity bean is moved to a different EJB server or container).

The motivation for this is to simplify the programming model for the entity bean client. While the client code needs to have a recovery handler for the system exceptions thrown from the individual method invocations on the home and remote interface, the client should not be forced to re-obtain the object references.

11.3.10 EntityContext

The container must implement the EntityContext.getEJBContext() method such that the bean instance can use the Java language cast to convert the returned value to the entity bean’s remote interface type. Specifically, the bean instance does not have to use the PortableRemoteObject.narrow(...) method for the type conversion.

11.4 Object interaction diagrams

This section uses object interaction diagrams to illustrate the interactions between a bean managed persistence entity bean instance and its container.

247

5/31/00

Sun Microsystems Inc.

Entity Bean Component Contract for Bean Managed PersistenceEnterprise JavaBeans 2.0, Public Draft

Object interaction diagrams

11.4.1 Notes

The object interaction diagrams illustrate a box labeled “container-provided classes.” These classes are either part of the container or are generated by the container tools. These classes communicate with each other through protocols that are container implementation specific. Therefore, the communication between these classes is not shown in the diagrams.

The classes shown in the diagrams should be considered as an illustrative implementation rather than as a prescriptive one

5/31/00

248

Sun Microsystems Inc

Object interaction diagrams

Enterprise JavaBeans 2.0, Public Draft

Entity Bean Component Contract for Bean

11.4.2 Creating an entity object

Figure 42 OID of Creation of an entity object with bean-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

javax.transaction.UserTransaction.begin()

create(args)

ejbCreate(args)

create representation in DB

register resource manager

new

ejbPostCreate(args)

new

registerSynchronization(synchronization)

business method

business method

249

5/31/00

Sun Microsystems Inc.

Entity Bean Component Contract for Bean Managed PersistenceEnterprise JavaBeans 2.0, Public Draft

Object interaction diagrams

11.4.3 Passivating and activating an instance in a transaction

Figure 43 OID of passivation and reactivation of an entity bean instance with bean-managed persistence

container-provided classes

client

EJB

EJB

container entity

synchro-

instance transaction database

 

Home

Object

context

nization

service

 

 

 

 

 

 

business method

business method

ejbStore()

write state to DB

ejbPassivate()

business method

ejbActivate()

ejbLoad()

read state from DB

business method

business method

business method

5/31/00

250