Programming Technologies
Peter Komisar © Conestoga College  version 1.1  Fall / 2008
Reference:  Draft Document for Review August 22,20075:25 pm
SG24-7501-00 Rational Application Developer V7 Programming Guide.,
'Java Servlet Programming', Jason Hunter & William Crawford

This is a synopsis of information found in the latter part
of the second chapter of the Draft Document for Review
August 22, 2007 5:25 pm SG24-7501-00 Rational Application
Developer V7 Programming Guide. It has been prepared
for private academic purposes and is not an effort to publish
the contained material.



We continue our overview with an extensive survey
of the different programming technologies that are
used in Enterprise Applications. We cannot within
the time constraints of a single course utilize all these
technologies however it is good to know what is out
there.

HTML & Static Content

static web pages - content is fully determined by the
content of a file on a web server, usually propagated
over HTML

Rational Sample
 
A static page telling bank customers where banks
are located and the hours they keep.

HTTP follows a request response model. HTTP 1.1
defines the following methods.

HTTP 1.1 Methods
GET and POST are the only commands that are
commonly  used in Web applications.

GET

GET requests are typically invoked when addresses are
entered in browser location fields, sites are stored as
bookmarks or locations are targeted using a hyperlink
inside an HTML document.

POST

POST requests are normally used with forms. A user
completes and submits an HTML form for processing.
This request type is most often used with dynamic Web
applications, where business logic is involved in processing
the values that are submitted.

// posting from an HTML form is a common feature of web applications

Status Codes

The first line of the HTTP response indicates the outcome of
the request. In the event of an error, this information informs
the user of the problem.


Status Code Classes

 // common status codes are 200(OK) and 404(Not Found).


Cookies

Cookies are a mechanism that servers can use to
store and retrieve information on a client. Cookies
contain textual information, within a size limit of 4KB
per cookie.


Cookies Attributes

Cookie Life Cycle

1 ) The user connects to a server that wants to install a cookie.
2 ) The server sends the cookie name & value in the HTTP
      response.
3 ) The browser receives the cookie and stores it.
4 ) Each time the user sends a request for a URL at this domain,
     the browser sends any cookies for that domain that are not
     expired.
5)  The cookie 'crumbles' at the expiration date.

Non-persistent cookies, those created without an expiry
date last only for the duration of the users browser session.

Persistent cookies are set once and remain on the users
hard drive until the expiration date of the cookie.

Cookies are widely used in dynamic Web applications.
More on cookies shortly.


Cookie Reference

http://wp.netscape.com/newsref/std/cookie_spec.html


HyperText Markup Language (HTML)

HTML uses tags to structure text into headings, paragraphs,
tables and hypertext links, etc.


Basic HTML Tags


A Simple HTML Example

<HTML>
<HEAD>
<TITLE>Hello HTML!</TITLE>
</HEAD>
<BODY style="font-family: Helvetica,Arial,sans-serif;>
<H2>HELLO HTML!</H2>
</BODY>
</HTML>

// a little bit of style syntax touched on in the next topic


A Simple HTML Page With a Form Element

<HTML>
<HEAD>
<TITLE>Hello Form</TITLE>
</HEAD>
<BODY>
<FORM METHOD=GET ACTION="Hello_Form">
Hello! May I ask, who are you?
<INPUT TYPE=TEXT NAME="name"<P>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
<HTML>


Cascading Style Sheets (CSS)

While HTML tags can be used to specify styling attributes
'the best practice' is to use a cascading style sheet (CSS).
A CSS file defines a set of style rules that an control how
an HTML or XML file is rendered in a browser or or how it
is formatted for print.

// key is separation

CSS separates presentation information away from the
data a document contains. CSS files can be referenced
so they apply to an entire Web site to provide continuity
to titles, fonts, and colors.

CSS Rule Example

Rules are made up of 'selector' and 'declaration'.  The selector
in the following example H2, is the link between the HTML
document  and the style sheet, and all HTML element types
are possible selectors.

The declaration has two parts: Property (color) and value (red):


Example


H2 { color: red }

 // H2 is the 'selector' and is followed by the declaration


CSS Reference


http://www.w3.org/Style/CSS/


Development Environment Requirements Provided by Eclipse
and Rational Dev 7


Dynamic Web applications

