Projects
Peter Komisar © Conestoga College  version 1.1  Fall / 2007

Reference:  Third Draft Document for Review, Sept. 17,2007,
SG24-7501-00 'Rational Application Developer V7 Programming
Guide'.

This is a synopsis of information found in the fifth chapter,
''Projects' found in the third draft Document for Review, dated
September 17, 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.

Any anonymous quotes are from the above noted reference.        


J2EE Containment Architecture


The projects chapter in the IBM pdf is organized
under the following headings.


J2EE Architecture


"The Java 2 Platform Enterprise Edition (J2EE) is a
highly available, reliable, scalable, and secure platform
for developing web and client-server applications in
Java."

// examples are based on J2EE1.4

J2EE Containment System // J2EE Modules

All the archives files described are compressed files
that use the compression scheme developed by Phil
Katz, (PKZip). Jar, tar and zip files all use this compression
scheme.

The overall containment scheme is described in the
diagram in Figure 5-1 on page 151 of the IBM PDF
and is represented by the contents of the EAR file.

SubComponents of EAR Files
// Enterprise Application Resource Files

Each of these major compressed container files has
it's own specially named XML descriptor file and may
also hold standard JAR files containing Java classes.
Following are details regarding each archive type.


EAR Files


An Enterprise archive (EAR) files is used to hold
a J2EE application that may be deployed to WebSphere
Application Server. EAR files are standard Java archive
files that conform to a defined directory and file structure.

Application.xml

An EAR (.ear) file contains a deployment descriptor called
'application.xml'. This XML file describes the application's
content and holds instructions for running and deploying the
application.

The instructions include security settings and references to
Web applications contained within the application resource.

As noted earlier, the EAR file may include zero or more of
the following:

WAR Files

Web archive (WAR) files contain the components
used by a deployable web application. These
components may include the following.

Web Application Components

web.xml

The WAR file deployment descriptor is called 'web.xml'. It
describes how to deploy the components packaged within
the Web module and to map incoming Web requests to
the correct resources.

EJB JAR files

An EJB JAR file is used to package EJB classes and
interfaces.

ejb-jar.xml

The EJB JAR deployment descriptor is called ejb-jar.xml.
It describes how the EJBs should be deployed.


J2EE Application Client JAR files

A J2EE Application Client is also packaged in a
JAR file. The file includes user interface files that
run on a client machine and access resources
supplied by a J2EE server. This would include such
things as data sources, security services, and EJBs.

application-client.xml


The deployment descriptor that comes with the
client's JAR file is called application-client.xml.


RAR Files


The RAR, or Resource Access archive is used
to package J2EE resource adapters that access
back-end resources. The adapter uses services
provided by an application server to manage the
lookup of the resource and to manage connections.

// similar to JDBC drivers or CORBA Orb lookups

Resource adapters are often provided by vendors
of enterprise information systems, (EIS) to provide
access mainframe resources or non-Java applications.

The resource adapter may be installed as a stand-alone
module on the server so that it can be shared among
several applications. It can also come as a dedicated
part of an enterprise application, available only to the
associated application and it's modules.

"The RAR file includes the Java classes, providing the
Java-side of the resource adapter, and platform-specific
code, providing the back-end connection functionality.

ra.xml

The deployment descriptor for the RAR is called ra.xml.


Other Names for J2EE Resource Adapters



Projects


Projects Basics

All resources are organized into projects. The project
contains the files, folders and properties required for
the application under construction.

Different kinds of projects can be created for
different applications as will be listed shortly.


Unless otherwise specified, projects are stored in
the Application Developer workspace directory.

Deleting Projects

On deleting a workspace, RAD/Eclipse offers the
following choices.

Selecting the second option which is the default, removes
the project from Rational Application Developer’s list of
projects, but leaves the file structure of the project intact.

These projects can later be imported by selecting:

Importing Projects

File → Import → General → Existing Projects Into Workspace.

 A project that has been deleted from the workspace
takes up no memory and is not examined during builds,
so deleting projects in this way can improve the
performance of Application Developer.

