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: /web -> :/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 /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.