Dynamic Web applications - applications accessed
using HTTP typically with a Web browser as the client-
side interface where logic and page generation is
handled by software on the server.

Many technologies can be used however WebSphere
focuses on Java technologies.

Redbook Example

The bank application expands to include Internet
banking. allowing customers to access their
account information online and perform some
transaction like paying bills.


Simple Web applications

The simplest web application using Java involves
the use of Java servlets and JavaServer Pages.
 
Servlets and JSPs are both part of the Java Enterprise
Edition (Java EE). Servlets in the early days started as
an extension package with it's own standalone API.
Servlets and JSPs can be hosted in a non-J2EE
environment like Apache Tomcat.


Jakarta Tomcat:Reference


http://jakarta.apache.org/tomcat/


Following are Sun Servlet and JSP sites.


Sun Servlets Site


http://java.sun.com/products/servlet/


Sun's JSP Site


http://java.sun.com/products/jsp/

// J2EE V1.4 specifies Servlet V2.4 and JSP V2.0.


Servlets


A servlet are Java classes run in server software
called web containers, also known as servlet engines.
Servlet are designed to process an HTTP request
and programmatically supply an HTTP response.
Because the response is typically to a browser this
typically involves streaming HTML tags along with
the data back to the client.


HttpServlet


HttpServlet in the javax.servlet.http package is
specialized for processing HTTP request and
responses. They are programmed similar to Java
applets where life cycle methods are overridden
to do the work a programmer wants done.

HTTP's GET and POST methods are encapsulated
in the doPost and doGet methods.

Key HttpServlet Methods

Deployment Descriptor

When a HTTP request is received, the Web container
checks a configuration file, known as a deployment
descriptor to discover which servlets class corresponds
to the URL that was provided.

If the servlet class is not loaded yet it's init( ) method
is called to construct it. This leads to the first call on
a servlet being longer than subsequent calls.

The Servlet init( ) Method

public void init( )

If this class has already been loaded and an instance
is running in the servlet engine, then the standard service( )
method of the  servlet is invoked. The service( ) method
has the following form.

Service Method

On examining the HTTP request type, the service method
decides whether to delegate processing to the doPost( )
or doGet( ) method.

Servlets are powerful as they can access many resources
on behalf of a client such as a database, a messaging
system or an Enterprise JavaBean.

Servlets also has a destroy( ) method that is used when
a servlet is unloaded from a Web container.

Servlets destroy( ) method

public void destroy ()


Typical Processing Pattern


The typical processing pattern is as follows:

Summary of the Typical Servlet Processing Pattern
While the last state can be carried out by the servlet
in println statements, this is not the recommended
approach as HTML and Java code is co-mingled
which makes maintenance messy. IBM Rational supplies
HTML design tools to keep the HTML and Java separate.

The following Servlet is an example of the 'bad practice'
of mixing languages in the same script. On the other hand
it is a very succinct example of a Servlet by a couple of
the servlet pioneers.

Hello World in a Servlet

// from 'Java Servlet Programming', Jason Hunter & William Crawford
// or HelloWorldExample in Tomcat

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
//import javax.servlet.http.HttpServletResponse;


public class HelloWorld extends HttpServlet{

public void doGet(HttpServletRequest req, HttpServletResponse res)
                           throws ServletException, IOException{
      res.setContentType("text/html");
      PrintWriter out=res.getWriter( );
      out.println("<HTML>");
      out.println("<HEAD><TITLE>Hello Earth</TITLE></HEAD>");
      out.println("<BODY>");
      out.println("<BIG>Hello Mother Earth!</BIG>");
      out.println("</BODY></HTML>");
      }
  }


IBM Rational recommends as a best practice the use
of a dedicated display technology, such as Java Server
Pages.


JavaServer Pages (JSPs)


JSPs are server-side HTML pages that include a
scripting technology enabling Java code to be
embedded within Web pages. From a client's view,
JSPs appear as regular HTML pages. The Java
tags which are invisible on the client side supply
dynamic content.

Java Server Pages are compiled at runtime into
servlets that execute to deliver the associated HTML.
Subsequent calls on the JSP re-execute the compiled
servlet.

JSP scripting elements are summarized below.


Summary of JSP scripting elements


Directives

Directives are instructions are processed by the JSP
at time of compilation.

Example

<%@ ... %> or <jsp:directive.page ... />

Declarations

