JEE Course - JEE Overview

63
JEE Overview Copyright © Oded Nissan 2009

description

Slides I prepared for a JEE course I lectured - this is the first chapter - JEE Overview

Transcript of JEE Course - JEE Overview

Page 1: JEE Course - JEE  Overview

JEE Overview

Copyright © Oded Nissan 2009

Page 2: JEE Course - JEE  Overview

What is JEE ? The JEE Architecture Overview of JEE technologies JEE Application Servers The JEE Development Environment Exercise Summary

Copyright © Oded Nissan 2009

JEE Overview

Page 3: JEE Course - JEE  Overview

A set of technologies for developing enterprise applications in Java

Specified by Sun and the Java Community Process (JCP).

Implemented by JEE vendors. Implementations of JEE technologies are

provided within Application Servers. Previously named J2EE (until version 1.4)

current version is JEE 5.

Copyright © Oded Nissan 2009

What is JEE?

Page 4: JEE Course - JEE  Overview

The Java Platform

Copyright © Oded Nissan 2009

What is JEE ?

High-EndServer

Java Technology Enabled Desktop

WorkgroupServer

Java Technology Enabled Devices

Page 5: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

The Java Platform

OptionalPackages

Java Enterprise

Edition(JEE)

Java StandardEdition

(JavaSE)

JVM

Java Card APIs

CardVM

OptionalPackages

Personal Basis Profile

Personal Profile

Foundation Profile

CDC

MIDP

CLDC

KVM

Java Platform Micro Edition(JavaMETM)

* Under development in JCP

Page 6: JEE Course - JEE  Overview

Distribution Transactions Security Scalability Persistence

Copyright © Oded Nissan 2009

Why do we need JEE ?

Page 7: JEE Course - JEE  Overview

Can use any JEE implementation for development and deployment Use production-quality standard implementation which

is free for development/deployment Use high-end commercial JEE products for scalability

and fault-tolerance

Vast amount of JEE community resources Many JEE related books, articles, tutorials, quality code

you can use, best practice guidelines, design patterns etc.

Can use off-the-shelf 3rd-party business components

Copyright © Oded Nissan 2009

Value to developers.

Page 8: JEE Course - JEE  Overview

Vendors work together on specifications and then compete in implementations In the areas of Scalability, Performance,

Reliability, Availability, Management and development tools, and so on

Freedom to innovate while maintaining the portability of applications

Do not have create/maintain their own proprietary APIs

Copyright © Oded Nissan 2009

Value to vendors

Page 9: JEE Course - JEE  Overview

Component provider Bean provider

Application assembler Deployer Platform provider

Container provider Tools provider System administrator

Copyright © Oded Nissan 2009

JEE Development Roles

Page 10: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

The JEE Life CycleCreation Assembly Deployment

Created by Component Developer

Assembledand Augmentedby Application

Assembler

Processed by Deployer

Deploy

EnterpriseComponents

JEE Container

JEE APPJEE Modules

Page 11: JEE Course - JEE  Overview

The JEE Architecture

Copyright © Oded Nissan 2009

Page 12: JEE Course - JEE  Overview

N-tier architecture Comprised of technologies for the business

tier the presentation tier and other system services.

Runs within the application server and within specific containers (web container, EJB container) within the Application server.

Copyright © Oded Nissan 2009

The JEE Architecture

Page 13: JEE Course - JEE  Overview

Uses the "component and container" model in which container provides system services in a well-defined and as industry standard

JEE is a standard that also provides portability of code because it is based on Java technology and standard-based Java programming APIs

Copyright © Oded Nissan 2009

The JEE Architecture

Page 14: JEE Course - JEE  Overview

Single Tier – a simple desktop application. Two Tier – A thin or a fat client and a server. Three Tier – A presentation tier a business

tier and a Data tier.

Copyright © Oded Nissan 2009

About N-Tier Architecture

Page 15: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Three-Tier architecture

Web Tier EJB Tier

Page 16: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

JEE Tier Architecture

Page 17: JEE Course - JEE  Overview

JEE Technologies

Copyright © Oded Nissan 2009

Page 18: JEE Course - JEE  Overview

Web services technologies JAX-WS 2.0 JAXR JAXB 2.0 Others…These technologies enable the implementation

of web services in the JEE framework.

Copyright © Oded Nissan 2009

JEE 5 Technologies

Page 19: JEE Course - JEE  Overview

Presentation tier technologies Servlets 2.5 Java Server Pages (JSP) 2.1 Java Standard Tag Library Java Server Faces (JSF) 1.2These technologies enable the implementation

of a presentation tier in the JEE framework.

Copyright © Oded Nissan 2009

JEE 5 Technologies

Page 20: JEE Course - JEE  Overview

Enterprise Application Technologies Enterprise Java Beans (EJB) 3.0 Java Persistence API (JPA) 1.0 Java Connector Architecture (JCA) 1.5 Java Messaging Services (JMS) 1.1 Java Transaction API (JTA) 1.1These technologies enable the implementation

of the business tier in the JEE framework.

Copyright © Oded Nissan 2009

JEE 5 Technologies

