Sun Java Solaris Communities My SDN Account Join SDN
 
Article

Integrated Java Technology for End-to-End m -Commerce

 



Article | Demo Application Readme | Client-Side Download | Server-Side Download

Readme Contents
Overview

m-RMS stands for Mobile Resource Management System. It is an extention of the original application, RMS, written using the J2EE technology for desktop clients. Details on the design, architecture and implementation of RMS can be found at Resource Management System: a J2EE Sample Application This paper and demo application demonstrate how to build and extend conventional Java solutions running on desktops, to mobile devices such as PDA's and handhelds using the J2ME/MIDP and XML technology, at the same time re-using the existing backend J2EE framework and infrastructure. m-RMS can run on any MIDP device including Java Phones, PalmOS handhelds or RIM devices.

m-RMS demonstrates the use of following technologies: J2EE, J2ME (CLDC + MIDP) and XMLtechnology, and WML/WAP

m-RMS application consists of two parts:

  • m-RMS wireless Portal
  • m-RMS client application
m-RMS Wireless Portal

The m-RMS wireless portal is a J2EE and XML implementation and consists of three tiers:

  • Database (Oracle, Cloudscape)
  • Application server(J2EE Reference Implementation from Sun, iPlanet, Weblogic or any other J2EE conformat Application server)
  • Web Server(J2EE Reference Implementation from Sun, iPlanet, Weblogic or any other J2EE conformant web server)

The web server constitutes the web tier in the four-tier architecture described in the Article. It hosts the following:

  • One set of JavaServer Pages(JSP) that generate WML content for micro browser.
  • Another set of JSP pages/servlets that generate XML content for the m-RMS MIDlet.
  • Another set of JSP pages which generate HTML for desktop browsers.

All sets of JSP pages/servlets use the same beans, EJBs and backend database.

Requirements: m-RMS Wireless Portal

To install and run the m-RMS portal, you need the following:

The J2EE SDK Reference Implementation includes a J2EE application server, a web server, Cloudscape database, and various development and deployment tools. The instructions for installing and running m-RMS portal assume that you are using these J2EE SDK components. However you can configure m-RMS portal to run with another database, such as Oracle 8i, or another application server and its respective deployment tools, such as BEA WebLogic 5.1. Appropriate application server specific instructions will need to be followed.

Installing and Running the m-RMS Portal

To install the m-RMS portal, perform the following steps:

Step 1. Download m-RMS portal software, m-RMS-server.zip This software needs to be installed, configured and run for all the three client end configurations.

Step 2. Unzip the m-RMS portal software .zipfile

Unzip the file m-RMS-server.zip by issuing the following command:

unzip m-rms-serevr.zip

The unzipped file contains the following directories:

  • ejb. Contains the source code (for example, Java classes and interfaces) for the EJB.
  • jsp. Contains HTML files, JSP pages, and gif files. There are two sets of JSP pages. One set generates HTML data for desktop browsers and the other set generates WML data for micro browser clients for mobile devices.
  • servlet. Contains servlets for generating XML data for J2ME client application
  • bean. Contains a Java class for the JavaBean supporting the JSP pages.

It also includes:

  • A shell script, build.sh, for compiling and packaging the EJBs, JSP pages and servlets. XML deployment descriptor files.
  • sqlscripts.zip. This zip file contains a script file, called cloudscape.sh, which can be used to create and populate a Cloudscape database. It also includes shell scripts for creating tables required by the m-RMS portal.

Step 3. Compile and Package the EJBs, Servlets and JSP pages

Run the build.sh script. The script:

  • Compiles the EJBs
  • Packages the EJBs into a file called RMSApp.jar
  • Packages the JSP pages, the JavaBean supporting the JSP pages, Servlets, and the HTML files into a file called RMSApp.war
  • Packages the jar and war files into a file called RMSApp.ear. It uses the XML deployment descriptor files to create the jar, war, and ear packages.

The script has a dummy setting for the environment variable J2EE_HOME and XML_HOME. You should set the value of J2EE_HOME to the J2EE SDK home and XML_HOME to the home of JAXP1.1 Reference Implementation.

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, servlets and JSP pages.

Step 4. Set Up m-RMS wireless portal

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
where sessionID is the Oracle database session ID.

Also, if you choose a database other than Cloudscape, 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 m-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: m-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.

For more details on the design, architecture and implementation of the m-RMS portal, refer to the original RMS article: Resource Management System: a J2EE Sample Application

m-RMS client end application

m-RMS can run in two configurations on the client end:

  • m-RMS MIDlet
  • WML Browser
m-RMS MIDlet

m-RMSMIDlet is an application which can be run on any MIDP device in standalone, wireless and wireline modes. In wireline and wireless modes, it communicates with the m-RMS wireless portal over HTTP using XML for exchanging information.

Requirements
  • MIDP implementation for the client device. There is a reference implementation of MIDP available from Sun for Java Phones and PalmOS. However, the m-RMS client/MIDlet will run on any MIDP conformant device.
  • NanoXML parser for J2ME
  • J2ME wireless toolkit (Any other MIDP development kit can also be used)
  • WinNT or Win2000
Installing and Running the m-RMS MIDlet

Note: Details are provided for compiling and packaging the m-RMS MIDlet using the J2ME wireless toolkit from Sun. Other available toolkits can be used for development.

Step 1. Download m-RMS-client.zip, the m-RMS MIDlet

Step 2. Unzip the m-RMS-client.zip file.

Unzip m-RMS-client.zip by issuing the following command:

unzip m-RMS-client.zip-d J2MEWTK/apps
where J2MEWTK
is the home directory for the J2ME wireless toolkit.

