Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Resource Management System

 
 

Articles Index

Sample Application

Introduction | ReadMe |Download

ReadMe Contents

Overview

RMS stands for Resource Management System, a sample application that demonstrates the use of JavaServer Pages (JSP), Enterprise JavaBeans (EJB), and other J2EE technologies. The application models an e-commerce solution for managing project resources such as computer hardware, software, and personnel. It allows you to record new projects in the system, allocate resources to a project, search for existing projects, and review both available and allocated resources.

Requirements

To install and run RMS, you need the Java 2 SDK, Standard Edition 1.2 or higher. The instructions for installing and running RMS assume that you also installed Java2 SDK, Enterprise Edition (J2EE SDK) 1.2 or higher. However you can run RMS without installing the J2EE SDK. If you don't install the J2EE SDK, you need JAR files that implement the J2EE specification.

The J2EE SDK includes a J2EE application server, web server, Cloudscape database, J2EE APIs, and various development and deployment tools. The instructions for installing and running RMS assume that you are using these J2EE SDK components. However you can configure RMS to run with another database, such as as Oracle 7.3.4, or another application server and its respective deployment tools, such as BEA WebLogic 5.1.

Installing and Running the RMS Application

The RMS application is made up of EJB components and JSPs. For a description of the RMS components, see Components. To install the application, perform the following steps:

Step 1: Unzip the RMS Zipfile

Unzip the file rms.zip by issuing the following command:

unzip rms.zip

The unzipped file contains the following directories:

  • ejb. Contains the source code (for example, Java classes and interfaces) for the EJBs.
  • jsp. Contains HTML files, JSPs, and gif files.
  • bean. Contains a Java class for the JavaBean supporting the JSPs.

It also includes:

Go to Top

Step 2: Compile and Package the EJBs and JSPs

Run the build.sh script. The script:

The script has a dummy setting for the environment variable J2EE_HOME. You should set the value to the J2EE SDK path.

You can use the J2EE SDK deployment tool as an alternative: The J2EE SDK includes a deployment tool. You can use this tool instead of the build.sh script to compile and package the EJBs and JSPs.

Go to Top

Step 3: Set Up RMS

  1. Create and populate a Cloudscape database named CloudscapeDB. You can use the cloudscape.sh script in the sqlscripts.zip package to create and populate the database or you can use the database tools provided by Cloudscape. RMS requires various tables for storing pertinent information, such as proposals, projects, and resources. There are SQL scripts provided in the package sqlscripts.zip that create the tables in the Cloudscape database. The scripts are:
    • RMS.sql
    • RMSData.sql

    When you run the cloudscape.sh script, it runs the RMS.sql and RMSData.sql scripts.

    After the SQL scripts run, verify that no errors occur. Ignore errors about dropping nonexistent tables (to make the application work for different conditions, the scripts begin by dropping tables). All database access is performed through the Java Database Connectivity (JDBC) application programming interface (API).

    You need to modify the jdbc.datasources property in the default properties file of the J2EE SDK as follows to reflect the JNDI name of the Cloudscape database:

    jdbc.datasources=jdbc/CloudscapeDB|jdbc:cloudscape:rmi:
    CloudscapeDB;create=true

    If you choose to use a database other than Cloudscape, you need to modify additional default.properties file specifications. For example, for an Oracle database, you need to change default.properties file specifications as follows:

    jdbc.driver=oracle.jdbc.driver.OracleDriver
    jdbc.datasources=jdbc/Oracle|jdbc:oracle:thin:@localhost:
    1521:sessionID
    wheresessionID is the Oracle database session ID.

    Also, if you choose a database other than Cludscape, you need JDBC driver classes for the database; you must include these classes in the classpath of the J2EE SDK server. In addition, you must modify the XML deployment descriptor parameters that refer to the logical and JNDI resource reference names of the database. For example, if you change the default.properties file as mentioned above for an Oracle database, you need to change the resource reference JNDI name to jdbc/Oracle.



  2. Start Cloudscape by entering the command: cloudscape -start

  3. Start the J2EE SDK server by entering the command: j2ee -verbose

  4. Use the deploy tool in the J2EE SDK to deploy the RMSApp.ear application.
    You can deploy the application by entering the command: deploytool -deploy RMSApp.ear localhost
    Alternatively you can use the deploy tool GUI to deploy the application:
    • Start the the deploy tool by entering the command: deploytool
    • Open the application: Select the File menu. Select Open Application. Enter file name: RMSApp.ear
    • Deploy the application: Select the Tools menu. Select Deploy Application . Go through the dialog boxes to complete the deployment. You can use the default values.

    If you want to uninstall the application after you deploy it, enter the command:

    deploytool -uninstall RMSApp localhost
    You can also uninstall through the deploy tool GUI.

Step 4: Run RMS from Your Browser

Point your browser at the index.html page. If you use the configuration in the package, the URL should look something like http://myhost:myport/RMSRoot/index.html

