1 |
|
---|
2 | Greenstone3 Runtime on Android
|
---|
3 | ==============================
|
---|
4 |
|
---|
5 | This extension helps you set up and run Greenstone3 on your android device.
|
---|
6 |
|
---|
7 | It relies on the environment variable ANDROID_SDK_HOME to determine
|
---|
8 | where the Android SDK lives on your file system, in a similar way
|
---|
9 | JAVA_HOME gets used by many programs to determin where Java is
|
---|
10 | installed on a particular computer. The key programs we need to run
|
---|
11 | from the Android SDK are 'adb' and 'dex'. The most straight forward
|
---|
12 | way to control this variable is to:
|
---|
13 |
|
---|
14 | cp setup-android.bash.in setup-android.bash
|
---|
15 |
|
---|
16 | and then edit 'setup-android.bash' the value of **ANDROID-SDK-HOME**
|
---|
17 | to be the top-level directory of where the Android SDK was installed to.
|
---|
18 |
|
---|
19 | Having done this, source the main setup file:
|
---|
20 |
|
---|
21 | source setup.bash
|
---|
22 |
|
---|
23 | which automatically sources setup-android.bash if the ANDROID_SDK_HOME
|
---|
24 | environment variable isn't set.
|
---|
25 |
|
---|
26 | Having sourced the setup file the two main steps are:
|
---|
27 |
|
---|
28 | 1) Install i-jetty on the Android device
|
---|
29 |
|
---|
30 | 2) Install Greenstone3 as a web-app application on Andoird device
|
---|
31 |
|
---|
32 | The first step typically only needs to be done once.
|
---|
33 |
|
---|
34 |
|
---|
35 | The key task for the second step is to transfer greenstone3's "web"
|
---|
36 | directory to /sdcard/jetty/webapps/ on the Android device. In
|
---|
37 | principle that would be:
|
---|
38 |
|
---|
39 | <GSDL3SRCHOME>/web -> <ANDROID-DEVICE>:/sdcard/jetty/webapps/greenstone3
|
---|
40 |
|
---|
41 | However we need to convert all the Java code (which lurks in Jar
|
---|
42 | files) in the "web" folder into DEX-byte-code equivalents first. We
|
---|
43 | therefore break this step of the installation down into sub-steps (see
|
---|
44 | below). In overview, we create a "webapps" folder in the *extension*
|
---|
45 | folder, where we copy the static file content of "web" to (i.e., the
|
---|
46 | non-Java stuff). We then top that up with Dexified versions of the
|
---|
47 | Java code. Finally the whole "webapps/greenstone3" folder in the
|
---|
48 | extensions area is copied over to the Android device.
|
---|
49 |
|
---|
50 |
|
---|
51 | Step 1
|
---|
52 | =======
|
---|
53 |
|
---|
54 | First, install i-jetty on your Android device. You can do this through
|
---|
55 | the Market, or else type:
|
---|
56 |
|
---|
57 | adb install i-jetty-3.1-signed-aligned.apk
|
---|
58 |
|
---|
59 | Note: for your Android device to install applications using 'adb' you
|
---|
60 | need to have enabled it's application 'Development' mode (under
|
---|
61 | Settings->Application)
|
---|
62 |
|
---|
63 | *************
|
---|
64 | **Important**
|
---|
65 | *************
|
---|
66 |
|
---|
67 | Having installed i-jetty, find the application on the Android device
|
---|
68 | and launch it (but you don't have to go as far as starting the i-jetty
|
---|
69 | server from within this application). Launching i-jetty completes the
|
---|
70 | installation of the application by creating the 'jetty' folder on the
|
---|
71 | Android's SD-card, and populating it with the default configuration
|
---|
72 | files for i-jetty. The 'jetty' folder is needed for your setup procedure
|
---|
73 | as it is where Greenstone-3 will be installed to.
|
---|
74 |
|
---|
75 |
|
---|
76 | Step 2
|
---|
77 | ======
|
---|
78 |
|
---|
79 | Next put your Android device into USB disk mode, and set up the necessary files
|
---|
80 | to run Greenstone3 as a web-app under i-jetty. The three sub-steps are:
|
---|
81 |
|
---|
82 |
|
---|
83 | Step 2.1
|
---|
84 | --------
|
---|
85 |
|
---|
86 | Transfer the bulk of the <GSDL3SRCHOME>/web structure to the preparation
|
---|
87 | area "webapps" with the extension foler (i.e., where you are running these
|
---|
88 | scripts from) with:
|
---|
89 |
|
---|
90 | ./PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh
|
---|
91 |
|
---|
92 | This script skips any .svn files if present. It also skips installing
|
---|
93 | the majority of 'localsite' as this can be rather large -- both in
|
---|
94 | size and in terms of the number of files invovled -- so copying is
|
---|
95 | rather slow, and it is probably not what you want anyway. Only the
|
---|
96 | 'lucene-jdbm-demo' collection is copied to the preparation area.
|
---|
97 | Any other collections you wish to add should be manually added to
|
---|
98 | the "webapps/greenstone3/sites/localsite/collect/" area.
|
---|
99 |
|
---|
100 | Step 2.2
|
---|
101 | --------
|
---|
102 |
|
---|
103 | Convert the class files (includes those stored in jar files) into
|
---|
104 | classs.dex with:
|
---|
105 |
|
---|
106 | ./JAVA-TO-DEX.sh
|
---|
107 |
|
---|
108 | The finished file, which is also by this point zipped up, is stored in
|
---|
109 | the 'lib' folder (should you wish to inspect it). It is also
|
---|
110 | automatically copied to "webapps/greenstone3/WEB-INF/lib" which is
|
---|
111 | where it needs to be to work when installed on the Android device.
|
---|
112 |
|
---|
113 |
|
---|
114 | Step 2.3
|
---|
115 | --------
|
---|
116 |
|
---|
117 | Copy Greenstone3's webapps folder onto the Android device's sd-card:
|
---|
118 |
|
---|
119 | ./IJETTY-PUSH.sh webapps/greenstone3
|
---|
120 |
|
---|
121 | This is the final step in getting Greenstone3 setup on an Andoird.
|
---|
122 | Switch off the USB disk mode on the Android device. Note: it can take
|
---|
123 | a device minute or two "preparing" the sd-card. This can be seen on
|
---|
124 | the notification view. Alternativey, if you try to start i-jetty
|
---|
125 | before the card is ready, then i-jetty points this out, and offers you
|
---|
126 | a 'retry' button.
|
---|
127 |
|
---|
128 |
|
---|
129 | Step 3
|
---|
130 | ======
|
---|
131 |
|
---|
132 | Launch i-jetty from my apps area. Then, within i-jetty, start the
|
---|
133 | server. Once the "Jetty started" message appears, switch to your
|
---|
134 | web-browser application. We've tested the built-in web browser, and
|
---|
135 | Mobile Firefox 4.
|
---|
136 | ====
|
---|
137 |
|
---|
138 | If the compiled Java code to Greenstone3 has changed, then you need to
|
---|
139 | repeat sub-steps 2.2 and 2.3. Transfering just the newly
|
---|
140 | dexified code can be achieved more quickly by entering:
|
---|
141 |
|
---|
142 | ./IJETTY-PUSH.sh webapps/greenstone3/WEB-INF/lib
|
---|
143 |
|
---|
144 |
|
---|
145 | Caveats:
|
---|
146 | ========
|
---|
147 |
|
---|
148 | 1. Due to difficulties in getting MG and MGPP working on android
|
---|
149 | through the NDK, these are currently not supported. Effectively,
|
---|
150 | the Greenstone3 used needs to be one compiled *without* JNI
|
---|
151 | support.
|
---|
152 |
|
---|
153 | 2. Due to a runtime (reflection) error, we had to modify xalan.jar.
|
---|
154 | The modified version of this file is also in the 'modified-jars'
|
---|
155 | folder used in this extension.
|
---|
156 |
|
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|