7) packaging and deployment

30
IBM RAD © 2008 IBM Corporation Vinod Patidar Section - 7) Packaging and Deployment

Upload: inder321m

Post on 26-Nov-2014

123 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 7) Packaging and Deployment

IBM RAD

© 2008 IBM Corporation

Vinod Patidar

Section - 7) Packaging and Deployment

Page 2: 7) Packaging and Deployment

IBM AI - RAD

Section 7 - Section 7 - Packaging and Deployment (9%)Packaging and Deployment (9%)

Create J2EE projects Create J2EE projects Import and export J2EE modules Import and export J2EE modules Create and locate resources in the Create and locate resources in the

appropriate location of the project appropriate location of the project hierarchy hierarchy

Work with Web and Application Work with Web and Application Deployment Descriptor EditorsDeployment Descriptor Editors

Page 3: 7) Packaging and Deployment

IBM AI - RAD

What is J2EE?

Enterprise application development Specification

Platform for - developing, deploying and managing - n-tier ,web-enabled ,server centric and component

based enterprise application

Page 4: 7) Packaging and Deployment

IBM AI - RAD

J2EE Architecture

Page 5: 7) Packaging and Deployment

IBM AI - RAD

J2EE Multi-tier Model

Page 6: 7) Packaging and Deployment

IBM AI - RAD

J2EE Benefits Standards- A wide range of standard services, components, clients, and tools are

supported- Applications are portable across J2EE platforms

Distribution- Provides scalability for performance and availability

Common services- Most commonly required services are provided by J2EE servers

Component model- Good separation of development responsibilities- Good reuse of code and opportunities to share logic between

applications Interoperability- Integration with other systems using standard protocols

Page 7: 7) Packaging and Deployment

IBM AI - RAD

J2EE Perspective

Project Explorer

Code Editor

Resource Views

Page 8: 7) Packaging and Deployment

IBM AI - RAD

Associating Projects with a Server

There are several ways to associate a project with a server:- From the project context pop-up menu, select Run As > Run

on server You will be able to choose a server in the dialog, and associate the

project with that server

- From the server context pop-up menu in the Servers view, select Add and Remove Projects… The server will be started in order to add or remove projects

- From the project context pop-up menu, select Properties > Server From here, you can set the runtime target and the default server

Page 9: 7) Packaging and Deployment

IBM AI - RAD

J2EE Packaging

The J2EE specification defines standard archive formats for all J2EE components- EJB module

Packaged in a Java archive (.jar) file

- Web module Packaged in a Web archive (.war) file

- Application client module Packaged in a Java archive (.jar) file

- Resource adapter module Packaged in a resource adapter archive (.rar) file

- Enterprise application Packaged in an enterprise archive (.ear) file

Page 10: 7) Packaging and Deployment

IBM AI - RAD

J2EE Packaging – Containment Hierarchy

web resource

JSP

Servlet

client1.jar

web1.war

res1.rar

EJB

client class

native library

adapter jar

ejb1.jar

app1.ear

ejb-jar.xml

application-client.xml

web.xml web resource

JSP

Servlet

ejb1.jar

client1.jar

web1.war

res1.rar

ra.xml

EJB

client class

native library

adapter jar

application.xml

Page 11: 7) Packaging and Deployment

IBM AI - RAD

EJB Module

An EJB module is contained in an EJB jar file Several beans may be packaged within a single EJB jar file The EJB JAR contains all the classes required for each EJB

- The enterprise bean class- The enterprise bean home and component interfaces- The primary key class if the bean is an entity bean

The deployment descriptor (ejb-jar.xml) contains:- EJB structural information

Defining the class names, external dependencies, persistent fields and relationships (for CMP beans)

- Application assembly information describing how the EJBs fit into a wider application Security information and transaction attribute

Page 12: 7) Packaging and Deployment

IBM AI - RAD

Web Module

Web modules (also known as Web applications) are contained in a Web archive (.WAR) file

A WAR file will normally contain several Servlets, JavaServer Pages and other Web resources- For example, a Web application may contain HTML files, graphics files,

audio files and movies

The deployment descriptor (web.xml) contains configuration information for resources contained in the war file- For example, initialization parameters, session management

configuration, Servlet declarations and mappings, filter definitions, welcome file list, and error pages

- Security information, tag libraries, and JNDI configuration may also be provided

Page 13: 7) Packaging and Deployment

IBM AI - RAD

Application Client Module

Application clients are contained in jar file An application client JAR file contains all the classes required

for the client to function The deployment descriptor (application-client.xml) contains

configuration information for the client- The enterprise beans and external resources referenced by the

application client

The mechanism for deployment and installation of the application client is not specified in the J2EE specification

J2EE product providers may provide an application launcher that integrates with the application client machine’s native operating system

Page 14: 7) Packaging and Deployment

IBM AI - RAD

Resource Adapter ModuleResource adapters are contained in a resource adapter archive (.RAR) file

A resource adapter archive RAR file contains:- Java code for the resource adapter- Utility Java classes for the resource adapter- Platform-dependent native libraries required by the resource

adapter- Help files and documentation

The deployment descriptor (ra.xml) contains:- General information on the adapter- The class names of the connection factory and implementation

class- Transaction and security information

Page 15: 7) Packaging and Deployment

IBM AI - RAD

Enterprise Application

Enterprise applications are contained in an enterprise archive (.ear) file

An enterprise archive file contains one or more J2EE modules- EJB jars, wars, application client jars and rars

