Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold

Similar presentations


Presentation on theme: "Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold"— Presentation transcript:

1 Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold barryh@cs.albany.edu

2 EJB Overview Server side softwareServer side software What is EJBWhat is EJB EJB Application ServersEJB Application Servers Types of Enterprise JavaBeansTypes of Enterprise JavaBeans How to build an enterprise beanHow to build an enterprise bean A simple client interaction scenarioA simple client interaction scenario

3 Server-side Software Examples Retail chain stores - Each store sends inventory and shopping information to servers at retail headquarters.Retail chain stores - Each store sends inventory and shopping information to servers at retail headquarters. Banks - ATM machines connect to a central server.Banks - ATM machines connect to a central server. Web sites - Thousands of users connect to web servers that connect to a central server for data and business logic.Web sites - Thousands of users connect to web servers that connect to a central server for data and business logic.

4 Enterprise JavaBeans EJB is a specification that defines how server-side components are written and how application servers manage them.EJB is a specification that defines how server-side components are written and how application servers manage them. These deployable components are called enterprise beans.These deployable components are called enterprise beans. The enterprise beans are deployed into a container that provides run time services.The enterprise beans are deployed into a container that provides run time services.

5 EJB Architecture Roles Bean ProviderApplication Assembler Deployer System Administrator Container/Server Provider Construct Enterprise Beans Build ApplicationDeploy System Supply EJB Container/Server

6 EJB Container / Application Server EJB Server Enterprise Bean 1 Enterprise Bean 2 Enterprise Bean 3 EJB Container 1EJB Container 2 Client Code: applets, servlets, applications

7 Server and Container Services Remote accessRemote access Support for multiple clientsSupport for multiple clients Resource managementResource management Component lifecycleComponent lifecycle Persistence of objectsPersistence of objects Location transparency Security - authentication and authorization Transaction management

8 EJB Container/Server Providers BEA Systems, Inc. Oracle Borland / Inprise IBM Sybase Bluestone Software

9 Enterprise Beans Session Beans Model business processesModel business processes Usually exists for duration of a single client server sessionUsually exists for duration of a single client server session Examples: price quoting, credit card validationExamples: price quoting, credit card validation Entity Beans Model business data Data resides in underlying storage such as a database Examples: employees, customers, bank accounts

10 Session Beans Stateless Session Beans Do not retain changes in state.Do not retain changes in state. Do not maintain identity of client across method calls.Do not maintain identity of client across method calls. I.e. a credit card verification bean.I.e. a credit card verification bean. Stateful Session Beans Maintain client identity across method calls. Retain state changes on behalf of the client. I.e. a shopping cart bean.

11 Entity Beans Bean-managed entity beans Component developer must write code to load, store and retrieve the entity bean.Component developer must write code to load, store and retrieve the entity bean. Container-managed entity beans The container is responsible for all access to the underlying storage. Component writer simply describes the fields that should be persisted.

12 Building A Bean Bean provider must provide the following: Enterprise bean class filesEnterprise bean class files A remote interfaceA remote interface A home interfaceA home interface Deployment descriptorsDeployment descriptors Properties file - optionalProperties file - optional

13 The Remote Interface and the EJB Object EJB Container/Server Enterprise Bean EJB Object Remote Interface Client Code 1. Call a method 2. Delegate client request to bean 3. Method returns 4. Route return value back to the client public interface javax.ejb.EJBObject extends java.rmi.remote {... }

14 The Home Interface and Object EJB Container/Server EJB Object Client Code Enterprise Beans Home Object (Object Factory) Home Interface 1. Request an EJB object reference 2. Create EJB object 3. Return EJB object reference public interface javax.ejb.EJBHome extends java.rmi.remote {... }

15 Typical Interaction Scenario Client Code EJB Container/Server EJB Object Enterprise Beans Home Object (Object Factory) Naming Service JNDI 1. Retrieve Home Object reference 2.Return Home Object Reference 3. Request a new EJB object 4. Create EJB object 5. Return EJB object reference 6. Invoke Business Method 7. Delegate Request to bean 8. Return result 10. Return result to client

16 Summary The Enterprise JavaBeans specification defines a standard architecture for implementing the business logic of multi-tier applications as reusable components. EJB servers are designed to provide run time and middleware services for containers and the components they contain. EJB containers are designed to handle details of component life cycle, transactions, and security management. They achieve this by intercepting method calls between the client and the components. This mechanism simplifies development of both components and client side software. Component developers are freed from writing to complex and proprietary middleware APIs. The Enterprise JavaBeans specification is based on the Java programming language, so enterprise beans take full advantage of the write once, run anywhere Java philosophy.

17 References Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition. EJB web site. Sun Microsystems, Inc. 2000.Designing Enterprise Applications with the Java 2 Platform, Enterprise Edition. EJB web site. Sun Microsystems, Inc. 2000. Enterprise JavaBeans web site. http://java.sun.com/products/ejbEnterprise JavaBeans web site. http://java.sun.com/products/ejb Matena, Vlada., Harper, Mark. Enterprise JavaBeans Specification, v1.1. EJB web site. Sun Microsystems, Inc. 1999.Matena, Vlada., Harper, Mark. Enterprise JavaBeans Specification, v1.1. EJB web site. Sun Microsystems, Inc. 1999. Roman, Ed. Mastering Enterprise JavaBeans and the Java 2 Platform Enterprise Edition. John Wiley and Sons Inc. 1999.Roman, Ed. Mastering Enterprise JavaBeans and the Java 2 Platform Enterprise Edition. John Wiley and Sons Inc. 1999. Thomas, Anne. Enterprise JavaBeans Technology Server Component Model for the Java Platform. EJB web site. Patricia Seybold Group. 1998.Thomas, Anne. Enterprise JavaBeans Technology Server Component Model for the Java Platform. EJB web site. Patricia Seybold Group. 1998.


Download ppt "Introduction to Enterprise JavaBeans Topics In Systems Architecture Barry Herbold"

Similar presentations


Ads by Google