Agenda

The Changing Landscape

Introduction to J2EE

J2EE Components

Containers

Services

Connectors

JMS

J2EE 1.2 Vs J2EE 1.3

 

The Changing Landscape

 

Stubs and Skeletons

public interface Person {

      public int getAge();

}

 

public class PersonClient {

      public static void main(String[] args) {

            Person person = new Person_Stub();

            int age = person.getAge();

            System.out.println(“The age of the person is : ” + age);

      }

}

public class Person_Stub implements Person{

      public int getAge() {

            Socket socket = new Socket(“myhost”,9000);

            ObjectOutputStream outSream = new ObjectOutputStream(socket.getOutputStream());

            outStream.writeObject(“age”);

            outputStream.flush();

            ObjectInputStream inStream = new ObjectInputStram(socket.getInputStream());

            return inStream.readInt();

      }

}

 

public class Person_Skeliton extends Thread {

      PersonServer myserver = new PersonServer();

      public void run() {

            ServerSocket ss = new ServerSocket(9000);

            Socket socket = ss.accept();

            ObjectInputStream inStream = new ObjectInputStream(socket.getInputStream());

            String method = (String)inStream.readObject();

            if (method.equals(“age”)) {

                  ObjectOutputStream outStream = new ObjectOutputStream(socket.getOutputStream());

                  outStream.writeInt(myServer.getAge());

                  outputStream.flush();

            }

      }

}

 

Rising Complexity

 

 

…Raises New Questions ….

How many users can concurrently use the system?

How many objects can be instantiated in a given time-frame?

How many transactions can be processed per second?

New questions surround system scalability

and transaction throughput

 

… Which Multi-tier May Answer

Simplify the enterprise application scenario

Remodel application development in three tiers

Tier I: Presentation Logic Layer

Tier II: Business Logic Layer

Tier III: Data Access Logic Layer

Move business and data access logic to same/separate servers

Keep only presentation logic on Client

 

Moving to the Server Helps…

“Power” components no more limited by client capability

Pooling, sharing of scarce resources now possible from server-side

Replication and distribution of application

High scalability

Design efficiency only limit to performance

Support hundreds to millions of concurrent users

Incremental support from server-side for increasing number of concurrent users

 

 

… But New Challenges Appear

Multi-threading

Resource sharing

Replication

Load balancing

Multi-tier applications more difficult to build than client-server

Compatibility with widely heterogeneous middleware services

 

what is an application server ?

Sits in the middle tier

Automates complex multi-tier features

Manages, recycles scarce system resources

processes, threads, memory, db links, network sessions

Load balances to share processing across multiple systems

Access to infrastructure services

naming/directory, txn, persistence, security

Specific runtime environment

 

 

Where it Fits in!

Multi-tier Revisited

Fat client to thin client

move business and data access logic to server,

use client to store and run only presentation logic

Next generation client server

scalability

performance

reliability

reusability

flexibility

Emergence of Standards

Proprietary Application Servers

E-Commerce, E-Business Market drive

Standards come along

Java 2 platform, Enterprise Edition (J2EE)

Compliance gains importance

Standards emerge as Winner

 

J2EE - Platform for developing multi-tier enterprise applications.

Breaks the barriers between existing enterprise systems.

Unified standard wraps and embraces existing resources required by multi-tier applications

Component-based model

 

Why components

Re-usable parts

Collaborative environment

Focuses skill-sets

Lowers development costs

Lends itself to rapid recasting

 

J2EE Architecture

J2EE application model

Divides enterprise applications into three fundamental parts:

Components

Containers

Connectors

 

 

J2EE components

A J2EE component is a self-contained functional unit that is assembled into a J2EE application and communicates with other components

Types

Client components (web browsers, applets, applications)

Web components (servlets, jsps)

Business components (ejbs)

 

 

Web Components

Servlets and JSPs

a software entity that provides a response to a request.

typically generates the user interface for a Web-based application.

                       

Web Components - JSP

Provides an extensible way to generate dynamic content for a Web client.

A JSP page contains

Template data to format the Web document.

JSP elements and scriptlets to generate the dynamic content in the Web document.

Extensible through the development of custom actions, which are encapsulated in tag libraries.

Client Components

Applets and application clients

