DEPRECATED

This document has been deprecated in favor of Bare Metal Project - Java (source).

Prerequisites


Setting Environment Variables

Place the following in your .profile or equivalent
export JAVA_HOME=<path to the JDK directory>
export NHIN_D_ROOT=<path to the directory that will contain the nhin-d directory>
export JAMES_ROOT=<path to the directory that will contain James instances>
OS X: JAVA_HOME is: /System/Library/Frameworks/JavaVM.framework/Home
*nix JAVA_HOME is: /usr/lib/jvm/java-6-sun

Java Cryptographic Extensions

Download and install the JavaMail API.
Unzip the resulting files, and place the jar files in $JAVA_HOME/jre/lib/ext, or, for OS X, $JAVA_HOME/lib/ext
unzip javamail-1.4.3.zip
sudo cp lib/*.jar $JAVA_HOME/jre/lib/ext

Check out and build the source code

cd $NHIN_D_ROOT
hg clone https://nhin-d.googlecode.com/hg/ nhin-d
cd nhin-d/java
mvn clean install

Install the James instance

NOTE: For this, and other sections, substitute curl -O for wget on OS X, or if your platform doesn't have wget.
mkdir /tmp/stage
cd /tmp/stage
wget http://www.eng.lsu.edu/mirrors/apache/james/server/apache-james-2.3.2.tar.gz
tar xvfz apache-james-2.3.2.tar.gz
rm apache-james-2.3.2.tar.gz
mv james-2.3.2/ $JAMES_ROOT/james_xd

Configure James

cd $JAMES_ROOT/james_xd/
chmod +x bin/run.sh
chmod +x bin/phoenix.sh
sudo -E ./bin/run.sh
<control-c>
sudo mkdir apps/james/SAR-INF/lib

Install the XD* JARs

sudo cp $NHIN_D_ROOT/nhin-d/java/xdmail/target/xdmail-1.0-SNAPSHOT.jar $JAMES_ROOT/james_xd/apps/james/SAR-INF/lib/
sudo cp $NHIN_D_ROOT/nhin-d/java/xd-common/target/xd-common-1.0-SNAPSHOT.jar $JAMES_ROOT/james_xd/apps/james/SAR-INF/lib/

Install Dependencies

cd $JAMES_ROOT/james_xd/apps/james/SAR-INF/lib/
sudo wget http://mirror.cc.columbia.edu/pub/software/apache/james/apache-mailet/2.4/apache-mailet-2.4.jar
sudo wget http://mirror.cc.columbia.edu/pub/software/apache/james/apache-mailet-base/1.1/apache-mailet-base-1.1.jar
sudo wget http://ftp.us.xemacs.org/pub/mirrors/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
sudo wget http://oss.sonatype.org/content/groups/public/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
sudo wget http://download.java.net/maven/2/com/sun/xml/ws/webservices-rt/2.0.1/webservices-rt-2.0.1.jar
sudo wget http://download.java.net/maven/1/javax.mail/jars/mail-1.4.1.jar

Get supporting configuration files

sudo wget http://nhindirect.org/file/view/config_xd.xml -O $JAMES_ROOT/james_xd/apps/james/SAR-INF/config.xml

Start James and Jetty

You may need to start multiple terminal/command line sessions to run each instance.
If you are using unix you can launch each process in the background by adding the & character to the end of the command.

You can optionally deploy the xd.war ($NHIN_D_ROOT/nhin-d/java/xd/target/xd.war) to a Tomcat 6 instance (or equivalent).
Start James
Start Jetty
cd $JAMES_ROOT/james_xd
sudo -E ./bin/run.sh
cd $NHIN_D_ROOT/nhin-d/java/xd
mvn jetty:run-war

Create James users

telnet localhost 4555
> root
> root
> adduser bob password
> quit

Send a test message

TODO: document smtp-cli installation.
smtp-cli --verbose \
         --host localhost \
         --port 25 \
         --force-ehlo \
         --from bob@fl.provider.com \
         --to **you@your-domain.com** \
         --subject "Message subject here" \
         --body-plain "This is the message body" \
         --attach DOCUMENT.xml@text/xml

Verify Step-Up

TODO

Verify Step-Down

TODO

Verify Relay

TODO


Supporting Files

config_xd.xml