Download presentation
Presentation is loading. Please wait.
1
EJB Design
2
Server-side components Perform –complex algorithms –high volume transactions Run in –highly available environment (365 days/year) –fault tolerant –transactional –secure
3
Basic Philosophy Enterprise applications are complex As they grow, specialization is a necessity Local control should be more focused on business/application specific issues Infrastructure issues should be left to specialists Many application issues are common Buying and assembling is better when possible Scalability is beyond the scope of most developers
5
Players in EJB System Bean Provider –java beans –EJB Application Assembler –uses beans to build –builds user interfaces and additional beans Deployer –performance and secxurity Systems Admin –handles problems of day-to-day running Container and Server Provider Tool Provider –IDEs –testing –build Persistence manager
6
Basic Architecture
7
User Interface Business Logic Database (infrastructure) Our Focus
8
3 -layer Separate for independence as in any layer design Application specific logic in business layer Reuse and scale business and infrastrucure layers without impacting the others As new interface technologies emerge, logic doesn’t (e.g., cell phone internet access)
9
How do the components interact? Most of the communication between layers, both interlayer and intralayer are some type of remote procedure call. Lots of technologies all basically the same –RPC –RMI –Corba –DCOM Also a need to preserve connectors to legacy system for evolution/migration needs
10
Main components Servers to manage complexity in first slide Servers are housed in containers Two containers –EJB –Web Database/infrastructure Input from java apps, web interfaces, legacy and related technologies (Corba).
11
Input Container Manages two main technologies –JSP –Servlets Handles issues of scalability, security, fault- tolerance, etc.
12
EJB container Entity Beans –data objects –typically connected to database entries Session Beans –logic operations –stateful and stateless Message Beans –asynchronous message exchange between beans –like mail senders, readers
14
Remote calls Allows for execution of logic on a machine other than the one caller executes on Requires using a stub for initiating and receiving the call. Takes the caller and creates –caller and calling stub Takes the procedure and creates –receiving stub and procedure
15
Worries about socket calls parameter packaging Worries about receiving socket calls unpackaging parameters Call appears local!
16
Container simplifies Bean
17
Typical business function interaction would be
18
Container simplifies Bean Business bean interaction would preferably be Hertz used to say “leave the driving to us”. Containers would say “leave the rest to us”.
20
Dumb! Only knows business logic. Smart! Knows everything else
21
You don’t implement.. Container does that!
24
EJB Overhead for an example remote call.
25
To Deploy Must Use JAR Contents include everything the container will need to manage it Class files Deployment descriptors Zip format
27
Hello World Our first example!
29
Remember it’s an interface (prototype) Insert prototype for the functionality you need.. hello() REMOTE INTERFACE
30
HOME INTERFACE Remember it’s an interface (prototype) Insert prototype for the functionality you need.. hello()
32
The Session Bean
33
SESSION BEAN
35
Bean Queries the contain via Context
36
DEPLOYMENT DESCRIPTOR - JAR
37
Simple Client-side Interaction with the EJB
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.