150 likes | 317 Views
Enterprise Java Beans. Model One Architecture. Data base. Model 1 J2EE – Web View. Model/View/Controller. Web Server. HTTP Request. CGI/SERVLET/PHP. HTTP Response. Model One Architecture. Data base. Model 1 J2EE – Other Views. Model/View/Controller. REWRITE!!!. Model 2 Without EJBs.
E N D
Model OneArchitecture Database Model 1 J2EE – Web View Model/View/Controller WebServer HTTP Request CGI/SERVLET/PHP HTTP Response
Model OneArchitecture Database Model 1 J2EE – Other Views Model/View/Controller REWRITE!!!
Model 2 Without EJBs Model TwoArchitecture View WebServer Control Model Request handler HTTP Request Control<<POJO>> Model <<POJO>> HTTP Response Build view
Model 2 with J2EE EJB’s Model Two Architecture EJB Container Web Container View Control Model WebServer Servlet Entity EJB Entity EJB HTTP Request Session EJB Session Bean JavaBean JavaBean <<forward>> <<creates>> JavaBean HTTP Response JSP page
Model 2 J2EE – Other Views Model TwoArchitecture Control Model View Session Bean EntityBean REWRITE!!!
Response <<forward>> Request Model 2 J2EE Architecure Model TwoArchitecture View WebServer Control Model Servlet Control<<Session EJB>> Model <<Entity EJB>> JSP page
Deploy Model 2 with EJBs View Layer Control & Model Layer
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
When should I Use J2EE Model 2? • Multiple apps share common data repository • Must support transactions • You need fine grained security (functional level) • High Scalability • High Availability • Must support multiple clients
Java Beans vs. Enterprise Java Beans Java Beans Enterprise Java Beans • General purpose component • Highly specialized business logic components • Collection of classes based on patterns • A single class • Executed and used anywhere • 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
Client Client EJB2 Servlet/JSP Applet EJB2 Client Client EJB2 B-to-B Swing App EJB2 The EJB Pool EJB2 EJB2 EJB1 EJBContainer EJB Pool Server
Client Client Servlet/JSP Applet EJB2 EJB3 Client Client EJB5 EJB4 B-to-B Swing App EJB2 Swapping in EJB Pool EJB1 EJB2 EJB2 EJBContainer EJB3 EJB3 EJB Pool EJB4 EJB4 EJB5 EJB5 Server
Client Client EJB2 Servlet/JSP Applet EJB2 Client Client EJB3 B-to-B Swing App ClusteredServers EJB2 EJB4 Clustering of EJB Servers EJB3 EJB2 EJB4