100% found this document useful (1 vote)
376 views

J2EE Architecture Overview

The document provides an overview of the J2EE architecture. It describes the evolution of web applications from static to dynamic content using technologies like servlets, JSP, EJBs and more. It explains the model-view-controller pattern and how it applies to J2EE. It also outlines the core components of J2EE like web/enterprise beans, containers and standard services provided.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
376 views

J2EE Architecture Overview

The document provides an overview of the J2EE architecture. It describes the evolution of web applications from static to dynamic content using technologies like servlets, JSP, EJBs and more. It explains the model-view-controller pattern and how it applies to J2EE. It also outlines the core components of J2EE like web/enterprise beans, containers and standard services provided.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

J2EE Architecture Overview

Unit Objectives
Why is this topic important? Servlets and JSP technology are important parts of J2EE In this unit you see how Servlets and JSP fit into the wider picture After completing this unit, you should be able to: Understand the stages in the development of Web applications Describe the model-view-controller (MVC) design pattern Understand the importance of MVC in J2EE applications Describe the components, containers, and services provided by a J2EE platform Describe the architecture of J2EE Understand the application model for J2EE applications

Web Application Evolution Static


Client Web Browser Network HTTP Request Server

HTTP Response

Web Server File System

Organizations want to make their information available to as many people in the world as possible This can be achieved by using the Web, delivering the information as static HTML pages

Web Application Evolution Applets


Client Web Browser with JVM HTTP Response Network HTTP Request Web Server File System With static HTML, users see passive page presentations which are always the same Presentation can be improved with Java applets or other client-side programs Server

Web Application Evolution Servlets


Client Network Web Browser
Requests for static resources HTTP Request

Server

Web Server Plug-in


Requests for dynamic resources

HTTP Response

Web Server File System

Dynamic response

Web Container

Applets cannot access data on back-end systems A Web container can provide server-side components (such as servlets) to generate dynamic content

Web Application Evolution JSP Pages


Request Response
service(req,res)

Web Container
methods()

Servlet

JavaBean
methods()

forward(req,res)

RequestDispatcher
service(req,res)

JavaServer Page Servlets give poor separation between business logic and presentation logic Use JavaServer Pages and JavaBeans to improve separation

Web Application Evolution EJBs


Web Browser HTTP Server Web Container EJB Container Java Application

EJBs: Are available remotely over the network Encapsulate business rules, application-specific logic, and access to data Can be used by many different types of application concurrently Represent a central repository of business logic

Web Application Evolution Scalability


Web Browser Web Container EJB Container

HTTP Server

Web Container

EJB Container

Business requirements often involve high availability Improved performance may be required as business grows Both these requirements can be achieved through scaling Servers can provide redundancy in the system By sharing the load between servers, performance can be enhanced

The Model-View-Controller Pattern


Model-View-Controller (MVC) is a design pattern Very widely used and regarded as a core concept in J2EE development Various practical benefits (covered in more detail later)
Promotes code reuse Reduces development time

The model
Represents the underlying data and business logic in one place Contains no information about the user interface

The view
The user interface things the user can see and respond to Represent a window into the model there can be many of these

The controller
Connects the model and the view Used to communicate between the model and view

A fourth layer persistence is often added to the pattern

MVC Application to J2EE


Controller
Web Browser 1 Transfer Servlet 2 4 J2EE Server

Model
Transfer EJB Transfer Result JavaBean 3

7
HTML HTML Doc Doc

View

Balance JSP Database

Persistence

MVC Benefits
Promotes code reuse The purpose of the model is to provide business logic and data access in one place This logic can be reused in many applications at the same time without the need for any extra coding Reduces development time The model, view, and controller can be developed in parallel More maintainable The view can be changed without affecting the model
A Web page view can be changed to display a chart instead of a table with no change to the model

The model can be changed without affecting the view


For example, the way in which an insurance premium is calculated may change, but the interface to the business method remains the same

Data can be moved without affecting the view or model


The layering concept allows for more flexibility

J2EE Introduction
The Java 2 Platform Enterprise Edition (J2EE) Specification consists of: The J2EE Platform
A standard platform of containers, services and communications

The J2EE Compatibility Test Suite


To verify that a J2EE platform product complies with the standard WebSphere Application Server 5.0 is J2EE 1.3 compatible WebSphere Application Server 6.0 is J2EE 1.4 compatible

The J2EE Reference Implementation


For prototyping J2EE applications and for providing an operational definition of the J2EE platform

