1 / 10

Enterprise Java Beans

Enterprise Java Beans. Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03. Introduction. What is EJB? It is a specification from Sun Microsystems. It is a server side component i.e. a readymade server framework is available to hold an EJB.

cade
Download Presentation

Enterprise Java Beans

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Enterprise Java Beans Welcome to the world of “Distributed System” Presented By: Sameer Nanda Date: 12/17/03

  2. Introduction What is EJB? • It is a specification from Sun Microsystems. • It is a server side component i.e. a readymade server framework is available to hold an EJB. • Server side components are faceless components i.e. no GUI. • The server used is Weblogic Application Server, because it follows the EJB specifications

  3. Application Server Why Application Server? • It follows the EJB specifications. • It provide with the 6 Primary Services like: • Naming Service, to bind a name with an Object. • Transaction Service, for remote object communication. • Security Service, using Secured Socket Layer(SSL). • Concurrency Service • Persistence, storing the state of an Object. • Resource Management, “Using an already existing object is less costlier than creating a new Object and then using it”

  4. Application Server(contd …) • EJB is deployed in the Application Server which in turn provides with the 6 primary services. • As a developer of the EJB component we do not have to explicitly take care of all this services; by default they are provided by the EJB been placed in the Application server. Naming Security Transaction Concurrency Persistance Resource Management Application Server EJB

  5. Definition of EJB The EJB Architecture is a component architecture for the development and deployment of Component-based distributed business applications. • EJB takes Java’s “Write Once Run Anywhere” (WORA)Capability and extends it to include “Reuse Anywhere”. • Applications written using EJB Architecture are scalable, transactional. • These applications may be written once and deployed on any server platform distributed over the network that supports the EJB Specifications.

  6. Why EJB? Basically there are 3 types of applications: • Monolithic Application: No Separation between User Interface, Business Logic & Data Access Difficult to reuse the code. • Two-Tier Architecture: No Separation between the User Interface and Business Logic. Ideally we should be able to separate the business rules from the user interface, so that we could update the business logic without modifying the client itself. This separation of Business rules from the implementation logic is the driving force behind the Three Tier Architecture. • Three-Tier Architecture: Separation between User Interface, Business Logic & Database. Reusability of User Interface & Business Logic. User Interface Business Logic Data Access User Interface Business Logic Data Access User Interface User Interface Business Logic Business Logic Data Base Server

  7. EJB Architecture Container Weblogic Application Server lookup(“ADD”) Request Response JNDI Deployment Descriptor EJB Home Interface JNDI Client EJB Impl Class EJB Object Interface Data Base Bean Instance Pool

  8. EJB Life Cycle In order to develop an EJB, Sun Microsystems came with a new package “javax.ejb”,it has: • EJBHome Interface: The EJB Container uses EJBHome & it controls the EJB Life Cycles: create( ), find( ) and remove( ) • EJBObject Interface:This is the place where we define our business methods(I.e. only the signatures of our business methods and not their actual implementation.) • EJB Implementation Class: In this class we provide the implementation for the Business methods provided by the EJB. This class should implement either the SessionBean /EntityBean Interface, depending upon the application what we are creating. But it cannot implement both. Types of EJB: Stateless SessionBean • Session Bean Stateful SessionBean Container Managed JDBC Persistance • EntityBean Bean Managed JDBC Persistance

  9. Types of Beans: • Stateless(SLSB): They provide with a more Generic Services. As the name suggests they don’t maintain a session with the client and are not dedicated to a particular client. A SLSB in transaction cannot be shared by any other client, whereas a SLSB in Instance pool can serve to any client. Example: Online checking for Availability of Tickets. • Stateful(SFSB): They maintain a state on behalf of an individual client, it is dedicated to the client who made a request for the bean. Here we can provide a specific amount of time for a particular instance of the bean to stay in the container and server the client, once the timeouts we can write the state of the bean in a secondary storage which can be invoked for future use. Example: Booking the tickets for Flight Reservations. • Container Managed JDBC(CMJDBC):They are long lived, sharable and remain alive because they represent some persistent data in the form of database records. Everything is managed by the Container. The Container is responsible for making connections to the database and hence the name. • Bean Managed JDBC(BMJDBC): Here as a developer of the Entity Bean we are responsible for saving the state of the bean into the database and the Container does not need to generate any database calls. Consequently this implementation is less adaptable then CMJDBC as the persistence needs to be hard coded into the bean. One advantage with BMJDB is that it gives a chance to the developer to deal with more than one database table.

  10. Where to Get More Information • References: • Enterprise Java Beans, By: Richard Monson Haefel • Tutorial on EJB, By: E. D. Roman

More Related