Deleting project // from Eclipse Documentation

To delete a project and remove its contents from the file system:

  1. Select the project in one of the navigation views.
  2. Click Delete on the pop-up menu.
  3. In the dialog which opens select Also delete contents under ....
  4. Click Yes.

To delete a project from the workspace without removing its contents from the file system:

  1. Select the project in one of the navigation views.
  2. Click Delete on the pop-up menu.
  3. In the dialog which opens select Do not delete contents.
  4. Click Yes.

Project Interchange File

Projects can be transferred between Workspaces
in the form of project interchange files. This is a zip
file that encapsulates the project.


Creating a Project Interchange File


Select File → Export → Other → Project Interchange
--> specify which projects to export and the location.


Importing projects Into a Workspace


Select File → Export → Other → Project Interchange

Note

"When exporting and importing a project, the project
interrelationships are also transferred but not the
referenced projects; it may also be necessary to
export all related projects."

Closing Projects

Closing projects locks their contents so they cannot
be edited. Other projects cannot reference any of the
resources inside them.

This is done from the Project Explorer context menu
using either:
Closed projects remain in the Project Explorer view,
but they cannot be expanded. Closing non-important
projects can speed up compilation times as the
underlying application builders only have to check
for resources in open projects.

Closed projects can be re-opened by selecting
Open Project from Project Explorer.



Rational Application Developer Projects


The following is summary of the wizards listed in the
text for RAD 7.  "Each wizard will create an empty
project of the specified type with the structures, files,
folders, supporting libraries, and references to support
such a project. Once created, it is still possible to change
aspects of the project through the project properties."

Invocation of Wizards

Use File → New → Project
→ Select the appropriate project Wizard.



// refer to http://eclipse.org/birt/phoenix/project
// Crystal reports must be selected on installation
// of Application Developer for this to be available.


To export the build settings of a project as an Ant file use
the following.

Exporting Build Settings as an Ant File

Export → Export → General → Ant Buildfiles
// from the Project Explorer

// reference site: http://www.eclipseplugincentral.com



Application Developer J2EE Projects


RAD 7 complies with the J2EE specifications for developing
enterprise and Web applications. This is a significant statement
and means that J2EE applications developed in this environment
will be portable and be able to run on any J2EE compliant
web or application server.


J2EE Packaging Happens at Export


The 'packaging rules' which were imaged earlier when
the J2EE containment hierarchy was described, are applied
by RAD 7 only when a J2EE application or module is
exported.

When being worked, applications and modules are stored
as projects within the workspace. RAD manages the migration
of the project into the J2EE package. For example, an enterprise
application is packaged as an .ear file. 

Following is a diagram that shows the relationship between
the project and the J2EE module and it's associated archive
file type.


Project Mapping To Module Types

Enterprise
Application
Project
     →   Enterprise
Application
Resource
EAR File 
     |




     |______
     |
Connector Project Resource Adapter Archive RAR
File
     |______
     |
Utility JAR Project Utility Java Library JAR
File
     |______
     |
Web Project Web Application Resource WAR
File
     |______
     |
Java Project Standard Java Archive JAR
File
     |______
     |
EJB Project EJB Resource JAR
File
     |______
   
Application
Client Project
Application
Client Resource
JAR File


Each of the J2EE Projects are further discussed in text
as summarized below.


Enterprise Application Project


Enterprise Application projects contain all the
resources needed for enterprise applications.

They can contain references to a combination of
These relationships can be specified when 'wizarding'
a new Enterprise Application project or through the
project properties

// more info in Chapter 16

J2EE Application Client project

J2EE Application Client projects contain the
resources needed for J2EE application client
modules. A client Java application is understood
to be a standalone application that is not web-
based which connects to a J2EE enterprise
application via an application server.

EJBs and data sources are referenced via a
naming services such as JNDI, or Java Naming
and Directory Interface.

// Chapter 17, Building J2EE Application Clients


Dynamic Web Project


A dynamic Web project contains resources
needed for Web applications. These are
elements such as JSPs, Java Servlets,
HTML and other files.