Execute in their own Java virtual machine.

 

Business Components - EJB

Server-side technology for developing and deploying components containing the business logic of an enterprise application.

scalable, transactional, and multi-user secure

Can be of three types

Session Beans

Entity Beans

Message Driven Beans

 

Session Beans

provide some service on behalf of a client and usually exists only for the duration of a single client-server session.

performs operations such as calculations or accessing a database for the client.

Represents business processes

Can be of two types

Stateless

Stateful

 

Entity Beans

Persistent object that represents data maintained in a data store;

Focus is data-centric.

entity bean, its primary key, and any remote references survive container crashes

Can be of two types

Container Managed Persistence

Bean Managed Persistence

 

Message Driven Beans

A message-driven bean is an asynchronous message consumer.

Invoked by the container as a result of the arrival of a JMS message.

 

What makes it Portable ?

Code written in Java

Written to standards

XML based component descriptors

Can be deployed on any J2EE implementation

 

Containers

Containers provide the runtime support for J2EE application components.

Component are installed in their containers during deployment

Interface between a component and the low-level platform-specific functionality that supports the component

Provided by a J2EE Product Provider

specification defines a set of standard services that each J2EE product must support. J2EE containers provide the APIs that application components use to access these services.

 

EJB Container

EJB 2.0 implementation

Full Life Cycle Support for all bean types

Stateful and Stateless session beans

Entity beans with container and bean managed persistence

Resource management

Concurrency control

Transaction and security semantics

Bean Pooling

 

Web Container

Controlled environment to run servlets, JSPs, htmls etc

Web engine

Servlet engine

JavaServer Pages compiler

Plug-in web container to popular web servers

Performance Optimizations to provide high scalability and concurrent usage.

Provides network services (by which requests and responses are sent), decodes requests, and formats responses.

support HTTP as a protocol for requests and responses,

 

J2EE Services

Services provided are

JAAS (Java Authorization and Authentication Service)

JTA (Java Transaction API)

JNDI (Java Naming and Directory Service)

RMI-IIOP

JDBC (Java DataBase Connectivity)

JMS (Java Message Service)

JavaMail

JAXP (Java API for XML Parsing)

J2EE™ Connector Architecture

 

Naming Services

provide application clients, enterprise beans, and Web components with access to a JNDI naming environment.

naming environment allows a component to be customized without the need to access or change the component’s source code.

container implements the component’s environment, provides it to the component as a JNDI naming context.

Tech details

A component creates a javax.naming.InitialContext object

looks up the environment naming context in InitialContext under the name java:comp/env.

object should be named within a subcontext of the naming environment according to the type of the object.

For example

EJBs are named within the subcontext java:comp/env/ejb

 JDBC DataSource references in the subcontext java:comp/env/jdbc.

 

Deployment Services

Allow components and applications to be customized at the time they are packaged and deployed.

J2EE applications are deployed as a set of nested units.

Each unit contains a deployment descriptor

an XML-based text file whose elements declaratively describe how to assemble and deploy the unit into a specific environment. Deployment

contain many elements related to customizing J2EE platform services such as transactions and security.

 

Deployment Units

Enterprise JavaBeans modules

contain class files for enterprise beans and an EJB deployment descriptor.

packaged as JAR files

Web modules

contain JSP files, class files for servlets, GIF and HTML files, and a Web deployment descriptor.

Web modules are packaged as WAR files

Application client modules

contain class files and an application client deployment descriptor

packaged as JAR files

 

Transaction Services

Transactions – ACID property

Atomicity

Consistency

Isolation

Durability

J2EE transactions are flat

J2EE platform implicitly handles many transaction details,

 Transaction propagation

coordinating among multiple transaction managers.

EJB Transactions

Bean Managed Transaction Demarcation

EJB manages all aspects of transaction

Container Managed Transaction Demarcation

Container container handles transaction management

based on the Application Assembler’s deployment instructions

Entity Beans can use only Container Managed Transaction Demarcation

 

Security Services

Ensure that resources are accessed only by users authorized to use them.

Access control involves two steps:

Authentication

Authorization

 

Security Methodologies

Declarative security

Programmatic security

 

Authentication

entity must establish its identity through authentication.

typically does so by providing authentication data

entity that can be authenticated is called a principal.