The enterprise application deployment descriptor (application.xml) contains:- Details of all the modules packages in the ear file- Definitions of security roles for the enterprise application

Page 16: 7) Packaging and Deployment

IBM AI - RAD

Relationship between Projects and J2EE Packages

In J2EE V1.4 there are four application component types supported by the runtime environment:- Application Clients- Applets- Web applications (servlets, JSPs, and HTML pages)- EJBs

J2EE components are packaged for deployment as modules:- Application client module- Web application module- EJB module- Resource adapter module

Rational Application Developer projects map to J2EE packages

Page 17: 7) Packaging and Deployment

IBM AI - RAD

J2EE Packaging Structure Review

WebDD

EJBModuleJAR file

WebModule

WAR file

ClientModuleJAR file

J2EEApplication

EAR fileInstalled

RARs

IBM Bind

SchemaMap

SchemaAttributes

Table Creation

was.policy(Java2 Sec)

IBMBind/Ext

HTML,GIFs, and

so on

ServletJSP

ApplicationDD

ClientClassesEJBs

IBMBind/Ext

IBMBind/Ext

EJBDD

ClientDD

RADD

Page 18: 7) Packaging and Deployment

IBM AI - RAD

Data Sources Defined in Enhanced EAR

Application-related properties and data sources can be defined within an application to simplify application deployment- Configuration files added to the J2EE EAR file as an IBM extension

Properties are used when application is installed Data source is registered with the WebSphere V6.1 server

when the application is started Configuration variables can be defined for substitution with

server values when application is installed

Enhanced EAR

Properties

ComponentsComponentsResources J2EE Enterprise Application

(EAR)

Page 19: 7) Packaging and Deployment

IBM AI - RAD

Other Properties Defined in the Enhanced EAR

1

2

3

4567

Page 20: 7) Packaging and Deployment

IBM AI - RAD

Exporting Web Applications

A Web application can be exported in two ways using the context menu:- As an EAR file- As a WAR file

Page 21: 7) Packaging and Deployment

IBM AI - RAD

Sharing Projects between Workspaces

Project Interchange is an export feature that allows the export of entire projects.

The project structure is maintained, including metadata files.- Unlike exporting a WAR, where

you may lose metadata.

Unrelated projects can be exported.- You can then

easily import the projects into another workspace with a single action.

Page 22: 7) Packaging and Deployment

IBM AI - RAD

The following J2EE components live in the:- Presentation layer- Business layer- Integration layer

J2EE Components in a Three-Layer Design

Session Beans

Entity Beans

PresentationLayer

BusinessLayer

IntegrationLayer

JavaBeans

SDOs

Java

Entity

Entity

Java

Java

JSP/JSFPages

Servlets

HTMLPages

JavaBeans

JavaBeans

Page 23: 7) Packaging and Deployment

IBM AI - RAD

Universal Test Client (UTC)

Server tools provide Universal Test Client support, allowing you to:

- Test your enterprise beans and other Java™ objects

- Test the local or remote interface methods of your enterprise beans

- Find an enterprise bean when you know or do not know the JNDI name

Page 24: 7) Packaging and Deployment

IBM AI - RAD

Publishing Applications

Application Developer supports:- WebSphere test environment in the development

environment- Tomcat test environment in the development environment- WebSphere local or remote server outside the development

environment- Tomcat local server outside the developer environment- J2EE Web publishing server- Static Web publishing server

Page 25: 7) Packaging and Deployment

IBM AI - RAD

Publishing Applications

The server tools provide several publishing methods that you can use when publishing projects and files.

Server StatusServer Name and Type

Page 26: 7) Packaging and Deployment

IBM AI - RAD

Checkpoint

1.What are the four application component types supported by the runtime environment?

2.What are the four modules used to package J2EE components?

3.Name two components of the WAR file.

4.You have a static Web project. Which archive can you use to export it: WAR or EAR?

5.What is one of the most common uses of the enhanced EAR?

6.What is the difference between exporting in .zip format and in project interchange format?

Page 27: 7) Packaging and Deployment

IBM AI - RAD

Checkpoint answers1.The four application component types supported by the

runtime environment:- Application Clients, Applets, Web applications (servlets, JSPs, HTML

pages, and so on), and EJBs

2.The four module types used to package J2EE components:- Application client module, Web application module, EJB module, and

Resource adapter module

3.Servlets, JSPs, HTML pages, and Web Deployment Descriptor

4.WAR

5.Substitution variables, authentications, shared libraries, virtual hosts, class loader mode, WAR class loader policy, and start weight.

6.The project interchange format preserves the metadata.

Page 28: 7) Packaging and Deployment

IBM AI - RAD

Checkpoint

1.What is an EAR?

2.What are the four types of modules contained in an EAR?

3.What are the three types of archives contained in an EAR?

4.Which archive type contains servlets and JSP pages?

Page 29: 7) Packaging and Deployment

IBM AI - RAD

Checkpoint solutions

1.Enterprise Archive

2.EARs can contain the following modules:• EJB• Web• Resource Adapter• Client Application

3.The three types of archive files are:• WAR (Web Archive)• RAR (Resource Archive)• JAR (Java Archive)

4.WAR

Page 30: 7) Packaging and Deployment

IBM AI - RAD

Japanese

Hebrew

Thank You

English

MerciFrench

Russian

DankeGerman

GrazieItalian

GraciasSpanish

Obrigado Portuguese

Arabic

Simplified Chinese

Traditional Chinese

Thai

Korean