Declarations are used to declare variables and methods.

Example

<%! ... %> or <jsp:declaration> ... </jsp:declaration>

Expressions

Java expressions are evaluated to a String which
is entered into the HTML

Example

<%= ... %> or <jsp:expression ... />


Scriptlet Blocks


Scriplet Blocks are sections of Java code embedded
within a JSP

<% ... %> or <jsp:scriptlet> ... </jsp:scriptlet>


The Use Bean Tag

UseBean Retrieves an object from a particular
scope or creates an object and puts it into a
specified scope

Example


<jsp:useBean ... />


The Get Property Tag


GetProperty calls a getter method on a bean,
converts the result to a String, and places it in
the output

Example

<jsp:getProperty ... />


The Set Property Tag


The Set Property Tag calls a setter method
on a bean

Example

<jsp:setProperty ... />


The Include Tag


Include is used to include content from another
page or resource.

<jsp:include ... />


Forward

Forwards the request processing to another URL

Example

<jsp:forward ... />

Tag Extensions // custom tags

The JSP scripting elements can be extended,
using a technology known as tag extensions or
custom tags. Custom tags allow a developer to
create new tags associated with code that may
address a wide range of programming tasks.

Tag extensions are grouped in tag libraries.
Some of the standard JSP tags are also XML-
compliant version, such as <jsp:useBean ... />.
This allows them to pass  XML validation.

While JSPs generate HTML output by default, it
sometimes is desirable to convert to XML in some
situations. For example, XML output can be
converted to HTML for Web browsers, Wireless
Markup Language (WML) for wireless devices, or
VoiceXML for voice interfaced systems.

JSPs can also be  XML based.

Following is a simple of JSP just to show
how the active Java elements are nested inside
HTML syntax. The page is saved to with a .jsp
extension.

Sample JSP

<html>
<head>
<title>
</title>
</head>
<body>

The square root of 12345 is <%= Math.sqrt(12345) %>
<HR/>
<%@ include file="Summer.html">
</body>
</html>




Tag Libraries

Tag libraries are a standard way of packaging tag
extensions for applications using JSPs.

In some ways JSPs when used with inline scripts
have the reverse problem associated with servlets.
While in a servlet, HTML is inter-mingled with the
Java code, in JSPs  Java code ends up interlaced
with the HTML code. Tags provide a cleaner
separation of the two.

View Helper Design Pattern

The View Helper design pattern has been documented
to address this problem. Tag extensions are a standardized
means of implementing this pattern.

// see http://java.sun.com/blueprints/corej2eepatterns/Patterns/

Summary of Approach
The JSP specification include classes that can
act as bases for tag extensions. Further JSP v2.0
provides a simplified means of defining tag
extensions that eliminates the need for a detailed
knowledge of Java.

Following are samples of tags supplied in the JSP
Standard Tag Library (JSTL). The JSTL is includes
several tag libraries.

Summary of Tags

Other tag libraries are also available. The Jakarta Taglibs
Project  may be found at http://jakarta.apache.org/taglibs/.
Custom tags can also be developed. 


Expression Language


Expression Language or EL was first developed
as part of the JSP Standard Tag Library. It is now
a standard part of JSP V2.0 specification. EL
provides a standard way of writing expressions
within a JSP.


Filters

Filters are a regular part of the Servlet API. Filters are
objects that can process request before they arrive at a
servlet or after a response leaves a servlet. Filters can
also form 'chains' of processing. The deployment
descriptor is used in configuring which filters apply to
which servlets or JSPs. 

Filters are useful in actions such as authentication
where a filter can be used to apply a security constraint
to a set of objects.


Life Cycle Listeners

Life cycle events are generated when servlet contexts
and sessions are initialized and destroyed and when
attributes are added or removed from a context or
session.

Following are the listeners available

Life Cycle Listeners
// in java.servlet or javax.servlet.http package


IBM Eclipse and RAD 7 Development Features For Servlets & JSPs
Following is a diagram summarizing the various way
in which the Java web components can be used in
a web application. Usually a servlet receives the request,
uses a JavaBean which gets it's data from a database.
The data is processed and returned to the client in the
form of a Java Server Page.


Java Components of a Simple Web Application

Web Browser-> Java Servlet-> JavaBean-> Relational Database
^ | ^
| v |
|____Java Server Page_____|

Struts