Page 21: JEE Course - JEE  Overview

What is a Web Service ? A web service is a software system identified

by a URI, whose public interfaces and bindings are defined and described using XML. Its definition can be discovered by other software systems. These systems may then interact with the Web service in a manner prescribed by its definition, using XML-based messages conveyed by Internet protocols.

Copyright © Oded Nissan 2009

Web Services

Page 22: JEE Course - JEE  Overview

Provide a way to connect heterogonous systems in a Language neutral, platform neutral manner.

Use the HTTP protocol to pass messages in the SOAP protocol.

Described by a Web Services Description language (WSDL) document.

Vendors provide tools to generate web service clients from a WSDL.

Web services can be registered and looked up in a UDDI directory.

Copyright © Oded Nissan 2009

Web Services

Page 23: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Web Services Architecture

Page 24: JEE Course - JEE  Overview

Web services are a platform neutral standard, JEE provides its own platform implementation.

JEE provide tools for exposing JEE components such as EJBs as web services.

JEE also provides tools for generating web service clients from existing WSDL documents and an API for accessing the services.

Copyright © Oded Nissan 2009

Web Services in JEE

Page 25: JEE Course - JEE  Overview

What is EJB ? EJB is a standard JEE technology developed by

Sun and the Java community A component architecture for building

distributed applications. A server side technology. Usually used to implement the application’s

business logic.

Copyright © Oded Nissan 2009

Enterprise Java Beans (EJB)

Page 26: JEE Course - JEE  Overview

Distributed components Transaction management support Security Scalability and fail-over Asynchronous Persistence – object relational mapping.

Copyright © Oded Nissan 2009

Benefits of EJB

Page 27: JEE Course - JEE  Overview

Stateless Session beans Stateful Session beans Message driven beans – asynchronous,

based on JMS. Entities – Java Persistence architecture (JPA).

Object-relational mapping.

Copyright © Oded Nissan 2009

EJB Types

Page 28: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

EJB Example

Page 29: JEE Course - JEE  Overview

Messaging systems (MOM) provide De-coupled communication Asynchronous communication Plays a role of centralized post office

Benefits of Messaging systems Flexible, Reliable, Scalable communication

systems Point-to-Point, Publish and Subscribe JMS defines standard Java APIs to

messaging systemsCopyright © Oded Nissan 2009

Java Messaging Services (JMS)

Page 30: JEE Course - JEE  Overview

Defines standard API for integrating J2EE technology with EIS systems CICS, SAP, PeopleSoft, etc.