The zip file has a directory m_RMS which includes the following:

  • A directory m_RMS/src which contains the package com.sun.m_rms. This package has the source code for all the java files comprising the m_RMS MIDP application.
  • A directory m_RMS/bin which contains m_RMS.jar and m_RMS.jad. This is the compiled version of the m_RMS MIDlet.
  • A directory m_RMS/res which contains the resources like the icons required to build m_RMS.jar.

Step 3. In order to compile and build the source code, you will need to install the NanoXML parser which the application uses for parsing the XML data from the portal server. Place the NanoXML files in the directory J2MEWTK/apps/m_RMS/src/nanoxml. You may choose an alternate parser, like kXML among others, however the source code for m-RMS client will need to be modified appropriately. Launch the J2ME wireless toolkit, create a new project Figure 1 , and click on the quot;Build" button to compile and build the m_RMS MIDlet as shown in Figure 2. This creates two files, m_RMS.jar and m_RMS.jad which are placed in the J2MEWTK/apps/m_RMS/bin directory. Choose the device of choice from the J2MEWTK Device menu and run the m_RMS MIDlet.

Figure 1
Figure 1

Figure 2
Figure 2

Any other suitable development toolkit can also be used, appropriate instructions will need to be followed.

Step 4.The following steps will need to be followed to configure and run the m_RMS MIDlet on any MIDP device.

Wireless or Wireline mode.

To launch the application in wireless or wireline mode, run m_RMS, and choose 'online mode' from the application's menu . It allows you to create, search, view, update, delete and download proposals and projects. You can also view the available/allocated resources for projects. When you run the application for the first time, you need to configure the wireless portal server URL, and port information. You can do this after launching the application in standalone mode first Figure 3. Then choose the "preferences" option from Menu Figure 4 and set the parameters appropriately Figure 5 You can now go back to Online mode by choosing the "Online Mode" option. While in online mode, it is possible to download information from the m-RMS portal server to the local device database. Then you can choose to work in "Standalone mode," modify the downloaded information, and later, using m_RMS application's Synchronize button, synchronize the data with the portal's database via wireline or wirelessly.

Figure 3

Figure 4

Standalone Mode Launch m_RMS, and select Standalone mode from its menu. You can interact with the application in this mode. It allows you to create , search, view, update, delete proposals and projects. The information is stored in the local device database. The information can later be synchronized back to the server via wireline or wirelessly using the "Synchronize" button provided on the m-RMS application's menu.

WML browser Client m-RMS can also be run on the client device by any WML browser.

Requirements: WML client

Requires a WML browser on the client device. A J2ME based WML browser or a native device browser (such as avantgo) can be used. The browser can be a HTTP or a WAP based browser. The m-RMS WML/JSP pages live on the m_RMS wireless portal server. These JSP's generate WML content which is transferred to the WML browser over HTTP/WAP.

Running m-RMS WML pages

Wireless and Wireless Mode.

To run the application, launch the WML browser, load the page http://j2ee_server:8000/RMSRoot/m-RMSWml.jsp where j2ee_server is the m-RMS portal server URL. You cannot work in Standalone mode in this configuration.

Instructions to configure and run on a Palm device

Requirements

  • A PDA like Plam Vx, Palm VII, or any other PalmOS platform running PalmOS 3.5 or higher, with a minimum of 8MB RAM.
  • Wireless internet connectivity from the device

Wireless mode. To work in wireless mode, the Palm needs to be configured for wireless access via a regular internet service provider. This may require the Palm to be configured for a wireless modem, for example, Ricochet or Omnisky etc. This configuration can be done by setting the Palm's network and connection menu.

Wireline mode Connect the Palm to the cradle. Connect the cradle to the serial port of a PC on LAN. Be sure to have a PPP server installed on the PC. There is one available from Mochasoft. You can also make this connection by using RAS on Windows. This configuration enables the cradle to function like a modem and provides access from Palm to LAN over TCP/IP via the direct serial port.

Download the MIDP4Palm, the MIDP implementation for PalmOS. It contains a MIDP.prc, MakeMIDApp.jar and a mksample.bat file besides other files and utilities. Create a file mkRMS.bat as follows:

java -jar MakeMIDPApp.jar -version 1.0 -icon m_RMS.bmp -nobeam -v -o m_RMS.prc -JARtoPRC m_RMS.jar -jad m_RMS.jad com.sun.m_rms.m_RMS.

where m_RMS.jar and m_RMS.jad are the same files compiled and built by the J2MEWTK as described above.

Copy all files which include m_RMS.jar, m_RMS.jad, m_RMS.bmp, from J2MEWTK/apps/m_RMS/bin into the MIDP4Palm home directory. Run mkRMS.bat. This generates a file called m_RMS.prc which can run on any PalmOS device like Palm, Handspring Visor or Symbol etc. Install MIDP.prc and m_RMS.prc onto Palm by using the Palm desktop and hotsync utilities provided by Palm device and associated software. Follow the instructions above for running the m_RMS MIDlet.

Similar instructions will need to be followed for building and installing device specific MIDlets on other devices.

References

Connected Limited Device Configuration (CLDC)

Mobile Information Device Profile (MIDP)

Java2 Enterprise Edition

Develop WAP applications using Java Servlets and Java Server Pages

Java Server Pages and XML

MIDP APIs for Wireless Applications. A Brief Tour for Software Developers (pdf, 171K, 14 pages)

Java 2 Micro Edition

Applications for Mobile Information Devices. Helpful Hints for Application Developers and User Interface Designers using the Mobile Information Device Profile (PDF, 106K, 17 pages)


Back To Top