source: trunk/gsdl3/docs/manual/manual.tex@ 6518

Last change on this file since 6518 was 6518, checked in by kjdon, 20 years ago

* empty log message *

  • Property svn:keywords set to Author Date Id Revision
File size: 145.7 KB
Line 
1\documentclass[a4paper,11pt]{article}
2\usepackage{times,epsfig}
3\hyphenation{Message-Router Text-Query}
4
5\newenvironment{gsc}% Greenstone text bits
6{\begin{footnotesize}\begin{tt}}%
7{\end{tt}\end{footnotesize}}
8
9\newcommand{\gst}[1]{{\footnotesize \tt #1}}
10\newcommand{\gsdlhome}{\$GSDL3HOME}
11
12\begin{document}
13
14\title{Greenstone 3: A modular digital library.}
15
16% if you work on this manual, add your name here
17\author{Katherine Don, George Buchanan and Ian H. Witten \\[1ex]
18 Department of Computer Science \\
19 University of Waikato \\ Hamilton, New Zealand \\
20 \{kjdon, grbuchan, ihw\}@cs.waikato.ac.nz}
21
22\date{}
23
24\maketitle
25
26\newenvironment{bulletedlist}%
27{\begin{list}{$\bullet$}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}}%
28{\end{list}}
29
30\noindent
31Greenstone Digital Library Version 3 is a complete redesign and
32reimplementation of the Greenstone digital library software. The current
33version (Greenstone2) enjoys considerable success and is being widely used.
34Greenstone3 will capitalise on this success, and in addition it will
35\begin{bulletedlist}
36\item improve flexibility, modularity, and extensibility
37\item lower the bar for ``getting into'' the Greenstone code with a view to
38 understanding and extending it
39\item use XML where possible internally to improve the amount of
40 self-documentation
41\item make full use of existing XML-related standards and software
42\item provide improved internationalisation, particularly in terms of sort order,
43 information browsing, etc.
44\item include new features that facilitate additional ``content management''
45 operations
46\item operate on a scale ranging from personal desktop to corporate library
47\item easily permit the incorporation of text mining operations
48\item use Java, to encourage multilinguality, X-compatibility, and to permit
49 easier inclusion of existing Java code (such as for text mining).
50\end{bulletedlist}
51Parts of Greenstone will remain in other languages (e.g. MG, MGPP); JNI (Java
52Native Interface) will be used to communicate with these.
53
54A description of the general design and architecture of Greenstone3 is covered by the document {\em The design of Greenstone3: An agent based dynamic digital library} (design-2002.ps, in the gsdl3/docs/manual directory).
55
56This documentation consists of several parts. Section~\ref{sec:install} covers greenstone installation, how to access the library, and some administration issues. Section~\ref{sec:user} looks at using the sample collections, creating new collections, and how to make small customisations to the interface. The remaining sections are aimed towards the Greenstone developer. Section~\ref{sec:develop-runtime} describes the run-time system, including the structure of the software, and the message format, while Section~\ref{sec:develop-build} describes the collection building process. Section~\ref{sec:new-features} describes how to add new features to Greenstone, such as how to add new services, new page types, new plugins for different document formats. Section~\ref{sec:distributed} describes how to make Greenstone run in a distributed fashion, using SOAP as an example communications protocol. Finally, there are several appendices, including how to install Greenstone from CVS, and a comparison of greenstone 2 and greenstone 3 format statements.
57\newpage
58\section{Greenstone installation and administration}\label{sec:install}
59
60This section covers where to get Greenstone 3 from, how to install it and how to run it. The standard method of running Greenstone is as a Java servlet. We provide the Tomcat servlet container to serve the servlet :-). Standard web servers may be able to be configured to provide servlet support, and thereby remove the need to use Tomcat. Please see your web server documentation for this. This documentation assumes that you are using Tomcat. To access Greenstone, Tomcat must be started up, and then it can be accessed via a web browser.
61
62
63\subsection{Get and install Greenstone}
64
65Greenstone is available from \gst{http://www.greenstone.org/greensone3}. There are currently two distributions: a self-installing tar for Linux, and a Windows executable.
66
67Greenstone is also available through CVS (Concurrent Versioning System). This provides the absolute latest development version, and is not guaranteed to be stable. Appendix~\ref{app:cvs} describes how to download and install Greenstone from CVS.
68
69\subsubsection{Linux}
70
71Download the latest version of the self-installing tar file, gsdl3-x.xx-unix.sh, and run it in a shell (./gsdl3-x.xx-unix.sh). Greenstone will be installed into a directory called gsdl3 inside the current directory. The install script will prompt you for the name of your computer and what port to run tomcat on (the defaults being localhost and 8080). Once Greenstone has been installed, you can start the library by running ./gsdl3/gs3-launch.sh, and opening up a browser pointing to localhost:8080/gsdl3 (or different computer name and port).
72
73\subsubsection{Windows}
74
75Download the latest Windows executable, gsdl3-x.xx-win32.exe, and double click it to start the installation. You will be prompted for your computer name and port number to run Tomcat on (defaults are localhost and 8080). Once Greenstone is installed, you can access the library by selecting Greenstone 3 Digital Library in the Start menu.
76
77\subsubsection{Accessing the library in a browser}
78
79Once you have started up the library (see the previous sections for OS dependent instructions), you can access it in a browser at http://localhost:8080/gsdl3 (or http://your-computer-name:your-chosen-port/gsdl3). This gets you to a welcome page, with three links: one to run a test servlet (this allows you to check that Tomcat is running properly), one to run the standard library servlet using the site \gst{localsite}, and one to run a library servlet using the site \gst{soapsite}. This site uses a SOAP connection to communicate with localsite, and demonstrates the library working in a distributed fashion. See Section~\ref{sec:distributed} for details about how to run Greenstone distributedly.
80
81\subsection{How the library works}
82
83The standard library program is a Java servlet.
84
85Other types of interfaces can be used, such as Java GUI programs. See Section~\ref{sec:new-interfaces} for details about how to make these.
86
87\subsubsection{Restarting the library}
88
89The library program (actually tomcat) can be restarted by ... (** put a mechanism in each install program **).
90
91
92Tomcat must be shutdown and restarted any time you make changes in the following for those changes to take effect:\\
93\begin{bulletedlist}
94\begin{gsc}
95\item \gsdlhome/web/WEB-INF/web.xml
96\item \gsdlhome/comms/jakarta/tomcat/conf/server.xml
97\end{gsc}
98\item any classes or jar files used by the servlets
99\end{bulletedlist}
100\noindent Note: stdout and stderr for the servlets both go to\\
101\gst{\gsdlhome/comms/jakarta/tomcat/logs/catalina.out}
102
103
104\subsection{Directory structure}
105
106Table~\ref{tab:dirs} shows the file hierarchy for Greenstone3.
107The first part shows the common stuff which can be shared between
108Greenstone users---the source, libraries etc. Under Linux, these will eventually be installed into appropriate system directories. The second part shows
109stuff used by one person/group---their sites and interface setup (see Section~\ref{sec:sites-and-ints}).
110etc. There can be several sites/interfaces per installation.
111
112\begin{table}
113\caption{The Greenstone directory structure}
114\label{tab:dirs}
115{\footnotesize
116\begin{tabular}{l p{8cm}}
117\hline
118\bf directory & \bf description \\
119\hline
120gsdl3
121 & The main installation directory---gsdl3home can be changed to something more standard\\
122gsdl3/src
123 & Source code lives here \\
124gsdl3/src/java/
125 & java source code \\
126gsdl3/src/cpp/
127 & c/ cpp source code---none yet \\
128gsdl3/packages
129 & Imported packages from other systems e.g. MG, MGPP \\
130gsdl3/lib
131 & Shared library files\\
132gsdl3/lib/java
133 & Java jar files\\
134gsdl3/resources
135 & any resources that may be needed\\
136gsdl3/resources/java
137 & properties files for java resource bundles - used to handle all the language specific text This directory is on the class path, so any other Java resources can be placed here \\
138gsdl3/resources/soap
139 & soap service description files \\
140gsdl3/resources/dtd
141 & Greenstone has trouble loading DTD files sometimes. They can go here\\
142gsdl3/bin
143 & executable stuff lives here\\
144gsdl3/bin/script
145 & some Perl building scripts\\
146gsdl3/bin/linux
147 & Linux executables for e.g. MGPP\\
148gsdl3/bin/windows
149 & windows executables for e.g. MGPP\\
150gsdl3/comms
151 & Put some stuff here for want of a better place---things to do with servers and communication. e.g. soap stuff, and tomcat servlet container\\
152gsdl3/docs
153 & Documentation :-)\\
154\hline
155gsdl3/web
156 & This is where the web site is defined. Any static html files can go here. This directory is the Tomcat root directory.\\
157gsdl3/web/WEB-INF
158 & The web.xml file lives here (servlet configuration information for tomcat)\\
159gsdl3/web/WEB-INF/classes
160 & Servlet classes go in here\\
161gsdl3/web/sites
162 & Contains directories for different sites---a site is a set of collections and services served by a single MessageRouter (MR). The MR may have connections (e.g. soap) to other sites\\
163gsdl3/web/sites/localsite
164 & One site - the site configuration file lives here\\
165gsdl3/web/sites/localsite/collect
166 & The collections directory \\
167gsdl3/web/sites/localsite/images
168 & Site specific images \\
169gsdl3/web/sites/localsite/transforms
170 & Site specific transforms \\
171gsdl3/web/interfaces
172 & Contains directories for different interfaces - an interface is defined by its images and XSLT files \\
173gsdl3/web/interfaces/default
174 & The default interface\\
175gsdl3/web/interfaces/default/images
176 & The images for the default interface\\
177gsdl3/web/interfaces/default/transforms
178 & The XSLT files for the default interface\\
179\hline
180\end{tabular}}
181\end{table}
182
183
184\subsection{Sites and interfaces}\label{sec:sites-and-ints}
185
186local gs stuff (sites and interfaces) vs installed stuff (code)\\
187where they live, whats the difference, what each contains.\\
188
189A site is comprised of a set of collections and possibly services. An interface is a set of images along with a set of xslt files used for translating xml output from the library into an appropriate form---html for the servlet case.
190One greenstone installation can have many sites and interfaces. One instantiation of a servlet uses one site and one interface. Sites and interfaces can be matched up in different ways. For example, a single site might be served with two different interfaces. This provides different modes of access to the same content. eg HTML vs WML, or perhaps providing completely different look and feel for different audiences. A standard interface may be used with many different sites---provides a consistent mode of access to a lot of different content.
191
192Collections live in the collect directory of a site. Any collections that are found in this directory when the servlet is initialised will be loaded up and presented to the user. Collections require valid configuration files, but apart from this, nothing needs to be done to the site to use new collections. Collection is added while tomcat is running will not be picked up: you can either restart the server, or send a configuration request to the servlet: these are described in Section~\ref{sec:runtime-config}.
193
194There are two Greenstone sites that come with the distribution: localsite, and soapsite. localsite has several demo collections, while soapsite has none. soapsite specifies that a soap connection should be made to localsite. Getting this to work involves setting up a soap server for localsite: see Section~\ref{sec:distributed} for details.
195
196Each site and interface has a configuration file which specifies parameters for the site or interface---these are described in Section~\ref{sec:config}.
197
198The file \gst{\gsdlhome/web/WEB-INF/web.xml} contains the setup information for Tomcat. It tells Tomcat what servlets to load, what initial parameters to pass them, and what web names map to the servlets.
199There are three servlets specified in web.xml (these correspond to the three links in the welcome page for greenstone): one is a test servlet that just prints ``hello greenstone'' to a web page. This is useful if you are having trouble getting Tomcat set up. The other two are Greenstone library servlets, {\em library}, which serves localsite, and {\em library1} which serves soapsite. Both of these servlets use the standard interface (called {\em default}).
200
201\begin{table}
202\caption{Greenstone servlet initialisation parameters}
203\label{tab:serv-init}
204{\footnotesize
205\begin{tabular}{llp{5cm}}
206\hline
207\bf name & \bf sample value & \bf description \\
208\hline
209gsdl3\_home & /research/kjdon/gsdl3 & the base directory of the gsdl3 installation \\
210site\_name & localsite & the name of the site to use \\
211interface\_name & default & the name or the interface to use\\
212library\_name & library & the web name of the servlet \\
213default\_lang & en & the default language for the interface\\
214receptionist\_class & NZDLReceptionist & (optional) specifies an alternative Receptionist to use\\
215messagerouter\_class & NewMessageRouter & (optional) specifies an alternative MessageRouter to use\\
216\hline
217\end{tabular}}
218\end{table}
219
220The initialisation parameters used by the library servlets are shown in Table~\ref{tab:serv-init}. This is where you define what site and interface each servlet uses. Any number of servlets can be specified here. See Appendix~\ref{app:tomcat} for more details about Tomcat.
221
222
223\subsection{Configuring a greenstone installation}\label{sec:config}
224
225Initial Greenstone3 system configuration is determined by a set of configuration files, all expressed in XML. Each site has a configuration file that binds parameters for the site, \gst{siteConfig.xml}. Each interface has a configuration file, \gst{interfaceConfig.xml}, that specifies Actions for the interface. Collections also have several configuration files; these are discussed in Section~\ref{sec:collconfig}.
226The configuration files are read in when the system is initialised, and their contents are cached in memory. This means that changes made to these files once the system is running will not take immediate effect. Tomcat needs to be restarted for changes to the interface configuration file to take effect. However, changes to the site configuration file can be incorporated sending a CGI-type command to the library. There are a series of CGI-type commands that can be sent to the library to induce reconfiguration of different modules, including reloading the whole site. This removes the need to shutdown and restart the system to reflect these changes. These commands are described in Section~\ref{sec:runtime-config}.
227
228\subsubsection{Site configuration file}\label{sec:siteconfig}
229
230The file \gst{siteConfig.xml} specifies the URI for the site (\gst{localSiteName}), the HTTP address for site resources (\gst{httpAddress}), any ServiceClusters that the site provides (for example, collection building), any ServiceRacks that do not belong to a cluster or collection, and a list of
231known external sites to connect to. Collections are not specified in the site
232configuration file, instead they are determined by the contents of the site's
233collections directory.
234
235The HTTP address is used for retrieving resources from a site outside the XML protocol. Because a site is HTTP accessible through Tomcat, any files (e.g. images) belonging to that site or to its collections can be specified in the HTML of a page by a URL. This avoids having to retrieve these files from a remote site via the XML protocol\footnote{Currently, sites live inside the Tomcat gsdl3 root context, and therefore all their content is accessible over HTTP via the Tomcat address. We need to see if parts can be restricted. Also, if we use a different protocol, then resources from remote sites may need to come through the XML. Also, if we are running locally without using Tomcat, we may want to get them via file:// rather than http://.}.
236
237Figure~\ref{fig:siteconfig} shows two example site configuration files. The first example is for a rudimentary site with no site-wide services,
238which does not connect to any external sites. The second example is for a site with one site-wide service cluster - a collection building cluster. It also connects to the first site using SOAP.
239These two sites are running on the same machine. For site \gst{gsdl1} to talk to site \gst{localsite}, a SOAP server must be run for \gst{localsite}. The address of the SOAP server, in this case, is \gst{http://localhost:8080/soap/servlet/rpcrouter}.
240
241
242\begin{figure}
243\begin{gsc}\begin{verbatim}
244<siteConfig>
245 <localSiteName value="org.greenstone.localsite"/>
246 <httpAddress value="http://localhost:8080/gsdl3/sites/localsite"/>
247 <serviceClusterList/>
248 <serviceRackList/>
249 <siteList/>
250</siteConfig>
251\end{verbatim}\end{gsc}
252
253\begin{gsc}\begin{verbatim}
254<siteConfig>
255 <localSiteName value="org.greenstone.gsdl1"/>
256 <httpAddress value="http://localhost:8080/gsdl3/sites/gsdl1"/>
257 <serviceClusterList>
258 <serviceCluster name="build">
259 <metadataList>
260 <metadata name="Title">Collection builder</metadata>
261 <metadata name="Description">Builds collections in a
262 gsdl2-style manner</metadata>
263 </metadataList>
264 <serviceRackList>
265 <serviceRack name="GS2Construct"/>
266 </serviceRackList>
267 </serviceCluster>
268 </serviceClusterList>
269 <siteList>
270 <site name="org.greenstone.localsite"
271 address="http://localhost:8090/soap/servlet/rpcrouter"
272 type="soap"/>
273 </siteList>
274</siteConfig>
275\end{verbatim}\end{gsc}
276\caption{Two sample site configuration files}
277\label{fig:siteconfig}
278\end{figure}
279
280\subsubsection{Interface configuration file}\label{sec:interfaceconfig}
281
282The interface configuration file \gst{interfaceConfig.xml} lists all the actions that the interface knows about at the start (but other ones can be loaded dynamically). If the interface uses servlets, it specifies what short name each action should use for the action CGI parameter e.g. QueryAction should use a=q. If the interface uses XSLT, it specifies what XSLT file should be used for each action and subaction.
283
284\begin{figure}
285\begin{gsc}\begin{verbatim}
286<interfaceConfig>
287 <actionList>
288 <action name='p' class='PageAction'>
289 <subaction name='home' xslt='home.xsl'/>
290 <subaction name='about' xslt='about.xsl'/>
291 <subaction name='help' xslt='help.xsl'/>
292 <subaction name='pref' xslt='pref.xsl'/>
293 </action>
294 <action name='q' class='QueryAction' xslt='basicquery.xsl'/>
295 <action name='b' class='GS2BrowseAction' xslt='classifier.xsl'/>
296 <action name='a' class='AppletAction' xslt='applet.xsl'/>
297 <action name='d' class='DocumentAction' xslt='document.xsl'/>
298 <action name='xd' class='XMLDocumentAction'>
299 <subaction name='toc' xslt='document-toc.xsl'/>
300 <subaction name='text' xslt='document-content.xsl'/>
301 </action>
302 <action name='pr' class='ProcessAction' xslt='process.xsl'/>
303 <action name='s' class='SystemAction' xslt='system.xsl'/>
304 </actionList>
305</interfaceConfig>
306\end{verbatim}\end{gsc}
307\caption{Default interface configuration file}
308\label{fig:ifaceconfig}
309\end{figure}
310
311This makes it easy for developers to implement and use different actions and/or XSLT files without recompilation. The server must be restarted, however.
312
313\subsection{Run-time re-initialisation}\label{sec:runtime-config}
314
315should this section go in here, cos its kind of adminy, or go into the user stuff, cos you need to do it after building a collection???
316
317When tomcat is started up, the site and interface configuration files are read in, and actions/services/collections loaded as necessary. The configuration is then static unless tomcat is restarted, or re-configuration commands issued.
318
319There are several CGI-type commands that can be issued to tomcat to avoid having to restart the server. These can reload the entire site, or just individual collections. Unfortunately at present there are no commands to reconfigure the interface, so if the interface configuration file has changed, tomcat must be restarted for those changes to take effect. Similarly, if the java classes are modified, tomcat must be restarted then too.
320
321Currently, the runtime configuration commands can only be accessed by typing in CGI-arguments into the URL, there is no nice web form yet to do this.
322
323The CGI arguments are entered after the \gst{library?} part of the URL. There are three types of commands: configure, activate, deactivate\footnote{There is no security for these commands yet in Greenstone, so the deactivate/delete command is disabled}. These are specified by \gst{a=s\&sa=c}, \gst{a=s\&sa=a}, and \gst{a=s\&sa=d}, respectively (\gst{a} is action, \gst{sa} is subaction). By default, the requests are sent to the MessageRouter, but they can be sent to a collection/cluster by the addition of \gst{sc=xxx}, where \gst{xxx} is the name of the collection or cluster. Table~\ref{tab:run-time config} describes the arguments in a bit more detail.
324
325\begin{table}
326\caption{Example run-time configuration arguments.}
327\label{tab:run-time config}
328{\footnotesize
329\begin{tabular}{lp{8cm}}
330\hline
331\gst{a=s\&sa=c} & reconfigures the whole site, reads in siteConfig.xml, reloads all the collections. Just part of this can be specified with another argument \gst{ss} (system subset). The valid values are \gst{collectionList}, \gst{siteList}, \gst{serviceList}, \gst{clusterList}. \\
332\gst{a=s\&sa=c\&sc=XXX} & reconfigures the XXX collection or cluster. \gst{ss} can also be used here, valid values are \gst{metadataList} and \gst{serviceList}. \\
333\gst{a=s\&sa=a} & (re)activate a specific module. Modules are specified using two arguments, \gst{st} (system module type) and \gst{sn} (system module name). Valid types are \gst{collection}, \gst{cluster} \gst{site}.\\
334\gst{a=s\&sa=d} & deactivate a module. \gst{st} and \gst{sn} can be used here too. Valid types are \gst{collection}, \gst{cluster}, \gst{site}, \gst{service}. Modules are removed from the current configuration, but will reappear if Tomcat is restarted.\\
335\gst{a=s\&sa=d\&sc=XXX} & deactivate a module belonging to the XXX collection or cluster. \gst{st} and \gst{sn} can be used here too. Valid types are \gst{service}. \\
336\hline
337\end{tabular}}
338\end{table}
339\newpage
340\section{Using Greenstone 3}\label{sec:user}
341
342Once you have greenstone 3 installed, you can access the sample collections. The installation comes with some example collections, and Section~\ref{sec:usecolls} describes these collections and how to use them. Section~\ref{sec:buildcol} describes how to build your own collections.
343
344\subsection{Using a collection}\label{sec:usecolls}
345
346A collection typically consists of a set of documents, which could be text, html, word, PDF, images, bibliographic records etc, along with some access methods, or services. Typical access methods include searching or browsing for document identifiers, and retrieval of content or metadata for those identifiers.
347Searching involves entering words or phrases and getting back lists of documents that contain those words. The search terms may be restricted to particular fields of the document. Browsing ...
348
349In the standard interface that comes with Greenstone3\footnote{of course, this is all customisable}, collections in a digital library are presented in the following manner. The 'home' page of the library shows a list of all the public collections in that library. Clicking on a collection link takes you to the home page for the collection, which we call the 'about' page. The standard page banner looks something like that shown in Figure~\ref{fig:page-banner}.
350
351\begin{figure}[h]
352 \centering
353 \includegraphics[width=4in]{pagebanner} %5.8
354 \caption{A sample collection page banner}
355 \label{fig:page-banner}
356\end{figure}
357
358The image at the top left is a link to the collection's about page. The top right has buttons to link to the library home page, help pages and preference pages. All the available services are arrayed along a navigation bar, along the bottom of the banner. Click on a name to access that service.
359Once you are looking at a document, clicking the open book icon at the top of the document, underneath the navigation bar, will take you back to the search or browse page where you accessed the document from.
360
361describe the colls that the sample installation comes with\\
362brief description of what a collection is.\\
363how to get around the collection, services etc. \\
364querying vs browsing \\
365use the demo colls that come with greenstone - one gs2 coll, one gs3 coll, tei coll??\\
366
367\subsection{Building a collection}\label{sec:buildcol}
368
369There are two ways to get a new collection into Greenstone 3. The first is to build it using the greenstone 3 building process. The second way is to import a greenstone 2 collection.
370
371Collections live in the collect directory of a site. As described in Section~\ref{sec:sites-and-ints}, there can be several sites per greenstone installation. The collect directory is at \$GSDL3HOME/web/sites/site-name/collect, where site-name is the name of the site you want your new collection to belong to.
372
373The following two sections describe how to create a collection from scratch, and how to import a greenstone 2 collection. Once a collection has been built, the library server needs to be notified that there is a new collection. This can be accomplished in two ways\footnote{eventually there will also probably be automatic polling for new collections}. If you are the library administrator, you can restart tomcat. The library servlet will then be created afresh, and will discover the new collection when it scans the collect directory for the collection list. Alternatively, there is a CGI command to reload a collection which can also load a new one. Use the CGI arguments \gst{a=s\&sa=a\&st=collection\&sn=collname}---this tells the library program to reload the collname collection.
374
375
376\subsubsection{Creating a collection from scratch}
377
378Building Greenstone 3 collections is done using the \gst{gs3build} script, whilst the files that control how the building is done are found inside the \gst{etc} subdirectory of \gst{gsdl3/web/sites/localsite/collect/[collectionname]}. There are a number of considerations in building a collection: including what documents appear in the collection, how they are indexed for searching, which classifications are used for browsing, etc. All these aspects are controlled by files within the collection's directory.
379
380Firstly, the documents that comprise the collection should be placed in the import subdirectory. At present, only documents in this directory will appear in the collection.
381
382The basic means of finding documents in Greenstone is search. The etc/collectionConfig.xml file controls which indexes are created to support search. By default, a collection will simply index the text of each document in the collection using the MG search engine. Alternative choices include selecting other search engines, indexing individual fields of documents (e.g. the document title) and indexing documents by section.
383
384Search indexes appear as individual \gst{<index>} elements within the \gst{<search>}element of the \gst{collectionConfig.xml} file, and classifications as individual \gst{<classifier>} elements within the \gst{<browse>} element. In each case, some choices are made using attributes of the element itself, and some through child elements.
385
386Indexes can alter which search engine to use for that index, the level at which the index should be built (e.g. document, section or paragraph) and the text over which it should be built (e.g. the document text, titles alone, author names, etc.). Section-level indexes allow a reader to recall part of a document (for instance, a chapter) rather than the entire document. However, Greenstone 3 must be able to identify the internal structure of the document to achieve this. The degree to which structure can be found varies from file format to file format.
387
388Each index also must have a unique name, which is used to identify it within Greenstone The name is given as an attribute of the \gst{<index>} element. The ``type'' indicates which search engine to use for the index. This attribute can contain either 'mg' or 'mgpp'. If the ``type'' attribute is not given, the default indexer is mg.
389
390The other choices are described using child elements of \gst{<index>}. The \gst{<level>} tag indicates the index level and the \gst{<field>} tag the text to be used. The \gst{<level>} tag can contain one of document, section or paragraph, while the \gst{<field>} tag can contain ``text'' or the name of a metadata field. If the \gst{<level>} tag is omitted, the default setting is to index by document, and if the \gst{<field>} tag is omitted, the default setting is to index the document text.
391
392Example index tags include:
393
394To index only the title of each separate document in the collection:
395\begin{gsc}\begin{verbatim}
396<index name="dtt">
397 <level>document</level>
398 <field>dc:title</field>
399 <displayItem name='name' lang="en">entire documents</displayItem>
400 <displayItem name='name' lang="fr">documents entiers</displayItem>
401 <displayItem name='name' lang="es">documentos enteros</displayItem>
402</index>
403\end{verbatim}\end{gsc}
404...in this case the \gst{<field>} tag refers to the ``title'' metadata item, found in the Dublin Core namespace. The mg search engine would be used on this index.
405
406Alternatively, to index the full document texts by section:
407\begin{gsc}\begin{verbatim}
408<index name="stx" type=''mgpp''>
409 <level>section</level>
410 <displayItem name='name' lang="en">entire documents</displayItem>
411 <displayItem name='name' lang="fr">documents entiers</displayItem>
412 <displayItem name='name' lang="es">documentos enteros</displayItem>
413</index>
414\end{verbatim}\end{gsc}
415...or...
416\begin{gsc}\begin{verbatim}
417<index name="stx" type=''mg''>
418 <level>section</level>
419 <field>text</field>
420 <displayItem name='name' lang="en">entire documents</displayItem>
421 <displayItem name='name' lang="fr">documents entiers</displayItem>
422 <displayItem name='name' lang="es">documentos enteros</displayItem>
423</index>
424\end{verbatim}\end{gsc}
425...in the first example, the \gst{<field>} tag is not explicitly defined, and would default to 'text', whereas it is explicitly set to 'text' in the second example. Note the different indexer selected for these two indexes. As they are of the same name, they should not appear in the same \gst{collectionConfig.xml} file.
426
427Moving onto \gst{<classifier>} items, the format is broadly similar to \gst{<index>} items, but with a couple of different choices. Firstly, each classifier should have a ``name'' and ``type'' attribute as with \gst{<index>} tags. In the case of \gst{<classifier>} items the ``type'' attribute identifies the type of classifier it is. At present, this should either be ``Hierarchy'' or ``AZList''.
428
429The remaining choices for the classifier should follow as child elements of the \gst{<classifier>} element. The \gst{<file>} element should contain the name of the file that describes the classifier as its ``URL'' attribute. The format of this file will be described later - it will vary from classifier type to classifier type. The \gst{<field>} element identifies the name of the field to index. More than one \gst{<field>} element may appear if two or more metadata fields are to be used with the classifier. Finally, the \gst{<sort>} item identifies another metadata field which the items within one classifier node are to be ordered. Unlike the \gst{<index>} element, the \gst{<classifier>} element does not have default, assumed values for its children.
430
431Metadata for documents can be added using metadata.xml files. These files have already been used in Greenstone 2, and the format is the same in Greenstone 3. A metadata.xml file has a root element of \gst{<DirectoryMetadata>}. This encloses a series of \gst{<FileSet>} items. Neither of these tags has any attributes. Each \gst{<FileSet>} item includes two parts: firstly, one or more \gst{<FileName>} tags, each of which encloses a regular expression to identify the files which are to be assigned the metadata. Only files in the same directory as the metadata.xml, or in one of its child directories, file will be selected. The filename tag encloses the regular expression as text, eg:
432
433\begin{gsc}\begin{verbatim}
434<FileName>example</FileName>
435\end{verbatim}\end{gsc}
436
437This would match any file containing the text 'example' in its name. The second part of the \gst{<FileSet>} item is a \gst{<Description>} item. The \gst{<Description>} tag has no attributes, but encloses one or more \gst{<Metadata>} tags. Each \gst{<Metadata>} tag contains one metadata item, i.e. a label to describe the metadata and a corresponding value. The \gst{<Metadata>} tag has one compulsory attribute: ``name''. This attribute gives the metadata label to add to the document. Each \gst{<Metadata>} tag also has an optional attribute: ``mode''. If this attribute is set to ``accumulate'' then the value is added to the document, and any existing values for that metadata item are retained. If the attribute is set to ``set'' or is omitted, then the existing value of the metadata item will be deleted.
438
439A sample \gst{metadata.xml} file can be found in the gs3test collection. However, here is an example fragment of that \gst{metadata.xml} file:
440
441\begin{gsc}\begin{verbatim}
442<FileSet>
443 <FileName>ec160e</FileName>
444 <Description>
445 <Metadata name="Title">The Courier - No.160 - Nov - Dec 1996 -
446 Dossier Habitat - Country reports: Fiji , Tonga (ec160e)</Metadata>
447 <Metadata mode="accumulate" name="Language">English</Metadata>
448 <Metadata mode="accumulate" name="Subject">Settlements and housing:
449 general works incl. low- cost housing, planning techniques, surveying,
450 etc.</Metadata>
451 <Metadata mode="accumulate" name="Subject">The Courier ACP 1990 - 1996
452 Africa-Caribbean-Pacific - European Union</Metadata>
453 <Metadata mode="accumulate" name="Organization">EC Courier</Metadata>
454 <Metadata mode="accumulate" name="AZList">T.1</Metadata>
455 </Description>
456</FileSet>
457\end{verbatim}\end{gsc}
458
459Here, only one file pattern is found in the file set. However, the \gst{Description} tag contains a number of separate metadata items. Note that the \gst{Title} metadata does not have the accumulate metadata. This means that when the title is assigned to a document, its existing \gst{Title} information will be lost.
460
461Whereever possible, the Greenstone 3 will import and use options from a Greenstone 2 \gst{collect.cfg} file. However, it is strongly recommended that a proper \gst{collectionConfig.xml} file is used wherever possible.
462
463To build a collection execute \gst{gs3build.sh -collect collectionname}. The process will run, placing the new indexes in the \gst{building} subdirectory of the collection's directory.
464
465[TODO: need to describe namespaces somewhere?]
466
467\subsubsection{Importing a greenstone 2 collection}
468
469Greenstone 3 can also serve Greenstone 2 collections. If you have a Greenstone 2 collection\footnote{For information about the Greenstone 2 software, and how to build collections using it, visit \gst{www.greenstone.org}}, you can copy it into the collect directory of the site you are using. Or make a link to it from the collect directory if your OS supports that.
470The Greenstone 3 run time system requires different configuration files for a collection, so you need to run a conversion script. All this does is create the new collectionConfig.xml and buildConfig.xml from the old collect.cfg and build.cfg files. It does not change the collection in any way, so it can still be used by Greenstone 2 software.
471
472The conversion script is \gst{convert\_coll\_from\_gs2.pl}. To run it, you need to specify the path to the collect directory, and the collection name. For example,
473
474\gst{convert\_coll\_from\_gs2.pl -collectdir \$GSDL3HOME/web/\-sites/\-localsite/\-collect demo}
475
476The script attempts to create gs3 format statements from the old greenstone 2 ones. The conversion may not always work properly, so if the collection looks a bit strange under greenstone 3, you should check the format statements. Format statements are described in Section~\ref{sec:formatstmt}.
477
478Once again, to have the collection recognised by the library servlet, you can either restart tomcat, or load it manually by sending the arguments \gst{a=s\&sa=c\&c=collname} to the library servlet.
479
480\subsection{Collection configuration files}\label{sec:collconfig}
481
482Each collection has two, or possibly three, configuration files, \gst{collectionConfig.xml} and \gst{buildConfig.xml}, and optionally \gst{collectionInit.xml} that give metadata, display and other information for the
483collection.\footnote{\gst{siteConfig.xml} and \gst{interfaceConfig.xml} is new for Greenstone3, while \gst{collectionConfig.xml} and \gst{buildConfig.xml} replace \gst{collect.cfg} and \gst{build.cfg} in
484Greenstone2.} The first includes user-defined presentation metadata for the collection,
485such as its name and the {\em About this collection} text; gives formatting information for the collection display; and also gives
486instructions on how the collection is to be built. The second is produced by
487the build-time process and includes any metadata that can be determined
488automatically. It also includes configuration information for any ServiceRacks needed by the collection.
489
490\subsubsection{collectionInit.xml}
491
492This optional file specifies a new collection class if the standrad one is not to be used. The only syntax so far is the class name:
493
494\begin{gsc}\begin{verbatim}
495<collectionInit class="XMLCollection"/>
496\end{verbatim}\end{gsc}
497
498Section~\ref{sec:new-coll-types} describes an example collection where this file is used. Depending on the type of collection that this is used for, one or both of the other config files may not be needed.
499
500\subsubsection{collectionConfig.xml}
501
502The collection configuration file is where the collection designer (e.g. a librarian) decides what form the collection should take. This includes the collection metadata such as title and description, and also includes what indexes and browsing structures should be built. The format of \gst{collectionConfig.xml} is still under consideration. However, Figure~\ref{fig:collconfig} shows the parts of it that have been defined so far. (Since collection building at this stage is still done using Greenstone2 Perl scripts and the old \gst{collect.cfg} file, we have only defined the format for the parts of \gst{collectionConfig.xml} that are used by the runtime-system.)
503
504Display elements for a collection or metadata for a document can be entered in any language---use lang='en' attributes to metadata elements to specify which language they are in.
505
506configuration files need to be encoded in utf-8.
507
508\begin{figure}
509\begin{gsc}\begin{verbatim}
510<collectionConfig xmlns:gsf="http://www.greenstone.org/configformat"
511 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
512 <metadataList>
513 <metadata name="creator">[email protected]</metadata>
514 </metadataList>
515 <displayItemList>
516 <displayItem name="smallicon" lang="en">mgppdemosm.gif</displayItem>
517 <displayItem name="description" lang="fr">C'est une collection pour
518 demonstration du logiciel Greenstone. Elle contient une petite
519 partie du projet de bibliotheques humanitaires et de developpement
520 (11 livres).</displayItem>
521 <displayItem name="description" lang="en">This is a demonstration
522 collection for the Greenstone digital library software. It contains
523 a small subset (11 books) of the Humanity Development Library. It is
524 built with mgpp.</displayItem>
525 <displayItem name="name" lang="en">greenstone mgpp demo</displayItem>
526 <displayItem name="icon" lang="en">mgppdemo.gif</displayItem>
527 </displayItemList>
528 <search>
529 <index name="idx"/>
530 <format>
531 <gsf:template match="documentNode">
532 <td valign='top'><gsf:link><gsf:icon/></gsf:link></td>
533 <td><gsf:metadata name='Title' select='ancestors'
534 separator=': '/>: <gsf:link><gsf:metadata name='Title' />
535 </gsf:link></td>
536 </gsf:template>
537 </format>
538 </search>
539 <browse>
540 <classifier name="CL1"/>
541 <classifier name="CL2"/>
542 <classifier name="CL3"/>
543 <classifier name="CL4">
544 <format>
545 <gsf:template match="documentNode">
546 <br /><gsf:link><gsf:metadata name='Keyword' />
547 </gsf:link></gsf:template>
548 </format>
549 </classifier>
550 </browse>
551 <display/>
552</collectionConfig>
553\end{verbatim}\end{gsc}
554\caption{Sample collectionConfig.xml file (mgppdemo collection)}
555\label{fig:collconfig}
556\end{figure}
557
558The \gst{<metadataList>} element specifies some collection metadata, such as creator. The \gst{<displayItemList>} specifies some language dependent information that is used for collection display, such as collection name and short description. These displayItem elements can be specified in different languages. If languages other than English are used, the configuration file should be encoded in utf-8.
559The \gst{<search>} and \gst{<browse>} elements give some formatting information about the indexes and classifiers. \gst{<displayItem>} elements are used to provide titles for the indexes or classifiers, while \gst{<format>} elements provide formatting instructions, typically for a document or classifier node in a list of results.
560
561The \gst{<display>} element contains optional formatting information for the display of documents. Templates that can be specified here include \gst{documentHeading}, \gst{DocumentContent}, and other information that could be specified (in a yet to be decided format) are things such as whether or not to display the cover image, table of contents etc.
562
563\subsection{buildConfig.xml}\label{sec:buildconfig}
564
565The file \gst{buildConfig.xml} is produced by the collection building process, and contains metadata and other information about the collection that can
566be determined automatically, such as the number of
567documents it contains. It also includes a list of ServiceRack classes that are
568required at runtime to provide the services that have been built into the
569collection. The serviceRack names are Java classes that are loaded
570dynamically at runtime. Any information inside the serviceRack element is
571specific to that service---there is no set format. Figure~\ref{fig:buildconfig} shows an example. This configuration file specifies that the collection should load up 3 ServiceRacks: GS2MGPPRetrieve, GS2MGPPSearch, and PhindPhraseBrowse. The contents of each \gst{<serviceRack>} element are passed to the appropriate ServiceRack objects for configuration. The collectionConfig.xml file is also passed to the ServiceRack objects at configure time---the \gst{format} and \gst{displayItem} information is used directly from the \gst{collectionConfig.xml} file rather than added into \gst{buildConfig.xml} during building. This enables changes in \gst{collectionConfig.xml} to take effect in the collection without rebuilding being necessary.
572
573
574\begin{figure}
575\begin{gsc}\begin{verbatim}
576<buildConfig xmlns:gsf="http://www.greenstone.org/configformat">
577 <metadataList>
578 <metadata name="numDocs">11</metadata>
579 </metadataList>
580 <serviceRackList>
581 <serviceRack name="GS2MGPPRetrieve">
582 <defaultLevel name="Sec" />
583 <classifierList>
584 <classifier name="CL1" content="Subject" />
585 <classifier name="CL2" content="Title" horizontalAtTop="true" />
586 <classifier name="CL3" content="Organization" />
587 <classifier name="CL4" content="Keyword" />
588 </classifierList>
589 </serviceRack>
590 <serviceRack name="PhindPhraseBrowse" />
591 <serviceRack name="GS2MGPPSearch">
592 <defaultLevel name="Sec" />
593 <levelList>
594 <level name="Doc" />
595 <level name="Sec" />
596 <level name="Para" />
597 </levelList>
598 <fieldList>
599 <field shortname="ZZ" name="allfields" />
600 <field shortname="TX" name="text" />
601 <field shortname="TI" name="Title" />
602 <field shortname="SU" name="Subject" />
603 <field shortname="ORG" name="Organization" />
604 <field shortname="SO" name="Source" />
605 </fieldList>
606 <searchTypeList>
607 <searchType name="plain" />
608 <searchType name="form" />
609 </searchTypeList>
610 <defaultIndex name="idx" />
611 <indexList>
612 <index name="idx" />
613 </indexList>
614 </serviceRack>
615 </serviceRackList>
616</buildConfig>
617\end{verbatim}\end{gsc}
618\caption{Sample buildConfig.xml file (mgppdemo collection)}
619\label{fig:buildconfig}
620\end{figure}
621
622\subsection{Formatting the collection}\label{sec:formatstmt}
623
624format statements. and displayItem stuff. advanced collection design.\\
625
626Part of collection design involves deciding how the collection should look. Greenstone has a default 'look' for a collection, so this is optional. However, the default may not suit the purposes of some collections, so many parts to the look of a collection can be determined by the collection designer.
627
628In standard greenstone, the library is served to a web browser by a servlet, and the html is generated using XSLT. XSLT templates are used to format all the parts of the pages. Some commonly overwritten templates are those for formatting lists: search results list, classifier browsing hierarchies, and for parts of the document display.
629
630Real XSLT templates for formatting search results or classifier lists are quite complicated, and not at all easy for a new user to write. For example, the following is a sample template for formatting a classifier list, to show Keyword metadata as a link to the document.
631
632\begin{gsc}\begin{verbatim}
633<xsl:template match="documentNode" priority="2"
634 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
635 <xsl:param name="collName"/>
636 <td><a href="{\$library_name}?a=d&amp;c={\$collName}&amp;
637 d={@nodeID}&amp;dt={@docType}"><xsl:value-of
638 select="metadataList/metadata[@name='Keyword']"/></a>
639 </td>
640</xsl:template>
641 \end{verbatim}\end{gsc}
642
643To write this, the user would need to know that:
644\begin{bulletedlist}
645\item the variable \$library\_name exists,
646\item the collection name is passed in as a parameter called collName
647\item metadata for a document is found in a metadataList and that its form is \gst{<metadata name="Keyword">the value</metadata>}
648\item the arguments needed for the link to the document are a, sa, c, d and dt.
649\end{bulletedlist}
650
651Since XSLT is written in XML, we can use XSLT to transform XML into XSLT. Greenstone provides a simplified set of formatting commands, written in XML, which will be transformed into proper XSLT. Table~\ref{tab:gsf-format} shows the set of 'gsf' (greenstone format) elements. If you have come from a Greenstone 2 background, Appendix~\ref{app:format} shows Greenstone 2 format elements and their equivalents in Greenstone 3.
652
653\begin{table}
654\caption{Format elements for GSF format language}
655\label{tab:gsf-format}
656{\footnotesize
657\begin{tabular}{p{6.5cm}p{6.5cm}}
658\hline
659\bf Element & \bf Description \\
660\hline
661\gst{<gsf:text/>} & The document's text\\
662\gst{<gsf:link>...</gsf:link>} & The HTML link to the document itself \\
663\gst{<gsf:link type='document'>...
664</gsf:link>} & Same as above\\
665\gst{<gsf:link type='classifier'>...
666</gsf:link>} & A link to a classification node (use in classifierNode templates)\\
667\gst{<gsf:link type='source'>...
668</gsf:link>} & The HTML link to the original file---set for documents that have been converted from e.g. Word, PDF, PS \\
669\gst{<gsf:icon/>} & An appropriate icon\\
670\gst{<gsf:icon type='document'/>} & same as above\\
671\gst{<gsf:icon type='classifier'/>} & bookshelf icon for classification nodes\\
672\gst{<gsf:icon type='source'/>} & An appropriate icon for the original file e.g. Word, PDF icon\\
673\gst{<gsf:metadata name='Title'/>} & The value of a metadata element for the current document or section, in this case, Title\\
674\gst{<gsf:metadata name='Title' select='select-type' [separator='y' multiple='true']/>} & A more extended selection of metadata values. The select field can be one of those shown in Table~\ref{tab:gsf-select-types}. There are two optional attributes: separator gives a String that will be used to separate the fields, default is ``, ``, and if multiple is set to true, looks for multiple values at each section.\\
675
676\gst{<gsf:choose-metadata>
677 <gsf:metadata name='metaA'/>
678 <gsf:metadata name='metaB'/>
679 <gsf:metadata name='metaC'/>
680</gsf:choose-metadata>}
681 & A choice of metadata. Will select the first existing one. the metadata elements can have the select, separator and multiple attributes like normal.\\
682\gst{<gsf:switch preprocess=
683'preprocess-type'>
684<gsf:metadata name='Title'/>
685<gsf:when test='test-type'
686test-value='xxx'>...</gsf:when>
687<gsf:when test='test-type'
688test-value='yyy'>...</gsf:when>
689<gsf:otherwise>...</gsf:otherwise>
690</gsf:switch>} & switch on the value of a particular metadata - the metadata is specified in gsf:metadata, has the same attributes as normal.\\
691\hline
692\end{tabular}}
693\end{table}
694
695The \gst{<gsf:metadata>} elements are used to output metadata values. The simplest case is \gst{<gsf:metadata name='Title'/>}---this outputs the Title metadata for the current document or section. Namespaces are important here: if the Title metadata is in the Dublin Core (dc) namespace, then the element should look like \gst{<gsf:metadata name='dc.Title'/>}. There are three other attributes for this element. 'multiple' is used when there may be more than one value for the selected metadata. For instance, one document may fall into several classification categories, and therefore may have multiple Subject metadata values. Adding \gst{multiple='true'} to the gsf:metadata element will retrieve all values, not just the first one. Multiple values are separated by commas by default. The separator attribute is used to change the separating string. For example, adding \gst{separator=': '} to the element will separate all values by a colon and a space.
696
697Sometimes you may want to display metadata values for sections other than the current one. For example, in the mgppdemo collection, in a search list we display the Title of all the enclosing sections, followed by the Title of the current section, all separated by semi-colons. The display ends up looking something like:
698Farming snails 2; Starting out; Selecting your snails
699where Selecting your snails is the Title of the section in the results list, and Farming snails 2 and Starting out are the Titles of the enclosing sections. The select attribute is used to display metadata for sections other than the current one. Table~\ref{tab:gsf-select-types} shows the options available for this attribute. The separator attribute is used here also, to specify the separating text.
700
701To get the previous metadata, the format statement would have the following in it:
702
703\begin{gsc}
704\begin{verbatim}
705<gsf:metadata name='Title' select='ancestors' separator='; '/>;
706 <gsf:metadata name='Title'/>
707\end{verbatim}
708\end{gsc}
709
710\begin{table}
711\caption{Select types for metadata format elements}
712\label{tab:gsf-select-types}
713{\footnotesize
714\begin{tabular}{ll}
715\hline
716\bf Select Type & \bf Description\\
717\hline
718current & The current section \\
719parent & The immediate parent section\\
720ancestors & All the parents back to the root (topmost) section\\
721root & The root or topmost section \\
722siblings & All the sibling sections\\
723children & The immediate children sections of the current section\\
724descendents & All the descendent sections\\
725\hline
726\end{tabular}}
727\end{table}
728
729The gsf:choose-metadata element selects the first available metadata value from the list of options.
730\begin{gsc}
731\begin{verbatim}
732<gsf:choose-metadata>
733 <gsf:option name='dc.Title'/>
734 <gsf:option name='dls.Title'/>
735 <gsf:option name='Title'/>
736</gsf:choose-metadata>
737\end{verbatim}
738\end{gsc}
739
740This will display the dls.Title metadata if available, otherwise it will use the dc.Title metadata if available, otherwise it will use the Title metadata. If there are no values for any of these metadata elements, then nothing will be displayed.
741
742The gsf:switch element allows different formatting depending on the value of a specified metadata element. For example, the following switch statement could be used to display a different icon for each document in a list depending on which organisation it came from.
743
744\begin{gsc}
745\begin{verbatim}
746<gsf:switch metadata='Organization' preprocess='toLower;stripSpace'>
747 <gsf:when test='equals' test-value='bostid'>
748 <!-- output BOSTID image --></gsf:when>
749 <gsf:when test='equals' test-value='worldbank'>
750 <!-- output world bank image --></gsf:when>
751 <gsf:otherwise><!-- output default image--></gsf:otherwise>
752</gsf:switch>
753\end{verbatim}
754\end{gsc}
755
756Preprocessing of the metadata value is optional. The preprocess types are toLower (make the value lowercase), toUpper (make the value uppercase), stripSpace (removes any whitespace from the value). These operations are carried out on the value of the selected metadata before the test is carried out. Multiple processing types can be specified, separated by ; and they will be applied in the order specified (from left to right).
757
758Each option specifies a test and a test value. Test values are just text. Tests include startsWith, contains, exists, equals, endsWith. Exists doesn't need a test value. Having an otherwise option ensures that something will be displayed even when none of the tests match.
759
760
761If none of the gsf elements meets your needs for formatting, XSLT can be entered directly into the format element, giving the collection designer full flexibility over how the collection appears.
762
763The collection specific templates are added into the configuration file \gst{collectionConfig.xml}. Any templates found in the XSLT files can be overwritten.
764The important part to adding templates into the configuration file is determining where to put them. Formatting templates cannot go just anywhere---there are standard places for them. Figure~\ref{fig:format-places} shows the positions that templates can occur.
765
766\begin{figure}
767\begin{gsc}\begin{verbatim}
768<collectionConfig>
769 <metadataList/>
770 <displayItemList/>
771 <search>
772 <format> <!--Put here templates related to searching and
773 the query page. The common one is the documentNode
774 template -->
775 <gsf:template match='documentNode'>...</gsf:template>
776 </format>
777 </search>
778 <browse>
779 <classifier name='xx'>
780 <format><!-- put here templates related to formating a
781 particular classifier page. Common ones are documentNode
782 and classifierNode templates-->
783 <gsf:template match='documentNode'>...</gsf:template>
784 <gsf:template match='classifierNode'>...</gsf:template>
785 <gsf:template match='classifierNode' mode='horizontal'>...
786 </gsf:template>
787 </format>
788 </classifier>
789 <classifier>...</classifier>
790 </browse>
791 <display>
792 <format><!-- here goes any formatting relating to the display
793 of the documents. These are generally named templates,
794 and format options -->
795 <gsf:template name='documentContent'>...</gsf:template>
796 <gsf:option name='TOC' value='true'/>
797 </format>
798 </display>
799</collectionConfig>
800\end{verbatim}\end{gsc}
801\caption{Places for format statements}
802\label{fig:format-places}
803\end{figure}
804
805The user specifies a \gst{<gsf:template>} for what they want to format---these can match \gst{documentNode} or \gst{classifierNode} (for node in a classification hierarchy).
806
807The template above is now represented as:
808
809\begin{gsc}\begin{verbatim}
810<gsf:template match='documentNode'>
811 <td><gsf:link><gsf:metadata name='Keyword'/></gsf:link></td>
812</gsf:template>
813\end{verbatim}\end{gsc}
814
815There are also formatting instructions that are not templates but are options.
816These are described in Table~\ref{tab:format_options}. They are entered into the configuration file like \gst{<gsf:option name='coverImages' value='false'/>}
817
818\begin{table}
819\caption{Formatting options}
820\label{tab:format_options}
821{\footnotesize
822\begin{tabular}{llp{5cm}}
823\hline
824\bf option name & \bf values & \bf description \\
825\hline
826coverImages & true, false & whether or not to display cover images for documents \\
827TOC & true, false & whether or not to display the table of contents for the document\\
828\hline
829\end{tabular}}
830\end{table}
831
832Note, format templates are added into the XSLT files before transforming, while the options are added into the page source, and used in tests in the XSLT.
833
834For local collections\footnote{and eventually remote collections} whole XSLT files can be overridden. A collection can have a transform directory. Any XSLT files in here will be used in preference to the interface files when using this collection. For example, if you want to have a completely different about page for the collection, you can put a new about.xsl into the collections transform directory, and this will be used instead. This is what we do for the Gutenberg sample collection.
835
836
837\subsection{Customising the interface}\label{sec:interface-customise}
838
839The interface can be customised in several ways.
840adding a new interface, adding a new language, \\
841changing the look and feel for an interface vs a site vs a collection\\
842
843what needs a tomcat restart?
844
845\subsubsection{Changing the interface language}
846
847The interface language can be changed by going to the preferences page, and choosing a language from the list. The list lists (:-)) all languages in which the interface has been defined so far.
848
849It is easy to add a new interface language to greenstone. Language specific text strings are separated out from the rest of the system to allow for easy incorporation of new languages. These text strings are contained in Java resource bundle properties files. These are plain text files consisting of key-value pairs, located in resources/java. Each interface has one named interface\_name.properties (where name is the interface name). Each service class has one with the same name as the class (e.g. GS2Search.properties). To add another language all of the base .properties files must be translated. The translated files keep the same names, but with a language extension added. For example, a French version of interface\_default.properties would be named interface\_default\_fr.properties.
850
851Keys will be looked up in the properties file closest to the specified language. For example, if language fr\_CA was specified (french language, country Canada), and the default locale was en\_GB, java would look at properties files in the following order, until it found the key: XXX\_fr\_CA.properties, XXX\_fr.properties, XXX\_en\_GB.properties, then XXX\_en.properties, and finally the default XXX.properties.
852
853You can tell Greenstone about a new language by ... currently in interfaceConfig.
854
855
856\subsubsection{Modifying an existing interface}
857
858Most of an interface is defined by XSLT files, which are stored in \$GSDL3HOME/\-web/\-interfaces/\-interface-name/\-transform. These can be changed and the changes will take affect straight away. If changes only apply to certain collections or sites, not everything that uses the interface, you can override some of the files by putting new ones in a different place. XSLT files are looked for in the following order: collection, site, interface, default interface. (This currently only apples to sites, and therefore collections, that reside in the same greenstone installation as the interface.) This also applies to files that are included from other XSLT files. For example the query.xsl for the query pages includes a file called querytools.xsl. To have a particular site show a different query interface either of these files may need to be modified. Creating a new version of either of these and putting it in the site transform directory will work. Either the new query.xsl will include the default querytools, or the default query.xsl will include the new querytools.xsl. The xsl:include directives are preprocessed by the java code and full paths added based on availability of the files, so that the correct one is used.
859
860Note that you cannot include a file with the same name as the including file. For example query.xsl cannot include query.xsl (it is tempting to want to do this if you just want to change one template for a particular file, and then include the default. but you cant).
861
862\subsubsection{Defining a new interface}
863
864A new interface may be needed if different instantiations of the library require different interfaces, or different developers want their own look and feel. Creating a new interface will allow modifications to be made while leaving the original one intact.
865
866A new interface needs a directory in \$GSDL3HOME/web/interfaces, the name of this directory becomes the interface name. Inside, it needs images and transform directories, and an interfaceConfig.xml file. Any XSLT may be overridden for a new interface by putting the replacement in the new transform directory. If the appropriate XSLT file is not there, the one from the default interface will be used - this enables just overriding a few XSLT files as needed.
867
868To use a new interface, the tomcat web.xml must be edited: either change the interface that a current version of the servlet is using, or add another servlet instantiation to the file (see Section~\ref{sec:sites-and-ints} or Appendix~\ref{app:tomcat}). The Tomcat server must be restarted for this to take effect.
869
870\newpage
871\section{Developing Greenstone 3: Run-time system}\label{sec:develop-runtime}
872
873runtime object structure diagram. describe the modules.\\
874class hierarchy,\\
875directory structure and where everything lives\\
876message format.\\
877overall description of message passing sequence.\\
878configuration process - start up and runtime\\
879\\
880page generation\\
881accessing the javadoc\\
882
883\subsection{Overview of modules??}
884
885A Greenstone3 'library' system consists of many components: MessageRouter, Receptionist, Actions, Collections, ServiceRacks etc. Figure~\ref{fig:local} shows how they fit together in a stand-alone system.
886
887\begin{figure}[t]
888 \centering
889 \includegraphics[width=4in]{local} %5.8
890 \caption{A simple stand-alone site.}
891 \label{fig:local}
892\end{figure}
893
894
895{\em MessageRouter}: this is the central module for a site. It controls the site, loading up all the collections, clusters, communicators needed. All messages pass through the MessageRouter. Communication between remote sites is always done between MessageRouters, one for each site.
896
897{\em Collection and ServiceCluster}: these are very similar. They both provide some metadata about the collection/cluster, and a list of services. The services are provided by ServiceRack objects that the collection/cluster loads up. A Collection is a specific type of ServiceCluster. A ServiceCluster groups services that are related conceptually, e.g. all the building services may be part of a cluster. What is part of a cluster is specified by the site configuration file. A Collection's services are grouped by the fact that they all operate on some common data---the documents in the collection.
898Functionally Collection and ServiceCluster are very similar, but conceptually, and to the user, they are quite different.
899
900{\em Service}: these provide the core functionality of the system e.g. searching, retrieving documents, building collections etc. One or more may be grouped into a single class (ServiceRack) for code reuse, or to avoid instantiating the same objects several times. For example, MGPP searching services all need to have the index loaded into memory. Services provide the core functionality for the system, e.g. searching, retrieving documents, building collections etc.
901
902{\em Communicator/Server}: these facilitate communication between remote modules. For example, if you want MR1 to talk to MR2, you need a Communicator-Server pair. The Server sits on top of MR2, and MR1 talks to the Communicator. Each communication type needs a new pair. So far we have only been using SOAP, so we have a SOAPCommunicator and a SOAPServer.
903
904{\em Receptionist}: this is the point of contact for the 'front end'. Its core functionality involves routing requests to the Actions, but it may do more than that. For example, a Receptionist may: modify the request in some way before sending it to the appropriate Action; add some data to the page responses that is common to all pages; transform the response into another form using XSLT for example. There is a hierarchy of different Receptionist types, which is described in Section~\ref{sec:recepts}.
905
906{\em Actions}: these do the job of creating the 'pages'. There is a different action for each type of page, for example PageAction handles semi-static pages, QueryAction handles queries, DocumentAction displays documents. They know a little bit about specific service types. Based on the 'CGI' arguments passed in to them, they construct requests for the system, and put together the responses into data for the page. This data is returned to the Receptionist, which may transform it to HTML. The various actions are described in more detail in Section~\ref{sec:pagegen}.
907
908
909\subsection{Start up configuration}\label{sec:startup-config}
910
911We use the Tomcat web server, which operates either stand-alone in a test mode
912or in conjunction with the Apache web server. The Greenstone LibraryServlet
913class is loaded by Tomcat and the servlet's \gst{init()} method is called. Each time a
914\gst{get/put/post} (etc.) is used, a new thread is started and
915\gst{doGet()/doPut()/doPost()} (etc.) is called.
916
917The \gst{init()} method creates a new Receptionist and a new
918MessageRouter. Default classes (DefaultReceptionist, MessageRouter) are used unless subclasses have been specified in the servlet initiation parameters (see Section~\ref{sec:sites-and-ints}). The appropriate system variables are set for each object (interface
919name, site name, etc.) and then \gst{configure()} is called on both. The MessageRouter handle
920is passed to the Receptionist. The servlet then communicates only with
921the Receptionist, not with the MessageRouter.
922
923The Receptionist reads in the \gst{interfaceConfig.xml} file, and loads up all the different Action classes. Other Actions may be loaded on the fly as needed. Actions are added to a map, with shortnames for keys. Eg the QueryAction is added with key 'q'. The Actions are passed the MessageRouter reference too.
924If the Receptionist is a TransformingReceptionist, a mapping between shortnames and XSLT file names is also created.
925
926The MessageRouter reads in its site configuration file \gst{siteConfig.xml}. It creates a module map that maps names to objects. This is used for routing the messages. It also keeps small chunks of XML---serviceList, collectionList, clusterList and siteList. These are what get returned in response to a describe request (see Section~\ref{sec:describe}.).
927Each ServiceRack specified in the configuration file is created, then queried for its list of services. Each service name is added to the map, pointing to the ServiceRack object. Each service is also added to the serviceList. After this stage, ServiceRacks are transparent to the system, and each service is treated as a separate module.
928ServiceClusters are created and passed the \gst{<serviceCluster>} element for configuration. They are added to the map as is, with the cluster name as a key. A serviceCluster is also added to the serviceClusterList.
929For each site specified, the MessageRouter creates an appropriate type of Communicator object. Then it tries to get the site description. If the server for the remote site is up and running, this should be successful. The site will be added to the mapping with its site name as a key. The site's collections, services and clusters will also be added into the static xml lists. If the server for the remote site is not running, the site will not be included in the siteList or module map. To try again to access the site, either Tomcat must be restarted, or a run-time reconfigure-sites commands must be sent (see next section).
930
931The MessageRouter also looks inside the site's \gst{collect} directory, and loads up a Collection object for each valid collection found.
932
933The Collection object reads its \gst{buildConfig.xml} and \gst{collectionConfig.xml}
934files, determines the metadata, and loads ServiceRack classes based on the
935names specified in \gst{buildConfig.xml\/}. The \gst{<serviceRack>} XML element is passed to the object to be used in configuration. The \gst{collectionConfig.xml} contents are also passed in to the ServiceRacks. Any format or display information that the services need must be extracted from the collection configuration file.
936Collection objects are added to the module map with their name as a key, and also a collection element is added into the collectionList XML.
937
938
939
940\subsection{Message passing}
941
942Action in Greenstone 3 is originated by a request coming in from the outside. In the standard web-based greenstone, this comes from a servlet into the receptionist. This external type request is a request for a page of data, and contains a representation of the CGI style arguments. A page of XML is returned, which can be in HTML format or other depending on the output parameter to the request. Messages inside the system all follow the same basic format: message elements contain multiple request elements, or multiple response elements. Messaging is all synchronous. The same number of responses as requests will be returned.
943
944When a page request comes in to the Receptionist, it looks at the action attribute to determine which action to send it to. The response is returned from the action.The page that the receptionist returns contains the original request, the response from the action and other info as needed (depends on the type of Receptionist). The data may be transformed in some way --- for the servlet greenstone we transform using XSLT to generate html pages which get returned to the servlet.
945
946Actions send internal style messages to the MessageRouter. Some can be answered by it, others are passed on to collections, and maybe on to services. Internal requests are for simple actions, such as search, retrieve metadata, retrieve document text
947There are different request types: describe, process, system...
948
949The message formats for each request type, and the response formats for each module are described in the following section.
950
951\subsection{an attempt at an API: message formats}
952
953\subsubsection{external$->$action}\label{sec:page-requests}
954
955request:
956These are the special 'external'-style messages. Requests originate from outside Greenstone, for example from a servlet, or java application. They are requests for a 'page' of data---for example, the home page for a site; the query page for a collection; the text of a document. They contain, in XML, a list of arguments specifying what type of page is required. If the external context is a servlet, the arguments represent the 'CGI' arguments in a Greenstone URL. The two main arguments are \gst{a} (action) and \gst{sa} (subaction). All other arguments are encoded as parameters.
957
958Here are some examples of requests\footnote{In a servlet context, these correspond to the URLs \gst{a=p\&sa=about\&c=demo\&l=fr}, and \gst{a=q\&l=en\&s=TextQuery\&c=demo\&rt=r\&ca=0\&st=1\&m=10\&q=snail}.}:
959
960\begin{quote}\begin{gsc}\begin{verbatim}
961<request type='page' action='p' subaction='about'
962 lang='fr' output='html'>
963 <paramList>
964 <param name='c' value='demo'/>
965 </paramList>
966</request>
967\end{verbatim}\end{gsc}\end{quote}
968
969\begin{quote}\begin{gsc}\begin{verbatim}
970<request type='page' action='q' lang='en' output='html'>
971 <paramList>
972 <param name='s' value='TextQuery'/>
973 <param name='c' value='demo'/>
974 <param name='rt' value='r'/>
975 <!-- the rest are the service specific params -->
976 <param name='ca' value='0'/> <!-- casefold -->
977 <param name='st' value='1'/> <!-- stem -->
978 <param name='m' value='10'/> <!-- maxdocs -->
979 <param name='q' value='snail'/> <!-- query string -->
980 </paramList>
981</request>
982\end{verbatim}\end{gsc}\end{quote}
983
984The Receptionist routes the message to the appropriate Action (determined by looking up its shortname$->$Action object map). The actions determine what information is needed from the server and retrieves it, making one or more internal requests to the MessageRouter. This information is gathered together into a single response, and returned to the Receptionist. The Receptionist may process the result further, depending on what type of Receptionist is it.
985
986
987\begin{table}
988{\footnotesize
989\begin{tabular}{lll}
990\hline
991\bf Argument & \bf Meaning &\bf Typical values \\
992\hline
993a & action & a (applet), q (query), b (browse), p (page), pr (process) \\
994& & s (system)\\
995sa & subaction & home, about (page action)\\
996c & collection or & demo, build \\
997& service cluster \\
998s & service name & TextQuery, ImportCollection \\
999rt & request type & d (display), r (request), s (status) \\
1000ro & response only & 0 or 1 - if set to one, the request is carried out \\
1001& & but no processing of the results is done \\
1002& & currently only used in process actions \\
1003o & output type & XML, html, WML \\
1004l & language & en, fr, zh ...\\
1005d & document id & HASHxxx \\
1006r & resource id & ???\\
1007pid & process handle & an integer identifying a particular process request \\
1008\hline
1009\end{tabular}}
1010\caption{Generic arguments that can appear in a Greenstone URL}
1011\label{tab:args}
1012\end{table}
1013
1014\subsection{'describe'-type messages}\label{sec:describe}
1015
1016The most basic of the internal standard requests is ``describe-yourself'', which can be sent to any module in the system. The module responds with a semi-predefined piece of XML, making these requests very efficient. The response is predefined apart from any language-specific text strings, which are put together as each request comes in, based on the language attribute of the request.
1017\begin{quote}\begin{gsc}\begin{verbatim}
1018<request lang='en' type='describe' to=''/>
1019\end{verbatim}\end{gsc}\end{quote}
1020If the \gst{to} field is empty, a request is answered by the MessageRouter.
1021An example response from a MessageRouter might look like this:
1022\begin{quote}\begin{gsc}\begin{verbatim}
1023<response lang='en' type='describe'>
1024 <serviceList/>
1025 <siteList>
1026 <site name='org.greenstone.gsdl1'
1027 address='http://localhost:8080/soap/servlet/rpcrouter'
1028 type='soap' />
1029 </siteList>
1030 <serviceClusterList>
1031 <serviceCluster name="build" />
1032 </serviceClusterList>
1033 <collectionList>
1034 <collection name='org.greenstone.gsdl1/
1035 org.greenstone.gsdl2/fao' />
1036 <collection name='org.greenstone.gsdl1/demo' />
1037 <collection name='org.greenstone.gsdl1/fao' />
1038 <collection name='myfiles' />
1039 </collectionList>
1040</response>
1041\end{verbatim}\end{gsc}\end{quote}
1042This MessageRouter has no individual site-wide services (an empty \gst{<serviceList>}), but has a service cluster called build (which provides collection importing and building functionality). It
1043communicates with one site, \gst{org.greenstone.gsdl1}. It is aware of four
1044collections. One of these, \gst{myfiles}, belongs to it; the other three are
1045available through the external site. One of those collections is actually from
1046a further external site.
1047
1048It is possible to ask just for a specific part of the information provided by a
1049describe request, rather than the whole thing. For example, these two
1050messages get the \gst{collectionList} and the \gst{siteList} respectively:
1051\begin{quote}\begin{gsc}\begin{verbatim}
1052<request lang='en' type='describe' to=''>
1053 <paramList>
1054 <param name='subset' value='collectionList'/>
1055 </paramList>
1056</request>
1057
1058<request lang='en' type='describe' to=''>
1059 <paramList>
1060 <param name='subset' value='siteList'/>
1061 </paramList>
1062</request>
1063\end{verbatim}\end{gsc}\end{quote}
1064
1065When a collection or service cluster is asked to describe itself, what is returned is a list of metadata, some display elements, and a list of services. For example, here is such
1066a message, along with a sample response.
1067
1068\begin{quote}\begin{gsc}\begin{verbatim}
1069<request lang='en' type='describe' to='mgppdemo'/>
1070
1071<response from="mgppdemo" type="describe">
1072 <collection name="mgppdemo">
1073 <displayItem lang="en" name="name">greenstone mgpp demo
1074 </displayItem>
1075 <displayItem lang="en" name="description">This is a
1076 demonstration collection for the Greenstone digital
1077 library software. It contains a small subset (11 books)
1078 of the Humanity Development Library. It is built with
1079 mgpp.</displayItem>
1080 <displayItem lang="en" name="icon">mgppdemo.gif</displayItem>
1081 <serviceList>
1082 <service name="DocumentStructureRetrieve" type="retrieve" />
1083 <service name="DocumentMetadataRetrieve" type="retrieve" />
1084 <service name="DocumentContentRetrieve" type="retrieve" />
1085 <service name="ClassifierBrowse" type="browse" />
1086 <service name="ClassifierBrowseMetadataRetrieve"
1087 type="retrieve" />
1088 <service name="TextQuery" type="query" />
1089 <service name="FieldQuery" type="query" />
1090 <service name="AdvancedFieldQuery" type="query" />
1091 <service name="PhindApplet" type="applet" />
1092 </serviceList>
1093 <metadataList>
1094 <metadata name="creator">[email protected]</metadata>
1095 <metadata name="numDocs">11</metadata>
1096 <metadata name="buildType">mgpp</metadata>
1097 <metadata name="httpPath">http://kanuka:8090/gsdl3/sites/
1098 localsite/collect/mgppdemo</metadata>
1099 </metadataList>
1100 </collection>
1101</response>
1102\end{verbatim}\end{gsc}\end{quote}
1103
1104The subset parameter can also be used in a describe request to a collection, to retrieve just the \gst{metadataList} or \gst{serviceList}.
1105
1106This collection provides many typical services. Notice how this response lists the services available, while the collection configuration file for this collection (Figure~\ref{fig:collconfig}) described serviceRacks. Once the service racks have been configured, they become transparent in the system, and only services are referred to.
1107There are three document retrieval services, for structural information, metadata, and content. The Classifier services retrieve classification structure and metadata. These five services were all provided by the GS2MGPPRetrieve ServiceRack. The three query services were provided by GS2MGPPSearch serviceRack, and provide different kinds of query interface. The last service, PhindApplet, is provided by the PhindPhraseBrowse serviceRack and is an applet service.
1108
1109A \gst{describe} request sent to a service returns a list of parameters that
1110the service accepts, some display information, (and in future may describe the content type for the request and response).
1111
1112Parameters can by in the following formats:
1113\begin{quote}\begin{gsc}\begin{verbatim}
1114<param name='xxx' type='integer|boolean|string|invisible' default='yyy'/>
1115<param name='xxx' type='enum_single|enum_multi' default='aa'/>
1116 <option name='aa'/><option name='bb'/>...
1117</param>
1118<param name='xxx' type='multi' occurs='4'>
1119 <param .../>
1120 <param .../>
1121</param>
1122\end{verbatim}\end{gsc}\end{quote}
1123
1124If no default is specified, the parameter is assumed to be mandatory.
1125Here are some examples of parameters:
1126\begin{quote}\begin{gsc}\begin{verbatim}
1127<param name='case' type='boolean' default='0'/>
1128
1129<param name='maxDocs' type='integer' default='50'/>
1130
1131<param name='index' type='enum' default='dtx'>
1132 <option name='dtx'/>
1133 <option name='stt'/>
1134 <option name='stx'/>
1135<param>
1136
1137<!-- this one is for the text box and field list for the
1138simple field query-->
1139<param name='simpleField' type='multi' occurs='4'>
1140 <param name='fqv' type='string'/>
1141 <param name='fqf' type='enum_single'>
1142 <option name='TI'/><option name='AU'/><option name='OR'/>
1143 </param>
1144</param>
1145
1146\end{verbatim}\end{gsc}\end{quote}
1147The type attribute is used to determine how to display the parameters on a web page or interface. For example, a string parameter may result in a text entry box, a boolean an on/off button, enum\_single/enum\_multi a drop-down menu, where one or many items, respectively, can be selected.
1148A multi-type parameter indicates that two or more parameters are associated, and should be displayed appropriately. For example, in a field query, the text box and field list should be associated. The occurs attribute specifies how many times the parameter should be displayed on the page.
1149Parameters also come with display information: all the text strings needed to present them to the user. These include the name of the parameter and the display values for any options. These are included in the above parameter descriptions in the form of \gst{<displayItem>} elements.
1150
1151A service description also contains some display information---this includes the name of the service, and the text for the submit button.
1152
1153Here is a sample describe request to the FieldQuery service of collection mgppdemo, along with its response. The parameters in this example include their display information. Figure~\ref{fig:query-display} gives an example html search form that may be generated from this describe response.
1154
1155\begin{quote}\begin{gsc}\begin{verbatim}
1156<request lang="en" to="mgppdemo/FieldQuery" type="describe" />
1157
1158<response from="mgppdemo/FieldQuery" type="describe">
1159 <service name="FieldQuery" type="query">
1160 <displayItem name="name">Form Query</displayItem>
1161 <displayItem name="submit">Search</displayItem>
1162 <paramList>
1163 <param default="Doc" name="level" type="enum_single">
1164 <displayItem name="name">Granularity to search at</displayItem>
1165 <option name="Doc">
1166 <displayItem name="name">Document</displayItem>
1167 </option>
1168 <option name="Sec">
1169 <displayItem name="name">Section</displayItem>
1170 </option>
1171 <option name="Para">
1172 <displayItem name="name">Paragraph</displayItem>
1173 </option>
1174 </param>
1175 <param default="1" name="case" type="boolean">
1176 <displayItem name="name">Turn casefolding </displayItem>
1177 <option name="0">
1178 <displayItem name="name">off</displayItem>
1179 </option>
1180 <option name="1">
1181 <displayItem name="name">on</displayItem>
1182 </option>
1183 </param>
1184 <param default="1" name="stem" type="boolean">
1185 <displayItem name="name">Turn stemming </displayItem>
1186 <option name="0">
1187 <displayItem name="name">off</displayItem>
1188 </option>
1189 <option name="1">
1190 <displayItem name="name">on</displayItem>
1191 </option>
1192 </param>
1193 <param default="10" name="maxDocs" type="integer">
1194 <displayItem name="name">Maximum documents to return
1195 </displayItem>
1196 </param>
1197 <param name="simpleField" occurs="4" type="multi">
1198 <displayItem name="name"></displayItem>
1199 <param name="fqv" type="string">
1200 <displayItem name="name">Word or phrase </displayItem>
1201 </param>
1202 <param default="ZZ" name="fqf" type="enum_single">
1203 <displayItem name="name">in field</displayItem>
1204 <option name="ZZ">
1205 <displayItem name="name">allfields</displayItem>
1206 </option>
1207 <option name="TX">
1208 <displayItem name="name">text</displayItem>
1209 </option>
1210 <option name="TI">
1211 <displayItem name="name">Title</displayItem>
1212 </option>
1213 <option name="SU">
1214 <displayItem name="name">Subject</displayItem>
1215 </option>
1216 <option name="ORG">
1217 <displayItem name="name">Organization</displayItem>
1218 </option>
1219 <option name="SO">
1220 <displayItem name="name">Source</displayItem>
1221 </option>
1222 </param>
1223 </param>
1224 </paramList>
1225 </service>
1226</response>
1227\end{verbatim}\end{gsc}\end{quote}
1228
1229\begin{figure}[t]
1230 \centering
1231 \includegraphics[width=3.5in]{query2.ps}
1232 \caption{The previous query service describe response as displayed on the search page.}
1233 \label{fig:query-display}
1234\end{figure}
1235
1236A describe request to an applet type service returns the applet html element: this will be embedded into a web page to run the applet.
1237\begin{quote}\begin{gsc}\begin{verbatim}
1238<request type='describe' to='mgppdemo/PhindApplet'/>
1239
1240<response type='describe'>
1241 <service name='PhindApplet' type='query'>
1242 <applet ARCHIVE='phind.jar, xercesImpl.jar, gsdl3.jar,
1243 jaxp.jar, xml-apis.jar'
1244 CODE='org.greenstone.applet.phind.Phind.class'
1245 CODEBASE='lib/java'
1246 HEIGHT='400' WIDTH='500'>
1247 <PARAM NAME='library' VALUE=''/>
1248 <PARAM NAME='phindcgi' VALUE='?a=a&amp;sa=r&amp;sn=Phind'/>
1249 <PARAM NAME='collection' VALUE='mgppdemo' />
1250 <PARAM NAME='classifier' VALUE='1' />
1251 <PARAM NAME='orientation' VALUE='vertical' />
1252 <PARAM NAME='depth' VALUE='2' />
1253 <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d' />
1254 <PARAM NAME='backdrop' VALUE='interfaces/default/>
1255 images/phindbg1.jpg'/>
1256 <PARAM NAME='fontsize' VALUE='10' />
1257 <PARAM NAME='blocksize' VALUE='10' />
1258 The Phind java applet.
1259 </applet>
1260 <displayItem name="name">Browse phrase hierarchies</displayItem>
1261 </service>
1262</response>
1263\end{verbatim}\end{gsc}\end{quote}
1264
1265Note that the library parameter has been left blank. This is because library refers to the current servlet that is running and the name is not necessarily known in advance. So either the applet action or the Receptionist must fill in this parameter before displaying the html.
1266
1267\subsubsection{'system'-type messages}\label{sec:system}
1268
1269``System'' requests are used to tell a MessageRouter, Collection or ServiceCluster to update its cached information and activate or deactivate other modules. For example, the MessageRouter has a set of Collection modules that it can talk to. It also holds some XML information about those collections---this is returned when a request for a collection list comes in. If a collection is deleted or modified, or a new one created, this information may need to change, and the list of available modules may also change. Currently they are initiated by particular CGI parameters (see Section~\ref{sec:runtime-config}).
1270
1271The basic format of a system request is as follows:
1272
1273\begin{quote}\begin{gsc}\begin{verbatim}
1274<request type='system' to=''>
1275 <system .../>
1276</request>
1277\end{verbatim}\end{gsc}\end{quote}
1278
1279One or more actual requests are specified in system elements. The following are examples:
1280\begin{quote}\begin{gsc}\begin{verbatim}
1281<system type='configure' subset=''/>
1282<system type='configure' subset='collectionList'/>
1283<system type='activate' moduleType='collection' moduleName='demo'/>
1284<system type='deactivate' moduleType='site' moduleName='site1'/>
1285\end{verbatim}\end{gsc}\end{quote}
1286
1287The first request reconfigures the whole site---the MessageRouter goes through its whole configure process again. The second request just reconfigures the collectionList---the MessageRouter will delete all its collection information, and re-look through the collect directory and reload all the collections again.
1288The third request is to activate collection demo. This could be a new collection, or a reactivation of an old one. If a collection module already exists, it will be deleted, and a new one loaded. The final request deactivates the site site1---this removes the site from the siteList and module map, and also removes any of that sites collections/services from the static lists.
1289
1290
1291A response just contains a status message, for example:
1292\begin{quote}\begin{gsc}\begin{verbatim}
1293<response from="">
1294 <status>collectionList reconfigured successfully</status>
1295</response>
1296\end{verbatim}\end{gsc}\end{quote}
1297
1298At some stage, an error or status code should be included.
1299
1300System requests are mainly answered by the MessageRouter. However, Collections and ServiceClusters will respond to a subset of these requests.
1301
1302\subsection{'format'-type messages}\label{sec:format}
1303
1304Collection designers are able to specify how their collection looks to a certain degree. They can specify format statements for display that will apply to the results of a search, the display of a document, entries in a classification hierarchy, for example. This info is generally service specific. All services respond to a format request, where they return any service specific formatting information. A typical request and response looks like this:
1305\begin{quote}\begin{gsc}\begin{verbatim}
1306<request lang="en" to="mgppdemo/FieldQuery" type="format" />
1307
1308<response from="mgppdemo/FieldQuery" type="format">
1309 <format>
1310 <gsf:template match="documentNode"><td><gsf:link>
1311 <gsf:metadata name="Title" />(<gsf:metadata name="Source" />)
1312 </gsf:link></td>
1313 </gsf:template>
1314 </format>
1315</response>
1316\end{verbatim}\end{gsc}\end{quote}
1317
1318The actual format statements are described in Section~\ref{sec:formatstmt}. They are templates written directly in XSLT, or in GSF, which stands for Greenstone Format, and is a simple XML representation of the more complicated XSLT templates.
1319GSF style format statements need to be converted to proper XSLT. This is currently done by the Receptionist (but may be moved to an ActionHelper): the format XML is transformed to XSLT using XSLT with the config\_format.xsl stylesheet.
1320
1321\subsection{'status'-type messages}\label{sec:status}
1322
1323These are only used with process-type services, which are those where a request is sent to start some type of process (see Section~\ref{sec:process}). The initial response states whether the process had successfully started, and whether its still continuing. If the process is not finished, status requests can be sent repeatedly to the service to poll the status, using the pid to identify the process. Status codes are used to identify the state of a process. The values used at the moment are listed in Table~\ref{tab:status codes}\footnote{A more standard set of codes should probably be used, for example, the HTTP codes}.
1324
1325\begin{table}
1326\caption{Status codes currently used in Greenstone 3}
1327\label{tab:status codes}
1328{\footnotesize
1329\begin{tabular}{llp{8cm}}
1330\hline
1331\bf code name & \bf code & \bf meaning \\
1332& \bf value & \\
1333\hline
1334SUCCESS & 1 & the request was accepted, and the process was completed \\
1335ACCEPTED & 2 & the request was accepted, and the process has been started, but it is not completed yet \\
1336ERROR & 3 & there was an error and the process was stopped \\
1337CONTINUING & 10 & the process is still continuing \\
1338COMPLETED & 11 & the process has finished \\
1339HALTED & 12 & the process has stopped \\
1340INFO & 20 & just an info message that doesn't imply anything \\
1341\hline
1342\end{tabular}}
1343\end{table}
1344
1345 The following shows an example status request, along with two responses, the first a 'OK but continuing' response, and the second a 'successfully completed' response. The content of the status elements in the two responses is the output from the process since the last status update was sent back.
1346
1347\begin{quote}\begin{gsc}\begin{verbatim}
1348<request lang="en" to="build/ImportCollection" type="status">
1349 <paramList>
1350 <param name="pid" value="2" />
1351 </paramList>
1352</request>
1353
1354<response from="build/ImportCollection">
1355 <status code="2" pid="2">Collection construction: import collection.
1356command = import.pl -collectdir /research/kjdon/home/gsdl3/web/sites/
1357 localsite/collect test1
1358starting
1359 </status>
1360</response>
1361
1362<response from="build/ImportCollection">
1363 <status code="11" pid="2">RecPlug: getting directory
1364/research/kjdon/home/gsdl3/web/sites/localsite/collect/test1/import
1365WARNING - no plugin could process /.keepme
1366
1367*********************************************
1368Import Complete
1369*********************************************
1370* 1 document was considered for processing
1371* 0 were processed and included in the collection
1372* 1 was rejected. See /research/kjdon/home/gsdl3/web/sites/
1373 localsite/collect/test1/etc/fail.log for a list of rejected documents
1374Success
1375 </status>
1376</response>
1377\end{verbatim}\end{gsc}\end{quote}
1378
1379\subsubsection{process messages}
1380
1381Process requests and responses provide the major functionality of the system---these are the ones that do the actual work. The format depends on the service they are for, so I'll describe these by service.
1382
1383Query type services TextQuery, FieldQuery, AdvancedFieldQuery (GS2MGSearch, GS2MGPPSearch), TextQuery (LuceneSearch)
1384The main type of requests in the system are for services. There are different types of services, currently: \gst{query}, \gst{browse}, \gst{retrieve}, \gst{process}, \gst{applet}, \gst{enrich}. Query services do some kind of search and return a list of document identifiers. Retrieve services can return the content of those documents, metadata about the documents, or other resources. Browse is for browsing lists or hierarchies of documents. Process type services are those where the request is for a command to be run. A status code will be returned immediately, and then if the command has not finished, an update of the status can be requested. Applet services are those that run an applet. Enrich services take a document and return the document with some extra markup added.
1385
1386 Other possibilities include transform, extract, accrete. These types of service generally enhance the functionality of the first set. They may be used during collection formation: 'accrete' documents by adding them to a collection, 'transform' the documents into a different format, 'extract' information or acronyms from the documents, 'enrich' those documents with the information extracted or by adding new information. They may also be used during querying: 'transform' a query before using it to query a collection, or 'transform' the documents you get back into an appropriate form.
1387
1388The basic structure of a service 'process' request is as follows:
1389\begin{quote}\begin{gsc}\begin{verbatim}
1390
1391<request lang='en' type='process' to='demo/TextQuery'>
1392 <paramList/>
1393 other elements...
1394</request>
1395
1396\end{verbatim}\end{gsc}\end{quote}
1397
1398The parameters are name-value pairs corresponding to parameters that were specified in the service description sent in response to a describe request.
1399
1400\begin{quote}\begin{gsc}\begin{verbatim}
1401<param name='case' value='1'/>
1402<param name='maxDocs' value='34'/>
1403<param name='index' value='dtx'/>
1404\end{verbatim}\end{gsc}\end{quote}
1405
1406Some requests have other content---for document retrieval, this would be a list of document identifiers to retrieve. For metadata retrieval, the content is the list of documents to retrieve metadata for.
1407
1408Responses vary depending on the type of request. The following sections look at the process type requests and responses for each type of service.
1409
1410\subsubsection{'query'-type services}
1411Responses to query requests contain a list of document identifiers, along with some other information, dependent on the query type. For a text query, this includes term frequency information, and some metadata about the result. For instance, a text query on 'snail farming', with the parameter 'maxDocs=10' might return the first 10 documents, and one of the query metadata items would be the total number of documents that matched the query.\footnote{no metadata about the query result is returned yet.}
1412
1413The following shows an example query request and its response.
1414
1415Find at most 10 Sections in the mgppdemo collection, containing the word snail (stemmed), returning the results in ranked order:
1416\begin{quote}\begin{gsc}\begin{verbatim}
1417<request lang='en' to="mgppdemo/TextQuery" type="process">
1418 <paramList>
1419 <param name="maxDocs" value="10"/>
1420 <param name="queryLevel" value="Section"/>
1421 <param name="stem" value="1"/>
1422 <param name="matchMode" value="some"/>
1423 <param name="sortBy" value="1"/>
1424 <param name="index" value="t0"/>
1425 <param name="case" value="0"/>
1426 <param name="query" value="snail"/>
1427 </paramList>
1428</request>
1429
1430<response from="mgppdemo/TextQuery" type="process">
1431 <metadataList>
1432 <metadata name="numDocsMatched" value="59" />
1433 </metadataList>
1434 <documentNodeList>
1435 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2"
1436 docType='hierarchy' nodeType="leaf" />
1437 <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12"
1438 docType='hierarchy' nodeType="leaf" />
1439 <documentNode nodeID="HASH010f073f22033181e206d3b7.1"
1440 docType='hierarchy' nodeType="interior" />
1441 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.2.2"
1442 docType='hierarchy' nodeType="leaf" />
1443 ...
1444 </documentNodeList>
1445 <termList>
1446 <term field="" freq="454" name="snail" numDocsMatch="58" stem="3">
1447 <equivTermList>
1448 <term freq="" name="Snail" numDocsMatch="" />
1449 <term freq="" name="snail" numDocsMatch="" />
1450 <term freq="" name="Snails" numDocsMatch="" />
1451 <term freq="" name="snails" numDocsMatch="" />
1452 </equivTermList>
1453 </term>
1454 </termList>
1455</response>
1456\end{verbatim}\end{gsc}\end{quote}
1457
1458The list of document identifiers includes some information about document type and node type. Currently, document types include \gst{simple}, \gst{paged} and \gst{hierarchy}. \gst{simple} is for single section documents, i.e. ones with no sub-structure. \gst{paged} is documents that have a single list of sections, while \gst{hierarchy} type documents have a hierarchy of nested sections. For \gst{paged} and \gst{hierarchy} type documents, the node type identifies whether a section is the root of the document, an internal section, or a leaf.
1459
1460The term list identifies, for each term in the query, what its frequency in the collection is, how many documents contained that term, and a list of its equivalent terms (if stemming or casefolding was used).
1461
1462\subsubsection{'browse'-type services}
1463
1464Browse type services are used for classification browsing. The request consists of a list of classifier identifiers, and some structure parameters listing what structure to retrieve.
1465
1466\begin{quote}\begin{gsc}\begin{verbatim}
1467<request lang="en" to="mgppdemo/ClassifierBrowse" type="process">
1468 <paramList>
1469 <param name="structure" value="ancestors" />
1470 <param name="structure" value="children" />
1471 </paramList>
1472 <classifierNodeList>
1473 <classifierNode nodeID="CL1.2" />
1474 </classifierNodeList>
1475</request>
1476
1477<response from="mgppdemo/ClassifierBrowse" type="process">
1478 <classifierNodeList>
1479 <classifierNode nodeID="CL1">
1480 <nodeStructure>
1481 <classifierNode nodeID="CL1">
1482 <classifierNode nodeID="CL1.2">
1483 <classifierNode nodeID="CL1.2.1" />
1484 <classifierNode nodeID="CL1.2.2" />
1485 <classifierNode nodeID="CL1.2.3" />
1486 <classifierNode nodeID="CL1.2.4" />
1487 <classifierNode nodeID="CL1.2.5" />
1488 </classifierNode>
1489 </classifierNode>
1490 </nodeStructure>
1491 </classifierNode>
1492 </classifierNodeList>
1493</response>
1494\end{verbatim}\end{gsc}\end{quote}
1495
1496Possible values for structure parameters are \gst{ancestors}, \gst{parent}, \gst{siblings}, \gst{children}, \gst{descendents}. The response gives, for each identifier in the request, a \gst{<nodeStructure>} element with all the requested structure put together into a hierarchy. The structure may include classifier and document nodes.
1497
1498
1499\subsubsection{'retrieve'-type services}
1500
1501Retrieval services are special in that requests are not explicitly initiated by a user from a form on a web page, but are called from actions in response to other things. This means that their names are hard-coded into the Actions. DocumentContentRetrieve, DocumentStructureRetrieve and DocumentMetadataRetrieve are the standard names for retrieval services for content, structure, and metadata of documents. Requests to each of these include a list of document identifiers. Because these generally refer to parts of documents, the elements are called \gst{<documentNode>}. For the content, that is all that is required. For the metadata retrieval service, the request also needs parameters specifying what metadata is required. For structure retrieval services, requests need parameters specifying what structure or structural info is required.
1502
1503Some example requests and responses follow.
1504
1505Give me the Title metadata for these documents:
1506\begin{quote}\begin{gsc}\begin{verbatim}
1507
1508<request lang="en" to="mgppdemo/DocumentMetadataRetrieve" type="process">
1509 <paramList>
1510 <param name="metadata" value="Title" />
1511 </paramList>
1512 <documentNodeList>
1513 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2"/>
1514 <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12"/>
1515 <documentNode nodeID="HASH010f073f22033181e206d3b7.1"/>
1516 ...
1517 </documentNodeList>
1518</request>
1519
1520<response from="mgppdemo/DocumentMetadataRetrieve" type="process">
1521 <documentNodeList>
1522 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
1523 <metadataList>
1524 <metadata name="Title">Putting snails in your second pen</metadata>
1525 </metadataList>
1526 </documentNode>
1527 <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12">
1528 <metadataList>
1529 <metadata name="Title">Now you must decide</metadata>
1530 </metadataList>
1531 </documentNode>
1532 <documentNode nodeID="HASH010f073f22033181e206d3b7.1">
1533 <metadataList>
1534 <metadata name="Title">Introduction</metadata>
1535 </metadataList>
1536 </documentNode>
1537 </documentNodeList>
1538</response>
1539\end{verbatim}\end{gsc}\end{quote}
1540
1541One or more parameters specifying metadata may be included in a request. Also, a value of \gst{all} will retrieve all the metadata for each document.
1542
1543Any browse-type service must also implement a metadata retrieval service to provide metadata for the nodes in the classification hierarchy. The name of it is the browse service name plus \gst{MetadataRetrieve}. For example, the ClassifierBrowse service described in the previous section should also have a ClassifierBrowseMetadataRetrieve service. The request and response format is exactly the same as for the DocumentMetadataRetrieve service, except that \gst{<documentNode>} elements are replaced by \gst{<classifierNode>} elements (and the corresponding list element is also changed).
1544
1545Give me the text (content) of this document:
1546\begin{quote}\begin{gsc}\begin{verbatim}
1547<request lang="en" to="mgppdemo/DocumentContentRetrieve" type="process">
1548 <paramList />
1549 <documentNodeList>
1550 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" />
1551 </documentNodeList>
1552</request>
1553
1554<response from="mgppdemo/DocumentContentRetrieve" type="process">
1555 <documentNodeList>
1556 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
1557 <nodeContent>&lt;Section&gt;
1558 &lt;/B&gt;&lt;P ALIGN=&quot;JUSTIFY&quot;&gt;&lt;/P&gt;
1559 &lt;P ALIGN=&quot;JUSTIFY&quot;&gt;190. When the plants in
1560 your second pen have grown big enough to provide food and
1561 shelter, you can put in the snails.&lt;/P&gt;
1562 </nodeContent>
1563 </documentNode>
1564 </documentNodeList>
1565</response>
1566\end{verbatim}\end{gsc}\end{quote}
1567
1568The content of a node is returned in a \gst{<nodeContent>} element. In this case it is escaped HTML.
1569
1570Give me the ancestors and children of the specified node, along with the number of siblings it has:
1571\begin{quote}\begin{gsc}\begin{verbatim}
1572<request lang="en" to="mgppdemo/DocumentStructureRetrieve" type="process">
1573 <paramList>
1574 <param name="structure" value="ancestors" />
1575 <param name="structure" value="children" />
1576 <param name="info" value="numSiblings" />
1577 </paramList>
1578 <documentNodeList>
1579 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" />
1580 </documentNodeList>
1581</request>
1582
1583<response from="mgppdemo/DocumentStructureRetrieve" type="process">
1584 <documentNodeList>
1585 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
1586 <nodeStructureInfo>
1587 <info name="numSiblings" value="2" />
1588 </nodeStructureInfo>
1589 <nodeStructure>
1590 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd"
1591 docType='hierarchy' nodeType="root">
1592 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4"
1593 docType='hierarchy' nodeType="interior">
1594 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2"
1595 docType='hierarchy' nodeType="leaf" />
1596 </documentNode>
1597 </documentNode>
1598 </nodeStructure>
1599 </documentNode>
1600 </documentNodeList>
1601</response>
1602\end{verbatim}\end{gsc}\end{quote}
1603
1604Structure is returned inside a \gst{<nodeStructure>} element, while structural info is returned in a \gst{<nodeStructureInfo>} element. Possible values for structure parameters are as for browse services: \gst{ancestors}, \gst{parent}, \gst{siblings}, \gst{children}, \gst{descendents}. Possible values for info parameters are \gst{numSiblings}, \gst{siblingPosition}, \gst{numChildren}.
1605
1606\subsubsection{'process'-type services}\label{sec:process}
1607Requests to process-type services are not requests for data---they request some action to be carried out, for example, create a new collection, or import a collection. The response is a status or an error message. The import and build commands may take a long time to complete, so a response is sent back after a successful start to the command. The status may be polled by the requester to see how the process is going.
1608
1609Process requests generally contain just a parameter list. Like for any service, the parameters used by a process-type service can be obtained by a describe request to that service.
1610
1611Here are two example requests for process-services that are part of the build service cluster (hence the addresses all begin with 'build/'), followed by an example response:
1612
1613\begin{quote}\begin{gsc}\begin{verbatim}
1614<request lang='en' type='process' to='build/NewCollection'>
1615 <paramList>
1616 <param name='creator' value='[email protected]'/>
1617 <param name='collName' value='the demo collection'/>
1618 <param name='collShortName' value='demo'/>
1619 </paramlist>
1620</request>
1621
1622<request lang='en' type='process' to='build/ImportCollection'>
1623 <paramList>
1624 <param name='collection' value='demo'/>
1625 </paramlist>
1626</request>
1627
1628<response from="build/ImportCollection">
1629 <status code="2" pid="2">Starting process...</status>
1630</response>
1631\end{verbatim}\end{gsc}\end{quote}
1632
1633The \gst{code} attribute in the response specifies whether the command has been successfully stated, whether its still going, etc (see Table~\ref{tab:status codes} for a list of currently used codes). The pid attribute specifies a process id number that can be used when querying the status of this process. The content of the status element is (currently) just the output from the process so far. Status messages, which are described in Section~\ref{sec:status}, are used to find out how the process is going, and whether it has finished or not.
1634
1635\subsubsection{'applet'-type services}
1636
1637Applet-type services are those that process the data for an applet. A request consists only of a list of parameters, and the response contains an \gst{<appletData>} element that contains the XML data to be returned to the applet. The format of this is entirely specific to the applet---there is no set format to the applet data.
1638
1639Here is an example request and response, used by the Phind applet:
1640\begin{quote}\begin{gsc}\begin{verbatim}
1641 <request type='query' to='mgppdemo/PhindApplet'>
1642 <paramList>
1643 <param name='pc' value='1'/>
1644 <param name='pptext' value='health'/>
1645 <param name='pfe' value='0'/>
1646 <param name='ple' value='10'/>
1647 <param name='pfd' value='0'/>
1648 <param name='pld' value='10'/>
1649 <param name='pfl' value='0'/>
1650 <param name='pll' value='10'/>
1651 </paramList>
1652 </request>
1653
1654 <response type='query' from='mgppdemo/PhindApplet'>
1655 <appletData>
1656 <phindData df='9' ef='46' id='933' lf='15' tf='296'>
1657 <expansionList end='10' length='46' start='0'>
1658 <expansion df='4' id='8880' num='0' tf='59'>
1659 <suffix> CARE</suffix>
1660 </expansion>
1661 ...
1662 </expansionList>
1663 <documentList end='10' length='9' start='0'>
1664 <document freq='78' hash='HASH4632a8a51d33c47a75c559' num='0'>
1665 <title>The Courier - N??159 - Sept- Oct 1996 Dossier Investing
1666 in People Country Reports: Mali ; Western Samoa
1667 </title>
1668 </document>
1669 ...
1670 </documentList>
1671 <thesaurusList end='10' length='15' start='0'>
1672 <thesaurus df='7' id='12387' tf='15' type='RT'>
1673 <phrase>PUBLIC HEALTH</phrase>
1674 </thesaurus>...
1675 </thesaurusList>
1676 </phindData>
1677 </appletData>
1678 </response>
1679
1680\end{verbatim}\end{gsc}\end{quote}
1681
1682\subsubsection{'enrich'-type services}
1683
1684Enrich services typically take some text of documents (inside \gst{<nodeContent>} tags) and returns the text marked up in some way. One example of this is the GatePOSTag service: this identifies Dates, Locations, People and Organizations in the text, and annotates the text with the labels. In the following example, the request is for Location and Dates to be identified.
1685*** TODO ****
1686\begin{quote}\begin{gsc}\begin{verbatim}
1687<request lang="en" to="GatePOSTag" type="process">
1688 <paramList>
1689 <param name="annotationType" value="Date,Location" />
1690 </paramList>
1691 <documentNodeList>
1692 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd">
1693 <nodeContent>
1694 FOOD AND AGRICULTURE ORGANIZATION OF THE UNITED NATIONS
1695 Rome 1986
1696 P-69
1697 ISBN 92-5-102397-2
1698 FAO 1986
1699 </nodeContent>
1700 </documentNode>
1701 </documentNodeList>
1702</request>
1703
1704<response from="GatePOSTag" type="process">
1705 <documentNodeList>
1706 <documentNode nodeID="HASHac0a04dd14571c60d7fbfd">
1707 <nodeContent>
1708 FOOD AND AGRICULTURE ORGANIZATION OF THE UNITED NATIONS
1709 <annotation type="Location">Rome</annotation>
1710 <annotation type="Date">1986</annotation>
1711 P-69
1712 ISBN 92-5-102397-2
1713 FAO <annotation type="Date">1986</annotation>
1714 </nodeContent>
1715 </documentNode>
1716 </documentNodeList>
1717</response>
1718\end{verbatim}\end{gsc}\end{quote}
1719
1720\subsection{Page generation}\label{sec:pagegen} **** REDO ********
1721
1722* talk general first: get data, get format info, transform gsf->xsl. transfrom xml->html
1723
1724* state saving. the XSLT files assume that arguments are saved somehow. This needs to be implemented outside Greenstone proper - we do this in the servlet, using something or other.
1725
1726URL-style requests are received by the Receptionist. Based on the arguments, a page of data must be returned to the servlet. As described in Section~\ref{sec:page-requests}, the requests are XML representations of Greenstone URLs. One of the arguments is action (a). This tells the Receptionist which Action module to pass the request to. Action modules decode the rest of the CGI-arguments to determine what requests need to be made to the system.
1727System requests are received by the MessageRouter, which answers them one by one, either itself or by passing them on to the appropriate module.
1728
1729Once the data needed from the system has been accumulated, it is put into a 'page' of XML. The page is transformed to its output form, currently HTML, via XSLT transformations, and returned to the user.
1730
1731The basic page format is:
1732\begin{quote}\begin{gsc}\begin{verbatim}
1733<page>
1734 <pageRequest/>
1735 <pageResponse/>
1736</page>
1737\end{verbatim}\end{gsc}\end{quote}
1738
1739* show configuration and describe whats its used for
1740
1741There are two main elements in the page: pageRequest, pageResponse. The pageRequest is the original request that came into the Receptionist---this is included so that any parameters can be preset to their previous values, for example, the query options on the query form. The pageResponse contains all the data that has been gathered from the system by the action. The other two elements contain extra information needed by XSLT. Config contains run-time variables such as the location of the gsdl home directory, the current site name, the name of the executable that is running (e.g. library)---these are needed to allow the XSLT to generate correct HTML URLs. Display contains some of the text strings needed in the interface---these are separate from the XSLT to allow for internationalization.
1742
1743The following subsections outline, for each action, what data is needed and what requests are generated to send to the system.
1744
1745
1746Once the XML page has been put together, the page to return to the user is created by transforming the XML using XSLT. The output is HTML at this stage, but it will be possible to generate alternative outputs, such as XML, WML etc. A set of XSLT files defines an 'interface'. Different users can change the look of their web pages by creating new XSLT files for a new 'interface'. Just as we have a sites directory where different sites 'live' (ie where their configuration file and collections are located), we have an interfaces directory where the different interfaces 'live' (ie their transforms and images are located there). The default XSLT files are
1747located in interfaces/default/transforms. Collections, sites and other interfaces
1748can override these files by having their own copy of the appropriate
1749files. New interfaces have their own directory inside interfaces/. Sites and collections can have a transform directory containing XSLT files. The order in which the XSLT files are looked for is collection, site, current
1750interface, default interface.\footnote{this currently breaks down for remote sites - need to rethink it a bit.}
1751***TODO*** describe a bit more?? currently only can get this locally
1752
1753\subsubsection{Receptionists}\label{sec:recepts}
1754
1755The receptionist is the controlling module for the page generation part of greenstone. It has the job of loading up all the actions, and it knows about the message router it and the actions are supposed to talk to. It routes messages received to the appropriate action (page-type messages) or directly to the message router (all other types). Receptionists also do other things, for example, adding to the page received back from the action any information that is common to all pages.
1756
1757There are different ways of providing an interface to greenstone, from web based CGI style (using servlets) to Java GUI applications. These different interfaces require slightly different responses from a receptionist, so we provide several standard types of receptionist.
1758
1759Receptionist: This is the most basic receptionist. The page it returns consists of the original request, and the response from the action it was sent to. Methods preProcessRequest, and postProcessPage are called on the request and page, respectively, but in this basic receptionist, they don't do anything.
1760
1761TransformingReceptionist: This extends Receptionist, and overwrites postProcessPage to transform the page using XSLT. An XSLT is listed for each action in the receptionists configuration file, and this is used to transform the page. First, some display information, and configuration information is added to the page. Then it is transformed using the specified XSLT for the action, and returned.
1762
1763WebReceptionist: The WebReceptionist extends TransformingReceptionist. It doesn't do much else except some argument conversion. To keep the URLs short, parameters from the services are given shortnames, and these are used in the web pages.
1764
1765DefaultReceptionist: This extends WebReceptionist, and is the default one for greenstone 3 servlets. Due to the page design, some extra information is needed for each page: some metadata about the current collection. The receptionist sends a describe request to the collection to get this, and appends it to the page before transformation using XSLT.
1766
1767NZDLReceptionist: (do we want to talk about this?) This is an example of a custom receptionist. For a look-alike nzdl.org system, even more information is needed for each page, namely the list of classifiers available from the ClassifierBrowse service.
1768
1769By default, the LibraryServlet uses DefaultReceptionist. However, there is an init-param called receptionist which can be set to make the servlet use a different one.
1770
1771\subsubsection{CGI arguments}
1772
1773The arguments used by the page come from several sources. Receptionist uses a couple, actions use some and services. the receptionist and actions are treated as a whole so must not have conflicting arguments. GSParams class specifies all the general basic arguments, and whether they should be saved or not. servlet has an init parameter params\_class, that specifies which params class to use - if subclass it. actions or receptionist may specify some new ones
1774
1775services may be created by different people, may be on a different site. cant guarantee no conflict with action params, or even with other services.
1776so service params are namespaced when they are put on the page. interface (recept and action) params will have no namespace) the default namespace is s1 (service1) - any parameters that are for the service will be prefixed by this. e.g. the case parameter for a search will be put in the page as s1.case.
1777The actions must now look for all the s1 parameters to send to the service.
1778
1779if there are two or more services combined on a page with a single submit button, they will use s1, s2, s3 etc as needed. the s parameter (service) will end up with a list e.g. s=TextQuery,MusicQuery, and the order of these determines the mapping order of the namespaces, ie s1 will be TextQuery, s2 MusicQuery.
1780
1781also talk about saving arguments - save ones that GSParams says to save, and any service ones should always save.
1782
1783\subsubsection{Page action}
1784* kind of info pages. other actions are associated with specific services.
1785* uses describe requests to modules
1786Depending on the subaction argument, different pages can be generated. For the 'home' page, a 'describe' request is sent to the MessageRouter---this returns a list of all the collections, services, serviceClusters and sites known about. For each collection, its metadata is retrieved via a 'describe' request. This metadata is added into the previous result, which is then added into the page. The page is
1787transformed using \gst{home.xsl}. For the 'about' page, a \gst{describe} request is sent to the module that the about page is about: this may be a collection or a service cluster. This returns a list of metadata
1788and a list of services, and the result is transformed using \gst{about.xsl}.
1789
1790
1791\subsubsection{Query action}
1792
1793The basic URL is \gst{a=q\&s=TextQuery\&c=demo\&rt=d/r}.
1794There are three query services which have been implemented: TextQuery, FieldQuery, and AdvancedFieldQuery. These are all handled in the same way by query action.
1795For each page, the service description is requested from the service of the current collection (via a describe request). This is currently done every time the query page is
1796displayed, but should be cached. The description includes a list of the parameters available for the query, such as case/stem, max num docs to return, etc. If the request type (rt) parameter is set to d for display, the action only needs to display the form, and this is the only request to the service. Otherwise, the submit button has been pressed, and a query request to the TextQuery service is sent. This has all the parameters from the URL put into the parameter list. A list of document identifiers
1797is returned. A followup query is sent to the MetadataRetrieve service of the collection: the content includes the list of
1798documents, with a request for some of their metadata. Which metadata to retrieve is determined by looking through the XSLT that will be used to transform the page (Formatter object??). The service description and query result are combined into a page of XML, which is
1799transformed using \gst{basicquery.xsl} to produce the html page.
1800
1801\subsubsection{Applet action}
1802
1803There are two types of request to the applet action: \gst{a=a \& rt=d\/} and
1804\gst{a=a \& rt=r\/}. The value \gst{rt=d\/} means ``display the applet.'' A
1805\gst{describe} request is sent to the service, which returns the \gst{<applet>} HTML element. The transformation file \gst{applet.xsl} embeds this
1806into the page, and the servlet returns the HTML.
1807
1808The value \gst{rt=r} signals a request from the applet. The result is returned
1809directly to the applet code, in XML. The other parameters are sent to the
1810service untransformed, and the result is passed directly back to the applet.
1811Applet action can therefore work with any applet whose service understands the
1812messages.
1813
1814Here are two examples of requests generated by the Applet action, along with their corresponding responses.
1815
1816The first request corresponds to the URL arguments \gst{a=a \&
1817rt=d \& sn=Phind \& c=mgppdemo\/}, which translate to ``display the Phind
1818applet for the mgppdemo collection''.
1819
1820
1821The second request corresponds to the arguments \gst{a=a \& rt=r \& sn=Phind \& c=mgppdemo \& pc=1 \& pptext=health \& pfe=0 \& ple=10 \& pfd=0 \& pld=10 \& pfl=0 \& pll=10}---this
1822indicates a request to the service itself. The extra arguments (not a, sa, sn, c) are simply copied into the
1823request as parameters. The response is in a form suitable for the applet, placed inside
1824\gst{<appletData>} in a standard Greenstone message. AppletAction returns the
1825contents of appletData to the browser, i.e. to the applet itself.
1826
1827
1828Note that the applet HTML may need to know the name of the \gst{library}
1829program. However, that name is chosen by the person who installed the software
1830and will not necessarily be ``library''. To get around this, the applet can
1831put a parameter called ``library'' into the applet data with a null value:
1832\begin{quote}\begin{gsc}\begin{verbatim}
1833<PARAM NAME='library' VALUE=''/>
1834\end{verbatim}\end{gsc}\end{quote}
1835When the Applet action encounters this parameter it inserts the name of the
1836current library servlet as its value.
1837
1838\subsubsection{Document action}
1839
1840DocumentAction sends a query to the DocumentRetrieve service of the collection requesting the text of the specified document. At this stage no additional information is obtained, but in future stuff like Title and
1841table of contents would be needed to make the display nicer.
1842
1843
1844\subsubsection{System action}\label{sec:system-action}
1845
1846SystemAction allows for manual reconfiguration of various components at run-time. There is no interactive web-page displaying the options, it merely turns a set of CGI arguments into an XML system request. The response from a system request is a message which is displayed to the user.
1847
1848\begin{table}
1849\caption{Configure CGI arguments}
1850\label{tab:system-cgi}
1851{\footnotesize
1852\begin{tabular}{ll}
1853\hline
1854\bf arg & \bf description\\
1855\hline
1856a=s & system action\\
1857sa=c$|$a$|$d & type of system request: c (configure), a (add/activate), \\
1858& d (delete/deactivate) \\
1859c=demo & the request will go to this collection/servicecluster \\
1860& instead of the message router\\
1861ss=collectionList & subset for configure: only reconfigure this part.\\
1862& For the MessageRouter, can be serviceClusterList, serviceList, \\
1863& collectionList, siteList.\\
1864& For a collection/cluster, can be metadataList or serviceList.\\
1865sn=demo & \\
1866st=collection& \\
1867\hline
1868\end{tabular}}
1869\end{table}
1870
1871
1872\subsubsection{Some class info - where should this go??}
1873\begin{table}
1874\caption{The utility classes in org.greenstone.gsdl3.util}
1875\label{tab:utils}
1876{\footnotesize
1877\begin{tabular}{lp{3.75in}}
1878\hline
1879\bf Utility class & \bf Description\\
1880\hline
1881ConfigVars & holds the servlet startup variables, including library name, site name, interface name, default language\\
1882Dictionary & wrapper around a Resource Bundle, providing strings with parameter\\
1883GSCGI & class to map between short name CGI arguments and long name request parameters \\
1884GSFile & class to create all Greenstone file paths e.g. used to locate configuration files, XSLT files and collection data. \\
1885GSHTML & provides convenience methods for dealing with HTML, e.g. making strings HTML safe\\
1886GSPath & used to create, examine and modify message address paths\\
1887GSStatus & some static codes for status messages\\
1888GSXML & lots of methods for extracting information out of Greenstone XML, and creating some common types of elements. Also has static Strings for element and attribute names used by Greenstone.\\
1889GSXSLT & some manipulation functions for Greenstone XSLT\\
1890Misc & miscellaneous functions\\
1891OID & class to handle Greenstone (2) OIDs\\
1892XMLConverter & provides methods to create new Documents, parse Strings or Files into Documents, and convert Nodes to Strings\\
1893XMLTransformer & methods to transform XML using XSLT \\
1894XSLTUtil & contains static methods to be called from within XSLT \\
1895\hline
1896\end{tabular}}
1897\end{table}
1898
1899\newpage
1900\section{Collection building architecture}\label{sec:develop-build}
1901**** GEORGE ****
1902how building actually works\\
1903the building structure/architecture\\
1904modules API\\
1905
1906\newpage
1907\section{Developing Greenstone 3: Adding new features}\label{sec:new-features}
1908
1909\subsection{Creating new services}\label{sec:new-services}
1910
1911*inherit from ServiceRack - abstract base class. this handles the main process method, determines the service name and request type. if request type is describe, and to is empty, it returns a list of services (short\_service\_info) which is initialised in the configure method. a describe request to a particular service results in getServiceDescription being called, which must be supplied by the subclass.
1912other request types (process) get sent to processXXX methods, where XXX is the service name.
1913
1914* what methods are expected
1915
1916*service type responses expected
1917
1918*a browse type service must also implement servicenameMetadataRetrieve service.
1919
1920* should a metadata retrieval service advertise what metadata is available??
1921
1922standard service type vs new service type - standrad needs some xml response syntax.
1923
1924\subsection{creating new actions/pages}\label{sec:new-pages}
1925
1926\subsection{new interfaces}\label{sec:new-interfaces}
1927e.g. java interface. where you can interface to. MR vs Receptionist. diff receptionists. egs, handheld - using servlet, transforming recpt, but new set of XSLT java program other program - talk to recpt but just get back XML data for pages. java gui - just talk to MR, do all processing itself.
1928
1929\subsection{Adding new classifiers}\label{sec:new-classifiers}
1930*** GEORGE ***
1931\subsection{Adding new plugins}\label{sec:new-plugins}
1932*** GEORGE ***
1933
1934\subsection{New types of collections}\label{sec:new-coll-types}
1935
1936There are two types of standard Greenstone collections: collections built with the Greenstone 3 building system, and collections that are imported from Greenstone 2. There are many options to collection building but it is conceivable that these options don't meet the needs of all collection builders. Greenstone 3 has an ability to use any type of collection you can come up with, assuming some java code is provided.
1937
1938
1939There are four levels of customisation that may be needed with new collections: service, collection, interface XSLT, and action levels. We will use the example collections that come with Greenstone to describe these different levels.
1940
1941Firstly, new service classes need to be written to provide the functionality to search/browse/whatever the collection. If the services have similar interfaces and functionality to the standard services, this may be all that is needed. For example, the Greenstone 2 MGPP collections were the first to be served in Greenstone 3. When we came to do Greenstone 2 MG collections, all we had to do was write some new service classes that interacted with MG instead of MGPP. Because these collections used the same type of services, this was all we had to do. The format of the configuration files was similar, they just specified MG serviceRack classes rather than MGPP ones.
1942
1943The nzmaps collection used the same level of customisation, just implementing new services and fitting all the extra display elements into the standard query/display framework using javascript.
1944
1945The gberg collection, however, was done quite differently to the standard collections. New services were provided to search the database (built with Lucene) and to provide the documents and parts of documents (using XSLT to transform the raw XML files). The collectionConfig file had some extra information in it: a list of the documents in the collection along with their Titles. Because the standard collection class has no notion of document lists, a new class was created (org.greenstone.gsdl3.collection.XMLCollection). This class is basically the same as a standard collection class except that it looks for and stores in memory the documentList from the collectionConfig file.
1946
1947To tell Greenstone to load up a different type of collection class, we use another configuration file: etc/collectionInit.xml. This specifies the name of the collection class to use.
1948Currently, this is all that is specified in that file, but you may want to add parameters for the class etc.
1949
1950\gst{<collectionInit class="XMLCollection"/>}
1951
1952The display for the collection is also quite different. The home page for the collection displays the list of documents. To achieve this, the describe response from the collection had to include the list, and a new XSLT was written for the collection that displayed this. Collection XSLT should be put in the transform directory of the collection\footnote{These are currently only used when running greenstone in a non-distributed fashion, but it will be added in properly at some stage}.
1953
1954Document display is significantly different to standard greenstone. There are two modes of display: table of contents mode, and content mode. Clicking on a document link from the collection home page takes the user to the table of contents for the collection. Clicking on one of the sections in the table of contents takes them to a display of that section. To facilitate this, not only do we need new XSLT files , we also needed a new action. XMLDocumentAction was created, that used two subactions, toc and text, for the different modes of display.
1955
1956The Receptionist was told about this new action by the addition of the following to the interfaceConfig.xml file:
1957
1958\begin{gsc}\begin{verbatim}
1959<action name='xd' class='XMLDocumentAction'>
1960 <subaction name='toc' xslt='document-toc.xsl'/>
1961 <subaction name='text' xslt='document-content.xsl'/>
1962</action>
1963\end{verbatim}\end{gsc}
1964
1965XSLT files are linked to subactions rather than the action as a whole. The collection supplies the two XSLT files written appropriately for the data it contains.
1966
1967All links that link to the documents have to be changed to use the xd action rather than the standard d action. These include the links from the home page, and the links from query results.
1968
1969Querying of the collection is almost the same as usual. The query service provides a list of parameters, does the query and then sends back a list of document identifiers. The standard query action was fine for this collection. The change occurs in the way that the results are displayed---this is accomplished using a format statement supplied in the collectionConfig file inside the search node.
1970
1971\begin{gsc}\begin{verbatim}
1972<search>
1973 <format>
1974 <gsf:template match="documentNode">
1975 <xsl:param name="collName"/>
1976 <xsl:param name="serviceName"/>
1977 <td>
1978 <b><a href="{$library_name}?a=xd&amp;sa=text&amp;c={$collName}&
1979 amp;d={@nodeID}&amp;p.a=q&amp;p.s={$serviceName}">
1980 <xsl:choose>
1981 <xsl:when test="metadataList/metadata[@name='Title']">
1982 <gsf:metadata name="Title"/>
1983 </xsl:when>
1984 <xsl:otherwise>(section)</xsl:otherwise>
1985 </xsl:choose>
1986 </a>
1987 </b> from <b><a href="{$library_name}?a=xd&amp;sa=toc&amp;
1988 c={$collName}&amp;d={@nodeID}.rt&amp;p.a=q&amp;p.s={$serviceName}">
1989 <gsf:metadata name="Title" select="root"/></a></b>
1990 </td>
1991 </gsf:template>
1992 </format>
1993</search>
1994\end{verbatim}\end{gsc}
1995
1996Instead of displaying an icon and the Title, it displays the Title of the section and the title of the document. Both of these are linked to the document: the section title to the content of that section, the document title to the table of contents for the document. Because these require non-standard arguments to the library, these parts of the template are written in XSLT not greenstone format language. As is shown here it is perfectly feasible to write a format statement that includes XSLT mixed in with greenstone format elements.
1997
1998The document display uses CSS to format the output---these are kept in the collection and specified in the collections XSLT files. The documents also specify DTD files. Due to the way we read in the XML files, Tomcat sometimes has trouble locating the DTDs. One option is to may all the links absolute links to files in the collection folder, the other option is to put them in Greenstone's DTD folder gsdl3/resources/dtd.
1999
2000\subsection{The NZDL mirror site}
2001
2002The library seen at \gst{http://www.greenstone.org/greenstone3/nzdl} is like a mirror to \gst{http://www.nzdl.org}---it aims to present the same collections, in the same way but using Greenstone 3 instead of Greenstone 2. It uses a new site and a new interface. The web.xml file had a new servlet entry in it to specify the combination of nzdl site and interface.
2003
2004The site was created by making a directory called nzdl in the sites folder. A siteConfig file was created. Because its running on Linux, we were able to link to all the collections in the old greenstone installation. The convert\_coll\_from\_gs2.pl script was run over all the collections to produce the new XML configuration files.
2005
2006A new interface, also called nzdl, was created in the interfaces directory.
2007In many cases, creating a new interface just requires the new images and XSLT to be added to the new directory(see Sections~\ref{sec:sites-and-ints} and \ref{sec:interface-customise}). This setup also required a bit more customisation.
2008
2009The standard Greenstone navigation bar lists all the services available for the collection. In Greenstone 2, the navigation bar provided the search option, and the different classifiers. This is not service specific, but hard coded to the search and classifiers. The XSLT that produced the navigation bar needed to be altered to produce this. But also, a new Receptionist was needed.
2010The standard receptionist (DefaultReceptionist) gathers a little bit of extra info for each page of XML before transforming it: this is the list of services for the collection and their display information, allowing the services to be listed along the navigation bar. This is information that is needed by every page (except for the library home page) and therefore is obtained by the receptionist instead of by each action. The nzdl interface needed a bit more information than this: for the ClassifierBrowse service, if there was one, the list of classifiers and their display elements must be obtained. So a new Receptionist was written that inherited from DefaultReceptionist, and added this new info into the page.
2011
2012One of the servlet initialisation parameters is the receptionist class: this was added to the servlet definition in the web.xml file so that the LibraryServlet would load up the right receptionist class.
2013
2014
2015\newpage
2016\section{Distributed Greenstone}\label{sec:distributed}
2017
2018Greenstone is designed to run in a distributed fashion. One greenstone installation can talk to several sites on different computers. This requires some sort of communication protocol. Any protocol can be used, however we have only implemented a simple SOAP protocol.
2019
2020more explanation..
2021
2022\begin{figure}[h]
2023 \centering
2024 \includegraphics[width=4in]{remote} %5.8
2025 \caption{A distributed digital library configuration running over several servers}
2026 \label{fig:remote}
2027\end{figure}
2028
2029We have used Apache SOAP for Java. This is run as a servlet in Tomcat.
2030If you have obtained Greenstone through CVS, you will need to install soap separately, describe in Appendix~\ref{app:soap-cvs}. Debugging soap is described in Appendix~\ref{app:soap-debug}.
2031
2032\subsection{Serving a site using soap}
2033what do we have to do?? resource file format, deploy the service etc.
2034
2035\appendix
2036
2037\newpage
2038\section{Using Greenstone 3 from CVS}\label{app:cvs}
2039
2040*** need to make sure building stuff is in here ***
2041
2042Greenstone 3 is also available via CVS. You can download the latest version of the code. This is not guaranteed to be stable, in fact it is likely to be unstable. The advantage of using CVS is that you can update the code and get the latest fixes.
2043
2044Note that you will need the Java 2 SDK, version 1.4.0 or higher.
2045
2046To check out the greenstone code, use:
2047
2048\begin{quote}\begin{gsc}\begin{verbatim}
2049cvs -d :pserver:cvs\[email protected]:2402/usr/local/
2050 global-cvs/gsdl-src co gsdl3
2051\end{verbatim}\end{gsc}\end{quote}
2052
2053If you need it, the password for anonymous CVS access is \gst{anonymous}. Note that some older versions of CVS have trouble accessing this repository due to the port number being present. We are using version 1.11.1p1.
2054
2055The software needs to be compiled and installed. The installation procedure has been semi-automated. The following sections describe installation under Linux and windows.
2056
2057\subsection{Linux install}
2058
2059An install.sh script is provided to compile and install Greenstone3. What you need to do is:
2060
2061\begin{quote}\begin{gsc}
2062cd gsdl3\\
2063source gs3-setup.sh\\
2064./gs3-prepare.sh\\
2065./gs3-configure.sh \\
2066./gs3-compile.sh \\
2067./gs3-finalise.sh\\
2068\end{gsc}\end{quote}
2069
2070Note: \gst{source gs3-setup.sh} sets the environment variables \gst{CLASSPATH, PATH, JAVA\_HOME} and needs to be done in a shell before doing collection building etc.
2071
2072To startup or shutdown the library (includes the Tomcat server and MYSQL server), the commands are:
2073\begin{quote}\begin{gsc}
2074./gs3-launch.sh
2075./gs3-launch.sh -shutdown
2076\end{gsc}\end{quote}
2077
2078\subsection{Windows install}
2079
2080Make sure that the following environment variables are set: JAVA\_HOME (where the JAva 2 SDK is installed); PATH (should include the CVS program, and \%JAVA\_HOME\%$\backslash$bin). The following commands should be run in a DOS prompt.
2081
2082Run gs3-setup.bat\\
2083Run gs3-prepare.bat\\
2084Using Wordpad, edit the gsdl3$\backslash$comms$\backslash$jakarta$\backslash$tomcat$\backslash$conf$\backslash$server.xml file. Add
2085
2086\begin{quote}\begin{gsc}
2087<!-- GSDL3 Service -->\\
2088<Context path='/gsdl3' docBase='@gsdl3home@$\backslash$web' debug='1'
2089 reloadable='true'/>
2090\end{gsc}\end{quote}
2091
2092above the line:
2093\gst{<!-- Tomcat Root Context -->}
2094
2095Still using Wordpad, edit the gsdl3$\backslash$comms$\backslash$jakarta$\backslash$tomcat$\backslash$conf$\backslash$web.xml file. set the value of the 'listings' parameter to false.
2096
2097Run make.bat\\
2098Run make.bat install.\\
2099Run gs3-finalise.bat\\
2100
2101To run Greenstone, run gs3-launch.bat. This will start the Tomcat server in a new DOS window (stop it by closing the window), and open a broser window showing the Greenstone 3 homepage.
2102
2103\newpage
2104\section{Tomcat}\label{app:tomcat}
2105
2106Tomcat is a servlet container. It is used to serve a Greenstone site using a servlet.
2107
2108The file \gst{\gsdlhome/comms/jakarta/tomcat/conf/server.xml} is the Tomcat configuration file. The installation process adds a context for Greenstone3 servlets (\gst{\gsdlhome/web})---this tells Tomcat where to find the web.xml file, and what URL (\gst{/gsdl3}) to give it. Anything inside the context directory is accessible via Tomcat\footnote{can we use .htaccess files to restrict access??}. For example, the index.html file that lives in \gst{\gsdlhome/web} can be accessed through the URL \gst{localhost:8080/gsdl3/index.html}. The demo collection's images can be accessed through \\
2109\gst{localhost:8080/gsdl3/sites/localsite/collect/demo/images/}.
2110
2111
2112Tomcat runs by default on port 8080---this can be changed in server.xml, in the \gst{<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 --><Connector>} element. The siteConfig files also need changing if Tomcat's port is changed: \gst{<httpAddress>} for the site, and \gst{<address>} for a remote site both use this.
2113
2114Note: Tomcat must be shutdown and restarted any time you make changes in the following for those changes to take effect:\\
2115\begin{bulletedlist}
2116\begin{gsc}
2117\item \gsdlhome/web/WEB-INF/web.xml
2118\item \gsdlhome/comms/jakarta/tomcat-tomcat-4.0.1/conf/server.xml
2119\end{gsc}
2120\item any classes or jar files used by the servlets
2121\end{bulletedlist}
2122\noindent Note: stdin and stdout for the servlets both go to\\
2123\gst{\gsdlhome/comms/jakarta/tomcat/logs/catalina.out}
2124
2125On startup, the servlet loads in its collections and services. If the site or collection configuration files are changed, these changes will not take effect until the site/collection is reloaded. This can be done through the reconfiguration messages (see Section~\ref{sec:runtime-config}), or by restarting Tomcat.
2126
2127We have set up Tomcat to follow symlinks. To disable this feature, remove the \gst{<Resources>} element from the gsdl3 context in \gst{\$GSDL3HOME/comms/jakarta/tomcat/conf/server.xml}:\\
2128
2129\begin{quote}\begin{gsc}
2130<Context path="/gsdl3" docBase="\$GSDL3HOME/web" debug="1" \\
2131reloadable="true">\\
2132 <Resources allowLinking='true'/>\\
2133</Context>\\
2134\end{gsc}\end{quote}
2135
2136We have set up tomcat to disallow directory listings for everything in the docBase directory. To turn this back on, you need to edit Tomcat's default web.xml file (\$GSDL3HOME/comms/jakarta/tomcat/conf/web.xml):
2137
2138In the default servlet definition, change the 'listings' parameter to true.
2139
2140Tomcat uses a Manager to handle HTTP session information. This may be stored between restarts if possible. To use a persistent session handling manager, uncomment the \gst{<Manager>} element in \gst{\$GSDL3HOME/comms/jakarta/tomcat/conf/server.xml}. For the default manager, session information is stored in the work directory: \gst{\$GSDL3HOME/comms/jakarta/tomcat/work/Standalone/localhost/gsdl3/SESSIONS.ser}. Delete this file to clear the cached session info.
2141
2142\subsection{Proxying tomcat with apache}
2143
2144Instead of incorporating servlet support into your existing web server, an easy alternative is to proxy tomcat. The \gst{http://www.greenstone.org/greenstone3} site uses apache to proxy Tomcat. ProxyPass and ProxyPassReverse directives need to be added to the Virtualhost description for the www.greenstone.org server.
2145
2146\begin{quote}\begin{gsc}
2147<VirtualHost xx.xx.xx.xx>\\
2148ServerName www.greenstone.org\\
2149...\\
2150ProxyPass /greenstone3 http://puka.cs.waikato.ac.nz:8080/gsdl3\\
2151ProxyPassReverse /greenstone3 http://puka.cs.waikato.ac.nz:8080/gsdl3\\
2152</VirtualHost>\\
2153\end{gsc}\end{quote}
2154
2155In our example, the greenstone 3 servlet can be accessed at \gst{http://www.greenstone.org/greenstone3/library}, instead of at \gst{http://puka.cs.waikato.ac.nz:8080/gsdl3/library}, which is not publically accessible.
2156
2157\subsection{Running tomcat behind a proxy}
2158
2159Almost everything works fine when tomcat is running behind a proxy. The only time this causes trouble is if the servlet itself needs to make external http connections. We do this in the infomine demo collection for example. One of the service classes sends http requests to the infomine database at riverside. Since this is going through the proxy, a username and password is needed. It is not sufficient to prompt the user for a password because they are unlikely to have a password for the particular proxy that tomcat is using. What we have done at present is to put a proxy element in the siteConfig.xml file. Here you have to enter a suitable username and password for the proxy server. Unfortunately these are entered in plain text. And the file is viewable via the servlet. So we need a better solution.
2160
2161\newpage
2162\section{SOAP}\label{app:soap}
2163
2164\subsection{Setting up SOAP from CVS}\label{app:soap-cvs}
2165
2166If you have obtained greenstone through CVS, you will need to install the SOAP stuff by running:
2167
2168\begin{quote}\begin{gsc}
2169install-soap.bash
2170\end{gsc}\end{quote}
2171
2172This unpacks the soap distribution, adds a SOAP context to Tomcat's server.xml configuration file, and creates the file \gst{src/java/org/greenstone/gsdl3/SOAPServer.java} from \gst{src/java/org/greenstone/gsdl3/SOAPServer.java.in} (it has a place where gsdl3home needs to be added).
2173It also tries to deploy the SOAP service, but this often doesn't work. You may need to run from a shell the following command:
2174
2175\begin{gsc}\begin{verbatim}
2176java org.apache.soap.server.ServiceManagerClient
2177 http://localhost:8080/soap/servlet/rpcrouter deploy
2178 resources/soap/localsite.xml
2179\end{verbatim}\end{gsc}
2180
2181You can also deploy a service through the website. If Tomcat is not running, start it up (see \ref{subsec:runtomcat}).
2182
2183The SOAP servlet can be accessed at \begin{gsc}{\tt http://localhost:8080/soap}\end{gsc}. You should see a welcome page. Click on ``Run the admin client''. This enables you to list, deploy and undeploy SOAP services.
2184
2185To deploy the SOAPServer for localsite:
2186
2187Click on ``deploy'' and edit the following fields in the deploy form:
2188
2189\begin{tabular}{ll}
2190ID: & org.greenstone.localsite\\
2191Scope: (choose Session & Request---new instantiation for each request\\
2192 or Application) & Session---same instantiation across a session\\
2193 & Application---only uses one instantiation\\
2194Methods: &process\\
2195Java Provider / Provider Class: & org.greenstone.gsdl3.SOAPServer\\
2196\end{tabular}
2197
2198Now click the ``deploy'' button at the bottom of the page. If the service has been deployed, it should appear when you click on the left hand ``List'' button.
2199
2200Information about deployed services is maintained between Tomcat sessions---you only need to deploy it once. To get the library1 servlet talking to the SOAP server, you need to shutdown and restart Tomcat (see \ref{subsec:runtomcat}). You should see more collections when you run the library1 servlet.
2201
2202\subsection{Debugging SOAP}\label{app:soap-debug}
2203
2204If you need to debug the SOAP stuff for some reason, or just want to look at the SOAP messages that are being passed back and forth, use a program called TcpTunnelGui. This intercepts messages coming in to one port, displays them, and passes them to another port.
2205To run it, type:
2206
2207\begin{quote}\gst{java org.apache.soap.util.net.TcpTunnelGui 8070 localhost 8080}
2208\end{quote}
2209
22108070 is the port that TcpTunnelGui listens on, and 8080 is the port that it sends the messages onto---the port that Tomcat is using. You need to modify Greenstone to talk to port 8070 when it wants to talk to Tomcat, so that the messages go through TcpTunnelGui. This is specified in the \gst{<site>} element of the soapsite site configuration file (\gst{\gsdlhome/web/sites/soapsite/siteConfig.xml}).
2211\begin{quote}\begin{gsc}\begin{verbatim}
2212<site name="org.greenstone.localsite"
2213 address="http://localhost:8080/soap/servlet/rpcrouter"
2214 type="soap"/>
2215\end{verbatim}\end{gsc}\end{quote}
2216
2217Note that \gst{http://localhost:8080/soap/servlet/rpcrouter} is the
2218address for talking to the Tomcat SOAP servlet services.
2219
2220
2221\newpage
2222\section{Format statements: Greenstone 2 vs Greenstone 3}\label{app:format}
2223The following table shows the Greenstone 2 format elements, and their equivalents in Greenstone 3
2224\begin{table}
2225\caption{Greenstone 3 equivalents of Greenstone 2 format statements}
2226{\footnotesize
2227\begin{tabular}{ll}
2228\hline
2229\bf Greenstone 2 & \bf Greenstone 3 \\
2230\hline
2231\gst{[Text]} & \gst{<gsf:text/>} \\
2232\gst{[num]} & \gst{<gsf:metadata name='docnum'/>}\\
2233\gst{[link][/link]} & \gst{<gsf:link></gsf:link>} or \\
2234& \gst{<gsf:link type='document'></gsf:link>}\\
2235\gst{[srclink][/srclink]} & \gst{<gsf:link type='source'></gsf:link>}\\
2236\gst{[icon]} & \gst{<gsf:icon/>} or \\
2237& \gst{<gsf:icon type='document'/>}\\
2238\gst{[srcicon]} & \gst{<gsf:icon type='source'/>}\\
2239\gst{[Title]} (metadata) & \gst{<gsf:metadata name='Title'/>} or \\
2240& \gst{<gsf:metadata name='Title' select='current'/>}\\
2241\gst{[parent:Title]} & \gst{<gsf:metadata name='Title' select='parent' />}\\
2242\gst{[parent(All):Title]} & \gst{<gsf:metadata name='Title' select='ancestors'/>}\\
2243\gst{[parent(Top):Title]} & \gst{<gsf:metadata name='Title' select='root' />}\\
2244\gst{[parent(All': '):Title]} & \gst{<gsf:metadata name='Title' select='ancestors'}\\
2245& \gst{ separator=': ' />}\\
2246\gst{[sibling(All': '):Title]} & \gst{<gsf:metadata name='Title' multiple='true'} \\
2247& \gst{ separator=': ' />}\\
2248\gst{\{Or\}\{[dc.Title],} & \gst{<gsf:choose-metadata>}\\
2249\gst{ [dls.Title], [Title]\}}& \gst{ <gsf:metadata name='dc.Title'/>}\\
2250& \gst{ <gsf:metadata name='dls.Title'/>}\\
2251& \gst{ <gsf:metadata name='Title'/>}\\
2252& \gst{</gsf:choose-metadata>}\\
2253\gst{\{If\}\{[parent:Title],} & \gst{<gsf:choose-metadata>}\\
2254\gst{ [parent:Title], [Title]\}}& \gst{ <gsf:metadata name='Title' select='parent'/>}\\
2255& \gst{ <gsf:metadata name='Title'/>}\\
2256& \gst{</gsf:choose-metadata>}\\
2257\gst{\{If\}\{[Subject],} & \gst{<gsf:switch>}\\
2258\gst{ <td>[Subject]</td>\}}& \gst{ <gsf:metadata name='Subject'/>}\\
2259& \gst{ <gsf:when test='exists'>} \\
2260& \gst{ <td><gsf:metadata name='Subject'/></td>}\\
2261& \gst{ </gsf:when></gsf:switch>}\\
2262\hline
2263\end{tabular}}
2264\end{table}
2265\end{document}
Note: See TracBrowser for help on using the repository browser.