The model-view-controller (MVC) architecture pattern
widely used in object-oriented systems. MVC allows
the division of responsibility to well-defined roles.


Component Roles of MVC Architecture

In Java-based dynamic Web applications, the servlet
normally serves as controller, the JSP fills the role of
view and JavaBeans or Enterprise JavaBeans, together
with associated elements,  act as the model.

However, Java EE V1.4 does not provide a standard
way of implementing the MVC pattern.

Struts is an MVC Framework that provides a standard
way of applying the MVC architecture to Java Web
Applications.


Struts Reference Site


http://struts.apache.org/

// more detail in chapter 13

Strut's ActionServlet Class

ActionServlet serves in the role of controller and provides
an entry point to a Strut application. ActionServlet uses
an ActionMapping object to determine which Action object
will handle the request. The Action object communicate
with the model and indicates what should happen next.
The ActionServlet uses this information to select the
appropriate response agent which is typically a JSP to
provide a dynamic response to a client.  This is the view.

Other Strut Features

IBM RAD Strut Development Features


// Eclipse has a Struts Plug In



JavaServer Faces (JSF)

A regular Java GUI allow the developer to build
complex visual interfaces with convenient event
handling code to process the user's input. HTML
components are relatively course in nature. The
request response model makes creation of event-
driven graphical interfaces problematic.

A richer interface is desirable and in IBM Rational
Banking application, Java Server Faces are used
to achieve this.

Additionally, a simple, lightweight, object-oriented
database access system, which removes the need
for direct JDBC coding would also be a desirable
feature. Again the JSF Framework comes to our
assistance in facilitating development of Java Web
applications.



Summary of JSF Features

The JSF specification

http://www.jcp.org/en/jsr/detail?id=127


Service Data Objects (SDO)


SDO is a data programming architecture and API
for the Java platform. It was designed to simplify how
applications handle data. SDO enables applications,
tools, and frameworks to more easily to query, view,
bind update, and introspect data.

"SDO was originally developed by IBM and BEA
Systems and is now the subject of a Java specification
request (JSR-235), but has not yet been standardized
under this process."

SDO allow accessing data from different sorts of data
sources, including relational databases, XML data sources,
Web services, and enterprise information systems, (EIS) .


Major SDO Components


// "This book covers the use of these technologies in WebSphere
// Studio rather than the Rational Software Development Platform, but
// the coverage of the technologies is still very useful."



Support for JSF and SDO in IBM RAD  7.0



Eclipse has a JSF Subproject at:


Eclipse JSF Subproject


http://www.eclipse.org/webtools/jsf/download.html




Java Components of a Simple Web Application


Browser <-> JSF Servlet /JSP Using JSF <->
<-> SDO <-> SDO Mediator <-> Database

AJAX


AJAX is an acronym for Asynchronous JavaScript™
and XML. AJAX is used to create interactive web apps.
AJAX seeks to make pages feel more responsive. This
is done by exchanging incremental bits of data with the
server behind the scenes.  It is based on the use of
JavaScript and XML.


Portal Applications

Definition

"Portal software - a type of development tool used to
create a portal (starting point) on a company's intranet
so that employees can find a centralized starting place
for access to consolidated enterprise-related functions,
such as e-mail, customer relationship management
(CRM) tools, company information, workgroup systems,
and other applications.  … "      -    from BitPipe.com

Portal applications are characterized by the following features.


Features of Portal Applications



The Banking Scenario


A portal application is used to enhance the user experience.
The Internet Banking Web Application is seamlessly integrated
with a customers  folio of bank products,  (accounts shares,
insurance etc.). The user enjoys a convenient single point of
entry to all services.


IBM WebSphere Portal


"WebSphere Portal runs within WebSphere Application Server,
using the J2EE standard services and management capabilities
of the server as the basis for portal services. WebSphere Portal
provides its own deployment, configuration, administration, and
communication features.

The WebSphere Portal Toolkit is provided as part of the Rational
Application Developer as a complete development environment
for developing portal applications. A wizard allows a developer to
begin development of a new portlet application, generating a
skeleton portlet application as a project in Rational Application
Developer and required deployment descriptors. The Portlet Toolkit
also provides debugging support for portal developers."

                        - quote from IBM Rational Application Developer 7.0 Draft


Java Portlet specification


The Java Portlet V1.0 specification is found at:

Java Portlet Specification Site
 
http://jcp.org/en/jsr/detail?id=168

It provides a standard for the developing Java portlets for
portal applications. WebSphere Portal V5.1 supports the
Java Portlet standard.

Eclipse has a Java project for support of Portals at the
following location.


Eclipse Support For Portals

https://eclipse-portalpack.dev.java.net/


IBM Rational Application Developer Support for Portlets
// Application Developer V7.0 includes the WebSphere Portal
// Toolkit and the WebSphere Portal V5.0.2.2 Integrated Test
// Environment.



Sample Portlet Architecture  // diagrammed in text

Browser     PDA      Mobile Phone
\ | /
Websphere Portal <--> Security Service
| | | |
Portlet Portlet
Portlet Portlet
/ | | \
Web Web Collaboration Legacy
App Service Application Application



Enterprise JavaBeans


Expanding the Application to the Enterprise

The issue of code reuse regularly arises. The same
business used in the RAD 7 Internet Banking Application
could be used by administrative staff working in bank offices.
Preferably, the same code can be reused without maintaining
several copies of the same code.

An object-oriented view of the data in the relational database
with convenient associated tools would again be preferable.

The system should be robust, able to deal with distributed
transactions based on several databases distributed
throughout the banks network.

Furthermore, since several applications will use the data
simultaneously, the system must manage issues associated
with multi-threading, resource allocation, and security.

The developers should be insulated from infrastructure
concerns so that they can concentrate on coding business
logic.

A final function, the bank needs to interact with legacy
systems not written in Java. A technology that allowed
interoperability between heterogeneous platforms and
languages would be desired.

Enterprise Java Beans Meets These Requirements

By no coincidence, all the requirements described
in the above scenario are satisfied by Enterprise
JavaBeans which supply back-end logic to access
data.

// following is an introductory overview of EJBs

The Different Types of EJBs

There are several types of EJBs. The first we look at
are session beans. 

Session EJBs

Session EJBs are described as task-oriented objects.
They are non-persistent and will not survive a container
shutdown or crash. Session EJBs are of two types,
stateless and stateful.

Session Bean Types

Session Facade Pattern


Session beans often act as the external face of the
business logic provided by EJBs. The session
facade pattern is described in many pattern catalogs.
The client sees only the session beans. The details
of the persistence mechanism is hidden behind these
session beans. The session bean layer is known as
the session facade. An by-product of this approach,
the session beans are often closely associated with
a particular application stopping them from being
reused by other applications.


Stateless Session EJBs

Stateless session EJBs are preferred over stateful
session EJBs, as they scale better. Stateless beans
are pooled by the EJB container so that they can
handle multiple requests from multiple clients.

Pooling is only possible if the beans are equivalent
and do not carry state information specific to a client.
In this way the container can assign an instance to
any client.


Stateful Session EJBs

Stateful session EJBs allow an EJB client to store
information in the session bean while executing a
series of method calls.  Each stateful bean instance
can only be associated with one client eliminating
the possibility of pooling stateful bean objects.


Entity EJBs  // encapsulate data

Entity EJBs encapsulate an object-oriented view of
data. The data itself is stored by in an external relational
database or other enterprise information system. Entity
beans should be for general purpose and not designed
specifically with a single application. Application-specific
logic should be handled by session EJBs that use entity
beans to access data.

Once created, an entity bean can be found using a key or
by search criteria. Entity beans are generally persistent,
requiring explicit removal.

There are two main entity bean types, container-managed
or bean-managed persistence.


Container-managed persistence (CMP)

The EJB container manages all database access
needed by the entity bean. Because there are no
SQL calls, the bean's code is not tied to the syntax
of a specific database providing some portability
between J2EE servers. The container provides an
object-relational mapping tool used to describe how
entity bean attributes map to table columns of a
database.


Bean-managed persistence (BMP)

The developer codes all database accesses made
required by the entity bean. This allows the use of
complex SQL and stored procedures not supported
for CMP entity beans.


Message-driven EJBs (MDBs)


MDBs receive and process messages.Their access is
limited messages sent to the messaging server that the
bean is configured to listen to. MDBs are stateless. They
are normally used in asynchronous messaging systems,
typically J2EE's own JMS or Java Messaging Service.
EJB V2.1 allows MDBs to be used with other messaging
systems as well.

