Enterprise JavaBeans Component Architecture is an example-driven book. Our goal is to show you how to design effective EJB components through our examples. Each example teaches you some aspect of EJB design. For instance, our first example (Loan EJB) illustrates the design and use of a stateless session bean (see “The Loan Enterprise Bean” on page 36).
The enterprise computing community has developed a rich set of design patterns. Where possible, we apply accepted design patterns within our examples, explaining the benefit that each pattern brings, as well as presenting its complete implementation. See, for example, the Session Facade Pattern implemented in several examples (“Session Facade Pattern” on page 250 as well as “Session Facade Pattern” on page 329).
We've attempted to bring an element of real-world problem solving to our program examples. At the same time, we avoid solutions that entail layers and layers of abstraction. We hope the developer can recognize the types of enterprise applications our examples represent and use our code as a starting point for further development. For example, we've written a JSP web component client that allows a user to log into a “system” based on a user name and a password. An underlying database stores “customer data,” and several enterprise Java beans provide the database lookup and verification steps. There's hardly a customer-based web site that doesn't need a similar capability (see “Web Component Client” on page 262).
Note that besides presenting code for all our EJB examples, we also present complete code for the clients. It may be surprising to see JSP programs in a book about EJB, but our belief is that the examples become more useful when you see how they work within a complete application. Also, an EJB is a component—and components can have all sorts of clients. Thus, we show you a JSP client and a stand-alone Java client with the same EJB.
We've developed and deployed all our examples using the Sun Microsystems Reference Implementation. We run the J2EE server on a Solaris Machine, but have tested our clients on several platforms including Windows and Red Hat Linux.
Table 1.1 describes the different examples. Some chapters include a single application (one or more clients with one or more EJBs). Other chapters include multiple examples built on earlier ones. This table will be helpful as you install and run the examples on your own system.
Chapter and Topics | Example Components | Source Directory |
---|---|---|
Chapter 3: Stateless Session Beans | loanSession | |
Stateless Session Bean | Loan EJB | |
Application Exceptions | LoanObjectException | |
Value Object Pattern | LoanVO | |
Stand-alone Java client | AmortClient | |
JSP web component client | paymentGet | |
paymentPost | ||
Chapter 4: Session Beans with JDBC | musicSession | |
Session Beans with JDBC | Music EJB | |
Database Reader | ||
Application Exceptions | NoTrackListException | |
Value Object Pattern | RecordingVO | |
TrackVO | ||
Java Swing client | MusicApp | (see Appendix A) |
JSP web component client | musicGet musicPost | |
Chapter 4: Session Beans with JDBC Data Access Object Pattern | musicDAO | |
DAO Pattern | Music EJB with DAO | |
Factory Pattern | MusicDAOFactory | |
System Exceptions | MusicDAOSysException | |
Naming Environment Entry | ||
Chapter 5: Stateful Session Beans | musicVL | |
Stateful Session Bean | MusicCart EJB | |
Value Object Pattern | CustomerVO | |
Value List Iterator Pattern | MusicIterator EJB | |
MusicPage EJB | ||
JSP web component client | login | |
loginPost | ||
musicCart | ||
shoppingPost | ||
Chapter 5: Stateful Session Beans Local Interfaces | musicLocal | |
Local interfaces | MusicPage EJB | |
Local vs. Remote interfaces | MusicIterator EJB | |
Stateful vs. Stateless | ||
Chapter 6: Entity Beans with BMP | customerDAO | |
Bean-managed persistence | Customer EJB | |
Finder/Home methods | ||
Transactions | ||
Local Interfaces | ||
DAO Pattern | CustomerDAO | |
Session Facade Pattern | CustomerSession EJB | |
Value Object Pattern | CustomerVO | |
Test Client | CustomerTestClient | |
JSP web component client | signUp | |
signUpPost | ||
loginPost | ||
Chapter 7: Entity Beans with CMP | ordersCMP | |
Container-managed persistence | Customer EJB | |
Relationship fields | Order EJB | |
EJB Query Language | LineItem EJB | |
Finder/Select Methods | ||
Session Facade Pattern | CustomerSession EJB | |
Value Object Pattern | OrderVO | |
LoanVO | ||
JSP web component client | processOrder | |
submitOrder | ||
Administrative client | AdminClient | |
Chapter 8: Message-Driven Beans | ||
JMS message queues | PingServer | |
Publish/Subscribe Pattern | SchoolApp client | School |
Student MDB | ||
Point-to-Point Pattern | OrderApp client | ShipOrders |
EJB integration | ShipOrder MDB |
3.145.20.193