The J2EE Blueprints


Best practices for developing multitier, thin-client applications

J2EE is developed using the Java Community Process Collaboration between major enterprise software vendors IBM actively contributes to the J2EE development process

J2EE Components
J2EE defines four types of components which must be supported by any J2EE product Applets
Graphical Java components which typically execute within a browser Can provide a powerful user interface for other J2EE components

Application client components


Java programs which execute on a client machine and access other J2EE components

Web components
Servlets and JavaServer Pages These provide the controller and view functionality in J2EE

Enterprise JavaBeans
Distributed, transactional components for business logic and database access

Component deployment can be managed using deployment descriptors (except applets)

J2EE Containers
J2EE defines four types of container. Containers manage the components they contain: Applet container
Typically provided by a browser, possibly using the Java Plug-in

Application client container


A stand-alone Java Runtime Environment

Web component container


Provided by a J2EE application server

Enterprise bean (EJB) container


Provided by a J2EE application server

J2EE components never interact with other J2EE components directly They depend on the run-time support of containers Interaction takes place using services provided by containers

J2EE Architecture
RMI-IIOP

J2EE Multitier Model


Client Tier
Java Client

Middle Tier
EJB Container (EJBs)

Enterprise Information Systems Tier


Legacy Applications Relational Databases Enterprise Resource Planning Systems

Web Client Web Client

Web Container (Servlets, JSPs, HTML)

Firewall

J2EE Services (JNDI, JMS, JavaMail)

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

J2EE Standard Services - Overview


The standard services provided in J2EE include the following: Hypertext Transfer Protocol (HTTP) Remote Method Invocation/Internet Inter-ORB Protocol (RMI-IIOP) Java Interface Definition Language (Java IDL) Java Transaction API (JTA) Java Message Service (JMS) JavaMail JavaBeans Activation Framework (JAF) Java API for XML Parsing (JAXP) Web Services (including JAX-RPC and SAAJ) J2EE Connector Architecture (JCA) Java Authentication and Authorization Service (JAAS) Java Authorization Service Provider Contract for Containers (JACC) Two services previously in J2EE now in J2SE in version 1.4: JDBC (relational database connectivity) JNDI (Java Naming and Directory Interface)

J2SE Standard Services - JNDI


Java Naming and Directory Interface Standard Extension JNDI provides directory and naming functionality The API is independent of the directory implementation JNDI enables applications to discover and retrieve objects of any type JNDI is used to register EJBs and to access server-provided objects

J2SE Standard Services - JDBC


JDBC is an API that provides vendorindependent connectivity to a variety of relational databases JDBC functionality provides basic connectivity and core database-related classes The Standard Extension provides additional functionality The Java Naming and Directory Interface (JNDI) can be used to manage data sources and connections Connection pooling can be provided by database vendors to enhance performance, particularly for server applications Support for distributed transactions, including support for the standard twophase commit protocol used by the Java Transaction API (JTA)

J2EE Standard Services - Communications


Hypertext Transfer Protocol The HTTP client-side API is defined by the java.net package The server-side API is defined by the Servlet and JSP interfaces The client- and server-side APIs also support HTTP over secure sockets (HTTPS) RMI-IIOP Allows RMI-style programming independent of protocol Implementation supports both the RMI protocol (JRMP) and CORBA IIOP Java IDL Allows J2EE components to invoke external CORBA objects using IIOP, which may be written in any language

J2EE Standard Services - JTA


Java Transaction API Standard Extension JTA specifies interfaces between a transaction manager and the parties involved in a distributed transaction system
The application, the resource manager, and the application server

JTA is implementation-neutral For application developers, the UserTransaction interface is the key Application developers normally want to use container-managed transaction demarcation, instead of using JTA

J2EE Standard Services - Messaging


Java Messaging Service Standard Extension The Java Message Service is a standard, vendor-neutral API used to access enterprise message systems Analogous to JDBC for databases Allows for the delivery of asynchronous messages in an application
The JMS client sending the message does not have to wait until the message has been processed

JavaMail Standard Extension and JAF JavaMail is used to add e-mail capability to applications Includes classes which encapsulate common mail functions and protocols Uses the JavaBeans Activation Framework to encapsulate message data

J2EE Standard Services - JAXP


Java API for XML Parsing (JAXP) JAXP enables applications to parse and transform XML documents
Independent of XML processor implementation

JAXP includes industry standard components


