Presentation is loading. Please wait.

Presentation is loading. Please wait.

J2EE Lecture 10: EJB 3.0 Overview

Similar presentations


Presentation on theme: "J2EE Lecture 10: EJB 3.0 Overview"— Presentation transcript:

1 J2EE Lecture 10: EJB 3.0 Overview
Dr. Ming Qiu Xiamen University Software School

2 Mastering EJB3.0, Chap 1 10.1 Overview What plumbing do you need to build a robust distributed object deployment? What is EJB, and what value does it add?

3 10.1 Overview EJB is a server-side component framework
Mastering EJB3.0, Chap 1 10.1 Overview EJB is a server-side component framework simplifies the process of building enterprise-class distribute component application in Java

4 10.1 Overview What is Software Component?
Mastering EJB3.0, Chap 1 10.1 Overview What is Software Component? A piece of code written to manifest the behavior of a corresponding abstract concept. Sounds like Objects, but it is different Self-contained Entity Be used in a similar or completely different application Can live an independent, reusable existence outside of original application A system can be designed to consist of reusable components

5 10.1 Overview The Need for Componentization
Mastering EJB3.0, Chap 1 10.1 Overview The Need for Componentization Lack of flexibility and interoperability Component Framework Common Object Request Broker Architecture (CORBA) ActiveX/COM EJB

6 10.1 Overview Remote method invocation Loading balancing
Mastering EJB3.0, Chap 1 10.1 Overview Remote method invocation Loading balancing Transparent failover Back-end integration Transaction Clustering Dynamic redeployment

7 10.1 Overview Each of these aspects can be thought of as a service
Mastering EJB3.0, Chap 1 10.1 Overview Clean shutdown Logging and Auditing Systems management Threading Message-oriented middleware Component life cycle Resource pooling Security Caching And much… Each of these aspects can be thought of as a service

8 10.1 Overview Application Server-Class Software
Mastering EJB3.0, Chap 1 10.1 Overview Application Server-Class Software Building Middleware Services from Scratch Buying Middleware Services via Application Server Software

9 10.1 Overview Standardization of Component Frameworks
Mastering EJB3.0, Chap 1 10.1 Overview Standardization of Component Frameworks More than 50 application servers on the market Need an agreement to enable any component to run within any application server

10 Mastering EJB3.0, Chap 1 10.1 Overview

11 10.1 Overview Enterprise JavaBeans Technology
Mastering EJB3.0, Chap 1 10.1 Overview Enterprise JavaBeans Technology A standard for developing and deploying server-side distribute components in Java It is a ubiquitous industry standard Portability is possible Rapid application development EJB is two things in one Specification A set of Java Interfaces

12 10.1 Overview Why Java Interface/implementation separation
Mastering EJB3.0, Chap 1 10.1 Overview Why Java Interface/implementation separation Safe and security If a thread dies, the application stays up No memory pointer in java Memory leaks occur much less often Cross-platform

13 10.1 Overview EJB as a Business Tier Component
Mastering EJB3.0, Chap 1 10.1 Overview EJB as a Business Tier Component Presentation tier components deal directly with end user or end application Business tier components perform server-side operation Such as executing complex algorithm or performing transactional business operation

14 10.1 Overview EJB components can perform following tasks
Mastering EJB3.0, Chap 1 10.1 Overview EJB components can perform following tasks Performing business logic Access a database Integrate with other systems Examples of EJB clients Application clients Dynamically generated Web pages Web service clients

15 Mastering EJB3.0, Chap 1 10.1 Overview

16 10.1 Overview Distributed Computing: The Foundation of EJB
Mastering EJB3.0, Chap 1 10.1 Overview Distributed Computing: The Foundation of EJB

17 the Java Platform, Enterprise Edition 10.0 (Java EE)
Mastering EJB3.0, Chap 1 the Java Platform, Enterprise Edition 10.0 (Java EE)

18 the Java Platform, Enterprise Edition 10.0 (Java EE)
Mastering EJB3.0, Chap 1 the Java Platform, Enterprise Edition 10.0 (Java EE) A uncompleted list of JavaEE Technologies Enterprise JavaBean(EJB) Java API for Web Services(JAX-WS) Java Remote Method Invocation (RMI) and RMI-IIOP Java Naming and Directory Interface (JNDI) Java Database Connectivity (JDBC) Java Transaction API(JTA) and Java Transaction Service(JTS) Java Message Service (JMS) Java Servlets Java Server Pages (JSP) Java Server Faces (JSF) Java EE Connector Architecture (JCA) The Java API for XML Parsing (JAXP) The Java Architecture for XML Binding (JAXB) The Java Authentication and Authorization Service (JAAS)

19 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was Briefly introduce the programming and deployment model in EJB2.0 To realize the breadth and depth of enhancements made in EJB3.0

20 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

21 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

22 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

23 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was Differences between the local and the remote interface The local interface extends javax.ejb.EJBLocalObject instead of javax.ejb.EJBObject The business method does not throw a java.rmi.RemoteException

24 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

25 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

26 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was Differences between the local and the remote home interface The local home interface extends javax.ejb.EJBLocalHome instead of javax.ejb.EJBHome The local home interface methods do not throw java.rmi.RemoteException

