Download presentation
Presentation is loading. Please wait.
Published byClyde Boone 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™ A COTS Architecture for Modern Enterprise Systems Kurt Wallnau Robert Seacord John Robert Santiago Comella
2
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 2 Outline of Today’s Tutorial Why Enterprise JavaBeans™ (EJB)? An Overview of EJB Security and Transactions Portability and Legacy Systems Summary and the Future of EJB
3
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 3 Why Enterprise JavaBeans™ ?
4
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 4 Why Enterprise JavaBeans™? The Nature and Challenges of Enterprise Systems Best of Breed vs. Off-the-Shelf Infrastructures Closed vs. Open Infrastructures Enterprise JavaBeans™ (EJB) Benefits Technical/Market/Business Triangulation
5
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 5 What are Enterprise Systems? Enterprise systems (ES) automate business processes, i.e., how work gets done Enterprise systems are 1 large heterogeneous distributed evolving dynamic long lived mission critical systems of systems 1. John Salasin, “DAMES: Dynamic Assembly of Military Enterprise Systems,” briefing materials
6
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 6 Challenges of Enterprise Systems ES PropertyES Challenge
7
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 7 ES’s Are Big Business Estimates of ES 1 market in federal systems alone is currently $3.7 billion, up from 1998 estimate of $2.8 billion BAAN, SAP, PeopleSoft and other enterprise resource planning (ERP) systems are meeting this demand Software component technologies are another market response -Estimates of this market range from $7 billion by 2002 2 to $12 billion by 2001 3 1. http://www.planetit.com/techcenters/docs/enterprise_apps/news/PIT19990707S0003 2. Gartner Group 3. IDC http://www.selectst.com/downloads/IDC/IDC.asp
8
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 8 Structure of an Enterprise System Infrastructure Platform (HW/OS) Business Objects (Shared Data) Business Logic Clients There are various ways of viewing enterprise systems 2-tiered, 3-tiered, N-tiered by infrastructure technology This N-tiered view will serve our purposes for today
9
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 9 Structure of an Enterprise System Infrastructure Platform (HW/OS) Business Objects (Shared Data) Business Logic Clients business rules application services relational data object-to-relation mapping distribution, events, naming, transactions, security, etc. Our focus is here...
10
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 10 ES Infrastructures are Complex Networking Connection mgmt Security Transactions Thread Pool Synchronization Persistence Infrastructure (e.g., Middleware) Business Objects (Shared Data) Business Logic Naming System mgmt The technical infrastructure needed for mission-critical applications is non-trivial Load Balancing Failover
11
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 11 “Best of Breed” Infrastructure is Problematic: The GEE Experience Networking Connection mgmt Security Transactions Thread Pool Synchronization Persistence Naming System mgmt Netscape Browser & ES Microsoft Explorer & IIS Java Web Server Visibroker/Java OrbixWeb JDK/RMI Netscape DS Microsoft IIS Java Key JSAFE CRYPTIX SSLEAY JCE Visibroker/C++ ITS Microsoft Access Oracle 7.x and 8.x ODBC/JDBC Orbix Names Visi Names Netscape DS Microsoft IIS Load Balancing Failover
12
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 12 The GEE: Some Lessons We built an enterprise infrastructure from COTS “parts” choice-points for product specific options product selections limited by “ensemble effect” latest versions of products often are often un- integratable with previous ensemble significant ongoing cost for product tracking and evaluation of new releases complex rules for build and deploy product/technology insulation is very very hard tremendous vertical and spanning product and technology competency needed product and technology competency is a wasting asset
13
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 13 Infrastructure Platform (HW/OS) Clients 1.1 1.2 1.3 COTS ERP: Proprietary, Vertically-Integrated ES Proprietary Scripting and Modeling Tools Pre-Integrated Infrastructure using vendor selected products and policies Pre-specified business processes, process templates and data items
14
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 14 EJB: Specification for “Open” but Proprietary ES Frameworks Infrastructure Platform (HW/OS) Clients EntityBeans for Persistent Data SessionBeans for Service Connections Specification of security, persistence, life cycle, naming, transactions via server and container contracts COTS Bean Families
15
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 15 COTS ERP vs. EJB: pros and cons COTS ERP Package Enterprise JavaBeans™
16
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 16 Rationale for EJB? ES PropertyES ChallengeEJB Benefit
17
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 17 To Bean or Not To Bean? (1) Ultimately this will require consideration of technical, market and business pros and cons Technical + The J in EJB addresses heterogeneity + Specification ties together a variety of ES infrastructure services in a “standard” way - The J in EJB may suffers from performance problems and JVM bugs - Not all services are sufficiently well defined to enable cross-container bean portability
18
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 18 To Bean or Not to Bean? (2) Market factors refer to the performance and viability of EJB in the technology marketplace: + EJB may unify a fragmented “app server” market, and jumpstart a market in servers and containers + EJB leverages tremendous interest in Java, and many EJB servers are now available - EJB is not “open”--Sun controls the spec, and its future evolution is unpredictable - Technology battle with Microsoft and fast Java evolution guarantee continued EJB instability
19
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 19 To Bean or Not To Bean? (3) Business factors will be particular to each organization. These are representative pros/cons + Organization is engaged in a general switchover to Java technology, so why wait? + Market in server/container providers provide competitive alternatives and fallbacks - Technology instability and immaturity will cause delays, rework, risking added cost and delayed time to market - EJB vendors will continue to provide proprietary and non-standard features
20
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 20 The Remainder of the Tutorial John Robert describes EJB in detail Robert Seacord takes a more in-depth look at several aspects of EJB and discusses strengths and weaknesses found Santiago Comella-Dorda discusses issues of Enterprise JavaBean portability and integration with legacy systems Robert Seacord closes with a brief summary and some thoughts on the future of EJB
21
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 21 Enterprise JavaBeans™ Overview
22
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 22 EJB Overview What is EJB? EJB Roles EJB Architecture EJB Services Building an EJB Application EJB & CORBA Summary
23
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 23 EJB in the n-Tier System LegacySystems ClientApplication EJB Server ClientsApplicationData You Are Here Database ClientApplet Browser
24
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 24 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 services including naming, transactions and security. interoperability with database servers and CORBA applications.
25
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 25 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.
26
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 26 EJB Roles Bean Provider Application Assembler Deployer System Admin. 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.
27
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 27 EJB Architecture Picture provided by Sun Microsystems, Inc. The container is the platform. The component is your application.
28
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 28 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
29
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 29 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 Oracle - Oracle8i Persistence - PowerTier Sun/Netscape alliance - reference implementation
30
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 30 EJB Application Enterprise JavaBeans™ Component Application consists of multiple beans Beans are “portable” across containers Beans can be purchased or constructed
31
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 31 Types of Enterprise JavaBeans 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
32
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 32 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
33
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 33 EJB Client Interfaces EJB Home EJB Object Factory Interface Finder Interface Remote Interface Contains bean services seen by clients
34
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 34 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.
35
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 35 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. By using a deployment descriptor, some attributes of the bean implementation are specified by the deployer, and implemented by the platform provider. Two kinds of information in a deployment descriptor Enterprise beans’ structural information - can’t change Application assembly information - can change Deployment descriptor + Deploy Bean Platform Specific Implementation of Bean
36
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 36 EJB Overview What is EJB? EJB Roles EJB Architecture EJB Services Building an EJB Application EJB & CORBA Summary
37
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 37 EJB Services Standard EJB services 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 services include Persistence Naming Transactions Security
38
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 38 Persistence EJB Definition “The data access protocol for transferring the state of the entity between the enterprise bean instance and the underlying database is referred to as object persistence.” Two types of persistence bean-managed - persistence logic implemented directly inside the enterprise bean class. container-managed - persistence logic delegated to container. The underlying data source may be an existing application rather than a database.
39
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 39 Bean-Managed Persistence Enterprise bean provider writes database access calls (using JDBC or SQLJ) directly in the entity bean. Entity bean is tied to the data source in which the entity is stored. More portable across EJB platforms than container- managed entity bean. Bean SQL code persistence logic Deployment Descriptor persistence-type Deploy EntityBean SQL code persistence logic +
40
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 40 Container-Managed Persistence Data access components (like JSBC and SQLJ calls) are generated at deployment time by container tool. Entity bean is independent from the data source in which the entity is stored. Less development effort for bean provider. Bean generated SQL code generated persistence logic Deployment Descriptor persistence-type cmp-fields Deploy EntityBean +
41
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 41 Name Service - Deployment Benefits EJB server has built-in name server. Service name of bean is assigned at deployment time, not compile time. Some EJB servers support enterprise bean replication. Deploy Deployment Descriptor bean home name
42
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 42 Name Service - Lookup Benefits JNDI allows clients 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”)
43
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 43 Transactions Picture provided by Sun Microsystems, Inc. Benefits EJB applications can defer transaction logic to EJB server and container. Distributed transactions.
44
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 44 Security Benefits Permissions specified 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
45
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 45 Building an EJB Application Database Client Application Server How do we build an EJB application?
46
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 46 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 EJBObject{ public getName(…) public setName(…) Specifies the life cycle interfaces public interface AccountHome extends EJBHome{ public create(…) public findByPrimaryKey(..)
47
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 47 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(…) {…….. }
48
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 48 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.)
49
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 49 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
50
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 50 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
51
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 51 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
52
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 52 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
53
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 53 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.
54
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 54 Summary The EJB architecture simplifies distributed application development by providing pre-integrated solution framework separating the business logic from distributed system services providing standard services, including naming, transactions, and security managing life cycle functions
55
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 55 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
56
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 56 For More Information... Telephone412 / 268-5800 Fax412 / 268-5758 Emailrcs@sei.cmu.edu kcw@sei.cmu.edu jer@sei.cmu.edu scd@sei.cmu.edu World Wide Webhttp://www.sei.cmu.edu U.S. mailCustomer Relations Software Engineering Institute Carnegie Mellon Pittsburgh, PA 15213-3890
57
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 57 EJB Security Management
58
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 58 Security Management Overview The enterprise bean class provider should not hard-code security policies and mechanisms into the business methods allows appropriate deployment for the operational environment of the enterprise The application assembler may define security roles for an application -semantic grouping of permissions method permissions for each security role -permission to invoke a specified group of methods
59
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 59 Security Management Overview - 2 Security Roles Method Permissions EJBEJB Bean Provider Application Assembler Deployer Users Groups System Admins
60
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 60 Bean Provider’s Responsibilities The bean provider should not implement security mechanisms or security policies in the enterprise beans’ business methods rely instead on the security mechanisms provided by the EJB Container It is possible, however, to programmatically access a Caller’s Security Context...
61
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 61 Programmatically Accessing a Caller’s Security Context Two methods allow the bean provider to access security information about the enterprise bean’s caller getCallerPrincipal isCallerInRole In general, security management should be enforced by the container the security API should is used infrequently
62
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 62 Declaring Security Roles Security roles are declared in the deployment descriptor... WombatPayroll com.wombat.PayrollBean This security role should be assigned to the employees allowed to update employees’ salaries. payroll …
63
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 63 Application Assembler’s Responsibilities Define security roles in the deployment descriptor employee allow employees to access their own data Specify the methods of the remote and home interface that each security role is allowed to invoke employee WombatPayroll getEmployeeInfo Link declared security role references to security roles payroll-department (add to bean description)
64
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 64 Deployer’s Responsibilities Ensures that an application is secure after it has been deployed in the operational environment Assigns principals and/or groups of principals used for managing security in the operational environment to defined security roles not specified in the EJB architecture! specific to that operational environment Can use the security view defined in the deployment descriptor merely as “hints”
65
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 65 EJB Container Provider’s Responsibilities The EJB container provider provides the implementation of the security infrastructure A security domain can be implemented, managed, and administered by the EJB Server e.g., the EJB Server may store X509 certificates The EJB specification does not define the scope of the security domain the scope may be defined by the boundaries of the application, EJB Server, operating system, network, or enterprise
66
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 66 System Administrator’s Responsibilities Typically responsible for creating a new user account adding a user to a user group removing a user from a user group removing or freezing a user account Security domain administration is beyond the scope of the EJB specification...
67
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 67 Proceed with Caution… Insecure Secure EJB Specification EIS EJB Server Vendor Threats
68
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 68 Summary The EJB architecture does not specify how an enterprise should implement its security architecture assignment of security roles to the operational environment’s security concepts is specific to the operational environment identification and authentication left to EJB Server vendor’s Security will be vendor specific for some time no plans to address problem in EJB 2.0
69
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 69 References [1] Java Authentication and Authorization Service (JAAS) http://java.sun.com/security/jaas/. [2]Java Cryptography Extension (JCE) http://java.sun.com/security/JCE1.2/spec/apidoc/index.html
70
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 70 EJB Transactions
71
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 71 Distributed Transactions EJB allows application developers to write applications that atomically update data in multiple databases may be distributed across multiple sites sites may use EJB Servers from different vendors The enterprise Bean Provider and the client application programmer are not exposed to the complexity of distributed transactions.
72
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 72 ACID Properties Atomicity. In a transaction involving two or more discrete pieces of information, either all of the pieces are committed or none are. Consistency. A transaction either creates a new and valid state of data, or, if any failure occurs, returns all data to its state before the transaction was started. Isolation. A transaction in process and not yet committed must remain isolated from any other transaction. Durability. Committed data is saved by the system such that, even in the event of a failure and system restart, the data is available in its correct state.
73
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 73 Programmatic vs. Declarative Transaction Demarcation Bean-managed transaction demarcation enterprise bean code demarcates transactions using javax.transaction.UserTransaction accesses between UserTransaction.begin and UserTransaction.commit calls are part of a transaction Container-managed transaction demarcation container demarcates transactions per instructions provided by the Application Assembler in the deployment descriptor
74
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 74 Container-Managed Transaction Demarcation NotSupported - container invokes enterprise Bean method with an unspecified transaction context Required - container invokes enterprise Bean method with a valid transaction context Supports If the client calls with a transaction context, same as Required If the client calls without a transaction context, same as NotSupported
75
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 75 Container-Managed Transaction Demarcation - 2 RequiresNew - container invokes enterprise Bean method with a new transaction context Mandatory - container invokes enterprise Bean method with the client’s transaction context Never - container invokes an enterprise Bean method without a transaction context client is required to call without a transaction context
76
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 76 Isolation Levels Describes the degree to which access to a resource manager by a transaction is isolated from other concurrently executing transactions Part of the EJB 1.0 specification -- has been eliminated in EJB 1.1! API for managing an isolation level is resource- manager specific bean provider may specify the same or different isolation levels for each resource manager
77
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 77 Updates to Multiple Databases DB A DB B DB C Client X Y Server Multiple databases Single transaction
78
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 78 Updates to Multiple Databases in Same Transaction DB A DB B X EJB Server Y client
79
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 79 Updates to Multiples Databases on Multiple Servers DB TP begin commit X Y EJB Server client
80
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 80 Two-Phase Commit (2PC) JDBC 1.2 does not support XA two phase commit impossible for an EJB server using JDBC 1.2 to directly support for distributed transactions Distributed transactions requires the existence of database drivers that support XA 2PC in most cases, developers are relying on the vendor to provide database drivers
81
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 81 Relationship to JTA and JTS Java Transaction API (JTA) Java Transaction Service (JTS)
82
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 82 Java Transaction API (JTA)
83
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 83 Java Transaction API (JTA) JTA specifies the interfaces between a transaction manager and the other parties involved in a distributed transaction processing system application programs resource managers application server
84
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 84 Java Transaction Service (JTS) Java binding of the CORBA Object Transaction Service (OTS) 1.1 specification Provides transaction interoperability using the standard IIOP protocol for transaction propagation between servers Intended for vendors who implement transaction processing infrastructure for enterprise middleware may be used by an EJB Server vendor as the underlying transaction manager
85
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 85 EJB Relationship to JTA and JTS Does not require the EJB Container to support the JTS interfaces Requires that the EJB Container support the javax.transaction.UserTransaction interface defined in JTA Does not require support for JTA resource manager (XAResource) application server interfaces
86
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 86 Summary Transaction-based systems can be implemented simply using EJB Transactions are not simple -- transaction behavior is affected by choice of session bean or entity bean stateful or stateless session bean bean-managed vs. container-managed transaction demarcation transaction attributes lots more stuff!
87
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 87 References [ 1 ] Java Transaction API (JTA). http://java.sun.com/products/jta. [ 2 ] Java Transaction Service (JTS). http://java.sun.com/products/jts. [ 3 ] OMG Object Transaction Service. http://www.omg.org/corba/sectrans.htm#trans.
88
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 88 For More Information... Telephone412 / 268-5800 Fax412 / 268-5758 Emailrcs@sei.cmu.edu World Wide Webhttp://www.sei.cmu.edu U.S. mailCustomer Relations Software Engineering Institute Carnegie Mellon Pittsburgh, PA 15213-3890
89
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 89 Integration of Legacy Software in EJB
90
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 90 Agenda Types of legacy systems Integrating legacy business logic Integrating legacy data
91
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 91 Types of “Legacy” Infrastructures Data Mainframes Non-relational databases File systems... Systems: Data + Logic (Niklaus Wirth) TP monitors, COBOL systems ERP systems CORBA and COM servers
92
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 92 Integrating Legacy Business Logic Keep and leverage investment Access old system through a new interface (Internet…). Substitute the old code in an incremental way -eliminating big-bang approach
93
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 93 Traditional Approaches Legacy System Function 1 Function 2 Internet server Screen HTML Screen Scrapping Terminal emulation… CGI extension Native comm. CGI Script New, pretty and Internet aware System Big- Bang Conversion IT manager commits suicide.
94
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 94 Traditional Approaches : Advantages & Problems Screen scrapping and terminal emulation fast and “cheap” plenty of support tools the new system is as inflexible and hard to maintain as the old one it is just a “make up” Big bang conversion definitive solution plenty of liberated IT resources are needed the EIS must not be vital, a period of adaptation to the new system must be admissible
95
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 95 Application Server Approaches Legacy System Function 1 Function 2 EJB Server Internet server Service Broker Screen HTML Native comm. Adapter Native comm. Function 2 bean CGI or Servlets Applet Wrapped functionality Function 1 bean Message Service.
96
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 96 Adapter Strategy: Details COBOL system no state between functions Function 1 Function 2 Green screen terminal Text only EJB server Adapter Stateless Session Communication: error control, connection pooling,timing... NOT_SUPPORTED Func. 1 Stateless Session Func. 2 Stateless Session Workflow 1 Stateful Session Wrapper of Function 1 If The COBOL system enables rolling a function then NEW_REQUIRED Text only Workflow model. If it involves more than one function then NOT_SUPPORTED
97
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 97 Application Server Approaches : Advantages & Problems Sometimes it is very difficult to divide the old monolithic system into discrete functions. Legacy interfaces can be very hard to use. Text based communication, for example, is error prone. Step by step approach. Very good “effort / added-value” relation. Straightforward approach with well defined steps.
98
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 98 Integrating Legacy Data: Why? Cannot migrate the data legacy systems may still use it. Don’t want to replicate data for coherence and maintenance. Data needs to be accessed from EJB applications preferably in a transparent way, I.e. through Entity beans.
99
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 99 XA Legacy Data II: Present Approach Mainframes, Relational DB, File systems, OO databases. JDBC Driver ODBC Driver Custom Resource Manager Native Access JDBC-ODBC Bridge Native Access Native Access EJB Server XA JDBC CUSTOM “Regular” Container “Specialized” Container Transaction Manager Entity Bean Entity Bean Native Access
100
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 100 Connector Legacy Data III: Future Approach Database Connector EJB Server Container Entity Bean Transaction Processor ERP Transactions Security Resource management Native Access Native Access Native Access Standard interfaces
101
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 101 Connectors Java SM Community Process Initiated expert group being formed Schedule for specification release not yet defined not expected until at least 2000 implementations will follow For more information contact: Rahul Sharma, Member of Technical Staff Sun Microsystems, Inc. Rahul.Sharma@sun.com
102
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 102 Connectors: Advantages Standard connection EIS resources and application servers. No more proprietary and non-portable solutions like specialized containers. Only covers the system level interfaces. Application level interfaces are still vendor specific.
103
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 103 Conclusions Application servers in general, and EJB in particular, are powerful and smart ways to integrate legacy systems in modern EIS. Every legacy integration effort includes risks. It is a difficult task that requires a great deal of expertise. Other options like big-bang migration or screen scraping are more expensive or do not fully solve the problem.
104
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 104 Portability in EJB
105
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 105 Implementation vs. Standard (MTS vs. EJB) Implementation Over-specification: every function, interface and behavior is defined Single vendor Standard Under-specification: different grades of imprecision -compatibility test suites and reference implementations can help portability Multi-vendor environment brings competence and innovation
106
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 106 Portability Is Not EJB’s Only Target Portability Compatibility With existing servers Product differentiation
107
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 107 EJB Development Process Component Market Enterprise Bean Provider E.Beans Generic E. Beans Specialized E. Beans Application template Market Application Assembler 1 2 3 EJB Deployer Deployed application Set of assembled E. Beans Deployed E. Beans EJB Platform Provider Server & container
108
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 108 When Portability is Important Component vendors that want a broad-based market for their components. Application assemblers that want a large market of pre-built components for reuse. Application server providers that want to expand the number of third-party components available for their platforms.
109
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 109 When Portability is Not Important Enterprises that make a strategic decision to use a particular EJB server to take advantage of proprietary features. Organizations that custom develop beans to meet non-negotiable requirements or to differentiate their application. Application server providers that want to offer non- standard extensions as a business strategy.
110
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 110 Basic Structure of an Enterprise Bean EJB Server EJB Container Enterprise Bean Home Remote interface Bean DD EB-Container Contract EB-Client Contract Server-Container Contract Client JNDI... Portability Related
111
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 111 The Enterprise Bean Contracts Source Code API definition Programming practices, rules and prohibitions Deployment descriptor XML based syntax Defined set of attributes Life cycle, transactional behavior….
112
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 112 Source Code Incompatibility Different flavors of JPE APIs JDK 1.1 vs. 1.2 RMI-CORBA mapping Additional and proprietary APIs XML Security Semantic differences Objects passed by value JNDI
113
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 113 Deployment Descriptor Incompatibility Syntactic differences have disappeared with EJB 1.1’s XML-based descriptor. There is a “standard core” set of deployment descriptor attributes. Different servers add additional attributes to control specific capabilities difficult to use only standard attributes Compatibility problems in deployment descriptors can affect the source code
114
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 114 Conclusions Are EJB applications portable? we could say that it is possible to make portable EJB applications, but it requires some workarounds and developer guidelines. Portability will increase with future releases of the standard the holes in the standard will be gradually filled EJB servers will more closely meet the standard test suites and reference implementation will be soon released.
115
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 115 Conclusions -2 Portability in EJB is an inversion. Making portable EJB applications is harder than using proprietary capabilities. Is it worth the effort in your case?
116
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 116 For More Information... Telephone412 / 268-5800 Fax412 / 268-5758 Emailrcs@sei.cmu.edu kcw@sei.cmu.edu jer@sei.cmu.edu scd@sei.cmu.edu World Wide Webhttp://www.sei.cmu.edu U.S. mailCustomer Relations Software Engineering Institute Carnegie Mellon Pittsburgh, PA 15213-3890
117
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 117 Additional Slides (I will only use them for specific questions)
118
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 118 Resource Managers They must provide: The XA interface to make them transactional aware A “custom” interface to access data -JDBC is one of these “custom” interfaces -Can be used by bean-managed persistence or container-managed if interface understood by container Pooling, concurrence and similar features implemented at this level
119
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 119 Resource Managers- 2 JDBC is a resource manager to access a special kind of legacy data: relational databases There are JDBC native drivers for plenty of databases: mainframes... If not native version available ==> an ODBC driver and a JDBC-ODBC bridge can be used. Developing JDBC drivers is complex but all EJB infrastructure can make transparent use of them. There are other resource managers to access other kinds of data e.g., OO, file system, SAP.
120
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 120 Specialized Containers If we want to use CM persistence, the container must “know” the resource manager Normal containers know JDBC sources, sometimes plain file systems. There could be other containers that know other resources: ODMG sources, SAP R/3…. -Versant Container to access the Versant ODBMS in WebLogic -WebSphere to CICS
121
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 121 Different approaches: Traditional solutions: -Screen scraping, CGI extensions, “magic converters”…. -They meet only some objectives. Application server solutions -Adapters -Service brokers Legacy Programs Middleware
122
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 122 EJB Roadmap
123
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 123 Java 2 Enterprise Edition Platform specification Reference implementation (RI) Application programming model (APM) Compatibility test suite (CTS)
124
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 124 J2EE Status and Schedule J2EE Platform Specification Public Draft June 15 Public Release July 1999 Final Release December 1999 J2EE RI & CTS Beta September 1999 FCS December 1999 J2EE APM document Public Draft August 1999 Sample App Beta August 1999
125
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 125 Enterprise JavaBeans 2.0 Specification Integration of Enterprise JavaBeans with the Java Message Service™ (JMS) Improved support for entity beans persistence support for relationships among EJBs Support for inheritance and subclassing of Enterprise JavaBeans Query syntax for entity bean finder methods support for additional methods in the Home Interface Mechanisms for container extensions EJB Server network interoperability protocol
126
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 126 Integration of EJB with JMS JMS is an API for accessing enterprise messaging systems from Java programs. JMS integration is needed to allow Enterprise JavaBeans to be invoked asynchronously from clients EJBs to interoperate with legacy systems that use JMS for integration use of disconnected clients with Enterprise JavaBeans use of Enterprise JavaBeans within publish/subscribe configurations.
127
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 127 Improved Support for Persistence for Entity Beans Define a standard interface between the container and the persistent storage mechanism insure that a bean developed on one EJB server can be portably deployed in a different server environment with a different -persistent storage facility -set of tools -database enable tools to operate across the containers of multiple vendors
128
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 128 Support for Relationships among Enterprise JavaBeans The bean provider in EJB 1.1 is responsible for management of 1-1, 1-n, and m-n associations among enterprise beans management of relationships between enterprise beans and their dependent objects Capture information about relationships so that it can be made available at deployment time run time
129
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 129 Support for Inheritance and Subclassing of Enterprise JavaBeans EJB currently supports class inheritance but not component inheritance Subclassing of components being considered for EJB 2.0 unclear how object persistence will be implemented practical advantages unclear
130
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 130 Query Syntax for Entity Bean Finder Methods Define a format for specifying the query criteria or the selection predicates that are to be used by finder method implementations support the definition of portable finder methods
131
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 131 Mechanisms for Container Extensions Interceptors are methods the container invokes during the bean invocation protocol provides a portable means for specializing the behavior of the container for specific operational environments reduces the need for specialized containers
132
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 132 Support for Additional Methods in the Home Interface Currently no means for adding methods independent of individual bean instances (other than create and finder methods) home methods are similar to static members in traditional OO can be used, for example, to support bulk update operations
133
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 133 EJB Server Network Interoperability Protocol Movement towards requiring RMI/IIOP Complete the mapping of EJB via RMI/IIOP by specifying support for interoperable security and naming supports network interoperability among CORBA-based EJB server implementations
134
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 134 Not Planned for EJB 2.0 Portable, security solution vendors must implement their own custom solutions
135
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 135 EJB Release Schedule Release 1.0 March 98, Final Release 1.1 May 99, Public Draft Q3 99, Public Release Q4 99, Final Release Release 2.0 Year 2000
136
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 136 EJB Summary and Conclusions
137
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 137 EJB Summary EJB server implementations lag behind proprietary application servers in support for distributed transactions security EJB supports development of “Write Once, Run Anywhere TM” Java applications issues exist porting between EJB servers
138
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 138 What are the Alternatives? Microsoft Transaction Server (MTS) Vendor suites database vendors (I.e., Oracle, Sybase) transaction manager (I.e., BEA Tuxedo) Web vendors (I.e., Netscape) Custom integration of Java technologies Enterprise Resource Planning (I.e., SAP, PeopleSoft, Baan, IBM San Francisco)
139
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 139 Microsoft Transaction Server (MTS) Microsoft proprietary solution only runs on Windows NT based on the Component Object Model (COM) interfaces to broad range of databases Active directory, security and clustering extensions added in Windows 2000 Efficient, low-cost solution on Microsoft platform “feel the power of the dark side of the force”
140
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 140 Vendor Suites Application servers that do not adhere to an EJB specification application programming language usually C++ but may also be Java typically provides support for distributed transactions, security, failover, replication database, transactions, Web vendors have different strengths Allows the development of large, complex enterprise systems risk of vendor lock
141
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 141 Custom Integration Best-of-breed integration of components control own architecture allows flexibility in selection of components that meet specific requirements components can be incrementally upgraded Greater degree of control and flexibility but requires greater expertise in infrastructure technologies greater investment in time and $$$ integrating products from different vendors can be problematic
142
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 142 Enterprise Resource Planning (ERP) Vertically integrated domain-specific frameworks includes business processes often difficult to integrate with legacy systems usually does not consist of the latest and greatest technologies Offers business solution may require the adoption of business processes trades flexibility for complete solution
143
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 143 Conclusion EJB can be used to build scalable, platform- neutral, multi-tier applications, but only if you avoid product-specific features EJB is still rapidly evolving -- look for stability elsewhere EJB is the keystone of Sun’s Java 2 Enterprise Edition
144
© 1999 by Carnegie Mellon University SEI/CBS Initiative Enterprise Java Beans- page 144 For More Information... Telephone412 / 268-5800 Fax412 / 268-5758 Emailrcs@sei.cmu.edu kcw@sei.cmu.edu jer@sei.cmu.edu scd@sei.cmu.edu World Wide Webhttp://www.sei.cmu.edu U.S. mailCustomer Relations Software Engineering Institute Carnegie Mellon Pittsburgh, PA 15213-3890
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.