Enterprise Java Beans. Model 1 J2EE – Web View Model/View/Controller Model View Control Data base...
-
Upload
betty-mills -
Category
Documents
-
view
218 -
download
1
Transcript of Enterprise Java Beans. Model 1 J2EE – Web View Model/View/Controller Model View Control Data base...
Enterprise Java Beans
Model 1 J2EE – Web View
Model/View/Controller
Model View
ControlDatabase
WebServer
Model One
Architecture
HTTP Request
HTTP Response
Model 1 J2EE – Other Views
Model/View/Controller Model One
Architecture
REWRITE!!! Database
View
Model 2 J2EE – Other Views
Control Model
EntityBean
Session Bean
Model Two
Architecture
REWRITE!!!
EJB ContainerWeb Container
View
Model 2 with J2EE EJB’s
Control Model
WebServer
Session EJB
Model Two Architecture
JavaBean
Entity EJB
Request Handler
BuildView
Servlet
JSP page
JavaBean
<<forward>>
HTTP Request
HTTP Response
EJB Benefits
Flexibility, Scalability and Adaptability Design based on best practices (design patterns) Facilitates communication (common framework) Reusability More robust solutions and saves development time
Security Transaction management Concurrency control Resource management Persistence Operating environment handling Error handling
Multiple apps share common data repository
Must support transactions
You need fine grained security (functional level)
High Scalability
High Availability
Must support multiple clients
When should I Use J2EE Model 2?
Java Beans vs. Enterprise Java Beans
Java Beans Enterprise Java Beans
General purpose component
A single class
Executed and used anywhere
Highly specialized business logic components
Collection of classes based on patterns
Executed only in an enterprise container
Three types of EJBs
Session beans – control/business logic and transaction management (Control)
Entity beans – to access data objects (database, file system, etc.) (Model)
Message beans – to communicate with other applications
The EJB Pool
EJBContainer
ClientServlet/JSP
ClientApplet
ClientSwing App
ClientB-to-B
EJB1EJB2
EJB2
EJB2
EJB2
EJB2
Server
EJB Pool
EJB2
Swapping in EJB Pool
ClientServlet/JSP
ClientApplet
ClientSwing App
ClientB-to-B
EJB1EJB2
EJB2
Server
EJB Pool
EJB4
EJB3
EJB5
EJB3
EJB4
EJB5
EJB3
EJB4 EJB5
EJBContainer
EJB2EJB2
ClusteredServers
Clustering of EJB Servers
ClientServlet/JSP
ClientApplet
ClientSwing App
ClientB-to-B
EJB2
EJB2
EJB4
EJB3
EJB2
EJB4
EJB2
EJB3
Deploy Model 2 with EJBs
View Layer Control & Model Layer