JEE Course - JEE Overview

Preview:

DESCRIPTION

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

Citation preview

JEE Overview

Copyright © Oded Nissan 2009

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

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?

The Java Platform

Copyright © Oded Nissan 2009

What is JEE ?

High-EndServer

Java Technology Enabled Desktop

WorkgroupServer

Java Technology Enabled Devices

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

Distribution Transactions Security Scalability Persistence

Copyright © Oded Nissan 2009

Why do we need JEE ?

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.

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

Component provider Bean provider

Application assembler Deployer Platform provider

Container provider Tools provider System administrator

Copyright © Oded Nissan 2009

JEE Development Roles

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

The JEE Architecture

Copyright © Oded Nissan 2009

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

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

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

Copyright © Oded Nissan 2009

Three-Tier architecture

Web Tier EJB Tier

Copyright © Oded Nissan 2009

JEE Tier Architecture

JEE Technologies

Copyright © Oded Nissan 2009

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

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

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

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

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

Copyright © Oded Nissan 2009

Web Services Architecture

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

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)

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

Copyright © Oded Nissan 2009

Benefits of EJB

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

Copyright © Oded Nissan 2009

EJB Example

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)

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)

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

Copyright © Oded Nissan 2009

Servlet Example

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

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 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

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)

Copyright © Oded Nissan 2009

Java Server Faces (JSF)

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

Copyright © Oded Nissan 2009

Other Relevant Technologies

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

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)

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)

Copyright © Oded Nissan 2009

JAAS Pluggable Authentication

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

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)

Copyright © Oded Nissan 2009

Java management Extensions (JMX)

Copyright © Oded Nissan 2009

Putting it All Together

Copyright © Oded Nissan 2009

Putting it All Together

JEE Application Servers

Copyright © Oded Nissan 2009

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

Copyright © Oded Nissan 2009

The App server and JEE containers.

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)

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)

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

The JEE Development Environment

Copyright © Oded Nissan 2009

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

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

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

Copyright © Oded Nissan 2009

JEE Application Structure

Copyright © Oded Nissan 2009

The EAR File Structure

Copyright © Oded Nissan 2009

JEE projects in Eclipse

Exercise

Copyright © Oded Nissan 2009

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

Intergration Frameworks JBoss Seam Spring Framework

Web Frameworks Spring MVC JSF Wicket GWT Tapestry

Copyright © Oded Nissan 2009

Popular JEE Frameworks

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 ?

Recommended