1 / 33

Enterprise JavaBeans (EJB) Overview

Enterprise JavaBeans (EJB) Overview. EJB Overview. What is EJB? EJB Roles EJB Architecture EJB Services Building an EJB Application EJB & CORBA Summary. EJB in the n-Tier System. You Are Here. Browser. Client Applet. Database. Client Application. Legacy Systems. EJB Server.

liza
Télécharger la présentation

Enterprise JavaBeans (EJB) Overview

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 JavaBeans (EJB) Overview

  2. EJB Overview • What is EJB? • EJB Roles • EJB Architecture • EJB Services • Building an EJB Application • EJB & CORBA • Summary

  3. EJB in the n-Tier System You Are Here Browser Client Applet Database Client Application Legacy Systems EJB Server Clients Application Data

  4. 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 serviceinterfaces including naming, transactions and security. • interoperability with database servers and CORBA applications.

  5. 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. EJB Roles Bean Provider - 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. Application Assembler Application Development and Deployment Deployer Platform Provider System Admins

  7. EJB Architecture The container is the platform. The component is your application. Picture provided by Sun Microsystems, Inc.

  8. EJB Platform Provide naming service using JNDI Provide OMG/OTS compliant transaction service Container EJB Server Manage EJ Bean life cycle Make EJ Bean Interfaces Available with JNDI Provide basic security services Persistence Management (DBMS and other) Manage transaction context

  9. 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 EJB Platform Vendors

  10. Enterprise JavaBeans™ Component EJB Application Application consists of multiple beans Beans are “portable” across containers Beans can be purchased or constructed

  11. 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. Mixing Beans • EJB applications use a combination of entity beans and session beans to implement business logic. PrefixBean Database Client EchoServiceBean SuffixBean Session Bean Entity Bean Application Server Application Server

  13. EJB Client Interfaces Factory Interface Finder Interface EJBHome EJBObject Remote Interface Contains bean services seen by clients

  14. EJB Architecture 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. Picture provided by Sun Microsystems, Inc.

  15. Deployment descriptor Deployment Platform Specific Implementation of Bean • 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. Bean Deploy +

  16. EJB Overview • What is EJB? • EJB Roles • EJB Architecture • EJB Services • Building an EJB Application • EJB & CORBA • Summary

  17. 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. 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. Deployment Descriptor database table database pool (location) Deploy • Generated Bean Code • SQL code • persistence logic

  19. 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. 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. MyClient Context ct= getInitialContext(…) ct.lookup(“EchoService”) Runtime

  21. Transactions • Benefits • Developers defer transaction logic to EJB server and container. • Distributed transactions (future). Picture provided by Sun Microsystems, Inc.

  22. 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. Building an EJB Application How do we build an EJB application? Client Database Application Server

  24. Step 1: Create Interfaces EJB Server Specifies the life cycle interfaces public interface AccountHome extends EJBHome{ public create(…) public findByPrimaryKey(..) Home I/F Client Database Specifies the interface provided to bean clients public interface Account extends EJBHome{ public getName(…) public setName(…) Remote I/F EJB specification This is generated You write this

  25. Step 2: Create Implementation EJB Server Home I/F Client Database Account implements EntityBean Implements bean interfaces public class AccountBean implements EntityBean { public void ejbActivate(...) {………} public void ejbPassivate(…) {……….} public getName(…) {……..} public setName(…) {…….. } Remote I/F EJB specification This is generated You write this

  26. Deployment descriptor Step 3: Deployment Descriptor EJB Server Home I/F Client Database Account implements EntityBean “Tells” the container how to deploy the bean (how to do DBMS access, transactions, security, naming, etc.) Remote I/F EJB specification This is generated You write this

  27. Deployment descriptor Step 4: Deploy EJB Server Home obj implements Home I/F Client Database Account implements EntityBean delegates Remote obj implements Remote I/F EJB specification This is generated You write this

  28. Entity Bean Inheritance - 1 Java.rmi.Remote Java.io.Serializable JDK EJBMetaData EnterpriseBean EJBObject EJB Spec EJBHome EntityBean Bean Provider (Wombat) Container Provider (Acme) Produced by Acme tools Extends or implements interface Extends implementation, code generation or delegation

  29. Entity Bean Inheritance - 2 Java.rmi.Remote Java.io.Serializable JDK EJBMetaData EnterpriseBean EJBObject EJB Spec EJBHome EntityBean Bean Provider (Wombat) AccountHome Account AccountBean Container Provider (Acme) Produced by Acme tools Extends or implements interface Extends implementation, code generation or delegation

  30. Entity Bean Inheritance - 3 Java.rmi.Remote Java.io.Serializable JDK EJBMetaData EnterpriseBean EJBObject EJB Spec EJBHome EntityBean Bean Provider (Wombat) AccountHome Account AccountBean AcmeRemote Container Provider (Acme) AcmeMetaData AcmeHome AcmeBean AcmeAccountHome AcmeRemoteAccount Produced by Acme tools AcmeAccountMetaData AcmeAccountBean Extends or implements interface Extends implementation, code generation or delegation

  31. 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. 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. References • [1] Enterprise JavaBeansTM Specification • Version 1.1 • http://java.sun.com/products/ejb/docs.html • [2] Enterprise JavaBeansTM Specification • Version 1.0 • http://java.sun.com/products/ejb/docs10.html • [3] Enterprise JavaBeansTM Tools • http://java.sun.com/javaone/javaone98/sessions/T402/index.htm

More Related