Before Connector architecture, each App server has to provide an proprietary adaptor for each EIS system m (# of App servers) x n (# of EIS's) Adaptors

With Connector architecture, same adaptor works with all JEE compliant containers 1 (common to all App servers) x n (# of EIS's) Adaptors

Copyright © Oded Nissan 2009

Java Connector Architecture (JCA)

Page 31: JEE Course - JEE  Overview

Java™ objects which extend the functionality of a HTTP server

Dynamic contents generation Better alternative to CGI, NSAPI, ISAPI, etc.

Efficient Platform and server independent Session management Java-based

Copyright © Oded Nissan 2009

Servlets

Page 32: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Servlet Example

A Servlet receives an HTTP request performs an action and generate output,

Page 33: JEE Course - JEE  Overview

Enables separation of business logic from presentation Presentation is in the form of HTML or

XML/XSLT Business logic is implemented as Java Beans or

custom tags Better maintainability, reusability

Extensible via custom tags Builds on Servlet technology (JSP is

compiled into a Servlet).Copyright © Oded Nissan 2009

Java Server Pages (JSP)

Page 34: JEE Course - JEE  Overview

<%@ page import="java.util.*" %> <HTML> <BODY> <%     System.out.println( "Evaluating date

now" );     Date date = new Date(); %> Hello!  The time is now <%= date %> </BODY> </HTML>

Copyright © Oded Nissan 2009

JSP Example

Page 35: JEE Course - JEE  Overview

JavaServer Faces technology is a server-side user interface component framework for Java technology-based web applications.

Implemented on top of the Servlet and JSP technologies.

Makes use of JSP tag libraries. Provides an MVC based web framework.

Copyright © Oded Nissan 2009

Java Server Faces (JSF)

Page 36: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Java Server Faces (JSF)

Page 37: JEE Course - JEE  Overview

JTA (Java Transaction API) JAAS (part of JavaSE) JNDI (part of JavaSE) JMX (part of JavaSE)

Copyright © Oded Nissan 2009

Other Relevant Technologies

Page 38: JEE Course - JEE  Overview

The Java™ Transaction API (JTA) allows applications to perform distributed transactions, that is, transactions that access and update data on two or more networked computer resources.

The JTA specifies standard Java interfaces between a transaction manager and the parties involved in a distributed transaction system: the application, the application server, and the resource manager that controls access to the shared resources affected by the transactions.

Copyright © Oded Nissan 2009

Java Transaction API

Page 39: JEE Course - JEE  Overview

A JTA transaction is controlled by the Java EE transaction manager.

JEE support declarative transactions, called Container Managed Transactions.

The JTA API can also be used directly by the developer.

JTA supports XA transactions.

Copyright © Oded Nissan 2009

Java Transaction API (JTA)

Page 40: JEE Course - JEE  Overview

Pluggable authentication framework Userid/password Smartcard Kerberos Biometric

Application portability regardless of authentication schemes underneath JAAS provides authentication scheme

independent API Authentication schemes are specified Login

configuration file, which will be read by JAASCopyright © Oded Nissan 2009

Java Authentication and Authorizations Service (JAAS)

Page 41: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

JAAS Pluggable Authentication

Page 42: JEE Course - JEE  Overview

Java Naming and Directory Interface Utilized by J2EE applications to locate resources

and objects in portable fashion Applications use symbolic names to find object

references to resources via JNDI The symbolic names and object references have to

be configured by system administrator when the application is deployed.

Copyright © Oded Nissan 2009

JNDI

Page 43: JEE Course - JEE  Overview

JMX technology provides a simple, standard way of managing resources such as applications, devices, and services.

JMX is used to monitor and manage the JVM itself (the jconsole application is an example).

In JEE JMX is used to manage server configuration and resources.

All applications server vendors provide JMX beans, which manage their servers.

Copyright © Oded Nissan 2009

Java management Extensions (JMX)

Page 44: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Java management Extensions (JMX)

Page 45: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Putting it All Together

Page 46: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

Putting it All Together

Page 47: JEE Course - JEE  Overview

JEE Application Servers

Copyright © Oded Nissan 2009

Page 48: JEE Course - JEE  Overview

JEE vendors provide their implementation of JEE technologies within an Application Server.

Each application server has its own implementation of JEE standards as well as some proprietary features.

Comprised of a Web Container,EJB Container and other server services.

Copyright © Oded Nissan 2009

JEE Application Servers

Page 49: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

The App server and JEE containers.

Page 50: JEE Course - JEE  Overview

WebSphere 7.0 – (IBM) Weblogic 10.0 – (formerly BEA now Oracle) Oracle Application Server 11.0 – Oracle. Sun Application Server 9.0 – (formerly Sun

now Oracle)WebSphere leads in market share.

Copyright © Oded Nissan 2009

Popular Commercial Application Servers (JEE 5 Complient)

Page 51: JEE Course - JEE  Overview

JBoss 5.0 - Redhat Glassfish 2.1- (formerly Sun now Oracle) Geronimo 2.1 – (Apache and IBM)

JBoss is the most popular,Glassfish’s future is uncertain after the Oracle acquisition, it is said to be very fast after some extensive code rewrites.

Copyright © Oded Nissan 2009

Popular Open source Application Servers (JEE 5 Compliant)

Page 52: JEE Course - JEE  Overview

Tomcat 6.0 – Apache Resin 3.0 – Caucho

Provide a web server and a web container without an EJB container JMS and some other features.

Very fast and lightweight. Good choice if you are only developing a web application.

Copyright © Oded Nissan 2009

Popular Open source Web Containers

Page 53: JEE Course - JEE  Overview

The JEE Development Environment

Copyright © Oded Nissan 2009

Page 54: JEE Course - JEE  Overview

Provided by Application Server vendors or open source projects.

Usually provided as plugins to popular IDEs such as Eclipse or NetBeans.

The tools help developers create JEE resources, debug and deploy them.

Copyright © Oded Nissan 2009

JEE Development Tools

Page 55: JEE Course - JEE  Overview

IBM – provides the RAD product (based on Eclipse) for developing for WebSphere.

JBoss and Weblogic provide plugins for Eclipse.

Sun provides plugins and integration with Netbeans.

The Eclipse project provides open source plugins for most application servers.

Copyright © Oded Nissan 2009

JEE Development Tools

Page 56: JEE Course - JEE  Overview

A JEE application is packaged into an EAR file. The EAR file contains Web modules, EJB

modules and utility jars. The Web application is packaged into a WAR

file, and the WAR file is packaged into the EAR.

The EJB’s are packaged into a special jar file which is the EJB module, which is packaged into the EAR file.

Copyright © Oded Nissan 2009

JEE Application Structure

Page 57: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

JEE Application Structure

Page 58: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

The EAR File Structure

Page 59: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

JEE projects in Eclipse

Page 60: JEE Course - JEE  Overview

Exercise

Copyright © Oded Nissan 2009

Page 61: JEE Course - JEE  Overview

Copyright © Oded Nissan 2009

The JEE Life Cycle- Development

Creation Assembly Deployment

Created by Component Developer

Assembledand Augmentedby Application

Assembler

Processed by Deployer

Deploy

EnterpriseComponents

JEE Container

JEE APPJEE Modules

Page 62: JEE Course - JEE  Overview

Intergration Frameworks JBoss Seam Spring Framework

Web Frameworks Spring MVC JSF Wicket GWT Tapestry

Copyright © Oded Nissan 2009

Popular JEE Frameworks

Page 63: JEE Course - JEE  Overview

What is JEE ? The JEE Architecture Overview of JEE technologies Putting it All Together JEE Application Servers JEE Development Environment

Copyright © Oded Nissan 2009

Summary – What did we learn ?