home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book Home Enterprise JavaBeans Search this book

Appendix B. State and Sequence Diagrams

The appendix contains state and sequence diagrams for all the bean types discussed in this book: container-managed and bean-managed entity beans, and stateless and stateful session beans. Although standard UML is used in these diagrams, some extensions were required to model EJB runtime characteristics. In the state diagrams, for example, actions of the client and container are shown in the standard format; callback methods and class instantiation operations are shown as part of the transition event. The separation of client and container requires this simple extension.

In the sequence diagrams, container-provided classes such as the container itself, EJB object, and EJB home are shown as separate classes but are also boxed together. Messages sent from classes in the container system box are considered to be sent from the container system as a whole, not necessarily the specific container-provided class. This generalization is necessary because the container's interaction with the bean is characterized by these classes but will be different from one vendor's implementation to the next. The exact source of the message is immaterial, as long as you realize that the container system sent it.

B.1. Entity Beans

B.1.1. Life Cycle State Diagram of the Entity Bean

figure

Figure B-1. Life cycle state diagram of the entity bean

B.1.2. Sequence Diagrams for Container-Managed Persistence

figure

Figure B-2. Creation and removal in container-managed persistence

figure

Figure B-3. Activation and synchronization in container-managed persistence

B.1.3. Sequence Diagrams for Bean-Managed Persistence

figure

Figure B-4. Creation and removal in bean-managed persistence

figure

Figure B-5. Activation and synchronization in bean-managed persistence

Table B-1 and Table B-2 summarize the operations that an entity bean is allowed to perform in various stages of its life cycle.

Table B-1. Allowed Operations for Entity Beans in EJB 1.1

Method

Allowed Operations

setEntityContext()

unsetEntityContext()

EntityContext methods:

getEJBHome()

JNDI ENC contexts:

Properties java:comp/env

ejbCreate()

ejbFind()

EntityContext methods:

getEJBHome()

getCallerPrincipal()

isCallerInRole()

getRollbackOnly()

setRollbackOnly()

JNDI ENC contexts:

Properties java:comp/env

Resource Managers java:comp/env/jdbc

EJB references java:comp/env/ejb

ejbPostCreate()

ejbLoad()

ejbStore()

ejbRemove()

business methods

EntityContext methods:

getEJBHome()

getCallerPrincipal()

isCallerInRole() getRollbackOnly()

setRollbackOnly()

getEJObject()

getPrimaryKey()

JNDI ENC contexts:

Properties java:comp/env

Resource Managers java:comp/env/jdbc

EJB references java:comp/env/ejb

ejbActivate()

ejbPassivate()

EntityContext methods:

getEJBHome()

getEJBObject()

getPrimaryKey()

JNDI ENC contexts:

Properties java:comp/env

Note that entity beans in EJB 1.1 can never access the EJBContext.getUserTransaction() method, because entity beans are not allowed to manage their own transactions. Only session beans can access this method.

Table B-2. Allowed Operations for Entity Beans in EJB 1.0

Allowed Operations

Method

Container-Managed Transactions

Bean-Managed Transactions

setEntityContext()

unsetEntityContext()

EntityContext methods:

getEnvironment()

getEJBHome()

EntityContext methods:

getEnvironment()

getEJBHome()

ejbCreate()

ejbFind()

EntityContext methods:

getEnvironment()

getEJBHome()

getCallerIdentity()

isCallerInRole()

getRollbackOnly()

setRollbackOnly()

EntityContext methods:

getEnvironment()

getEJBHome()

getCallerIdentity()

isCallerInRole()

getUserTransaction()

ejbPostCreate()

ejbLoad()

ejbStore()

ejbRemove()

business methods

EntityContext methods:

getEnvironment()

getEJBHome()

getCallerPrincipal()

getRollbackOnly()

isCallerInRole()

setRollbackOnly()

getEJBObject()

getPrimaryKey()

EntityContext methods:

getEnvironment()

getEJBHome()

getCallerPrincipal()

isCallerInRole()

getEJBObject()

getPrimaryKey()

getUserTransaction()

ejbActivate()

ejbPassivate()

EntityContext methods:

getEnvironment()

getEJBHome()

getEJBObject()

getPrimaryKey()

EntityContext methods:

getEnvironment()

getEJBHome()

getEJBObject()

getPrimaryKey()



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.











??????????????@Mail.ru