Download presentation
Presentation is loading. Please wait.
Published byMaude Hoover Modified over 9 years ago
1
SEI/CBS Initiative Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213-3890 Sponsored by the U.S. Department of Defense © 1999 by Carnegie Mellon University Enterprise Java Beans - page 1 Enterprise JavaBeans (EJB) Overview
2
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 2 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Overview What is EJB? EJB Roles EJB Architecture EJB Services Building an EJB Application EJB & CORBA Summary
3
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 3 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB in the n-Tier System LegacySystems ClientApplication EJB Server ClientsApplicationData You Are Here Database ClientApplet Browser
4
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 4 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. What is EJB? Specification for component based distributed computing framework using Java technology. Enterprise JavaBeans Specification describes roles and responsibilities for component-based software development of server-side applications. an architecture including EJB Servers, Containers, and Beans. a set of service interfaces including naming, transactions and security. interoperability with database servers and CORBA applications.
5
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 5 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Specification Evolving Technology Release 1.0 - March 98, Final Release 1.1 - May 99, Public Draft Goals Component-Based software development. Separate business logic from system code. Address application life cycle. Compatible with CORBA (non Java apps). Specification owned by Sun and supported by 40+ companies.
6
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 6 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Roles Bean Provider Application Assembler Deployer System Admins Platform Provider Application Development and Deployment - Producer of enterprise beans. - Combines enterprise beans into larger deployable parts. - Deploys enterprise beans into a specific operational environment. - Container provider and server provider. - Configuration and administration of infrastructure.
7
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 7 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Architecture Picture provided by Sun Microsystems, Inc. The container is the platform. The component is your application.
8
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 8 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Platform Container Manage EJ Bean life cycle Make EJ Bean Interfaces Available with JNDI Provide basic security services Persistence Management (DBMS and other) Manage transaction context Provide naming service using JNDI Provide OMG/OTS compliant transaction service EJB Server
9
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 9 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Platform Vendors Select EJB complaint platform for purchase (1.0 or 1.1). EJB Platform vendors supplement standard EJB with proprietary features. Current Vendors include: BEA Systems - WebLogic Bluestone - Sapphire/Web IBM - WebSphere Inprise - Application Server Netscape - Application Server (future) Oracle - Oracle8i Persistence - PowerTier Sun - NetDynamics
10
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 10 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Application Enterprise JavaBeans™ Component Application consists of multiple beans Beans are “portable” across containers Beans can be purchased or constructed
11
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 11 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Types of Enterprise Java Beans Session Bean Used for client interface Not shared between clients Two kinds of Session Bean: -stateless - common object identity -stateful - unique object identity Entity Bean Maps to data in database or application Shared between clients Persistent state -container managed - access defined at deployment -bean managed - access defined as part of bean Support optional in 1.0 and mandatory in 1.1
12
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 12 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Entity Bean Session Bean Mixing Beans EJB applications use a combination of entity beans and session beans to implement business logic. Application Server Database Client PrefixBean SuffixBean EchoServiceBean
13
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 13 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Client Interfaces EJB Home EJB Object Factory Interface Finder Interface Remote Interface Contains bean services seen by clients
14
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 14 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Architecture Picture provided by Sun Microsystems, Inc. The purchased EJB server is the platform. The application consists of session and entity beans. Application interfaces are made available to clients at time of deployment.
15
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 15 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Deployment Deployment provides a mechanism for adapting a component for a specific runtime environment. Deployment is an intermediate step between coding a bean and executing a bean. This allows some attributes of the bean implementation to be determined by the platform provider, and the deployer. Key EJ bean design decision is determining which bean attributes are coded into the bean and which are decided at deployment time. Deployment descriptor + Deploy Bean Platform Specific Implementation of Bean
16
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 16 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Overview What is EJB? EJB Roles EJB Architecture EJB Services Building an EJB Application EJB & CORBA Summary
17
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 17 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB Services Standard EJB service interfaces allow application developers to : focus on business logic rather than infrastructure defer responsibility for common services to the EJB platform create “portable” applications that can be reused support a component marketplace Standard EJB service interfaces include: Persistence - JDBC Naming - JNDI Transactions - UserTransaction interface of JTA Security - java.security in JDK
18
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 18 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Container-Managed Persistence Benefits Developer can defer persistence to container. Bean need not contain database specific code because decision is made at deployment time. Choice of bean managed persistence if needed. Generated Bean Code SQL code persistence logic Deployment Descriptor database table database pool (location) Deploy
19
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 19 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Name Service - Deployment Benefits EJB server has built-in name server. Bean need not contain name specific code because decision is made at deployment time. Some EJB servers support enterprise bean replication. Deploy Deployment Descriptor bean home name
20
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 20 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Name Service - Lookup Benefits JNDI allows developer to use one interface for locating CORBA, LDAP, NDS, and file objects. Allows management of enterprise wide services using naming hierarchy. Runtime MyClient Context ct= getInitialContext(…) ct.lookup(“EchoService”)
21
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 21 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Transactions Picture provided by Sun Microsystems, Inc. Benefits Developers defer transaction logic to EJB server and container. Distributed transactions (future).
22
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 22 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Security EJB Benefits Developer can specify permissions for each bean service at deployment time. Builds on security of JDK. Detailed discussion by Robert Seacord. Deploy Deployment Descriptor security roles... Generated Bean Code security logic
23
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 23 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Building an EJB Application Database Client Application Server How do we build an EJB application?
24
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 24 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Step 1: Create Interfaces Database Client EJB Server Home I/F Remote I/F EJB specification This is generated You write this Specifies the interface provided to bean clients public interface Account extends EJBHome{ public getName(…) public setName(…) Specifies the life cycle interfaces public interface AccountHome extends EJBHome{ public create(…) public findByPrimaryKey(..)
25
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 25 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Step 2: Create Implementation Database Client EJB Server Home I/F Remote I/F Account EntityBean implements EJB specification This is generated You write this Implements bean interfaces public class AccountBean implements EntityBean { public void ejbActivate(...) {………} public void ejbPassivate(…) {……….} public getName(…) {……..} public setName(…) {…….. }
26
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 26 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Step 3: Deployment Descriptor Database Client EJB Server Home I/F Remote I/F Account EntityBean Deployment descriptor implements EJB specification This is generated You write this “Tells” the container how to deploy the bean (how to do DBMS access, transactions, security, naming, etc.)
27
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 27 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Step 4: Deploy Database Client EJB Server Home obj Remote obj Home I/F Remote I/F Account EntityBean Deployment descriptor implements delegates EJB specification This is generated You write this
28
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 28 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Entity Bean Inheritance - 1 Java.rmi.RemoteJava.io.Serializable JDK EJB Spec Bean Provider (Wombat) Produced by Acme tools Container Provider (Acme) EJBMetaData EJBObject EJBHome EnterpriseBean EntityBean Extends or implements interface Extends implementation, code generation or delegation
29
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 29 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Entity Bean Inheritance - 2 Java.rmi.RemoteJava.io.Serializable JDK EJB Spec Bean Provider (Wombat) Produced by Acme tools Container Provider (Acme) EJBMetaData AccountHome EJBObject AccountBean EJBHome EnterpriseBean Account EntityBean Extends or implements interface Extends implementation, code generation or delegation
30
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 30 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Entity Bean Inheritance - 3 Java.rmi.RemoteJava.io.Serializable JDK EJB Spec Bean Provider (Wombat) Produced by Acme tools Container Provider (Acme) EJBMetaData AccountHome AcmeHome AcmeAccountHome EJBObject AccountBean AcmeRemote AcmeRemoteAccount EJBHome EnterpriseBean Account AcmeMetaData AcmeBean AcmeAccountMetaDataAcmeAccountBean EntityBean Extends or implements interface Extends implementation, code generation or delegation
31
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 31 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. EJB & CORBA EJB and CORBA are complimentary standards. EJB uses CORBA for: Enabling non-Java clients to access EJB applications. Interoperability for EJB environments that include systems from multiple vendors. EJB-to-CORBA mapping (separate specification) Mapping of EJB interfaces to RMI-IIOP. Propagating transaction context. Propagating security context. Interoperable naming service.
32
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 32 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. Summary The EJB architecture simplifies application development by: providing pre-integrated solution framework separating the business logic from distributed system services providing standard service interfaces, including naming, transactions, and security managing life cycle functions
33
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 33 Delete this red box (from the slide master) after creating all of your slides. Keep everything inside the “safe area” for correct display. References [1] Enterprise JavaBeans TM Specification Version 1.1 http://java.sun.com/products/ejb/docs.html [2] Enterprise JavaBeans TM Specification Version 1.0 http://java.sun.com/products/ejb/docs10.html [3] Enterprise JavaBeans TM Tools http://java.sun.com/javaone/javaone98/sessions/T402/index.htm
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.