Seminar: Enterprise JavaBeans - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Seminar: Enterprise JavaBeans

Description:

Title: Author: Lee Jean Man Last modified by: Lee Jean Man Created Date: 3/3/2000 6:30:01 AM Document presentation format – PowerPoint PPT presentation

Number of Views:166
Avg rating:3.0/5.0
Slides: 54
Provided by: LeeJe4
Category:

less

Transcript and Presenter's Notes

Title: Seminar: Enterprise JavaBeans


1
Seminar Enterprise JavaBeans
2
  • Agenda
  • Java 2 Platform
  • Java 2 Platform,Enterprise Edition(J2EE)
  • Enterprise JavaBeans
  • Enterprise JavaBeans Architecture

3
Java 2 Platform
4
Java History
  • 1995 Sun World95
  • 1996 JDK1.0 Final Release
  • 1997 JDK1.1 Final Release
  • 1999 JDK1.2 Final Release
  • 2000 JDK1.3 Final Release

5
Today/Tomorrow
Web Content E-mail Entertainment Travel Personal
Finance E-commerce Voice Over IP Long Distance
Phone
6
Todays Enterprise
7
Short History of Java Enterprise Technology
8
Java 2 Platform
  • Java 2 Platform,Standard Edition(J2SE)
  • Java 2 Platform,Enterprise Edition(J2EE)
  • Java 2 Platform,Micro Edition(J2ME)

9
Java 2 Platform
10
Java History
11
Java Enterprise Architecture
Workstation
PC
Video Server
Web Server
BeeperCell PhoneATM Game
PDA
Corporate LAN
Solstice Firewall
Public Internet
CorporateIntranet
Workgroup Server
Firewall
Kiosk
Server
Mainframe
Java Desktop
Java Device
12
  • Agenda
  • Java 2 Platform
  • Java 2 Platform,Enterprise Edition(J2EE)
  • Enterprise JavaBeans
  • Enterprise JavaBeans Architecture

13
Java 2 Platform Enterprise Edition(J2EE)
14
Application Servers
  • Provides infrastructure to support management of
    business logic and access to services
  • Provide proprietary APIs,which leads to vendor
    lock
  • Diminishes ability to reuse business logic on
    another vendors application servers

15
Enterprise Goals
  • Reuse
  • Interoperability
  • Portability
  • Time-to-Market

16
Why another Java 2 Platform?
Enterprise Services Require
17
What is J2EE ?
  • J2EE is An Integrated Application Environment (
    consist of below )
  • API specifications (EJB,JSP,JDBC etc)Defines
    J2EE requirements
  • Reference implementation of APIsOperational J2EE
    platform
  • Compatibility tests with brandingValidates J2EE
    platform compatibility
  • Application Programming ModelDescribes how to
    build J2EE application

18
What is J2EE ?
  • The enterprise developer can concentrate on
    application components,not the underlying
    services
  • Separation of business logic and services provide
    for better reuse of business logic

Business logic
  • Business
  • logic

Services
Services
19
J2EE Architecture
20
J2EE API Summary
  • J2SE 1.3
  • JDBC 2.0
  • RMI/IIOP 1.0
  • EJB 1.1.x
  • Servlet 2.2
  • JSP 1.1
  • JNDI 1.2
  • JTA 1.0
  • JMS 1.0
  • JavaMail 1.1
  • JAF 1.0

21
J2EE Standard Services
Services Java
Technology
  • Web
  • Database
  • Naming and Directory
  • Management
  • Email
  • Protocol
  • Transaction

Servlet/JSP(HTML/XML) JDBCTM JNDI JMX JavaMail
TM JavaIDL/RMI OTS/JTS/JTA
22
J2EE Platform
23
J2EE is important
  • Integrated Application Environment
  • Open platform
  • Integrates with existing environments
  • Provides foundation for future development

24
  • Agenda
  • Java 2 Platform
  • Java 2 Platform,Enterprise Edition(J2EE)
  • Enterprise JavaBeans
  • Enterprise JavaBeans Architecture

25
  • Enterprise JavaBeans

26
EJB Architecture
27
EJB Design Goals
  • Simplify development/deployment of distributed
    applications
  • Achieve broad industry acceptance
  • The right expert focuses on the right job
  • Platform independent and protocol neutral
  • Enable development of portable components - Truly
    enable reuse

28
Defining Enterprise JavaBeans
  • A server-side component architecture
  • Model to enable efficient development and
    deployment of Java applications
  • Transactional,Portable
  • Distributed,Multi-tier
  • Scalable
  • Secure

29
Defining Enterprise JavaBeans
  • EJB is not JavaBeans
  • a Server Component specification for Java
  • Separates business and system programming
  • Portability of business objects
  • Extensibility through vendor features

30
JavaBeans Versus Enterprise JavaBeans
  • Java Beans
  • Can be either visible or non-visible
  • Intended to be local to a single process on the
    client side
  • Uses the BeanInfo classes, Property Editors
    Customizers to describe itself
  • Can also be deployed as an ActiveX control
  • Enterprise JavaBeans
  • Are decidedly Non-Visible, remote objects
  • Remotely executable components deployed on the
    server
  • Uses the Deployment Descriptor to describe itself
  • Can not deployed as an ActiveX control since OCXs
    run on the desktop