Message Facade Pattern

MDBs are normally used as adapters allowing session
bean logic to be used by a messaging system. They are
described in the Rational Draft document as an "asynchronous
extension of the session facade . . . known as the message
facade pattern."

Because message-driven beans can only be invoked via
messages, they have no client interface.


Other EJB features

Container-managed relationships (CMR)

The EJB V2.0 container is able to manage relationships
between entity beans. This code is generated automatically
as part of the deployment process.


Relationships
"The methods required to traverse the relationships
are generated as part of the development and code
generation mechanisms."    -- Rational V.0 Draft


EJB query language (EJB QL)


EJB QL is a query language used to query  for CMP
entity beans. It is based on SQL and allows searches
on persistent attributes of an enterprise bean. EJB
will traverse container-managed relationships as part
of the query.

"EJB QL defines queries in terms of the declared
structure of the EJBs themselves, not the underlying
data store; as a result, the queries are independent
of the bean's mapping to a persistent store." 

// based on Java structure

<ejb-ql> Element

EJB query language can be used to define a finder
or a select method for a CMP entity bean. These
methods are specified in the bean's deployment
descriptor using the <ejb-ql> element. Queries
specified in the deployment descriptor are converted
to SQL calls at deployment.

EJB QL Query

 
An EJB QL query is a string. It  contains the
following elements.

EJB QL Query Elements
EJB QL is a abridged version of SQL and only
permits SELECT statements.

// V2.1 extends the language from V2.0.


Local and Remote Interfaces


EJBs originally design was based on RMI or Java
Remote Method Invocation. They were later extended
to support CORBA or  Common Object Request Broker
Architecture, using RMI over the Internet Inter-ORB
Protocol (RMI-IIOP).


Improved Efficiency in EJB V2.0

To make local calls more efficient  EJB V2.0 allows
local interfaces to be used instead for calls to EJBs
in the same JVM, avoiding an expensive network call.
A session or entity EJB can be defined as having a
local interface, a remote interface, or both. Because
MDBs do not use interfaces, this issue doesn't apply
to them.

// skipped EJB timer service useful for scheduling calls


IBM Eclipse and RAD 7.0 Support for EJBs


Java Components of a Simple Web Application With EJBs

Web Browser                     J2EE client
_____|_____________________________|____
|
|______Servlet___
| | | Web application
|______ JSP ___|
|
JavaBean
_______________________|_________________
|
Session Bean
|
Entity Bean
| EJB container
_______________________|__________________
|
Java Application <-> Database


J2EE Application Clients

There are four Java EE Application Clients defined
in the Java EE specification.

Four J2EE Application Clients


APIs // Application Programming Interfaces

The J2EE specification requires the following APIs
be provided to Java EE Application Clients, in
addition to those provided by the Java Standard
Edition.

J2EE Specified Required APIs Available to Clients

// generally the stuff that comes with the J2EE distribution.


Security

The Java EE specification requires that the authentication
systems used in J2EE generally are available to J2EE
clients. Authentication is supplied by the Java EE Application
Client container.

// same security is extended to the client as is used in
// the general J2EE system

Naming    // JNDI

The Java EE specification requires that Java EE
Application Clients have the same naming features
that are provided for Web components and EJBs.
Clients should be able to use JNDI or Java Naming
and Directory Interface to look up objects using
object references as well as real JNDI names.

"The reference concept allows a deployer to configure
references that can be used as JNDI names in lookup
code. The references are bound to real JNDI names at
deployment time, so that if the real JNDI name is
subsequently changed, the code does not have to be
modified or recompiled—only the binding needs to be
updated."   - IBM Rational V.7 Draft


References can be defined for the following.

JNDI Referencable Components

JNDI Code Sample // from the Rational V.7 Draft

accountHome = (AccountHome)initialContext
.lookup("java:comp/env/ejb/account");

// where java:comp/env/ is a standard prefix used
// to identify references, and ejb/account would be
// bound at deployment time to the real JNDI name
// used for the Account bean.



Deployment

The packaging format for J2EE Clients is based
on the standard Java JAR format, and it allows the
developer to specify which class contains the main
method to be executed at run time.

"Java EE application clients for the WebSphere
Application Server platform run inside the Application
Client for WebSphere Application Server."

This product is available for download from IBM's
developerWorks, as well the WebSphere Application
Server installation CD.

