Index: /gs3-extensions/android-war/trunk/src/DEX-TO-PREPARED-SDCARD.sh
===================================================================
--- /gs3-extensions/android-war/trunk/src/DEX-TO-PREPARED-SDCARD.sh	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/DEX-TO-PREPARED-SDCARD.sh	(revision 26613)
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+#if [ "x$SDCARD_WEBAPPS" = "x" ] ; then
+#  echo "Environment variable SDCARD_WEBAPPS undefined"
+#  echo "  => No valid directory to install to on Android device"
+#  echo "  => Did you run setup.bash before the Android device was in disk mode?"
+#  echo "  => Alternatively, set the environment variable explicitly"
+#  exit -1
+#fi
+
+if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
+  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined"
+  exit -1
+fi
+
+echo "#---"
+echo "# Copying dexified servlet code to "
+echo "#   $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib"
+echo "#---"
+echo ""
+
+if [ -d $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib ] ; then
+  /bin/rm -rf $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib 
+fi
+
+/bin/cp -r lib $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+#SRC_DIR=$PREPARE_SDCARD_GSDL3HOME 
+#DST_DIR=$WITHIN_SDCARD_GSDL3HOME
+#if [ "x$IJOS" = "xcygwin" ] ; then
+#  SRC_DIR=`cygpath -w $SRC_DIR`
+#  DST_DIR=`cygpath -w $DST_DIR`
+#elif [ "x$IJOS" = "xmingw" ] ; then
+#  SRC_DIR=`echo $SRC_DEX | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+#  DST_DIR=`echo $DST_DIR | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+#fi
+
+
+adb push war/greenstone3 "$WITHIN_SDCARD_GSDL3HOME"
Index: /gs3-extensions/android-war/trunk/src/DEX-TO-SDCARD.sh
===================================================================
--- /gs3-extensions/android-war/trunk/src/DEX-TO-SDCARD.sh	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/DEX-TO-SDCARD.sh	(revision 26613)
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+if [ "x$SDCARD_WEBAPPS" = "x" ] ; then
+  echo "Environment variable SDCARD_WEBAPPS undefined"
+  echo "  => No valid directory to install to on Android device"
+  echo "  => Did you run setup.bash before the Android device was in disk mode?"
+  echo "  => Alternatively, set the environment variable explicitly"
+  exit -1
+fi
+
+if [ ! -d $SDCARD_GSDL3HOME ] ; then
+  # First time install has been run => do a full copy
+  mode="Installing"
+
+else
+  # Only need to regenerate 'lib' folder
+  mode="Updating"
+fi
+
+echo "#---"
+echo "# $mode Android servlet version to "
+echo "#   $SDCARD_GSDL3HOME/WEB-INF/lib"
+echo "#---"
+echo ""
+
+if [ -d $SDCARD_GSDL3HOME/WEB-INF/lib ] ; then
+  /bin/rm -rf $SDCARD_GSDL3HOME/WEB-INF/lib 
+fi
+
+/bin/cp -r lib $SDCARD_GSDL3HOME/WEB-INF/.
Index: /gs3-extensions/android-war/trunk/src/IJETTY-PUSH.sh
===================================================================
--- /gs3-extensions/android-war/trunk/src/IJETTY-PUSH.sh	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/IJETTY-PUSH.sh	(revision 26613)
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
+  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined" 1>&2
+  echo "Have you source setup.bash?" 1>&2
+  exit -1
+fi
+
+if [ $# = "0" ] ; then
+  within_webapps="greenstone3"
+elif [ $# = "1" ] ; then
+  within_webapps=${1#webapps/}
+else
+  echo "Error: too many arguments" 1>&2
+  echo "Usage: $0 webapps-dir" 1>&2
+  exit -1
+fi
+
+# remove any trailing slash, as 'adb' does not appear to like this
+within_webapps=${within_webapps%/}
+
+echo "Running: adb push \"webapps/$within_webapps\" \"$WITHIN_SDCARD_WEBAPPS/$within_webapps\""
+
+adb push "webapps/$within_webapps" "$WITHIN_SDCARD_WEBAPPS/$within_webapps"
+
+echo ""
+echo "####"
+echo "# Start up i-jetty on the Android device, and in a web browser visit:"
+echo "#   http://localhost:8080/greenstone3/"
+echo "####"
+echo ""
Index: /gs3-extensions/android-war/trunk/src/JAVA-TO-DEX.sh
===================================================================
--- /gs3-extensions/android-war/trunk/src/JAVA-TO-DEX.sh	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/JAVA-TO-DEX.sh	(revision 26613)
@@ -0,0 +1,165 @@
+#!/bin/bash
+
+if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
+  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined" 1>&2
+  exit -1
+fi
+
+
+JARS="axis.jar commons-lang3-3.0-beta.jar cp.jar \
+  gsdl3.jar gutil.jar \
+  LuceneWrapper3.jar \
+  jdbm.jar js.jar serializer.jar \
+  xercesImpl.jar xml-apis.jar"
+
+# LuceneWrapper.jar and xalan.jar used to be in the list,
+# but are now in modified-jars.  See README.txt in that
+# directory for details
+
+#---
+# Copy GS3 classes files to I-Jetty classes
+#---
+
+if [ -d classes ] ; then
+  echo "#---"
+  echo "# Regenerating directory: classes"
+  echo "#---"
+  /bin/rm -rf classes
+fi
+
+echo "#---"
+echo "# Copying Greenstone-3 classes to the I-Jetty extension"
+/bin/cp -rf "$GSDL3HOME/WEB-INF/classes" classes
+/bin/rm -rf classes/.svn
+
+echo "# Setting GSDL3HOME to match SD-Card on Android device"
+echo "#---"
+
+if [ "x$IJOS" = "xcygwin" -o "x$IJOS" = "xmingw" ] ; then
+  SDCARD_GSDL3HOME_ONDEVICE=`echo $PREPARE_SDCARD_GSDL3HOME | sed 's@^/.\+/webapps/@/sdcard/jetty/webapps/@'`
+else 
+  echo "Need to change mapped location of Android device on host machine" 
+  echo "But no support currently implemented for: $IJOS"
+  SDCARD_GSDL3HOME_ONDEVICE=$PREPARE_SDCARD_GSDL3HOME
+fi
+
+cat classes/global.properties \
+  | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \
+  | sed "s@^tomcat\.port=.*@tomcat.port=$IJETTY_PORT@" \
+  > classes/global.properties.android
+
+/bin/mv classes/global.properties.android classes/global.properties
+
+cat classes/log4j.properties \
+  | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \
+  > classes/log4j.properties.android
+
+/bin/mv classes/log4j.properties.android classes/log4j.properties
+
+
+#---
+# Copy selected GS3 Jar files to I-Jetty jars
+#---
+
+echo "#---"
+if [ -d jars ] ; then
+  echo "# Regenerating jars"
+  /bin/rm -rf jars
+else
+  echo "# Generating jars"
+fi
+echo "#---"
+mkdir jars
+
+for f in $JARS ; do
+  echo "  Copying from Greenstone-3 to I-Jetty: $f"
+  /bin/cp "$GSDL3HOME/WEB-INF/lib/$f" jars/.
+done
+
+echo "Overriding existings Greenstone jars with ones that needed tweaking for Android"
+/bin/cp -v modified-jars/* jars/.
+
+
+echo "Topping up 'jars' with Android specific jars"
+/bin/cp -v extra-jars/* jars/.
+
+
+#---
+# Generate dex file in I-Jetty 'classes' directory
+#---
+
+
+# If need more memory, add
+# -JXmx1024M
+
+OUTPUT_DEX=$IJETTY_HOME/classes/classes.dex 
+INPUT_DIR=$IJETTY_HOME/jars
+
+dxcmd="dx"
+
+if [ "x$IJOS" = "xcygwin" ] ; then
+  OUTPUT_DEX=`cygpath -w $OUTPUT_DEX`
+  INPUT_DIR=`cygpath -w $INPUT_DIR`
+  dxcmd="dx.bat"
+elif [ "x$IJOS" = "xmingw" ] ; then
+  OUTPUT_DEX=`echo $OUTPUT_DEX | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+  INPUT_DIR=`echo $INPUT_DIR | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+  dxcmd="cmd /c dx.bat"
+fi
+
+# add --verbose for more information
+$dxcmd --verbose --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
+
+##dx.bat --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
+
+if [ $? != 0 ] ; then
+  echo "Error(s) encountered when running 'dx'"
+  exit 
+fi
+
+#---
+# Zip up I-Jetty classes directory and put it in lib
+#---
+
+echo "#---"
+if [ -d lib ] ; then
+  echo "# Regenerating directory: lib"
+  /bin/rm -rf lib
+else 
+  echo "# Generating directory: lib"
+fi
+echo "#---"
+mkdir lib
+
+echo "#---"
+echo "Zipping up I-Jetty 'classes' and storing in 'lib'"
+echo "#---"
+(cd classes && zip -r ../lib/classes.zip . && cd ..)
+
+if [ $? != 0 ] ; then
+  echo "Error(s) encountered zipping up dexified 'lib' files"
+  exit 
+fi
+
+
+
+echo "#---"
+echo "# Copying dexified 'lib' servlet code to "
+echo "#   $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib"
+echo "#---"
+echo ""
+
+if [ -d $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib ] ; then
+  /bin/rm -rf $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib 
+fi
+
+/bin/cp -r lib $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+
+
+echo ""
+echo "####"
+echo "# Run ./IJETTY-PUSH.sh \"webapps/greenstone3\" to install all the files needed on the Andorid device"
+echo "# Or  ./IJETTY-PUSH.sh \"webapps/greenstone3/WEB-INF/lib\" to install the latest DEX files on the device"
+echo "####"
+echo ""
Index: /gs3-extensions/android-war/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh
===================================================================
--- /gs3-extensions/android-war/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh	(revision 26613)
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+if [ ! -d $PREPARE_SDCARD_GSDL3HOME ] ; then
+  # First time install has been run => do a full copy
+  mode="Installing"
+
+else
+  # Only need to regenerate 'lib' folder
+  mode="Updating"
+fi
+
+echo "#---"
+echo "# $mode $GSDL3HOME -> $PREPARE_SDCARD_GSDL3HOME"
+echo "# (this may take several minutes)"
+echo "#---"
+echo ""
+
+if [ $mode = "Installing" ] ; then
+  (cd $GSDL3HOME && find . -type d ) \
+    | egrep -v '/\.svn' \
+    | egrep -v 'sites/' \
+    | egrep -v 'WEB-INF/classes' \
+    | egrep -v 'WEB-INF/lib' \
+    | xargs -I {} mkdir -p $PREPARE_SDCARD_GSDL3HOME/{}
+fi
+
+(cd $GSDL3HOME && find . -type f ) \
+  | egrep -v '/\.svn' \
+  | egrep -v 'sites/' \
+  | egrep -v 'WEB-INF/classes' \
+  | egrep -v 'WEB-INF/lib' \
+  | xargs -I {} /bin/cp -u -v $GSDL3HOME/{} $PREPARE_SDCARD_GSDL3HOME/{}
+
+/bin/cp resources/index.html $PREPARE_SDCARD_GSDL3HOME/.
+/bin/cp resources/web.xml $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite ] ; then
+  echo "Creating 'localsite' in $PREPARE_SDCARD_GSDLHOME"
+  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite
+  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect
+fi
+
+/bin/cp -u -v $GSDL3HOME/sites/localsite/siteConfig.xml $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
+
+/bin/cp -u -v -r $GSDL3HOME/sites/localsite/etc $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
+
+/bin/cp -u -v -r $GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/.
+
+echo "Removing .svn folders from copied 'lucene-jdbm-demo' collection"
+find $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo \
+ -type d -name ".svn" -exec /bin/rm -rf {} \; -print
+
+if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo/index ] ; then
+  pushd $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo
+  unzip index.zip
+  popd
+fi
+
+echo ""
+echo "####"
+echo "# If not already done so, run: "
+echo "#   ./JAVA-TO-DEX.sh"
+echo "# to cross-compile the Greenstone code and supporting JAR files" 
+echo "####"
+echo ""
+
+
+
Index: /gs3-extensions/android-war/trunk/src/README.txt
===================================================================
--- /gs3-extensions/android-war/trunk/src/README.txt	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/README.txt	(revision 26613)
@@ -0,0 +1,160 @@
+
+Greenstone3 Runtime on Android
+==============================
+
+This extension helps you set up and run Greenstone3 on your android device.
+
+It relies on the environment variable ANDROID_SDK_HOME to determine
+where the Android SDK lives on your file system, in a similar way
+JAVA_HOME gets used by many programs to determin where Java is
+installed on a particular computer.  The key programs we need to run
+from the Android SDK are 'adb' and 'dex'.  The most straight forward
+way to control this variable is to:
+
+  cp setup-android.bash.in setup-android.bash
+
+and then edit 'setup-android.bash' the value of **ANDROID-SDK-HOME**
+to be the top-level directory of where the Android SDK was installed to.
+
+Having done this, source the main setup file:
+
+  source setup.bash
+
+which automatically sources setup-android.bash if the ANDROID_SDK_HOME
+environment variable isn't set.
+
+Having sourced the setup file the two main steps are:
+
+  1) Install i-jetty on the Android device
+
+  2) Install Greenstone3 as a web-app application on Andoird device
+
+The first step typically only needs to be done once. 
+
+
+The key task for the second step is to transfer greenstone3's "web"
+directory to /sdcard/jetty/webapps/ on the Android device.  In
+principle that would be:
+
+  <GSDL3SRCHOME>/web -> <ANDROID-DEVICE>:/sdcard/jetty/webapps/greenstone3
+
+However we need to convert all the Java code (which lurks in Jar
+files) in the "web" folder into DEX-byte-code equivalents first.  We
+therefore break this step of the installation down into sub-steps (see
+below).  In overview, we create a "webapps" folder in the *extension*
+folder, where we copy the static file content of "web" to (i.e., the
+non-Java stuff).  We then top that up with Dexified versions of the
+Java code.  Finally the whole "webapps/greenstone3" folder in the
+extensions area is copied over to the Android device.
+
+
+Step 1
+=======
+
+First, install i-jetty on your Android device.  You can do this through
+the Market, or else type:
+
+  adb install i-jetty-3.1-signed-aligned.apk
+
+Note: for your Android device to install applications using 'adb' you
+need to have enabled it's application 'Development' mode (under
+Settings->Application)
+
+*************
+**Important**
+*************
+
+Having installed i-jetty, find the application on the Android device
+and launch it (but you don't have to go as far as starting the i-jetty
+server from within this application).  Launching i-jetty completes the
+installation of the application by creating the 'jetty' folder on the
+Android's SD-card, and populating it with the default configuration
+files for i-jetty.  The 'jetty' folder is needed for your setup procedure
+as it is where Greenstone-3 will be installed to.
+
+
+Step 2
+======
+
+Next put your Android device into USB disk mode, and set up the necessary files
+to run Greenstone3 as a web-app under i-jetty.  The three sub-steps are:
+
+
+Step 2.1
+--------
+
+Transfer the bulk of the <GSDL3SRCHOME>/web structure to the preparation
+area "webapps" with the extension foler (i.e., where you are running these
+scripts from) with:
+
+  ./PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh
+
+This script skips any .svn files if present.  It also skips installing
+the majority of 'localsite' as this can be rather large -- both in
+size and in terms of the number of files invovled -- so copying is
+rather slow, and it is probably not what you want anyway.  Only the
+'lucene-jdbm-demo' collection is copied to the preparation area.
+Any other collections you wish to add should be manually added to
+the "webapps/greenstone3/sites/localsite/collect/" area.
+
+Step 2.2
+--------
+
+Convert the class files (includes those stored in jar files) into
+classs.dex with:
+
+  ./JAVA-TO-DEX.sh  
+
+The finished file, which is also by this point zipped up, is stored in
+the 'lib' folder (should you wish to inspect it).  It is also
+automatically copied to "webapps/greenstone3/WEB-INF/lib" which is
+where it needs to be to work when installed on the Android device.
+
+
+Step 2.3
+--------
+
+Copy Greenstone3's webapps folder onto the Android device's sd-card:
+
+  ./IJETTY-PUSH.sh webapps/greenstone3
+
+This is the final step in getting Greenstone3 setup on an Andoird.
+Switch off the USB disk mode on the Android device.  Note: it can take
+a device minute or two "preparing" the sd-card.  This can be seen on
+the notification view.  Alternativey, if you try to start i-jetty
+before the card is ready, then i-jetty points this out, and offers you
+a 'retry' button.
+
+
+Step 3
+======
+
+Launch i-jetty from my apps area.  Then, within i-jetty, start the
+server.  Once the "Jetty started" message appears, switch to your
+web-browser application.  We've tested the built-in web browser, and
+Mobile Firefox 4.
+====
+
+If the compiled Java code to Greenstone3 has changed, then you need to
+repeat sub-steps 2.2 and 2.3.  Transfering just the newly
+dexified code can be achieved more quickly by entering:
+  
+ ./IJETTY-PUSH.sh webapps/greenstone3/WEB-INF/lib
+
+
+Caveats:
+========
+
+1. Due to difficulties in getting MG and MGPP working on android
+   through the NDK, these are currently not supported.  Effectively,
+   the Greenstone3 used needs to be one compiled *without* JNI
+   support.
+
+2. Due to a runtime (reflection) error, we had to modify xalan.jar.
+   The modified version of this file is also in the 'modified-jars'
+   folder used in this extension.
+
+
+
+
+
Index: /gs3-extensions/android-war/trunk/src/modified-jars/README.txt
===================================================================
--- /gs3-extensions/android-war/trunk/src/modified-jars/README.txt	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/modified-jars/README.txt	(revision 26613)
@@ -0,0 +1,36 @@
+
+====
+
+***** [Deprecated] *****
+
+LuceneWrapper.jar has been regenerated for the Android version of Greenstone-3.
+The key issue was that the version being used in Greenstone:
+
+  gs2build/common-src/indexers/lucene-gs
+
+uses lucene-core-2.3.2.jar
+
+In this version of Lucene, IndexSearcher ultimately inherits from Remote/RMI.
+This isn't supported in Android's version of Java that it converts to Dex format.
+Shifting to a newer version (2.9.4, the newest version of the 2.x series) moves
+the code beyond this reliance.
+
+Command to compile:
+
+  ant common.compile-core
+  ant common.jar-cor
+
+(result in build needs to be renamed, and copied to a couples of spots so it
+is then included/unjar'd in the Greenstone wrapper code for Lucene)
+
+Another (optional) improvmenent was to compile the lucene, targetted at 1.6.
+This is to eliminate 'dx' warning about anonymous classes.  In:
+
+  common-build.xml
+
+locate the source and target 1.4 values, and change to 1.6
+
+====
+
+xalan.jar needs to be changed
+
Index: /gs3-extensions/android-war/trunk/src/resources/index.html
===================================================================
--- /gs3-extensions/android-war/trunk/src/resources/index.html	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/resources/index.html	(revision 26613)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+		<title>Greenstone Version 3</title>
+		<style type="text/css">
+			li {padding: 0.8em 0;}
+			body {
+				background: #fff url('interfaces/default/images/chalk.gif') scroll repeat-y left top;
+			}
+		</style> 
+	</head>  
+	<body style="background: white; color: black;">
+	<div style="width: 1000px; margin: 0 auto;">
+		<h2 style="text-align:center; font-size:110%;font-family:sans-serif;">Welcome to your Greenstone3 installation!</h2>
+			
+		<ul>	
+			<li><a href="library">Run the main servlet for Greenstone 3.</a> This is an interface that demonstrates the wide variety of capabilities in Greenstone 3.</li>
+			<li><a href="gs2-library">Run the Greenstone 2 look and feel servlet. (Deprecated)</a> View the demo collections that come with Greenstone, using the Greenstone 2 look and feel.</li>
+			<li><a href="basic-library">Run the basic servlet. (Deprecated, but good on self-contained Android installs)</a> View the same collections using a basic look and feel. </li>
+			<li><a href="gateway">Run the gateway servlet.</a> This uses the standard Greenstone 3 look and feel, and talks via SOAP to the site with the demo collections (localsite).
+				<ul>
+					<li>Note that SOAP needs to be installed, and a SOAP server needs to be running for localsite.</li>
+				</ul>
+			</li>
+			<li><a href="testing">Run the 'Hello World' test servlet.</a> Use this link to check that your server can run the simplest of Java servlets.</li>
+
+		</ul>
+	</div>
+
+	<p style="text-align:center; font-size: 75%;"><a href="http://www.greenstone.org/greenstone3-home">powered by greenstone3</a></p>
+
+	</body>
+</html>
Index: /gs3-extensions/android-war/trunk/src/resources/web.xml
===================================================================
--- /gs3-extensions/android-war/trunk/src/resources/web.xml	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/resources/web.xml	(revision 26613)
@@ -0,0 +1,338 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!-- this is based on a sample web.xml file provided by 
+http://jakarta.apache.org/tomcat/tomcat-4.0-doc/appdev/web.xml.txt
+-->
+
+<!-- For Android, this file is a copy of the one in 
+       <greenstone3-home>/web/WEB-INF/web.xml 
+    with anything to do with the following removed:
+      Axis, OAI, and MAT
+  -->
+
+<web-app>
+	<display-name>GSDL3</display-name>
+	<description>
+		Greenstone digital library version 3.
+	</description>
+  
+	<filter>
+		<filter-name>Greenstone URL Filter</filter-name>
+		<filter-class>org.greenstone.gsdl3.core.URLFilter</filter-class>
+	</filter>
+
+	<filter-mapping>
+		<filter-name>Greenstone URL Filter</filter-name>
+		<url-pattern>*</url-pattern>
+	</filter-mapping>
+  
+	<!-- Context initialization parameters that define shared
+	String constants used within your application, which
+	can be customized by the system administrator who is
+	installing your application.  The values actually
+	assigned to these parameters can be retrieved in a
+	servlet or JSP page by calling:
+
+	String value =
+	getServletContext().getInitParameter("name");
+
+	where "name" matches the <param-name> element of
+	one of these initialization parameters.
+
+	You can define any number of context initialization
+	parameters, including zero.
+	-->
+  
+	<context-param>
+		<param-name>webmaster</param-name>
+		<param-value>greenstone3@list.scms.waikato.ac.nz</param-value>
+		<description>
+			The EMAIL address of the administrator to whom questions
+			and comments about this application should be addressed.
+		</description>
+	</context-param>
+  
+
+	<!-- Servlet definitions for the servlets that make up
+	your web application, including initialization
+	parameters.  With Tomcat, you can also send requests
+	to servlets not listed here with a request like this:
+
+	http://localhost:8080/{context-path}/servlet/{classname}
+
+	but this usage is not guaranteed to be portable.  It also
+	makes relative references to images and other resources
+	required by your servlet more complicated, so defining
+	all of your servlets (and defining a mapping to them with
+	a servlet-mapping element) is recommended.
+
+	Servlet initialization parameters can be retrieved in a
+	servlet or JSP page by calling:
+
+	String value =
+	getServletConfig().getInitParameter("name");
+
+	where "name" matches the <param-name> element of
+	one of these initialization parameters.
+
+	You can define any number of servlets, including zero.
+	-->
+
+	<servlet>
+		<servlet-name>tester</servlet-name>
+		<description>a test servlet</description>
+		<servlet-class>TestServlet</servlet-class>
+	</servlet>
+  
+	<!-- For client side text fetching -->
+	<servlet>
+		<servlet-name>grabtext</servlet-name>
+		<description>Grabs text for client-side display with minimal overhead.</description>
+		<servlet-class>org.greenstone.gsdl3.ClientSideServlet</servlet-class>
+	</servlet>
+  
+  
+	<servlet>
+		<servlet-name>library</servlet-name>
+		<description>The standard gsdl3 library program</description>
+		<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
+		<init-param>
+			<param-name>library_name</param-name>
+			<param-value>library</param-value>
+		</init-param>
+		<init-param>
+			<param-name>site_name</param-name>
+			<param-value>localsite</param-value>
+		</init-param>
+		<init-param>
+			<param-name>interface_name</param-name>
+			<param-value>default</param-value>
+		</init-param>
+		<init-param>
+			<param-name>receptionist_class</param-name>
+			<param-value>DefaultReceptionist</param-value>
+		</init-param>
+		<init-param>
+			<param-name>default_lang</param-name>
+			<param-value>en</param-value>
+		</init-param>
+	</servlet>
+  
+	<servlet>
+		<servlet-name>gs2-library</servlet-name>
+		<description>Greenstone 2 lookalike library program: uses localsite with the gs2 interface</description>
+		<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
+		<init-param>
+			<param-name>library_name</param-name>
+			<param-value>gs2-library</param-value>
+		</init-param>
+		<init-param>
+			<param-name>site_name</param-name>
+			<param-value>localsite</param-value>
+		</init-param>
+		<init-param>
+			<param-name>interface_name</param-name>
+			<param-value>gs2</param-value>
+		</init-param>
+		<init-param>
+			<param-name>default_lang</param-name>
+			<param-value>en</param-value>
+		</init-param>
+		<init-param>
+			<param-name>session_expiration</param-name>
+			<param-value>1800</param-value>
+		</init-param>
+		<init-param>
+			<param-name>params_class</param-name>
+			<param-value>GS2Params</param-value>
+		</init-param>
+	</servlet>
+  
+	<servlet>
+		<servlet-name>nzdl-library</servlet-name>
+		<description>gsdl3 library program</description>
+		<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
+		<init-param>
+			<param-name>library_name</param-name>
+			<param-value>nzdl</param-value>
+		</init-param>
+		<init-param>
+			<param-name>site_name</param-name>
+			<param-value>nzdl</param-value>
+		</init-param>
+		<init-param>
+			<param-name>interface_name</param-name>
+			<param-value>nzdl</param-value>
+		</init-param>
+		<init-param>
+			<param-name>default_lang</param-name>
+			<param-value>en</param-value>
+		</init-param>
+		<init-param>
+			<param-name>params_class</param-name>
+			<param-value>NZDLParams</param-value>
+		</init-param>
+		<init-param>
+			<param-name>session_expiration</param-name>
+			<param-value>600</param-value>
+		</init-param>
+  </servlet>
+
+	<servlet>
+		<servlet-name>gateway</servlet-name>
+		<description>gsdl3 library based on gateway site and basic interface. It uses SOAP to talk to localsite</description>
+		<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
+		<init-param>
+			<param-name>library_name</param-name>
+			<param-value>gateway</param-value>
+		</init-param>
+		<init-param>
+			<param-name>site_name</param-name>
+			<param-value>gateway</param-value>
+		</init-param>
+		<init-param>
+			<param-name>interface_name</param-name>
+			<param-value>basic</param-value>
+		</init-param>
+		<init-param>
+			<param-name>default_lang</param-name>
+			<param-value>en</param-value>
+		</init-param>
+	</servlet>
+  
+	<servlet>
+		<servlet-name>basic-library</servlet-name>
+		<description>basic gsdl3 library program: uses localsite and the basic interface</description>
+		<servlet-class>org.greenstone.gsdl3.LibraryServlet</servlet-class>
+		<init-param>
+			<param-name>library_name</param-name>
+			<param-value>basic-library</param-value>
+		</init-param>
+		<init-param>
+			<param-name>site_name</param-name>
+			<param-value>localsite</param-value>
+		</init-param>
+		<init-param>
+			<param-name>interface_name</param-name>
+			<param-value>basic</param-value>
+		</init-param>
+		<init-param>
+			<param-name>default_lang</param-name>
+			<param-value>en</param-value>
+		</init-param>
+		<!--<init-param>
+			<param-name>allow_client_side_xslt</param-name>
+			<param-value>true</param-value>
+		</init-param>-->
+	</servlet>
+
+
+
+ 
+    <!-- Define mappings that are used by the servlet container to
+         translate a particular request URI (context-relative) to a
+         particular servlet.  The examples below correspond to the
+         servlet descriptions above.  Thus, a request URI like:
+
+           http://localhost:8080/{contextpath}/graph
+
+         will be mapped to the "graph" servlet, while a request like:
+
+           http://localhost:8080/{contextpath}/saveCustomer.do
+
+         will be mapped to the "controller" servlet.
+
+		Note: context path is determined by the servlet container - 
+		in Tomcat, specified in server.xml -kjdon
+		
+         You may define any number of servlet mappings, including zero.
+         It is also legal to define more than one mapping for the same
+         servlet, if you wish to.
+    -->
+    <!--
+    
+    <servlet-mapping>
+      <servlet-name>controller</servlet-name>
+      <url-pattern>*.do</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+      <servlet-name>graph</servlet-name>
+      <url-pattern>/graph</url-pattern>
+    </servlet-mapping>
+    -->
+    
+
+	<servlet-mapping>
+		<servlet-name>nzdl-library</servlet-name>
+		<url-pattern>/nzdl</url-pattern>
+    </servlet-mapping>
+	<servlet-mapping>
+		<servlet-name>tester</servlet-name>
+		<url-pattern>/testing</url-pattern>
+	</servlet-mapping>
+  
+	<servlet-mapping>
+		<servlet-name>library</servlet-name>
+		<url-pattern>/library/*</url-pattern>
+	</servlet-mapping>
+
+	<servlet-mapping>
+		<servlet-name>gs2-library</servlet-name>
+		<url-pattern>/gs2-library</url-pattern>
+	</servlet-mapping>
+  
+	<servlet-mapping>
+		<servlet-name>gateway</servlet-name>
+		<url-pattern>/gateway</url-pattern>
+	</servlet-mapping>
+  
+	<servlet-mapping>
+		<servlet-name>basic-library</servlet-name>
+		<url-pattern>/basic-library</url-pattern>
+	</servlet-mapping>
+
+	<servlet-mapping>
+		<servlet-name>grabtext</servlet-name>
+		<url-pattern>/grabtext</url-pattern>
+	</servlet-mapping>
+  
+
+  <!-- uncomment this if you want to use the SOAPMonitorService. You will also 
+  need to copy the SOAPMonitorApplet*.class files from 
+  gsdl3/comms/soap/axis/web/WEB-INF/classes to the gsdl3/web directory. See the 
+  comms/soap/axis/docs/install.html Appendix for details about how to use this -->
+  <!--
+  <servlet-mapping>
+    <servlet-name>SOAPMonitorService</servlet-name>
+    <url-pattern>/SOAPMonitor</url-pattern>
+  </servlet-mapping>
+  -->
+  <!-- uncomment this if you want the admin servlet -->
+  <!--
+  <servlet-mapping>
+    <servlet-name>AdminServlet</servlet-name>
+    <url-pattern>/servlet/AdminServlet</url-pattern>
+  </servlet-mapping>
+  -->
+
+  <!-- Define the default session timeout for your application,
+  in minutes.  From a servlet or JSP page, you can modify
+  the timeout for a particular session dynamically by using
+  HttpSession.getMaxInactiveInterval(). -->
+
+  <session-config>
+    <session-timeout>240</session-timeout>    <!-- 4 hours -->
+  </session-config>
+
+  <!-- axis mime-mappings -->
+  <mime-mapping>
+    <extension>wsdl</extension>
+    <mime-type>text/xml</mime-type>
+  </mime-mapping>
+  
+  <mime-mapping>
+    <extension>xsd</extension>
+    <mime-type>text/xml</mime-type>
+  </mime-mapping>
+
+</web-app>
Index: /gs3-extensions/android-war/trunk/src/setup-android.bash.in
===================================================================
--- /gs3-extensions/android-war/trunk/src/setup-android.bash.in	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/setup-android.bash.in	(revision 26613)
@@ -0,0 +1,18 @@
+if [ "x$ANDROID_SDK_HOME" = "x" ] ; then
+
+  hostos=`uname | sed 's/^cygwin.*$/cygwin/i' | sed 's/^mingw.*$/mingw/i'`
+
+  # e.g, (mingw friendly) /c/Apps/Android/android-sdk
+
+  export ANDROID_SDK_HOME=**ANDROID-SDK-HOME**
+
+  if [ "x$hostos" = "xcygwin" ] ; then
+    export ANDROID_SDK_HOME="/cygdrive$ANDROID_SDK_HOME"
+  fi
+
+  export PATH=$ANDROID_SDK_HOME/tools:$ANDROID_SDK_HOME/platform-tools:$PATH
+
+  echo "+ Your environment has now been set up to run the Android SDK at location:"
+  echo "+   $ANDROID_SDK_HOME"
+fi
+
Index: /gs3-extensions/android-war/trunk/src/setup.bash
===================================================================
--- /gs3-extensions/android-war/trunk/src/setup.bash	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/setup.bash	(revision 26613)
@@ -0,0 +1,91 @@
+
+if [ "x$ANDROID_SDK_HOME" = "x" ] ; then
+  if [ ! -e setup-android.bash ] ; then
+    echo ""
+    echo "Unable to find 'setup-android.bash'.  You either need to:" 1>&2
+    echo "  1) copy setup-android.bash.in to setup-android.bash and" 1>&2
+    echo "     edit **ANDROID_SDK_HOME** to point to where this is located" 1>&2
+    echo "     on your file system, or" 1>&2
+    echo "  2) Explicitly set the environment variable ANDROID_SDK_HOME" 1>&2
+    echo "     and make sure 'dx' is on your PATH" 1>&2
+  else 
+    source setup-android.bash
+
+    export IJETTY_HOME=`pwd`
+    export IJOS=`uname | sed 's/^cygwin.*$/cygwin/i' | sed 's/^mingw.*$/mingw/i'`
+    
+    if [ "x$GSDL3HOME" = "x" ] ; then
+	echo "  Setting GSDL3HOME to '../../web'"
+	export GSDL3HOME=../../web
+    else 
+	echo "Using existing value of GSDL3HOME: '$GSDL3HOME'"
+    fi
+    
+    export PREPARE_SDCARD_GSDL3HOME=$IJETTY_HOME/webapps/greenstone3/
+    
+    export WITHIN_SDCARD_WEBAPPS=/sdcard/jetty/webapps
+    export WITHIN_SDCARD_GSDL3HOME=$WITHIN_SDCARD_WEBAPPS/greenstone3
+    
+    echo ""
+    echo "  Using:"
+    echo ""
+    echo "     $PREPARE_SDCARD_GSDL3HOME"
+    echo ""
+    echo "  as the webapps *preparation* area for the Greenstone servlet"
+    echo ""
+    echo "  Using:"
+    echo ""
+    echo "     $WITHIN_SDCARD_GSDL3HOME"
+    echo ""
+    echo "  as the *installation* point for the Greenstone servlet on the sd-card"
+    echo ""
+
+
+    if [ "x$IJETTY_PORT" = "x" ] ; then
+	export IJETTY_PORT=8080
+	echo ""
+	echo "  Setting IJETTY_PORT to 8080"
+	echo "  Explicityly set this environment variable to override this default"
+	echo ""
+    else
+	echo ""
+	echo "  Using IJETTY PORT = $IJETTY_PORT"
+	echo ""
+    fi
+
+    echo "+ Your environment has now been set up with iJetty extension for Greenstone"
+
+    echo ""
+    echo "======"
+    echo "If this is the first time you have installed Greenstone on the Android device, "
+    echo " run:"
+    echo ""
+    echo "   adb install i-jetty-3.1-signed-aligned.apk"
+    echo ""
+    echo "to install jetty on your device, followed by"
+    echo ""
+    echo "  ./PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh"
+    echo ""
+    echo "to set up Greenstone3's 'web' directory for the i-jetty webapps area."
+    echo ""
+    echo "Then:"
+    echo ""
+    echo "  ./JAVA-TO-DEX.sh"
+    echo ""
+    echo "to cross-compile Greenstone java code to the Android DEX format and add it to the webapps area."
+    echo ""
+    echo "Finally run:"
+    echo ""
+    echo "  ./IJETTY-PUSH.sh webapps/greenstone3"
+    echo ""
+    echo "to install the Greenstone3's webapps folder (including cross-compiled DEX files) on the Android device"
+    echo "======"
+    echo ""
+
+  fi
+fi
+
+
+
+
+
Index: /gs3-extensions/android-war/trunk/src/setup.bat
===================================================================
--- /gs3-extensions/android-war/trunk/src/setup.bat	(revision 26613)
+++ /gs3-extensions/android-war/trunk/src/setup.bat	(revision 26613)
@@ -0,0 +1,18 @@
+@echo off
+
+set ANDROID_SDK_HOME=**ANDROID-SDK-HOME**
+
+set PATH=%ANDROID_SDK_HOME%\tools;%ANDROID_SDK_HOME%\platform-tools;%PATH%
+
+echo + Your environment has now been set up to run the Android SDK
+
+
+pushd "%CD%"
+CD /D "%~dp0"
+set IJETTY_HOME=%CD%
+popd
+
+
+echo + Dos/Windows support only partially supported.  Consider using
+echo   Cygwin or Mini-Unix to run the .sh scripts
+
