README --- Flexible Spending Account Sample Application


Maintained by: Jawahar Malhotra <jawahar@netscape.com>
Last modified: Fri May 2 15:14:20 1997

Purpose

This application is intended to be a sample which illustrates the following:

  1. using server-side JavaScript (SSJS) to access remote services running atop an IIOP-enabled ORB.
  2. a remote service written entirely in Java using the Netscape Internet Services Broker

THIS APPLICATION IS NOT INTENDED FOR ANY OTHER PURPOSE. You are free to copy this code and build upon it.


Flexible Spending Account?

A Flexible Spending Account is one in which employees may deposit pre-tax dollars to be used for medical expenses. Employees typically elect to sign up for this plan with the administrator of the plan (the employer) and select a dollar amount that they want deposited into their account. When an employee incurs a medical expense, the employee submits a claim which, if approved, results in a withdrawal from the account and the remittance of the approved amount to the employee.

This application provides support for managing Flexible Spending Accounts.

The administrator interface has support for

The employee interface has support for


Typical Flow of Events

The system can only handle ONE claim per employee at any time. Once the claim has been deleted, a new claim may be submitted.


Architecture

The system comprises of:

  1. A standalone Java application which contains implementations for all the interfaces defined in Flexi.idl, the IDL file defining the interfaces to the remote service. This application implements the guts of the FSA system and is known as the Remote Flexi Application. Upon startup, this application creates an instance of an object implemeting the interface ::FSA::Admin and registers it with the name 'FSA-Admin'. Clients of this service obtain access to this object first by resolving its name. Clients can use this object to create other objects. This application has been designed to be run from the shell.
  2. An SSJS application known as 'flexi'. This application implements both the Administrator and Employee interfaces. It connects with the FSA-Admin object and uses that object, and other objects returned by FSA-Admin, to perform most of its operations.


Setting up for execution

In the following, $SR will be used to denote the directory in which you have installed the server (server root).

The system is shipped with the following main files/directories:

  1. flexi/Flexi.idl. Describes the interface to the remote service, including Admin, Account, Claim.
  2. flexi/Flexi. This directory contains code generated from Flexi.idl by 'idl2java'. This includes the skeletons and stubs.
  3. flexi/impl. This directory contains implementations in Java for all the interfaces defined in Flexi.idl. It also contains class FlexiServer which implements the main program for the Java application which runs the service.
  4. flexi/*.html. These files implement the SSJS application. Also included is flexi.web.


Starting the Remote Flexi Application

Running this part requires JDK. It has been tested using JDK 1.0.2. You should have installed JDK before proceeding. $JDK will be used to refer to the directory where you have installed your JDK.

Open a shell and ensure that the following environment is present:

  1. The CLASSPATH includes
    1. .
    2. $SR/js/samples/flexi
    3. $SR/wai/java/nisb.zip
    4. $JDK/lib/classes.zip
  2. You path includes $JDK/bin

Once the above environment is setup:

  1. cd $SR/js/samples/flexi/impl
  2. Type:
    java FlexiServer

You should see a message like:

Started FSA Admin: Admin[Server,oid=PersistentId[repId=IDL:Flexi/Admin:1.0,objectName=FSA-Admin]]
after which the appplication will go into a listening mode waiting for service requests.


Starting the SSJS Application

Ensure that you have 'Server-side JavaScript' turned on before proceeding any further. You can do this via the Admin Server.

Edit your server's obj.conf file. Find the line which looks similar to the following:

Init classpath="$SR/wai/java/nisb.zip:$SR/js/samples:$SR/plugins/java/classes/serv3_0.zip:
$SR/plugins/java/local-classes" ldpath="$SR/plugins/java/bin" fn="SJavaBootInit"
Prepend the following to the classpath:
$SR/js/samples/flexi

Edit your server's jsa.conf file. Add the following line to the list of applications present there:

flexi uri=/flexi object=$SR/js/samples/flexi/flexi.web home=fsa.html start=start.html client-mode=client-cookie maxdbconnect=0
This installs the SSJS Flexi application into your server. Note that this application has a start page which gets executed upon server startup. This start page attempts to connect to the Remote Flexi Application. So, ensure that you have the remote application running before you start your server, once you've added the flexi SSJS application to the server.

Restart the server. The server should come up with the fexi application.


Using Flexi

Point your browser to:

http://server-name/flexi

This brings you to the interface selector page. Select either the admin or the employee interface. To get a quick feel for the application follow the steps outlined in the section Typical Flow of Events.'