"The Application Client for WebSphere Application
Server provides a launchClient command, which sets
up the correct environment for Java EE Application
Clients and runs the main class."

// Quite a bit of efforts has been lent to Eclipse's RCP API. See
// IBM WebSphere Developer Technical
Journal: Developing Eclipse
// rich client applications for
the WebSphere platform  An overview of
// Eclipse RCP
and WebSphere


IBM Article on Eclipse Rich Client Applications

http://www.ibm.com/developerworks/websphere/techjournal/0608_xu/0608_xu.html


IBM Rational Application Developer V7.0 Support for Clients
// see diagram in text showing J2EE Client connecting to EJB


Web Services


Rational's bank application now is described as
having the following parts.

Rational's Bank Application Components
In this system everything is contained in the banks system.
The Java application and J2EE client will probably be on
private bank network.

The scenario continues, mortgage agents want to search
many mortgage providers for the best deals for customers,
systems that may not use Java.

" The League of Agents for Mortgage Enquiries has published
a description of services that its members might use to get this
type of information. We want to conform to this description in
order to allow the maximum number of agents to use our bank’s
systems.

We may also want to be able to share information with other
banks; for example, we may wish to exchange information on
funds transfers between banks. Standard mechanisms to
perform these tasks have been provided by the relevant
government body."

These issues relate to interoperability, which Web services
address. Web services allow different types of systems to
communicate. Web services can be built to use existing
business logic.

A fundamental common unit provided by XML enables Web
service communication between different platforms, operating
system, language, or technology used to implement it.


Basic Overview of How Web Services Work


1 ) A service provider creates a Web service
2 ) publishes its interface and access information
     to a service registry
3) A service requestor locates entries in the service
    registry, binds to the service provider and invokes
    the  Web service.

Web Service Standards


Specification Sites


http://www.w3.org/TR/soap/
http://www.w3.org/TR/wsdl/
http://www.oasis-open.org/committees/uddi-spec/doc/tcspecs.html

// see pdf for web service diagram adobe page 130


J2EE V1.4 includes Web services. Java EE V1.4 allows
ordinary Java resources and stateless session EJBs to
be exposed as Web services.

Eclipse provides the recently released Web Tools Platform
to support Web Services.  // Aug 2008


Eclipse Web Services Support

http://www.eclipse.org/webtools/


IBM Application Developer 7.0 Support For Web Services



Messaging Systems

Web Services have some drawbacks
Back to the Scenario

The bank would like to integrate it's ATMs to transact
against its EJBs, using EJBs to handle messaging.
IBM has such a system called IBM WebSphere MQ.
In the sample scenario, WebSphere MQ can provide
Java interfaces that conform to the Java Message Service
(JMS) specification. ( JMS uses an interface system not
unlike JDBC.)

Java Message Service (JMS)

JMS uses the following elements

JMS Elements

Message-driven EJBs (MDBs)

MDBs first appeared in EJB V2.0 and were extended
in EJB V2.1. MDBs listens for and consumes incoming
messages sent from a destination or endpoint system.

The client is decoupled from the message consumer,
and is not aware how the message is being processed.

MDBs, the Simplest Bean

From a developer viewpoint , MDBs are the simplest
type of EJB, since they do not have clients like session
or entity beans. "The only way of invoking an MDB is to
send a message to the endpoint or destination that the
MDB is listening to." [IBM v.7 draft]

IN EJB V2.0, MDBs only handled JMS messages. Though
still the relevent type, in EJB V2.1 MDBs have been extended
to use other messaging systems.

Classes Required to Process Messages

Message Facade Pattern


The 'message facade pattern,  referenced in the text draft,
has the MDB act as an adapter, receiving and parsing the
message. A bean is invoked to handle the business logic
that processes the message.

IBM Rational App Dev V7.0 Support for MDBs



Assignment


Prepare and submit the Companies main page with
the specifications described briefly in the first note.
I wouldn't worry about aesthetic details as the
page can be modified as we continue. You should
print both the view and the source code. Include your
name, Assignment Number and Course, at the top
of the source code.

You can 'cheat' this if you wish and use a
WYSIWYG editor such as the 'Composer' editor
in SeaMonkey, the open source version of the
Netscape suite.

As an alternative you might create the front page
in an editor that allow you to save a copy as an
html file.