The project wizard is used to configure:
Following is a quick list of other features the web
project wizard supports.

Features Supported by the Web Project Wizard
"By selecting the appropriate facets it is possible
to create a project which uses Struts or Java Server
Faces as a framework for building a web application."

// Chapter 12, “Develop Web applications . . . "


Static Web Project


A static Web project, containing only static Web
content, (HTML, images, sounds, movies etc.) need
only a web server, and not need a J2EE application
server.

The wizard allows:
// More in Chapter12, “Develop Web applications . . ."


EJB Project


EJB projects contain the resources for EJB
applications, including:
The wizard allows configuring:
// more in Chapter 16, “Develop Web applications using EJBs”

Connector Project

A connector project contains the resources required
for a J2EE resource adapter. The wizard allows setting:

 Java Project


A Java project contains:
The associated Java builder:
Java projects are used for:
// more on Chapter 7, “Develop Java applications”


Creating a new Project


A new application is normally started by building one
or more
projects in the RAD/Eclipse workspace. The
projects should be planned first. Then the wizards can
be used to create skeleton project sets.

For example to create a new Enterprise application
project, the '
New Enterprise Application' wizard is used.

Launching the New Enterprise Application Wizard

Select File → New → Project

Select J2EE → Enterprise Application Project.

// see pdf for a picture or run. Websphere Studio,
// Eclipse J2EE version or RAD 7.


On the first page you can specify:
A configuration may include:
// a good idea --> all similar projects should use the same configuration.

"An existing configuration can be chosen on this option or
<custom> can be selected which means that the user has
 the opportunity to specify their own selections in the next
screen of the wizard."


Project Facet's Page


The second page is the 'Project Facets' page used to
customize which features and versions will be available
in the new project. Configurations can be saved and
used for subsequent projects.

The same facets page appears when creating a new:
but with facet options applicable to the given project type


The Final Page


The final page allows the user to select any projects
that will be part of the enterprise application. "The
dialog includes select boxes for all Java, EJB, Web
and Application Client projects in the current workspace.
"

The 'Content Directory' Field

This field allows specifying a folder to store contents. If left
empty, content is stored under the root directory.

The 'New Module' Button

This button allows creating empty projects / modules within
the new Enterprise Application project.

Otherwise make selections nad click Finish.

Clicking  Finish again.

RAD may offer to switch you to the relevant perspective from
which the project was created.


Project Properties

To make changes to the properties of a project:

In the Properties dialog most project attributes can
be edited. Different types of projects have different
options available.

Enterprise Application Project Options:

Rational Application Developer Samples

Rational Application Developer provides a large number
of sample applications. Standard Eclipse is very sparse
in this respect. Samples can be helpful in exploring the
the platform's features and to investigate the different types
of projects that can be created.


Two Methods to Access the Gallery
// a grey circle with a yellow ball, blue cube and green pyramid

Samples Gallery

The samples gallery lists all the samples available
on the Eclipse platform. At the time that the redbook
draft was written, there were 26 sample applications
within Application Developer and 46 links to tutorial
topics within IBM developer works. The standard
Eclipse distribution has only a few samples.

Samples are arranged in four main categories:

Showcase Samples

Showcase Samples are extensive, containing
complete multi-tier, end-to-end applications that
follow best practices for application development.

Application Samples

Application samples are created using more than
one tool or API and show how different tools within
Rational Application Developer interact with each
other.

Technology Samples

Technology samples are smaller code-based
examples that focus on a single tool or API.

developerWorks Samples

These samples are available via links to the IBM
developerWorks Web site. These would include the
most current samples and require  Internet access.

// the example shown in the pdf is the  the Auction Web
// application is one of the Web application


Samples can be selected from a hierarchical list in
the left-hand pane.


Assignment


Recall that Java supplies AWT and Swing Components.
IBM introduces us to SWT components. Do the ' SWT Hello
World Example' supplied in Eclipse 3.3. You will need to
download the library as the instructions will tell you.
Screenshot the display of HelloWorld as it appears in the
SWT GUI.