Reference Information

Components

The RMS application comprises the following components:

  • RMS Bean: This is a stateless Session Bean that consolidates the search results from the Project and Proposal components of the application and presents them to the client (such as JSPs). The RMS Bean uses JNDI to communicate with the Proposal Bean and the Project Bean.

  • Proposal Bean: This is an Entity Bean (Bean-managed persistence) for proposals. It processes search, add, delete, and update requests on proposals.

  • Project Bean: This is an Entity Bean (Bean-managed persistence) for projects. It processes search, add, delete, and update requests on projects.

  • Client: This component includes the JSPs and a JavaBean supporting the JSPs (JSP.class). The JavaBean supporting the JSPs communicates with the RMS Session Bean over JNDI.

All the components, except for the Client component, are implemented as Enterprise JavaBeans components.

Architectureal Diagram

The following architectural diagram shows the relationship between the RMS components.

Click on image to enlarge

Packages

The following packages are provided:

Package Name Package Content
RMS JavaBean supporting the JSPs on the client side
examples.ejb.beans.session Session Bean and other classes supporting the Session Bean
examples.ejb.beans.proposal Proposal Bean
examples.ejb.beans.project Project Bean
examples.ejb.beans.share Classes common to all the beans

Beans might require certain environment properties to be defined. See the deployment descriptor supplied with the package.

Classes

For RMS classes, the following naming convention is used:

<Component name>: EJB remote interface
<Component name>Home: EJB Home interface
<Component name>Bean: EJB implementation

Deployment Descriptors

A deployment descriptor describes the content of a functional unit (a component or components) that is deployed in a server. All the information about the RMS components that are deployed in the EJB server are stored as environment properties in deployment descriptors. Examples of such properties are:

  • Database connection parameters, such as jdbcDriverClass and jdbcDriverURL.
  • EJB and database JNDI names
  • Other environment variables such as logical database names

Deployment descriptors need to be customized to suit the target environment. The descriptors are provided in three XML files (application.xml, sun-j2ee-ri.xml, and ejb-jar.xml). The files contain a description of each JNDI and environment property used, and their corresponding sample values. You can use the EJB server's deployment tools to customize the deployment descriptors as appropriate. In particular, pay close attention to the JNDI names specified in the deployment descriptors. Here is a list of JNDI and environment properties for each bean, and their sample value:

  • RMS Bean
    • jndi-name: specifies the JNDI name for the bean (beans.RMSBean)
    • ejb-class: specifies the class name for the RMS bean (examples.ejb.beans.session.RMSBean)
    • home: specifies the home interface for the RMS bean (examples.ejb.beans.session.RMSHome)
    • remote: specifies the remote interface for the RMS bean (examples.ejb.beans.session.RMS)
    • env-entry-name: specifies the database name (CloudscapeDB)
    • res-ref-name: specifies the logical resource reference name for the database (jdbc/CloudscapeDB)
    • res-ref-name<jndi-name>: maps the logical database name to the JNDI database name (jdbc/CloudscapeDB)
    • ejb-ref-name: specifies the logical reference name of the entity beans it references (ejb/propBean, ejb/ProjBean)
    • ejb-ref-name<jndi-name>: maps the logical entity bean names to the actual JNDI names of the beans (beans.PropBean, beans.ProjBean)
  • Proposal Bean
    • jndi-name: specifies the JNDI name for the bean (beans.PropBean)
    • ejb-class: specifies the class name for the Proposal bean (examples.ejb.beans.propentity.PropBean)
    • home: specifies the home interface for the Proposal bean (examples.ejb.beans.propentity.PropHome)
    • remote: specifies the remote interface for the Proposal bean (examples.ejb.beans.propentity.Prop)
    • primary-key-class: specifies the primary key class (java.lang.string)
    • env-entry-name: specifies the database name (CloudscapeDB)
    • res-ref-name: specifies the logical resource reference name for the database (jdbc/CloudscapeDB)
    • res-ref-name<jndi-name>: maps the logical database name to the JNDI database name (jdbc/CloudscapeDB)
  • Project Bean
    • jndi-name: specifies the JNDI name for the bean (beans.ProjBean)
    • ejb-class: specifies the class name for the Project bean (examples.ejb.beans.projentity.ProjBean)
    • home: specifies the home interface for the Project bean (examples.ejb.beans.projentity.ProjHome)
    • remote: specifies the remote interface for the Project bean (examples.ejb.beans.projentity.Proj)
    • primary-key-class: specifies the primary key class (java.lang.string)
    • env-entry-name: specifies the database name (CloudscapeDB)
    • res-ref-name: specifies the logical resource reference name for the database (jdbc/CloudscapeDB)
    • res-ref-name<jndi-name>: maps the logical database name to the JNDI database name (jdbc/CloudscapeDB)
Introduction | ReadMe | Download
Go to Top