1 第十四章 j2ee 入门 introduction introduction what is j2ee ? the platform for enterprise...

Post on 30-Dec-2015

265 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

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

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.

4

J2EE Platform

5

J2EE Platform

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

7

Multitier Applications

8

Client tier

9

Web tier

10

Business and EIS Tiers

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

12

J2EE Platform Technologies

Component TechnologiesJ2EE ContainersJ2EE Containers

Platform Service Communication Technologies Platform Roles

13

J2EE Application Components

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

15

J2EE Containers

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

17

Container Types

18

J2EE Standard Services

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

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

21

Communication Technologies

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

22

Internet Protocols

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

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

24

Object Management Group Protocols

Java IDL

RM I-IIOP

25

Messaging Technologies

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

JavaMail

26

Data Formats

HTML 3.2 Image files:

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

JAR file Class file XML

27

J2EE Platform Roles

• J2EE Product Provider

• Tool Provider

• Application Component Provider

• Application Assembler

• Application

Deployer /System Administrator

28

J2EE Application Scenarios

29

Multitier Application Scenario

30

EJB-Centric Application Scenario

31

Web-Centric Application Scenario

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

3 March 2001 SCM of J2EE 33

Packaging

Portability Limit

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

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

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

top related