27 Mastering EJB3.0, Chap 2

28 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was

29 Mastering EJB3.0, Chap 2

30 Mastering EJB3.0, Chap 3

31 10.2 Pre-EJB 3.0: The World That Was
Mastering EJB3.0, Chap 2 10.2 Pre-EJB 3.0: The World That Was Dissect EJB 2.x Development Complexities Deployment Complexities Debugging and Testing Complexities

32 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean

33 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean EJB Container Responsible for managing enterprise bean Transaction management Security Resource and life cycle management Remote accessibility Support for concurrent requests Clustering and load-balancing

34 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Type of Bean Session beans model business processes Stateful & Stateless session bean Message-driven beans (MDBs) Similar to session beans, but driven by message Entity beans (deprecated) Model business data

35 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean

36 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean RMI-IIOP: The Protocol of Bean EJB and Location Transparency JNDI is an enabler of location transparency Provides a standard API to access different kinds of naming and directory services within a java program Provides two API Naming API Directory API

37 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean The EJB 3.0 Simplified API No home and object interfaces No component interface Use of Java metadata annotations Simplification of APIs for accessing bean’s environment

38 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Elimination of Home and Object Interface Pre EJB 3.0 The Home interface served as a factory for creating reference to the EJB Object. The EJB Object Interfaces was to provide client view for an EJB

39 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Elimination of Component Interface Pre EJB 3.0 Components need to implement javax.ejb.SessionBean or javax.ejb.MessageDrivenBean Carried the various life cycle method

40 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Use of Annotations Annotations are used to provide the additional context to program. Can be applied to various elements in Java Methods, variables, constructors, package declarations

41 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Annotations and Bean Development EJB 3.0 is a mix of metadata tags and code structs

42 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Annotations and Deployment Descriptions EJB 3.0 annotations can be used in lieu of deployment descriptors. Container Specific Deployment Description Describe the value-added services of container

43 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean The Good, Bad and Ugly of Deployment Annotation Convenient Place configuration along with the bean’s logic. Tricky When the bean provider and deployer is not the same person. Simplified Access to environment

44 Package and Deployment of the “New” Bean
Mastering EJB3.0, Chap 3 Package and Deployment of the “New” Bean

45 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean Example of EJB 3.0 Bean The Business Interface

46 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean The Bean Class

47 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean The Deployment Descriptor

48 10.3 The New Enterprise JavaBean
Mastering EJB3.0, Chap 3 10.3 The New Enterprise JavaBean The Client

49 Mastering EJB3.0, Chap 3

50 Summary of Term The enterprise bean instance The business interface
A POJO contains business method implementation of local/remote business interface The business interface A plain old java interface that enumerates the business methods exposed by the enterprise bean. The deployment descriptor A XML file that specifies the middleware requirements of the bean The Ejb-jar file The package unit for enterprise bean The vendor-specific deployment descriptor Specify the bean’s need for proprietary container.

51 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) Naming Service Associates names with objects Provides a facility to find an object with a name Directory Service A naming service that has been extended and enhanced to provide directory object operations to manipulating attribute

52 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI)

53 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) Problems with Naming and Directory Different Directory vendors offer different types of services Lightweight Directory Access Protocol (LDAP) Network Information System (NIS) Network Directory System (NDS) What is JNDI A System for java client to access Naming and Directory systems Provide one common interface to disparate directories

54 Mastering EJB3.0, Appendix A
Architecture

55 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) JNDI in JavaEE Using JNDI to acquire a reference to the JTA User-Transaction interface Using JNDI to connect to resource factories, such as JDBC drivers or JMS drivers Using JNDI for clients and for beans to look up other beans

56 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) JNDI Concepts Atomic Name A simple, basic, indivisible name In the string /etc/fstab, etc and fstab are atomic names Compound Name Zero or more atomic names put together using a specific syntax /etc/fstab is a compound name

57 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) Binding An association of a name with a object Autoexec.bat  a file C:\windows  a folder /usr/people/ed/.cshrc  multiple bindings Context A set of zero or more bindings

58 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) Naming System A connected set of contexts that use the same name syntax. Namespace The set of names contained in a naming system javax.naming.Name javax.naming.Context

59 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI)

60 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI)

61 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) Composite Name A name that spans multiple naming systems Initial Context The starting point of exploring a namespace Initial Context Factory Be implemented by JNDI drivers churns out initial context javax.naming.InitialContext

62 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI)

63 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) java.naming.factory.initial The name of the environment property for specifying the initial context factory to use java.naming.provider.url The name of the environment property for specifying the location of the JBoss JNDI service provider the client will use. java.naming.factory.url.pkgs The name of the environment property for specifying the list of package prefixes to use when loading in URL context factories.

64 10.4 The Java Naming and Directory Interface (JNDI)
Mastering EJB3.0, Appendix A 10.4 The Java Naming and Directory Interface (JNDI) All the environment parameters can be put into jndi.properties file, found on classpath.

65 Mastering EJB3.0, Appendix A


Download ppt "J2EE Lecture 10: EJB 3.0 Overview"

Similar presentations


Ads by Google