DOM (Document Object Model) SAX (Simple API for XML Processing) XSLT (XML Style Language Transformations)

JAXP adds additional functionality beyond these standards Java API for XML Remote Procedure Call (JAX-RPC) Enables Java applications incorporating XML-based RPC functionality according to the SOAP (Simple Object Access Protocol) 1.1 specification Java API for XML Registries (JAX-R) APIs to access UDDI Registry

J2EE Standard Services - Web Services


Web Services now part of J2EE 1.4 JAX-RPC 1.1 JAX-R Web Services for J2EE specification (JSR 109)
Standard deployment model of Web Services application within a J2EE Application Server

WS-I Basic Profile 1.0


Guidelines for interoperability in a heterogeneous environment

SAAJ 1.1 SOAP with attachments API for Java

J2EE Standard Services - Connectors


J2EE Connector Architecture (JCA) Allows resource adapters that support access to Enterprise Information Systems (EIS) to be plugged into J2EE products Defines a connection management contract between a J2EE server and a resource adapter to allow connection pooling to EIS systems Defines a transaction management contract between the transaction manager and an EIS that supports transactional access
Also supports transactions that are managed entirely by an EIS

Defines a security contract that enables secure access to an EIS

J2EE Standard Services - JAAS


Java Authentication and Authorization Service (JAAS) JAAS can be used for two purposes:
Authentication of users, to reliably and securely determine who is currently executing Java code, regardless of how the code is running Authorization of users to ensure they have the permissions required to do the actions performed

JAAS authentication is pluggable


Java applications using JAAS remain independent from underlying authentication technologies

JAAS authorization extends the existing Java security architecture


Access control can be based not just on what code is running, but also on who is running it

Java Authorization Service Provider Contract for Containers (JACC)


Allows custom authorization service providers to be plugged into the Application Server

J2EE Standard Services - Containers


Different containers have different service requirements
Optional Package EJB 2.1 Servlet 2.4 JSP 2.0 JMS 1.1 JTA 1.0 JavaMail 1.3 JAF 1.0 JAXP 1.1 Web Services JCA 1.5 JAAS 1.0 JACC
Appl Client

Applet " " " " " " " " " " " "

Web ! (client) ! ! ! ! ! ! ! ! ! ! !

EJB ! " " ! ! ! ! ! ! ! ! !

! (client) " " ! " " " ! ! " ! "

J2EE Interoperability
The J2EE platform includes interoperability requirements J2EE may be used to integrate systems
Applications written in different languages, like C++ or Visual Basic Applications running on different platforms, such as PCs or UNIX workstations Stand-alone Java-based applications that are not directly supported by J2EE

The interoperability requirements of J2EE make this possible


J2EE applications can connect to legacy systems using CORBA or lowlevel socket interfaces J2EE applications can connect to other J2EE applications across multiple J2EE products

Interoperability is achieved through the use of standard protocols for communication and data transfer

J2EE Platform Roles


J2EE defines the following roles J2EE product provider
Implements a J2EE product that provides containers, APIs, and other features

Application component provider


Produces application building blocks (HTML documents, EJBs, JSPs, and so forth) In many cases this role will be further subdivided

Application assembler
Takes components developed by component providers and assembles them into complete a J2EE application

Deployer
Deploys, configures, and runs EJBs and Web applications

System administrator
Configures and administers the infrastructure

Tool provider
Provides application component development and packaging tools

J2EE Implementation
The J2EE Compatibility Test Suite Includes over 15000 tests for J2EE 1.4 Tests a candidate platform for J2EE compatibility
Checks that all the necessary operations (for example, in required APIs) are possible Checks that the behavior of the APIs meets the specification Checks end-to-end compatibility by performing operations on J2EE components and back-end systems and checking the results

Ensures portability between platforms The J2EE Reference Implementation Provides an operational definition of the J2EE platform
The purpose is to validate the specification and act as a reference for J2EE platform providers

Can be used by developers to confirm portability Included as a binary with the J2EE Software Development Kit (free for development and testing)

Unit Summary
This unit covered the following topics: The stages in the development of Web applications The model-view-controller (MVC) design pattern The importance of MVC in J2EE applications The components, containers, and services provided by a J2EE platform The architecture of J2EE The application model for J2EE applications

Checkpoint
1. Briefly describe the MVC pattern. 2. What are the four J2EE containers? 3. List the full names and purposes of the following J2EE services:
JCA JTA JAXP JMS

You might also like