principal can be a user or another program

 

Types of Authentication

Basic

Digest

Form Based

Certificate

 

Authorization

system determines whether the principal is authorized to access resources based on the security policies

Security role - logical grouping of users that is defined by an Application Component Provider or Application Assembler.

Each security role is mapped by a Deployer to principals in the deployment environment.

Control access to an enterprise bean’s methods by specifying the method-permission

 

Service Technologies

JDBC API

provides database-independent connectivity between the J2EE platform and a wide range of tabular data sources.

Perform connection and authentication to a database server

Manage transactions

Move SQL statements to a database engine for preprocessing and execution

Execute stored procedures

Inspect and modify the results from Select statements

Service Technologies

Java Transaction API (JTA)

allows applications to access transactions in a manner independent of specific implementations.

 Java Transaction Service (JTS)

specifies the implementation of a transaction manager which supports JTA

Service Technologies

JNDI

Provides naming and directory functionality.

JNDI is independent of any specific implementations, applications can use JNDI to access existing naming and directory services.

Connector Architecture

Standard API for connecting the J2EE platform to enterprise information systems

 

Communication Technologies

Internet protocols – TCP/IP, HTTP, SSL

Remote method invocation protocols – RMI, JRMP

Object Management Group protocols - IIOP

Messaging technologies – JMS, JavaMail

Data formats – HTML, Image, JAR, Class, XML

 

Interoperability

J2EE applications to connect to legacy systems using CORBA or low-level Socket interfaces.

J2EE applications to connect to other J2EE applications across multiple J2EE products, whether from different Product Providers or from the same Provider, and multiple J2EE platforms.

 

 

Connectors

Connectors sit beneath the J2EE platform

Define a portable service API to plug into existing enterprise vendor offerings

Provide standard client API

 

Where it all fits together ?

Platform Roles

J2EE Product Provider

Application Component Provider

Application Assembler

Deployer

System Administrator

Tools Provider

How the Roles Collaborate

J2EE Product Provider

Implementer and supplier of a J2EE product that includes the component containers, J2EE platform APIs etc.

Free to implement interfaces that are not specified by this specification

Must provide application deployment and management tools.

 

Application Component Provider

Multiple roles for Application Component Providers

HTML document designers

document programmers

enterprise bean developers

Use tools to produce J2EE applications and components.

 

Application Assembler

Takes a set of components developed by Application Component Providers and assembles them into a complete J2EE application (.ear) file.

Responsible for providing assembly instructions describing external dependencies of the application that the Deployer must resolve in the deployment process.

 

Deployer

Responsible for deploying web applications and Enterprise Java Beans components into a specific operational environment.

Responsibilities include

Installation of application on server

Configuration of application

Execution of newly installed application

 

System Administrator

Responsible for the configuration and administration of the enterprise’s computing and networking infrastructure.

Uses runtime monitoring and management tools provided by the J2EE Product Provider to accomplish these tasks.

 

Tools Provider

Provides tools used for the

Development

Packaging

Assembling

Deployment

 

J2EE Application Life Cycle

Application Assembly & Deployment

Provide scalable and modular application assembly, and portable deployment of J2EE applications into any J2EE product.

JMS

Standard API for messaging

Common way for Java programs to create, send, receive and read an enterprise messaging system’s messages.

Asynchronous processing

Two messaging models

Point to Point Model

Publish Subscribe Model

 

Point-to-Point Messaging Model

 

Publish/Subscribe Messaging Model

A JMS application is composed of

JMS Clients - java language programs that send and receive messages.

Messages - communicate information between its clients.

JMS Provider - messaging system that implements JMS in addition to the other administrative functionality

Administered Objects - preconfigured JMS objects created by an administrator for the use of clients.

 

J2EE 1.2 Vs J2EE 1.3

J2EE 1.3 requires J2SE 1.3.x

JMS provider supporting both Topics and Queues is required.

All referenced specifications are updated to reference their most recent versions.

EJB 2.0

JSP 1.2

Servlet 2.3

Added the following required APIs: JAXP 1.0, JCX 1.0, JAAS 1.0.

Requiring support for previous versions as well.

 

Where J2EE is headed ….

Management and Deployment Standards

Security APIs

Deployment APIs

Management APIs

Web Services