36
1 第第第第 J2EE 第第 Introduction What is J2EE ? The Platform for Enterprise Solutions J2EE Application Programming Model J2EE Benefits J2EE Platform Technologies J2EE Application Scenarios J2EE Application Construction

1 第十四章 J2EE 入门 Introduction Introduction What is J2EE ? The Platform for Enterprise Solutions J2EE Application Programming Model J2EE Benefits

Embed Size (px)

Citation preview

Page 1: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

1

第十四章 J2EE 入门

Introduction

What is J2EE ?

The Platform for Enterprise Solutions

J2EE Application Programming Model

J2EE Benefits J2EE Platform Technologies

J2EE Application Scenarios

J2EE Application Construction

Page 2: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

2

‘Enterprise’ in J2EE

• ‘Programming in the large’ and ‘enterprise computing’ :

– Lots of users and the application has an ‘extended life’– Deployed on heterogeneous computing environments – Maintainability, Flexibility, Reusability are major issues– Needs to support transactions, resource-pooling,

security, threading, persistence, life-cycle management etc…

• Need for special solutions to manage complexity – Proprietary frameworks and middleware– Need for standard APIs for enterprise computing– Multi-tiered architecture in enterprise applications

Page 3: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

3

What is J2EE?• J2EE means :

– J2EE Platform - A standard platform for hosting J2EE applications, specified as a set of required APIs, specifications and policies.

– J2EE Application Programming Model - A standard programming model for developing multi-tier, thin-client applications.

– J2EE Compatibility Test Suite - A suite of compatibility tests for verifying that a J2EE platform product is compatible with the J2EE platform standard.

– J2EE Reference Implementation - A reference implementation for demonstrating the capabilities of J2EE and for providing an operational definition of the J2EE platform.

Page 4: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

4

J2EE Platform

Page 5: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

5

J2EE Platform

Page 6: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

6

Multitiered Distributed Application Model

• J2EE platform is a multitiered distributed application model

• Application logic divided into components according to function

• Various components installed on different machines depending on which tier in the multitiered J2EE environment the application component belongs

Page 7: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

7

Multitier Applications

Page 8: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

8

Client tier

Page 9: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

9

Web tier

Page 10: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

10

Business and EIS Tiers

Page 11: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

11

J2EE Platform Benefits

Simplified architecture and development

Integration with existing information systems

Scalability to meet demand variations

Choices of servers, tools, components

Flexible security model

Page 12: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

12

J2EE Platform Technologies

Component TechnologiesJ2EE ContainersJ2EE Containers

Platform Service Communication Technologies Platform Roles

Page 13: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

13

J2EE Application Components

Page 14: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

14

Self-contained functional software unit assembled into a J2EE application

• Client components - application clients or applets • Web components - Servlets or JSP

• run on the server• may respond to HTTP requests from client• typically contains presentation logic• dynamically generates HTML pages, XML or other data format

• Business components - EJB

J2EE Application Components

Page 15: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

15

J2EE Containers

Page 16: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

16

Container Services

• Containers are the interface between a component and the low-level platform-specific functionality.

• Before a component can be executed, it must be assembled into a J2EE application and deployed into its container.

• The assembly process involves specifying container settings for each component and for the J2EE application itself.

• Container services: security transaction management Java Naming and Directory Interface (JNDI) lookups remote connectivity also manages nonconfigurable services such as enterprise bean and

servlet life cycles, database connection resource pooling, data persistence, and access to the J2EE platform APIs

Page 17: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

17

Container Types

Page 18: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

18

J2EE Standard Services

Page 19: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

19

• JTA/JTS - demarcation interface used by container and components to demarcate transaction boundaries

• RMI-IIOP - use of RMI-style programming independent of underlying protocol supports both

JRMP and CORBA IIOP• JavaIDL - allows components to invoke external CORBA objects using IIOP• JDBC - standard API for accessing RDBMS• JMS - messaging that supports reliable P2P and pu

blish-subscribe uses JAF

J2EE Standard Services

Page 20: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

20

• JNDI - standard for accessing naming and directory services

• JavaMail - ability to send email notifications• JAXP - support for SAX and DOM parsing of XML doc

uments and XSLT• J2EE Connector Architecture – resource adapters t

hat support access to EIS to be plugged in. • JAAS - services to authenticate and enforce access

controls upon users extends userbased authorization

J2EE Standard Services

Page 21: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

21

Communication Technologies

Internet protocols Remote method invocation protocols Object Management Group protocols Messaging technologies Data formats

Page 22: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

22

Internet Protocols

TCP/IP --Transport Control Protocol over Internet Protocol HTTP 1.0 --Hypertext Transfer Protocol SSL 3.0 --Secure Socket Layer

Page 23: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

23

Remote Method Invocation Protocols

A set of APIs that allow developers to builddistributed applications Uses Java language interfaces to define remote objects Turn local method invocations into remote method invocations

Page 24: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

24

Object Management Group Protocols

Java IDL

RM I-IIOP

Page 25: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

25

Messaging Technologies

Java Message Service•point-to-point messaging•publish-subscribe messaging

JavaMail

Page 26: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

26

Data Formats

HTML 3.2 Image files:

•GIF (Graphics Interchange Format) •JPEG (Joint Photographic Experts Group)

JAR file Class file XML

Page 27: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

27

J2EE Platform Roles

• J2EE Product Provider

• Tool Provider

• Application Component Provider

• Application Assembler

• Application

Deployer /System Administrator

Page 28: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

28

J2EE Application Scenarios

Page 29: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

29

Multitier Application Scenario

Page 30: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

30

EJB-Centric Application Scenario

Page 31: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

31

Web-Centric Application Scenario

Page 32: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

32

J2EE Application Construction

Component Provider

IDE

Authoring

Class Class

JSP JSP

Java Java

HTML HTML

StaticStatic

Create

JavaCode

CreateWeb

Contents

Assembler

PackagingTool

ComponentProvidercreatescompo-nents

Assemblercreatesportablepackages

Deployer

Deploy Tool

Deployercreates

deployableunitsand

deploystheminto

servers

EJB.JAR EJB.JAR

Client.JARClient.JAR

Web.WAR Web.WAR

Appl.EAR Appl.EAR

Portable

EJB.JAR EJB.JAR

Client.JARClient.JAR

Web.WAR Web.WAR

Appl.EAR Appl.EAR

Deployable

J2EE Server

J2EE Server

Page 33: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

3 March 2001 SCM of J2EE 33

Packaging

Portability Limit

Page 34: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

34

J2EE JAR files

Java ARchive file containing a J2EE module or application

EJB.JAR contains an EJB module Web.WAR contains a Web module Client.JAR contains a Client module Application.EAR contains a J2EE application

of one or more modules

Page 35: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

35

Deployment and Deploy Tools• Deployment

Changing/Add properties in the Deployment Descriptor Access control Bean references External Resource references Transactional attributes

Mapping Beans in to the Data BaseDeploy it into the server

• Deploy Tools J2EE compatible servers provides their own

Deploy Tool

Page 36: 1 第十四章 J2EE 入门  Introduction Introduction  What is J2EE ?  The Platform for Enterprise Solutions  J2EE Application Programming Model  J2EE Benefits

36

Deployment Tool

VendorDeploymentDescriptor

PortablePackages

Application.EAREJB.JAR

Web.WARClientt.JAR

EJB Server

J2EE ServerWEB Server

Client

Deployment

Deployable Web.WAR

Deployable CLient.JAR

DeployableApplication.EAR

DeployableEJB.JAR