Nsjava was originally developed to support the porting of Webmail module in the Openacs project. In acs classic, the webmail module was one of the first of a new type of modules from Arsdigita. The font-end presentation layer and control logic were still implemented in Tcl and the data-model was still in Oracle SQL, but the mail processing made use of the JavaMail libraries which were loaded into Oracle and called as stored procedures. In addition, the java code used something called SQLJ to access the database instead of JDBC which is a common standard for database connectivity in java programs. This presented a problem for the Openacs project, as Postgresql does not support Java as a stored procedure language. Nsjava solves the webmail porting problem by embedding a java virtual machine as an in-process module that runs within Aolserver. The control interface from the Tcl layer is still very similar to the ACS classic version, and it required very little work to port this. On the other hand, the Java code, which as stated before relied on SQLJ to access the DB, required modification of all of the SQLJ statements. Future plans for nsjava include adding either a JDBC abstraction layer for accessing the DB, or the inclusion of an SQLJ preprocessor. Installation of the webmail module in Openacs is a little more involved than most of the other modules, as webmail depends on the proper installation and configuration of Openacs, Qmail, and Nsjava.
See the nsjava installation instructions for details on how to install nsjava.
To install the JavaMail libraries used by webmail module, download the JavaMail library and the JavaBeans Activation Framework. Unpack the distributions and copy activation.jar and mail.jar into the same directory where you installed the nsjava shared library and the nsjava jarfile.
Change to the webmail java directory:
cd acs3-pg/www/webmail/java
Set the CLASSPATH environment variable:
export CLASSPATH=/home/nsadmin/bin/mail.jar:/home/nsadmin/bin/activation.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java:/home/nsadmin/bin/nsjava.jar
The above example is for illustration only, so you'll need to adjust your CLASSPATH setting to fit the location of various CLASSPATH components shown above.
You should now be ready to compile the java webmail components. Go ahead and build it by typing:
make
Note that MessageParser.java will give a warning about using a deprecated API. This warning can be ignored.
In the nsajva installation guide, you were told to set the ClassPath Variable in the nsjava module section of your nsd.tcl file. In order to run webmail, you need to modify it to include the Java components that are used by webmail. The needed components include mail.jar, activation.jar, and the webmail/java directory. Shown below is an example from my own Webmail installation:
ns_param ClassPath "/home/nsadmin/bin/mail.jar:/home/nsadmin/bin/activation.jar:/home/nsadmin/bin/nsjava.jar\
:/usr/local/jdk/jdk118_v1/lib/classes.zip:/home/nsadmin/mirror/acs3-pg/www/webmail/java"
The setup of Qmail for use with the webmail module is detailed in the webmail.html file, which is located in the www/doc directory of the openacs installation.
The final step is to configure the webmail parameters in the parameter file (ad.tcl) located in acs3-pg/parameters. Under the section ns/server/${server}/acs/webmail you need to configure the following parameters:
ns_param WebmailEnabledP 1
ns_param ProcessQueueInterval 120
ns_param AliasDirectory "/home/nsadmin/qmail/alias"
ns_param QueueDirectory "/home/nsadmin/qmail/queue"
Set WebmailEnabledP to one if you want the webmail module enabled. The ProcessQueueInterval parameter sets the time in seconds for reading mail from the Qmail queue and placing the parsed messages in the DB. The AliasDirectory and the QueueDirectory parameters tell the webmail module where to create new alias files for new users and where to find the incoming mail queue. The alias directory needs to be writeable by the Aolserver process.