EJB .

4,514 views

Published on

Published in: Education, Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,514
On SlideShare
0
From Embeds
0
Number of Embeds
106
Actions
Shares
0
Downloads
554
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

EJB .

  1. 1. by Vinay Ayyagari, St.Johns PG College,Hyd . 06/05/09
  2. 2. Enterprise Java Beans <ul><li>Introduction </li></ul><ul><li>What is the Difference between Web server and Application Server ? </li></ul><ul><li>Elements of EJB Components </li></ul><ul><li>EJB Component can Access by </li></ul><ul><li>Ejb Architecture </li></ul>06/05/09
  3. 3. Introduction <ul><li>Enterprise Java Beans ( EJB ) is </li></ul><ul><ul><li>is the server-side component architecture for Java Platform, Enterprise Edition (Java EE). </li></ul></ul><ul><ul><li>EJB technology enables rapid and simplified development of distributed, transactional, secure and portable applications based on Java technology </li></ul></ul><ul><ul><li>Presented by Sun in the 1999, Which EJBapplication runs in a J2EE Server or Application Server. </li></ul></ul>06/05/09
  4. 4. What is the Difference between Web server and Application Server ? <ul><li>A Web server contains only a web container but an Application Server contains both a Web Container and a EJB Container. </li></ul><ul><li>A Web Server does not follows Clustering but an Application Server follows Clustering. </li></ul>06/05/09
  5. 5. What the EJB Do? <ul><li>. </li></ul>06/05/09
  6. 6. EJB Component can Access by <ul><li>EJB Component runs inside a server and it can be accessible by the Following Types of Clients. </li></ul><ul><li>A Desktop application can access EJB </li></ul><ul><li>An applet can access EJB </li></ul><ul><li>A web client Using Servelt or Jsp can access EJB. </li></ul><ul><li>One EJB can access another EJB. </li></ul><ul><li>A CORBA client can access EJB. </li></ul>06/05/09
  7. 7. Elements of EJB Components <ul><li>Elements of EJB components are </li></ul><ul><li>Home Interface </li></ul><ul><li>Remote Interface </li></ul><ul><li>Bean Class. </li></ul>06/05/09
  8. 8. What is Home Interface: <ul><li>Home Interface is a factory for creating EJB Objects. </li></ul><ul><li>Home Interface Extends EJB Home interface and it is given in Javax.ejb.*; </li></ul><ul><li>The Home Interface contains Life Cycle methods like Create(),Remove(),findXxx(), etc.. </li></ul><ul><li>Each method in Home Interface returns the Remote Object or EJBObject </li></ul><ul><li>Each method in Home Interface throws “Remote Exception”. </li></ul>06/05/09
  9. 9. Remote Interface: <ul><li>It Contains Business logic methods. </li></ul><ul><li>In order to create a Remote Interface ,Our Interface must be extend EJBObject interface </li></ul><ul><li>Remote Interface is given in Javax.ejb.*;Package. </li></ul><ul><li>Each Business method in this interface throws “Remote Exception”. </li></ul><ul><li>The return values of these methods can be void or primitives or Objects. </li></ul>06/05/09
  10. 10. Bean Class: <ul><li>The Bean Class contains both Life cycle methods Implementation + Business Logic Methods give in Home Interface and Remote Interface and also it contains Container Call back methods. </li></ul><ul><li>The Bean Class must be implemented either Session Bean or Entity Bean or Message Driven Bean Interfaces. </li></ul>06/05/09
  11. 11. Step 1:The EJB Container stores Home Object into the Naming Service. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  12. 12. Step 2.Client Communicates with Naming registry with JNDI lookup() operation . <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  13. 13. Step-3.Clients gets the Home Object reference back to the Client (h) <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  14. 14. Step-4.Clients calls Create method on Home Object reference (h),so that call will be received Home Object in the Container. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  15. 15. Step-5.Home Object Creates a bean object according to necessity. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  16. 16. Step-6.The Home Object either Creates or Locates EJB Object in the Container <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  17. 17. Step-7.Home Object returns a reference of EJB Object back to the Client (r) <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  18. 18. Step-8.Client calls a Business method on EJB Object reference, so that the Ejb Object running in the container will receive it. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  19. 19. Step-9.The EJB Object transfers or delegates the Business method call to the Bean Object. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  20. 20. Step-10.The Bean Object executes Business logic and returns result back to EJB Object. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object
  21. 21. Step-11.Finally EJB Object returns the result back to the Client. <ul><li>R </li></ul><ul><li> Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object Result
  22. 22. EJB Architecture <ul><li>R </li></ul><ul><li>Client EJB Server </li></ul>06/05/09 Client EJB Container Home Object Ejb Object Bean Object Result
  23. 23. EJB Architecture <ul><li>Note: In the Ejb development, the programmer will provide Home & Remote interfaces. The Container creates the Implementation classes for these 2 interfaces and generates objects automatically .These Objects are called Home Object and EJB Object. </li></ul>06/05/09
  24. 24. Bibliography <ul><li>http://java.sun.com/products/ejb/ </li></ul><ul><li>www.math.iitb.ac.in/~bjothi/ncoot2003 </li></ul><ul><li>Tom Valesky, “Enterprise Java Beans&quot;, </li></ul><ul><li>Pearson Education, 2002. </li></ul>06/05/09
  25. 25. . <ul><li>Finally “EJB” says </li></ul><ul><li> Thank You. </li></ul>06/05/09

×