31
JavaBeans Versus Enterprise JavaBeans
Server
Enterprise information Services
Client
Java Beans
Container
Java Beans
Database
EJB1
Java Beans
Existing application
EJB2
Client
EJB3
Java Beans
Server manages resources such as threads,
connection pooling, caching, and state
management
Java Beans
32
  • What Is Special About EJBs?
  • Learn once
  • Write Once, Run Anywhere TM
  • Portable and interoperable
  • Flexible and extensible
  • Scalable
  • Easier to write distributed applications
  • Transaction management
  • CORBA compatible

33
  • Agenda
  • Java 2 Platform
  • Java 2 Platform,Enterprise Edition(J2EE)
  • Enterprise JavaBeans
  • Enterprise JavaBeans Architecture

34
Enterprise JavaBeans Architecture
35
Key Components in EJB
  • EJB Server
  • EJB container
  • Home Object
  • EJBObject
  • Enterprise Bean

36
EJB Architecture Overview
EJB Home Interface
EJB Home Class
EJB Object Interface
EJB Object Class
EJB Class
EJB Container
Deployment Descriptor
Manifest
EJB Server
37
EJB Architecture Overview
38
Application Life Cycle
39
EJB Server
  • Provides System Services
  • Transaction support
  • Database access
  • System resource
  • Namespace
  • Implementations
  • Middleware servers
  • Application servers
  • Database servers

40
EJB Server
  • Supplies containers for EJBs
  • API between server and container is
  • currently vendor specific
  • Server could provide several container
  • types to provide various extended
  • services to different beans

41
EJB Container
  • Currently provided by EJB Server
  • EJB access to server resource through
  • standard API
  • May Contain one or multiple classes
  • Tools for EJB creation and deployment

42
EJB Container
  • Some standard services
  • Persistence
  • EJB instance creation location
  • Namespace
  • Transaction control
  • Swapping
  • Security
  • Custom services
  • Application-specific
  • Bridge to existing systems

43
Home Interface
  • Factory interface for the bean
  • Interface provided by EJB developer
  • Class generated by vendor tool
  • One factory class per bean class
  • Factory instance is installed into the
  • servers naming service

44
Home Interface
  • import java.io.Serializable
  • import java.rmi.RemoteException
  • import javax.ejb.CreateException
  • import javax.ejb.EJBHome
  • public interface ConverterHome extends EJBHome
  • Converter create() throws RemoteException,

  • CreateException

45
Remote Interface
  • Interface is provided by bean developer
  • Implementation is provided by
  • container tools, which include
  • Stubs and Skeletons
  • The EJB Object

46
Remote Interface
import javax.ejb.EJBObject import
java.rmi.RemoteException public interface
Converter extends EJBObject public double
dollarToYen(double dollars)
throws RemoteException public
double yenToEuro(double yen)
throws RemoteException
47
EJB Object
  • The EJB Object is a wrapper object that
  • Acts as a proxy to the EJB instance
  • Interface provided by Bean Developer
  • Implementation class generated by tool
  • Each business method has a corresponding
  • method in the EJB Object
  • Wrapper method implements container-
  • provided services

48
EJB Architecture Overview
Home Object
Home Interface
Client
EJB Object
Bean
Remote Interface
EJB
Skeleton
Stub
Remote Interface
EJB
49
EJB Source
import java.rmi.RemoteException import
javax.ejb. public class ConverterEJB implements
SessionBean public double dollarToYen(double
dollars) return dollars 121.6000
public double yenToEuro(double yen)
return yen 0.0077 public
ConverterEJB() public void ejbCreate()
public void ejbRemove() public void
ejbActivate() public void ejbPassivate()
public void setSessionContext(SessionContext
sc)
50
Types of EJBs
Session Beans Client state
Server
Enterprise information Services
Container
Client
EJB1
Proxy
Database
EJB2
Proxy
Existing application
Client
EJB3
Proxy
Entity Beans State of data
51
Session Beans Versus Entity Beans
Session Beans Private client resource Bean
carries client state Bean is not
persistent Lifetime is controlled by
client Transactional participant Single-threaded M
andatory since 1.0
  • Entity Beans
  • Access by multiple clients concurrently
  • Bean represents state of data in data store
  • Bean is persistent
  • Lifetime corresponds to its persistent
  • store
  • Transactional by nature
  • Single-threaded
  • Mandatory since 1.1

52
Client Source
import javax.naming. import javax.rmi.PortableRe
moteObject import Converter import
ConverterHome public class ConverterClient
public static void main(String args) try
Context initial new InitialContext() Object
objref initial.lookup("MyConverter") Convert
erHome home (ConverterHome)PortableRemoteObje
ct.narrow(objref,ConverterHome.class) Converter
currencyConverter home.create() double
amount currencyConverter.dollarToYen(100.00)
System.out.println(String.valueOf(amount)) amou
nt currencyConverter.yenToEuro(100.00) System
.out.println(String.valueOf(amount)) catch
(Exception ex)
53
Enterprise EJB Scenario
J D B C
DB
JSP/Servlet
Java Beans
HTTP request
J M S
JSPs
EJBs
Back Office
HTTP response
Enterprise Application Server
Write a Comment
User Comments (0)
About PowerShow.com