Index: trunk/gsdl3/docs/manual/manual.tex
===================================================================
--- trunk/gsdl3/docs/manual/manual.tex	(revision 5504)
+++ 	(revision )
@@ -1,2147 +1,0 @@
-\documentclass[a4paper,11pt]{article}
-\usepackage{times,epsfig}
-\hyphenation{Message-Router Text-Query}
-
-\newenvironment{gsc}% Greenstone text bits
-{\begin{footnotesize}\begin{tt}}%
-{\end{tt}\end{footnotesize}}
- 
-\newcommand{\gst}[1]{{\footnotesize \tt #1}}
-\begin{document}
-
-\title{A modular digital library:\\
-       Architecture and implementation of Greenstone3}
-
-% if you work on this manual, add your name here
-\author{Katherine Don and Ian H. Witten \\[1ex]
-        Department of Computer Science \\
-         University of Waikato \\ Hamilton, New Zealand \\
-        \{kjdon, ihw\}@cs.waikato.ac.nz}
-
-\date{}
-
-\maketitle
-
-\newenvironment{bulletedlist}%
-{\begin{list}{$\bullet$}{\setlength{\itemsep}{0pt}\setlength{\parsep}{0pt}}}%
-{\end{list}}
-
-
-\noindent
-Greenstone Digital Library Version 3 is a complete redesign and
-reimplementation of the Greenstone digital library software.  The current
-version (Greenstone2) enjoys considerable success and is being widely used.
-Greenstone3 will capitalize on this success, and in addition it will
-\begin{bulletedlist}
-\item improve flexibility, modularity, and extensibility
-\item lower the bar for ``getting into'' the Greenstone code with a view to
-   understanding and extending it
-\item use XML where possible internally to improve the amount of
-   self-documentation
-\item make full use of existing XML-related standards and software
-\item provide improved internationalization, particularly in terms of sort order,
-   information browsing, etc.
-\item include new features that facilitate additional ``content management''
-   operations
-\item operate on a scale ranging from personal desktop to corporate library
-\item easily permit the incorporation of text mining operations
-\item use Java, to encourage multilinguality, X-compatibility, and to permit
-   easier inclusion of existing Java code (such as for text mining).
-\end{bulletedlist}
-Parts of Greenstone will remain in other languages (e.g. MG, MGPP); JNI (Java
-Native Interface) will be used to communicate with these.
-
-A 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).
-
-NOTES: structure: make the classes and messages separate. have a class hierarchy and a module hierarchy/picture - keep the two separate. schemas/subschemas??
-user vs developer - make a clearer distinction
-are we going to publish an API. what is it? what do we want to provide?
-\section{System modules}\label{sec:modules}
-
-A 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.
-
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=4in]{local} %5.8
-  \caption{A simple stand-alone site.}
-  \label{fig:local}
-\end{figure}
-
-
-{\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.
-
-{\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, eg all the building services may be part of a cluster. What is part of a cluster is specified by the site config file. A Collection's services are grouped by the fact that they all operate on some common data---the documents in the collection.
-Functionally Collection and ServiceCluster are very similar, but conceptually, and to the user, they are quite different.
-
-{\em ServiceRack}: these provide one or more services - they are grouped into a single class purely 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, eg searching, retrieving documents, building collections etc.
-
-{\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.
-
-{\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 teh 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}.
-
-{\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}.
-
-
-\section{Configuration}\label{sec:config}
-
-Initial 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 config file, \gst{interfaceConfig.xml}, that specifies Actions for the interface. Each collection has two configuration files, \gst{collectionConfig.xml} and \gst{buildConfig.xml}, that give metadata, display and other information for the
-collection.\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
-Greenstone2.}  The first includes user-defined presentation metadata for the collection,
-such as its name and the {\em About this collection} text; gives formatting information for the collection display; and also gives
-instructions on how the collection is to be built.  The second is produced by
-the build-time process and includes any metadata that can be determined
-automatically. It also includes configuration information for any ServiceRacks needed by the collection.
-
-The 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 have no effect. 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}.
-
-\subsection{Site configuration file}\label{sec:siteconfig}
-
-The 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
-known external sites to connect to.  Collections are not specified in the site
-configuration file, instead they are determined by the contents of the site's
-collections directory.
-
-The HTTP address is used for retrieving resources from a site outside the XML protocol. Because a site is HTTP accessible, 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://.}.
- 
-Figure~\ref{fig:siteconfig} shows two example site configuration files. The first example is for a rudimentary site with no site-wide services,
-which 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.
-These 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:8090/soap/servlet/rpcrouter}.
-
-
-\begin{figure}
-\begin{gsc}\begin{verbatim}
-<siteConfig>
-  <localSiteName value="org.greenstone.localsite"/>
-  <httpAddress value="http://localhost:8090/gsdl3/sites/localsite"/>
-  <serviceClusterList/>
-  <serviceRackList/>
-  <siteList/>
-</siteConfig>
-\end{verbatim}\end{gsc}
-
-\begin{gsc}\begin{verbatim}
-<siteConfig>
-  <localSiteName value="org.greenstone.gsdl1"/>
-  <httpAddress value="http://localhost:8090/gsdl3/sites/gsdl1"/>
-  <serviceClusterList>	
-    <serviceCluster name="build">
-      <metadataList>
-        <metadata name="Title">Collection builder</metadata>
-        <metadata name="Description">Builds collections in a 
-				gsdl2-style manner</metadata>
-      </metadataList>
-      <serviceRackList>
-        <serviceRack name="GS2Construct"/>
-      </serviceRackList>
-    </serviceCluster>
-  </serviceClusterList>
-  <siteList>
-    <site name="org.greenstone.localsite"
-      address="http://localhost:8090/soap/servlet/rpcrouter"
-      type="soap"/>
-  </siteList>
-</siteConfig>
-\end{verbatim}\end{gsc}
-\caption{Two sample site configuration files}
-\label{fig:siteconfig}
-\end{figure}
-
-\subsection{Interface configuration file}\label{sec:interfaceconfig}
-
-The interface config 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 eg QueryAction should use a=q. If the interface uses xslt, it specifies what xslt file should be used for each action and subaction.
-
-\begin{figure}
-\begin{gsc}\begin{verbatim}
-<interfaceConfig>
-  <actionList>
-    <action name='p' class='PageAction'>
-      <subaction name='home' xslt='home.xsl'/>
-      <subaction name='about' xslt='about.xsl'/>
-    </action>
-    <action name='q' class='QueryAction' xslt='basicquery.xsl'/>
-    <action name='b' class='BrowseAction' xslt='classifier.xsl'/>
-    <action name='a' class='AppletAction' xslt='applet.xsl'/>
-    <action name='d' class='DocumentAction' xslt='document.xsl'/>
-    <action name='pr' class='ProcessAction' xslt='process.xsl'/>
-    <action name='s' class='SystemAction' xslt='system.xsl'/>
-  </actionList>
-</interfaceConfig>
-\end{verbatim}\end{gsc}
-\caption{A sample interface config file}
-\label{fig:ifaceconfig}
-\end{figure}
-
-This makes it easy for developers to implement and use different actions and/or xslt files without recompilation. The server must be restarted, however.
-
-\subsection{Collection configuration file}\label{sec:collconfig}
-
-The collection configuration file is where the collection designer (eg 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.)
-
-
-\begin{figure}
-\begin{gsc}\begin{verbatim}
-<collectionConfig xmlns:gsf="http://www.greenstone.org/
-                         configformat">	
-  <metadataList>	
-    <metadata name="colName" lang="en">greenstone mgpp demo
-    </metadata>
-    <metadata name="colDescription" lang="en">This is a 
-      demonstration collection for the Greenstone digital 
-      library software. It contains a small subset (11 books) 
-      of the Humanity Development Library.</metadata>
-    <metadata name="colDescription" lang="fr">C'est une 
-      collection pour demonstration du logiciel Greenstone.
-      Elle contient une petite partie du projet de bibliotheques 
-      humanitaires et de developpement (11 livres).</metadata>
-    <metadata name="colIcon">mgppdemo.gif</metadata>
-  </metadataList>
-  <search type='mgpp'>
-    <index name="tt" content="text,metadata" 
-			level="Document,Section">
-      <displayName lang="en">books</displayName>
-    </index>
-    <format>	
-      <gsf:template match="documentNode">
-	<td><gsf:link><gsf:metadata name="Title"/>(<gsf:metadata 
-		name="Source"/>)</gsf:link></td>
-      </gsf:template>
-    </format>
-  </search>
-  <browse>
-    <classifier name="CL1" type="Hierarchy" content="Subject" 
-	level="Document">
-      <option name="hfile" value="sub.txt"/>
-      <option name="sort" value="Title"/>
-    </classifier>
-    <classifier name="CL2" type="AZList" content="Title" 
-	level="Document">
-      <displayName lang='en'>all titles</displayName>
-      <format>
-        <gsf:template match="classifierNode">
-	  <td><gsf:link type="classifier"><gsf:metadata name="Title"/>
-	    </gsf:link></td>
- 	</gsf:template>
-      </format>
-    </classifier>
-    <classifier name="CL3" type="List" content="Keyword" 
-	level="Document">
-      <format>
-	<gsf:template match="documentNode"><td><gsf:link>
-	<gsf:metadata name="Keyword"/></gsf:link></td></gsf:template>
-      </format>
-    </classifier>
-    <classifier type="Phind" content="text" level="Section"/>      
-  </browse>
-</collectionConfig>
-\end{verbatim}\end{gsc}
-\caption{Sample collectionConfig.xml file}
-\label{fig:collconfig}
-***** REDO *****
-\end{figure}
-
-****REDO****
-The \gst{<metadataList>} element specifies some collection metadata, such as name and description. These metadata elements can be specified in different languages. The configuration file should be encoded in utf-8. 
-The \gst{<search>} element specifies what type of indexer to use, and what indexes to build. A \gst{<format>} element is used to customize what each document entry in a results list should look like.
-The \gst{<browse>} element specifies what browsing structures should be created over the documents. Again, \gst{<format>} elements are used to customize items in the hierarchy, both classifier nodes, and document entries. Section~\ref{sec:colldesign} looks at the collection configuration file in more detail.
-
-The \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. 
-
-\subsection{Building configuration file}\label{sec:buildconfig}
-
-The file \gst{buildConfig.xml} is produced by the collection building process, and contains  metadata and other information about the collection that can
-be determined automatically,  such as the number of
-documents it contains.  It also includes a list of ServiceRack classes that are
-required at runtime to provide the services that have been built into the
-collection.  The serviceRack names are Java classes that are loaded
-dynamically at runtime. Any information inside the serviceRack element is
-specific to that service---there is no set format. Figure~\ref{fig:buildconfig} shows an example. This config 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 ot 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.
-
-
-\begin{figure}
-\begin{gsc}\begin{verbatim}
-<buildConfig xmlns:gsf="www.greenstone.org/format" >
-  <metadataList>
-    <metadata name="numDocs">11</metadata>
-    <metadata name="documentMetadata"><element name="Title"/>
-        <element name="Subject"/><element name="Organization"/>
-        <element name="URL"/></metadata>
-  </metadataList>
-  <serviceRackList>
-    <serviceRack name="GS2MGPPRetrieve">
-      <defaultLevel name="Section"/>
-      <levelList>
-        <level name="Document"/>
-        <level name="Section"/>
-      </levelList>
-      <classifierList>
-        <classifier name="CL1" content="Subject" 
-          documentInterleave="true" orientation='vertical'/>
-        <classifier name="CL2" content="Title" 
-          documentInterleave="false" orientation='horizontal'/>
-        <classifier name="CL4" content="Organisation" 
-          documentInterleave="true" orientation='vertical'/>
-        <classifier name="CL5" content="Keyword" 
-          documentInterleave="true" orientation='vertical'/>
-      </classifierList>
-    </serviceRack>
-    <serviceRack name="GS2MGPPSearch">
-      <defaultIndex name="tt"/>
-      <defaultLevel name="Section"/>
-      <levelList>
-        <level name="Document"/>
-        <level name="Section"/>
-      </levelList>
-      <indexList>
-        <index name="tt"/>
-        <index name="t0"/>
-      </indexList>
-      <fieldList>
-        <field shortname="TX" name="TextOnly"/>
-        <field shortname="SU" name="Subject"/>
-        <field shortname="TI" name="Title"/>
-      </fieldList>
-    </serviceRack>
-    <serviceRack name="PhindPhraseBrowse"/>
-  </serviceRackList>
-</buildConfig>
-\end{verbatim}\end{gsc}
-\caption{Sample buildConfig.xml file}
-\label{fig:buildconfig}
-\end{figure}
-
- 
-\subsection{Start up configuration}\label{sec:startup-config}
-
-We use the Tomcat web server, which operates either stand-alone in a test mode
-or in conjunction with the Apache web server.  The Greenstone LibraryServlet
-class is loaded by Tomcat  and the servlet's \gst{init()} method is called.  Each time a
-\gst{get/put/post} (etc.) is used, a new thread is started and
-\gst{doGet()/doPut()/doPost()} (etc.) is called.
-
-The \gst{init()} method creates a new Receptionist and a new 
-MessageRouter. Default classes (DefaultReceptionist, MessageRouter) are used unless subclasses have been specified  in the servlet initiation parameters (see Section~\ref{sec:tomcat}). The appropriate system variables are set for each object (interface
-name, site name, etc.) and then \gst{configure()} is called on both. The MessageRouter
-is passed to the Receptionist. The servlet then communicates only with
-the Receptionist, not with the MessageRouter.
-
-The 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.
-If the Receptionist is a Transforming receptionist, a mapping between shortnames  and xslt files is also created. 
-
-The 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}.).
-Each ServiceRack specified in the config 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.
-ServiceClusters 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.
-For each site specified, the MessageRouter creates an appropriate type 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 map with its site name as a key. The sites 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).
-
-The MessageRouter also looks inside the site's \gst{collect} directory, and  loads up a Collection object for each valid collection found.
-
-The Collection object reads its \gst{buildConfig.xml} and \gst{collectionConfig.xml}
-files, determines the metadata, and loads ServiceRack classes based on the 
-names 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 config file.
-Collection objects are added to the module map with their name as a key, and also a collection element is added into the collectionList xml.
-
-\subsection{Run-time (re)configuration}\label{sec:runtime-config}
-
-The startup configuration reads in the various config files and loads up quite a lot of XML into memory. This avoids having to read in files all the time. However, this means that any changes to these files will have no effect in the system. So some run-time reconfiguration options are provided. Currently, these can only be accessed by typing in cgi-arguments into the URL, there is no nice web form yet to do this. SystemAction converts these arguments into system requests, which are described in Section~\ref{sec:system}.
-
-The cgi arguments are entered after the \gst{library?} part of the URL. There are three types of commands: configure, activate, deactivate. 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 abit more detail.
-
-\begin{table}
-\caption{Example run-time configuration arguments.}
-\label{tab:run-time config}
-\begin{tabular}{lp{8cm}}
-\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}. \\
-\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}. \\
-\gst{a=s\&sa=a} & 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}.\\
-\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}. \\
-\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}. \\
-\end{tabular}
-\end{table}
-
-\section{System messages}\label{sec:messages}
-
-
-Once the system is up and running (the configuration
-process described in Section~\ref{sec:startup-config} has been carried out), it is passing messages back and forth. All modules communicate via message passing.
-
-There are two different styles of messaging.  The first style of messaging is the internal Greenstone communication. Requests and responses follow a basic format, and both are in XML. Each individual  communication is contained in a \gst{<message>} element\footnote{all sample requests and responses shown are assumed to have \gst{<message>} elements}. 
-They contain either \gst{<request>} or \gst{<response>} elements--- a single message may contain multiple requests/responses. Each \gst{<request>} (and \gst{<response>}?) has a language attribute, of the form \gst{lang='...'}. Virtually all responses contain text strings, and this attribute specifies the preferred language for these strings.  Element and attribute names are formated in lower case with the first letter of internal words capitalized, like 'matchDocs'. Each request typically specifies one service or one action, and the response contains either the data requested, or a status message. 
-
-
-Requests have a \gst{to} attribute and responses have \gst{from}.  These are addresses used
-by routing modules.  For example \gst{to='site1/demo/TextQuery'} routes a
-message to modules named \gst{site1}, \gst{demo} then \gst{TextQuery}. These modules happen to be a MessageRouter for a remote site (\gst{site1}), a Collection (\gst{demo}), and a Service (\gst{TextQuery}). 
-
-There are several types of request, specified by the \gst{type} attribute: \gst{describe}, \gst{system}, \gst{process}, \gst{status}, \gst{format}. These requests can ask for any functionality available in the system. They are described in more detail in Sections~\ref{sec:describe}, \ref{sec:system}, \ref{sec:process}, \ref{sec:status}, and \ref{sec:format}, respectively.
-
-The second messaging style is the communication between the servlet (or other external agent) and the Greenstone system (via the Receptionist). The request contains a simple representation of the arguments in a Greenstone URL, and has a request type of 'page', as it is a request for a page of data. It has the same format as any other request in the system.  The response, however, does not follow the same format as other responses, and may given in different formats, such as XML, HTML etc. 
-
-These page-type messages come into the Receptionist and are passed to the appropriate action. The actions generate appropriate internal messages which are sent to the MessageRouter. The responses are put together into a single page of XML. This may be returned as XML, or transformed into some other form, eg HTML using XSLT. This type of message is described in Section~\ref{sec:page}.
-
-\subsection{page-type messages}\label{sec:page}
-
-These 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 specifiying 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).\footnote{The \gst{sa} replaces Greenstone's old \gst{p} arg for
-the page action, and is new for other actions.  For example, a text query could
-be encoded as \gst{a=q \& sa=text\/}.}  All other arguments are encoded as
-parameters.
-
-Here is 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}.}:
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request type='page' action='p' subaction='about'
-         lang='fr' output='html'>
-  <paramList>
-    <param name='c' value='demo'/>
-  </paramList>
-</request>
-\end{verbatim}\end{gsc}\end{quote}
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request  lang='en' type='page' action='q'  output='html'>
-  <paramList>
-    <param name='s' value='TextQuery'/>
-    <param name='c' value='demo'/>
-    <param name='rt' value='r'/>
-    <!-- the rest are the service specific params -->
-    <param name='ca' value='0'/> <!-- casefold -->
-    <param name='st' value='1'/> <!-- stem -->
-    <param name='m' value='10'/> <!-- maxdocs -->
-    <param name='q' value='snail'/> <!-- query string -->
-  </paramList>
-</request>
-\end{verbatim}\end{gsc}\end{quote}
-
-The 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, and returns the page to the external entity. Section~\ref{sec:pagegen} describes the different types of Receptionist, and details the structure of the 'pages' they produce. 
-
-The LibraryServlet class communicates with the Receptionist, which is the entry
-point into the system.  Future GUIs could communicate either with the
-Receptionist or directly with the MessageRouter. If they communicate with the Receptionist they may use the either page type requests, asking for predefined pages of information, or they can use any of the other internal type requests--- these requests will be passed directly to the MessageRouter. If they communicate with the MessageRouter directly, they must use the internal message format described in the next sections---this is more powerful, but involves more work by the client. Individual services are requested---the results need to be put together by the client.
-
-The main  arguments/parameters used currently are shown in Table~\ref{tab:args}.
-Other arguments can be specified by  particular actions. These include any parameters needed to access services.  For example, the TextQuery service has a set of parameters including stem and case etc, that are only used by the query action.  
-
-\begin{table}
-\center{\footnotesize
-\begin{tabular}{lll}
-\hline
-\bf Argument & \bf Meaning &\bf Typical values \\
-\hline
-a & action & a (applet), q (query), b (browse), p (page), pr (process) \\
-& & s (system)\\
-sa & subaction & home, about (page action)\\
-c & collection or  & demo, build \\
-& service cluster \\
-s & service name & TextQuery, ImportCollection \\
-rt & request type & d (display), r (request), s (status) \\
-ro & response only & 0 or 1 - if set to one, the request is carried out \\
-& & but no processing of the results is done \\
-& & currently only used in process actions \\
-o & output type & xml, html, wml \\
-l & language & en, fr, zh ...\\
-d & document id & HASHxxx \\
-r & resource id & ???\\
-pid & process handle & an integer identifying a particular process request \\
-\hline
-\end{tabular}}
-\caption{Generic arguments that can appear in a Greenstone URL}
-\label{tab:args}
-\end{table}
-
-
-\subsection{'describe'-type messages}\label{sec:describe}
-
-The 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.
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang='en' type='describe' to=''/>
-\end{verbatim}\end{gsc}\end{quote}
-If the \gst{to} field is empty, a request is answered by the MessageRouter. 
-An example response from a MessageRouter might look like this:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<response lang='en' type='describe'>
-  <serviceList/>
-  <siteList>
-    <site name='org.greenstone.gsdl1'
-            address='http://localhost:8080/soap/servlet/rpcrouter'
-            type='soap' />
-  </siteList>
-  <serviceClusterList>
-    <serviceCluster name="build" />
-  </serviceClusterList>
-  <collectionList>
-    <collection name='org.greenstone.gsdl1/
-  	              org.greenstone.gsdl2/fao' />
-    <collection name='org.greenstone.gsdl1/demo' />
-    <collection name='org.greenstone.gsdl1/fao' />
-    <collection name='myfiles' />
-  </collectionList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-This 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
-communicates with one site, \gst{org.greenstone.gsdl1}.  It is aware of four
-collections.  One of these, \gst{myfiles}, belongs to it; the other three are
-available through the external site.  One of those collections is actually from
-a further external site.
-
-It is possible to ask just for a specific part of the information provided by a
-describe request, rather than the whole thing.  For example, these two
-messages get the \gst{collectionList} and the \gst{siteList} respectively:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang='en' type='describe' to=''>
-  <paramList>
-    <param name='subset' value='collectionList'/>
-  </paramList>
-</request>
-
-<request lang='en' type='describe' to=''>
-  <paramList>
-    <param name='subset' value='siteList'/>
-  </paramList>
-</request>
-\end{verbatim}\end{gsc}\end{quote}
-
-When 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
-a message, along with a sample response.
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang='en' type='describe' to='mgppdemo'/>
-
-<response from="mgppdemo" type="describe">
-  <collection name="mgppdemo">
-    <displayItem lang="en" name="name">greenstone mgpp demo
-    </displayItem>
-    <displayItem lang="en" name="description">This is a 
-      demonstration collection for the Greenstone digital 
-      library software. It contains a small subset (11 books) 
-      of the Humanity Development Library. It is built with 
-      mgpp.</displayItem>
-    <displayItem lang="en" name="icon">mgppdemo.gif</displayItem>
-    <serviceList>
-      <service name="DocumentStructureRetrieve" type="retrieve" />
-      <service name="DocumentMetadataRetrieve" type="retrieve" />
-      <service name="DocumentContentRetrieve" type="retrieve" />
-      <service name="ClassifierBrowse" type="browse" />
-      <service name="ClassifierBrowseMetadataRetrieve" 
-            type="retrieve" />
-      <service name="TextQuery" type="query" />
-      <service name="FieldQuery" type="query" />
-      <service name="AdvancedFieldQuery" type="query" />
-      <service name="PhindApplet" type="applet" />
-    </serviceList>
-    <metadataList>
-      <metadata name="creator">greenstone@cs.waikato.ac.nz</metadata>
-      <metadata name="maintainer">greenstone@cs.waikato.ac.nz</metadata>
-      <metadata name="numDocs">11</metadata>  
-      <metadata name="buildType">mgpp</metadata>
-      <metadata name="httpPath">http://kanuka:8090/gsdl3/sites/
-                                localsite/collect/mgppdemo</metadata>
-    </metadataList>
-  </collection>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-This collection provides many typical services...
-
-The subset parameter can also be used in a describe request to a collection, to retrieve just the \gst{metadataList} or \gst{serviceList}.
-
-A \gst{describe} request sent to a service returns a list of parameters that
-the service accepts, some display information, (and in future may describe the content type for the request and response).
-
-Parameters have the following format:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<param name='xxx' type='integer|boolean|string' default='yyy'/>
-<param name='xxx' type='enum_single|enum_multi' default='aa'/>
-  <option name='aa'/><option name='bb'/>...
-</param>
-<param name='xxx' type='multi' occurs='4'>
- <param .../>
- <param .../>
-</param>
-\end{verbatim}\end{gsc}\end{quote}
-
-If no default is specified, the parameter is assumed to be mandatory.
-Here are some examples of parameters:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<param name='case' type='boolean' default='0'/>
-
-<param name='maxDocs' type='integer' default='50'/>
-
-<param name='index' type='enum' default='dtx'>
-  <option name='dtx'/>
-  <option name='stt'/>
-  <option name='stx'/>
-<param>
-
-<!-- this one is for the text box and field list for the 
-simple field query-->
-<param name='simpleField' type='multi' occurs='4'>
-  <param name='fqv' type='string'/>
-  <param name='fqf' type='enum_single'>
-    <option name='TI'/><option name='AU'/><option name='OR'/>
-  </param>
-</param>
-
-\end{verbatim}\end{gsc}\end{quote}
-The 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.
-A 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.
-Parameters 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.
-
-A service description also contains some display information---this includes the name of the service, and the text  for the submit button. 
-
-Here 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. 
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="mgppdemo/FieldQuery" type="describe" />
-
-<response from="mgppdemo/FieldQuery" type="describe">
-  <service name="FieldQuery" type="query">
-    <displayItem name="name">Form Query</displayItem>
-    <displayItem name="submit">Search</displayItem>
-    <paramList>
-      <param default="Document" name="level" type="enum_single">
-        <displayItem name="name">Granularity to search at</displayItem>
-        <option name="Document">
-          <displayItem name="name">Document</displayItem>
-        </option>
-        <option name="Section">
-          <displayItem name="name">Section</displayItem>
-        </option>
-      </param>
-      <param default="1" name="case" type="boolean">
-        <displayItem name="name">Turn casefolding </displayItem>
-        <option name="0">
-          <displayItem name="name">off</displayItem>
-        </option>
-        <option name="1">
-          <displayItem name="name">on</displayItem>
-        </option>
-      </param>
-      <param default="1" name="stem" type="boolean">
-        <displayItem name="name">Turn stemming </displayItem>
-        <option name="0">
-          <displayItem name="name">off</displayItem>
-        </option>
-        <option name="1">
-          <displayItem name="name">on</displayItem>
-        </option>
-      </param>
-      <param default="10" name="maxDocs" type="integer">
-        <displayItem name="name">Maximum documents to return
-        </displayItem>
-      </param>
-      <param name="simpleField" occurs="4" type="multi">
-        <displayItem name="name"></displayItem>
-        <param name="fqv" type="string">
-          <displayItem name="name">Word or phrase </displayItem>
-        </param>
-        <param default="ZZ" name="fqf" type="enum_single">
-          <displayItem name="name">in field</displayItem>
-          <option name="ZZ">
-            <displayItem name="name">All fields</displayItem>
-          </option>	  
-          <option name="TX">
-            <displayItem name="name">TextOnly</displayItem>
-          </option>
-          <option name="SU">
-            <displayItem name="name">Subject</displayItem>
-          </option>
-          <option name="TI">
-            <displayItem name="name">Title</displayItem>
-          </option>
-        </param>
-      </param>
-    </paramList>
-  </service>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-\begin{figure}[t]
-  \centering
-  \includegraphics[width=3.5in]{query2.ps}
-  \caption{The previous query service describe response as displayed on the search page.}
-  \label{fig:query-display}
-\end{figure}
-
-A describe request to an applet type service returns the applet html element: this will be embedded into a web page to run the applet. 
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request type='describe' to='mgppdemo/PhindApplet'/>
-
-<response type='describe'>
-  <service name='PhindApplet' type='query'>
-    <applet ARCHIVE='phind.jar, xercesImpl.jar, gsdl3.jar, 
-			jaxp.jar, xml-apis.jar'
-            CODE='org.greenstone.applet.phind.Phind.class'
-            CODEBASE='lib/java'
-            HEIGHT='400' WIDTH='500'>
-      <PARAM NAME='library' VALUE=''/>
-      <PARAM NAME='phindcgi' VALUE='?a=a&amp;sa=r&amp;sn=Phind'/>
-      <PARAM NAME='collection' VALUE='mgppdemo' />
-      <PARAM NAME='classifier' VALUE='1' />
-      <PARAM NAME='orientation' VALUE='vertical' />
-      <PARAM NAME='depth' VALUE='2' />
-      <PARAM NAME='resultorder' VALUE='L,l,E,e,D,d' />
-      <PARAM NAME='backdrop' VALUE='interfaces/default/>
-				      images/phindbg1.jpg'/>
-      <PARAM NAME='fontsize' VALUE='10' />
-      <PARAM NAME='blocksize' VALUE='10' />
-      The Phind java applet.
-    </applet>
-    <displayItem name="name">Browse phrase hierarchies</displayItem>
-  </service>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-Note 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.
-
-\subsection{'system'-type messages}\label{sec:system}
-
-``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}).
-
-The basic format of a system request is as follows:
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request type='system' to=''>
-  <system .../>
-</request>
-\end{verbatim}\end{gsc}\end{quote}
-
-One or more actual requests are specified in  system elements. The following are examples:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<system type='configure' subset=''/>
-<system type='configure' subset='collectionList'/>
-<system type='activate' moduleType='collection' moduleName='demo'/>
-<system type='deactivate' moduleType='site' moduleName='site1'/>
-\end{verbatim}\end{gsc}\end{quote}
-
-The 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.
-The 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.
-
-
-A response just contains a status message, for example:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<response from="">
-  <status>collectionList reconfigured successfully</status>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-At some stage, an error or status code should be included.
-
-System requests are mainly answered by the MessageRouter. However, Collections and ServiceClusters will respond to a subset of these requests. 
-
-\subsection{'process'-type messages} 
-
-The 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.
-
-  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.
-
-The basic structure of a service 'process' request is as follows:
-\begin{quote}\begin{gsc}\begin{verbatim}
-
-<request lang='en'  type='process' to='demo/TextQuery'>
-  <paramList/>
-  other elements...
-</request>
-
-\end{verbatim}\end{gsc}\end{quote}
-
-The parameters are name-value pairs corresponding to parameters that were specified in the service description sent in response to a describe request. 
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<param name='case' value='1'/>
-<param name='maxDocs' value='34'/>
-<param name='index' value='dtx'/>
-\end{verbatim}\end{gsc}\end{quote}
-
-Some 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. 
-
-Responses vary depending on the type of request. The following sections look at hte process type requests and responses for each type of service.
-
-\subsubsection{'query'-type services}
-Responses 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.}
-
-The following shows an example query request and its response.
-
-Find at most 10 Sections in the mgppdemo collection, containing the word snail (stemmed), returning the results in ranked order:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang='en'  to="mgppdemo/TextQuery" type="process">
-  <paramList>
-    <param name="maxDocs" value="10"/>
-    <param name="queryLevel" value="Section"/>
-    <param name="stem" value="1"/>
-    <param name="matchMode" value="some"/>
-    <param name="sortBy" value="1"/>
-    <param name="index" value="t0"/>
-    <param name="case" value="0"/>
-    <param name="query" value="snail"/>
-  </paramList>
-</request>
-
-<response from="mgppdemo/TextQuery" type="process">
-  <metadataList>
-    <metadata name="numDocsMatched" value="59" />
-  </metadataList>
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" 
-	docType='hierarchy' nodeType="leaf" />
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12" 
-	docType='hierarchy' nodeType="leaf" />
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.1" 
-	docType='hierarchy' nodeType="interior" />
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.2.2" 
-	docType='hierarchy' nodeType="leaf" />
-    ...
-  </documentNodeList>
-  <termList>
-    <term field="" freq="454" name="snail" numDocsMatch="58" stem="3">
-      <equivTermList>
-        <term freq="" name="Snail" numDocsMatch="" />
-        <term freq="" name="snail" numDocsMatch="" />
-        <term freq="" name="Snails" numDocsMatch="" />
-        <term freq="" name="snails" numDocsMatch="" />
-      </equivTermList>
-    </term>
-  </termList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-The 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 whather a section is the root of the document, an internal section, or a leaf.
-
-The term list identifies, for each term in teh 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).
-
-\subsubsection{'browse'-type services}
-
-Browse 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.
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="mgppdemo/ClassifierBrowse" type="process">
-  <paramList>
-    <param name="structure" value="ancestors" />
-    <param name="structure" value="children" />
-  </paramList>
-  <classifierNodeList>
-    <classifierNode nodeID="CL1.2" />
-  </classifierNodeList>
-</request>
-
-<response from="mgppdemo/ClassifierBrowse" type="process">
-  <classifierNodeList>
-    <classifierNode nodeID="CL1">
-      <nodeStructure>
-	<classifierNode nodeID="CL1">
-          <classifierNode nodeID="CL1.2">
-	    <classifierNode nodeID="CL1.2.1" />
-	    <classifierNode nodeID="CL1.2.2" />
-	    <classifierNode nodeID="CL1.2.3" />
-	    <classifierNode nodeID="CL1.2.4" />
-	    <classifierNode nodeID="CL1.2.5" />
-          </classifierNode>	
-	</classifierNode>
-      </nodeStructure>
-    </classifierNode>
-  </classifierNodeList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-Possible 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. 
-
-
-\subsubsection{'retrieve'-type services}
-
-Retrieval services are special in that requests are not explicilty 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.
-
-Some example requests and responses follow.
-
-Give me the Title metadata for these documents:
-\begin{quote}\begin{gsc}\begin{verbatim}
-
-<request lang="en" to="mgppdemo/DocumentMetadataRetrieve" type="process">
-  <paramList>
-    <param name="metadata" value="Title" />
-  </paramList>
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2"/>
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12"/>
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.1"/>
-    ...
-  </documentNodeList>
-</request>
-
-<response from="mgppdemo/DocumentMetadataRetrieve" type="process">
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
-      <metadataList>
-        <metadata name="Title">Putting snails in your second pen</metadata>
-      </metadataList>
-    </documentNode>
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.2.12">
-      <metadataList>
-        <metadata name="Title">Now you must decide</metadata>
-      </metadataList>
-    </documentNode>
-    <documentNode nodeID="HASH010f073f22033181e206d3b7.1">
-      <metadataList>
-        <metadata name="Title">Introduction</metadata>
-      </metadataList>
-    </documentNode>
-  </documentNodeList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-One 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.
-
-Any 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).
-
-Give me the text (content) of this document:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="mgppdemo/DocumentContentRetrieve" type="process">
-  <paramList />
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" />
-  </documentNodeList>
-</request>
-
-<response from="mgppdemo/DocumentContentRetrieve" type="process">
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
-      <nodeContent>&lt;Section&gt; 
-       &lt;/B&gt;&lt;P ALIGN=&quot;JUSTIFY&quot;&gt;&lt;/P&gt;
-       &lt;P ALIGN=&quot;JUSTIFY&quot;&gt;190. When the plants in 
-       your second pen have grown big enough to provide food and 
-       shelter, you can put in the snails.&lt;/P&gt;
-      </nodeContent>
-    </documentNode>
-  </documentNodeList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-The content of a node is returned in a \gst{<nodeContent>} element. In this case it is escaped HTML.
-
-Give me the ancestors and children of the specified node, along with the number of siblings it has:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="mgppdemo/DocumentStructureRetrieve" type="process">
-  <paramList>
-    <param name="structure" value="ancestors" />
-    <param name="structure" value="children" />
-    <param name="info" value="numSiblings" />
-  </paramList>
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" />
-  </documentNodeList>
-</request>
-
-<response from="mgppdemo/DocumentStructureRetrieve" type="process">
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2">
-      <nodeStructureInfo>
-        <info name="numSiblings" value="2" />
-      </nodeStructureInfo>
-      <nodeStructure>
-        <documentNode nodeID="HASHac0a04dd14571c60d7fbfd" 
-                docType='hierarchy' nodeType="root">
-          <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4" 
-                  docType='hierarchy' nodeType="interior">
-            <documentNode nodeID="HASHac0a04dd14571c60d7fbfd.4.2" 
-                   docType='hierarchy' nodeType="leaf" />
-          </documentNode>
-        </documentNode>
-      </nodeStructure>
-    </documentNode>
-  </documentNodeList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-Structure is returned inside a \gst{<nodeStructure>} element, while structural info is returned in a \gst{<nodeStructureInfo>} element. Possible values for strcuture 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}. 
-
-\subsubsection{'process'-type services}\label{sec:process}
-Requests 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. 
-
-Process 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.
-
-Here 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:
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang='en'  type='process' to='build/NewCollection'>
-  <paramList>
-    <param name='creator' value='me@home.com'/>
-    <param name='collName' value='the demo collection'/>
-    <param name='collShortName' value='demo'/>
-  </paramlist>
-</request>
-
-<request lang='en'  type='process' to='build/ImportCollection'>
-  <paramList>
-    <param name='collection' value='demo'/>
-  </paramlist>
-</request>
-
-<response from="build/ImportCollection">
-  <status code="2" pid="2">Starting process...</status>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-The \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 teh status element is (currenlty) 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.
-
-\subsubsection{'applet'-type services}
-
-Applet-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 tehe applet. The format of this is entirely specific to the applet---there is no set format to the applet data.
-
-Here is an example request and response, used by the Phind applet:
-\begin{quote}\begin{gsc}\begin{verbatim}
-  <request type='query' to='mgppdemo/PhindApplet'>
-    <paramList>
-      <param name='pc' value='1'/>
-      <param name='pptext' value='health'/>
-      <param name='pfe' value='0'/>
-      <param name='ple' value='10'/>
-      <param name='pfd' value='0'/>
-      <param name='pld' value='10'/>
-      <param name='pfl' value='0'/>
-      <param name='pll' value='10'/>
-    </paramList>
-  </request>
-
-  <response type='query' from='mgppdemo/PhindApplet'>
-    <appletData>
-      <phindData df='9' ef='46' id='933' lf='15' tf='296'>
-        <expansionList end='10' length='46' start='0'>
-          <expansion df='4' id='8880' num='0' tf='59'>
-            <suffix> CARE</suffix>
-          </expansion>
-          ...
-        </expansionList>
-        <documentList end='10' length='9' start='0'>
-          <document freq='78' hash='HASH4632a8a51d33c47a75c559' num='0'>
-            <title>The Courier - N??159 - Sept- Oct 1996 Dossier Investing 
-                   in People Country Reports: Mali ; Western Samoa
-            </title>
-          </document>
-          ...
-        </documentList>
-        <thesaurusList end='10' length='15' start='0'>
-          <thesaurus df='7' id='12387' tf='15' type='RT'>
-            <phrase>PUBLIC HEALTH</phrase>
-          </thesaurus>...
-        </thesaurusList>
-      </phindData>
-    </appletData>
-  </response>
-
-\end{verbatim}\end{gsc}\end{quote}
-
-\subsubsection{'enrich'-type services}
-
-Enrich 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.
-*** TODO ****
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="GatePOSTag" type="process">
-  <paramList>
-    <param name="annotationType" value="Date,Location" />
-  </paramList>
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd">
-      <nodeContent>
-        FOOD AND AGRICULTURE ORGANIZATION OF THE UNITED NATIONS
-        Rome 1986
-        P-69
-        ISBN 92-5-102397-2
-        FAO 1986
-      </nodeContent>
-    </documentNode>
-  </documentNodeList>
-</request>
-
-<response from="GatePOSTag" type="process">
-  <documentNodeList>
-    <documentNode nodeID="HASHac0a04dd14571c60d7fbfd">
-      <nodeContent>
-	FOOD AND AGRICULTURE ORGANIZATION OF THE UNITED NATIONS
-	<annotation type="Location">Rome</annotation> 
-          <annotation type="Date">1986</annotation>
-        P-69
-        ISBN 92-5-102397-2
-        FAO <annotation type="Date">1986</annotation>
-      </nodeContent>
-    </documentNode>
-  </documentNodeList>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-\subsection{'status'-type messages}\label{sec:status}
-
-These 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}.
-
-\begin{table}
-\caption{Status codes currently used in Greenstone 3}
-\label{tab:status codes}
-\begin{tabular}{llp{8cm}}
-\bf code name & \bf code  & \bf meaning \\
-& \bf value & \\
-SUCCESS &  1 & the request was accepted, and the process was  completed \\
-ACCEPTED & 2 & the request was accepted, and the process has been started, but it is not completed yet \\
-ERROR & 3 & there was an error and the process was stopped \\
-CONTINUING & 10 & the process is still continuing \\
-COMPLETED & 11 & the process has  finished \\
-HALTED & 12 & the process has stopped  \\
-INFO & 20 & just an info message that doesnt imply anything \\
-\end{tabular}
-\end{table}
-
- 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.
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="build/ImportCollection" type="status">
-  <paramList>
-    <param name="pid" value="2" />
-  </paramList>
-</request>
-
-<response from="build/ImportCollection">
-  <status code="2" pid="2">Collection construction: import collection.
-command = import.pl -collectdir /research/kjdon/home/gsdl3/web/sites/
-    localsite/collect test1
-starting
-  </status>
-</response>
-
-<response from="build/ImportCollection">
-  <status code="11" pid="2">RecPlug: getting directory 
-/research/kjdon/home/gsdl3/web/sites/localsite/collect/test1/import
-WARNING - no plugin could process /.keepme
- 
-*********************************************
-Import Complete
-*********************************************
-* 1 document was considered for processing
-* 0 were processed and included in the collection
-* 1 was rejected. See /research/kjdon/home/gsdl3/web/sites/
-    localsite/collect/test1/etc/fail.log for a list of rejected documents
-Success
-  </status>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-\subsection{'format'-type messages}\label{sec:format}
-
-Collection 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:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<request lang="en" to="mgppdemo/FieldQuery" type="format" />
-
-<response from="mgppdemo/FieldQuery" type="format">
-  <format>
-    <gsf:template match="documentNode"><td><gsf:link>
-      <gsf:metadata name="Title" />(<gsf:metadata name="Source" />)
-      </gsf:link></td>
-    </gsf:template>
-  </format>
-</response>
-\end{verbatim}\end{gsc}\end{quote}
-
-The actual format statements are described further in Section~\ref{sec:colldesign}. 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. 
-GSF 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.
-
-\section{Page generation}\label{sec:pagegen} **** REDO ********
-
-* talk general first: get data, get format info, transform gsf->xsl. transfrom xml->html
-
-URL-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}, 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. 
-System requests are received by the MessageRouter, which answers them one by one, either itself or by passing them on to the appropriate module. 
-
-Once 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.
-
-The basic  page format  is:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<page>
-  <pageExtra>
-    <config/>
-    <display/>
-  </pageExtra>
-  <pageRequest/>
-  <pageResponse/>
-</page>
-\end{verbatim}\end{gsc}\end{quote}
-
-* show config and describe whats its used for
-
-There are four main elements in the page: config, translate, request, response. The request 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.\footnote{this should be saved instead in some sort of state saving - if you leave a page and go back you want your parameters to be the same as well}. The response 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 (eg 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.
-
-The following subsections outline, for each action, what data is needed and what requests are generated to send to the system. 
-
-
-Once 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
-located in interfaces/default/transforms. Collections, sites and other interfaces
-can override these files by having their own copy of the appropriate
-files. 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
-interface, default interface.\footnote{this currently breaks down for remote sites - need to rethink it a bit.}
-***TODO*** describe a bit more?? currently only can get this locally
-
-\subsection{Receptionists}\label{sec:recepts}
-
-The 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.
-
-There 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.
-
-Receptionist: 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 dont do anything.
-
-TransformingReceptionist: This extends Receptionist, and overwrites postProcessPage to transform the page using xslt. An xslt is listed for each action in the receptionists config file, and this is used to transform the page. First, some display information, and config information is added to the page. Then it is transformed using the specified xslt for the action, and returned.
-
-WebReceptionist: The WebReceptionist extends TransformingREceptionist. It doesn't do much else except some argument conversion. To keep the url's short, parameters from the services are given shortnames, and these are used in the web pages. 
-
-DefaultReceptionist: 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 teh collection to get this, and appends it to teh page before transformation using xslt.
-
-NZDLReceptionist: (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 teh ClassifierBrowse service. 
-
-By 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.
-
-\subsection{cgi args}
-
-THe args 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 args. GSParams class specifies all teh general basic args, 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
-
-services may be created by different people, may be on a different site. cant garantee no conflict with action params, or even with other services.
-so service params are namespaced when they are put on the page. interface (recept and action) params wil have no namespace) the default namespace is s1 (service1) - any params that are for the service will be prefixed by this. eg the case param for a search will be put in the page as s1.case.
-THe actions must now look for all the s1 params to send to teh service.
-
-if 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 param (service) will end up with a list eg s=TextQuery,MusicQuery, and the order of these determines the mapping order of teh namespaces, ie s1 will be TExtQuery, s2 MusicQuery.
-
-also talk abotu saving args - save ones that GSParams says to save, and any service ones should always save.
-\subsection{Internationalization}
-
-Internationalization is a big part of Greenstone3. Language specific text strings are separated out from the rest of the system to allow for easy incorporation of new languages.
-
-Language specific text strings are specified in resource bundle property files. These live in resources/java.
-
-There is a properties file per class, and one per interface. At the moment, we have
-
-GS2MGPPSearch.properties
-GS2MGPPRetrieve.properties etc - the service classes
-
-interface\_default.properties. - for the default interface
-
-To add other languages, create eg GS2MGPPSearch\_fr.properties.
-
-The interface ones are treated differently from the other ones. The action doesn't know which text strings are needed by a particular transform, so it gets them all out of the properties file, and puts them into an xml \gst{<display>} element - the xslt can get the ones it needs from there.
-xslt could perhaps get the stuff from the properties bundle on the fly using java extension elements - would this be better? but we dont want to re-load teh properties file every time a new text string is needed.
-
-All other class specific text strings are just retrieved one by one as they are needed and added into the xml - for example, the names for query params are retrieved when the service description is created.
-
-* for each page type, show a typical request (cgi or xml??) and a sample response
-
-\subsection{Page action}
-* kind of info pages. other actions are associated with specific services.
-* uses describe requests to modules
-Depending 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
-transformed 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
-and a list of services, and the result is transformed using \gst{about.xsl}.
-
-
-\subsection{Query action}
-
-THe basic url is \gst{a=q\&s=TextQuery\&c=demo\&rt=d/r}.
-There are three query services which have been implemented: TextQuery, FieldQuery, and AdvancedFieldQuery. These are all handled in the same way by query action.
-For 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
-displayed, 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
-is returned. A followup query is sent to the MetadataRetrieve service of the collection: the content includes the list of
-documents, with a request for some of their metadata. Which metadata to retrieve is determined by looking through the xslt that wil be used to transform the page (Formatter object??). The service description and query result are combined into a page of xml, which is
-transformed using \gst{basicquery.xsl} to produce the html page.
-
-\subsection{Applet action}
-
-There are two types of request to the applet action: \gst{a=a \& rt=d\/} and
-\gst{a=a \& rt=r\/}.  The value \gst{rt=d\/} means ``display the applet.'' A
-\gst{describe} request is sent to the service, which returns the \gst{<applet>} HTML element.  The transformation file \gst{applet.xsl} embeds this
-into the page, and the servlet returns the HTML.
-
-The value \gst{rt=r} signals a request from the applet.  The result is returned
-directly to the applet code, in XML.  The other parameters are sent to the
-service untransformed, and the result is passed directly back to the applet.
-Applet action can therefore work with any applet whose service understands the
-messages.
-
-Here are two examples of requests generated by the Applet action, along with their corresponding responses.
-
-The first request corresponds to the URL arguments \gst{a=a \&
-rt=d \& sn=Phind \& c=mgppdemo\/}, which translate to ``display the Phind
-applet for the mgppdemo collection''.
-
-
-The 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 
-indicates a request to the service itself. The extra arguments (not a, sa, sn, c)  are simply copied into the
-request as parameters. The response is in a form suitable for the applet, placed inside
-\gst{<appletData>} in a standard Greenstone message.  AppletAction returns the
-contents of appletData to the browser, i.e. to the applet itself.
-
-
-Note that the applet HTML may need to know the name of the \gst{library}
-program.  However, that name is chosen by the person who installed the software
-and will not necessarily be ``library''.  To get around this, the applet can
-put a parameter called ``library'' into the applet data with a null value:
-\begin{quote}\begin{gsc}\begin{verbatim}
-<PARAM NAME='library' VALUE=''/>
-\end{verbatim}\end{gsc}\end{quote}
-When the Applet action encounters this parameter it inserts the name of the
-current library servlet as its value.
-
-\subsection{Document action}
-
-DocumentAction 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
-table of contents would be needed to make the display nicer.
-
-
-\subsection{System action}\label{sec:system-action}
-
-SystemAction 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.
-
-\begin{table}
-\caption{Configure cgi arguments}
-\label{tab:system-cgi}
-\begin{tabular}{ll}
-\hline
-\bf arg & \bf description\\
-a=s & system action\\
-sa=c$|$a$|$d & type of system request: c (configure), a (add/activate), \\
-& d (delete/deactivate) \\
-c=demo &  the request will go to this collection/servicecluster \\
-& instead of the message router\\
-ss=collectionList & subset for configure: only reconfigure this part.\\
-&  For the MessageRouter,  can be serviceClusterList, serviceList, \\
-& collectionList, siteList.\\
-&  For a collection/cluster, can be metadataList or serviceList.\\
-sn=demo & \\
-st=collection& \\
-\hline
-\end{tabular}
-\end{table}
-
-
-\section{Collection formation}
-
-So far, only Greenstone2 style building is available. This uses the import.pl and buildcol.pl perl scripts from Greenstone2. These scripts and their needed perl modules have not been added to the Greenstone3 system, so to do building, you need to have Greenstone2 installed, and GSDLHOME, and GSDLOS set. (can do this by running 'source setup.bash' in the top level directory of gsdl.
-
-There are three ways of getting collections into Greenstone3. 
-
-\subsection{Importing gs2 collections}
-
-Collections built in a Greenstone2 system can be used in Greenstone3. Just copy across the collection's directory into the appropriate collect directory, and run \gst{convert\_coll\_from\_gs2.pl}. You need to specify the collect directory and the collection name. Eg.
-
-\gst{convert\_coll\_from\_gs2.pl -collectdir /research/kjdon/gsdl3/web/\-sites/\-localsite/collect demo}
-
-This creates the appropriate Greenstone3 XML configuration files. If you restart Tomcat, or give an add command (\gst{a=s\&sa=a\&st=collection\&sn=demo}), you should be able to see your new collection. You may need to edit some of the format stuff by hand.
-
-
-\subsection{Building new collections through the web interface}
-
-Collection construction can be done through the web, using the build ServiceCluster in localsite. Just sequence through the steps needed. There is no automatic sequence taking you to the next page, you have to go back to the build 'about' page, and select the next service manually. So far, AddDocument does not work, so documents need to be manually added to the import directory. And there is no ConfigureCollection service yet, so if you want anything other than the default configuration, you need to edit the collect.cfg config file by hand.
-
-You need to carry out the following steps:
-
-\begin{quote}
-NewCollection\\
-- add docs to import directory\\
-- optionally edit collect.cfg 
-ImportCollection\\
-BuildCollection\\
-ActivateCollection\\
-\end{quote}
-
-Note, activate uses \gst{activate\_gs2\_style\_coll.pl} which is similar to \gst{convert\_coll\_from\_gs2.pl} but assumes that collectionConfig.xml already exists.
-
-\subsection{Command line building}
-
-
-Collection building can also be done on the command line:
-
-\begin{gsc}\begin{verbatim}
-ConstructCollection -site <site-path> 
-                    -mode new|import|build|activate 
-                    [options] <coll-name>
-\end{verbatim}\end{gsc}
-
-eg
-
-\begin{gsc}\begin{verbatim}
-ConstructCollection -site /research/kjdon/gsdl3/web/sites/localsite 
-                    -mode new 
-                    -creator kjdon@cs.waikato.ac.nz testcol
-\end{verbatim}\end{gsc}
-
-The options get passed to the underlying script, - there is no good help message yet.
-import and build use gs2 import.pl and buildcol.pl so you can specify any of their options if you like.
-The sequence of steps is the same as for building via the web interface: new, manually add documents to the import directory, and edit collect.cfg if needed, import, build, activate.
-
-Building stuff is in src/java/org/greenstone/gsdl3/build.
-CollectionConstructor is the base class for building control. GS2PerlConstructor is the implementation that uses Greenstone 2 Perl scripts. The building process sends events (ConstructionEvent) to any listeners (ConstructionListener) as important stages happen. You can add one or more listeners to the constructor which will get notified of events. The perl stuff just passes any messages on---should be more informative in  future.
-
-\subsection{Collection design}\label{sec:colldesign}
-
-Part 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.
-
-In 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. 
-
-Real XSL 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.
- 
-\begin{gsc}\begin{verbatim}
-<xsl:template match="documentNode" priority="2"
-     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-  <xsl:param name="collName"/>
-    <td><a href="{\$library_name}?a=d&amp;c={\$collName}&amp;
-           d={@nodeID}&amp;dt={@docType}"><xsl:value-of 
-           select="metadataList/metadata[@name='Keyword']"/></a>
-    </td>
-</xsl:template>
- \end{verbatim}\end{gsc}
- 
-To write this, the user would need to know that:
-\begin{bulletedlist}
-\item the variable \$library\_name exists,
-\item the collection name is passed in as a parameter called collName
-\item metadata for a document is found in a metadataList and that its form is \gst{<metadata name="Keyword">the value</metadata>}
-\item the arguments needed for the link to the document are a, sa, c, d and dt.
-\end{bulletedlist}
- 
-Since XSLT is written in XML, we can use XSLT to transform XML into XSLT. GSF uses a simple set of XML elements to represent the old (Greenstone2) format statement elements, and we use XSLT to transform it into a proper XSLT template.
- 
-\begin{tabular}{ll}
-\bf Greenstone 2        & \bf Greenstone 3 \\
-\gst{[Text]} & \gst{<gsf:text/>} \\
-\gst{[num]} & \gst{<gsf:num/>}\\
-\gst{[link][/link]} & \gst{<gsf:link></gsf:link>} or \\
-& \gst{<gsf:link type='document'></gsf:link>}\\
-\gst{[srclink][/srclink]} & \gst{<gsf:link type='source'></gsf:link>}\\
-\gst{[icon]} & \gst{<gsf:icon/>} or \\
-& \gst{<gsf:icon type='document'/>}\\
-\gst{[srcicon]} & \gst{<gsf:icon type='source'/>}\\
-\gst{[Title]} (metadata) & \gst{<gsf:metadata name='Title'/>} or \\
-& \gst{<gsf:metadata name='Title' select='current'/>}\\
-\gst{[parent:Title]} & \gst{<gsf:metadata name='Title' select='parent' />}\\
-\gst{[parent(All):Title]} & \gst{<gsf:metadata name='Title' select='ancestors'/>}\\
-\gst{[parent(Top):Title]} & \gst{<gsf:metadata name='Title' select='root' />}\\
-\gst{[parent(All': '):Title]} & \gst{<gsf:metadata name='Title' select='ancestors'}\\ 
-& \gst{separator=': ' />}\\
-\end{tabular}
- 
- Other select values for gsf:metadata are \gst{children} and \gst{descendents}. How you would actually use these is unclear.
- 
-The 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).
- 
-The template above is now represented as:
- 
-\begin{gsc}\begin{verbatim}
-<gsf:template match='documentNode'>
-  <td><gsf:link><gsf:metadata name='Keyword'/></gsf:link></td>
-</gsf:template>
-\end{verbatim}\end{gsc}
- 
-I am not sure how the \{If\} and \{Or\} stuff will go yet. Any ideas????
-\section{Greenstone Installation}
-
-This section describes the directory structure of the Greenstone source, and provides an installation guide to installing Greenstone from CVS.
-
-\subsection{Directory structure}
-Table~\ref{tab:dirs} shows the file hierarchy for Greenstone3.
-The first part  shows the common stuff which can be shared between
-Greenstone users---the src, libraries etc. Under linux, these will eventually be installed into appropriate system directories. The second part shows
-stuff used by one person/group---their sites and interface setup
-etc. There can be several sites/interfaces per installation.
-
-\begin{table}
-\caption{The Greenstone directory structure}
-\label{tab:dirs}
-\center{\footnotesize
-\begin{tabular}{l p{8cm}}
-\hline
-gsdl3 
-  & The main installation directory---gsdl3home can be changed to something more standard\\
-gsdl3/src 
-  & Source code lives here \\
-gsdl3/src/java/org/greenstone/gsdl3   
-  & Contains the top level classes that either have main programs, or are server/servlet classes\\
-gsdl3/src/java/org/greenstone/gsdl3/core 
-  & ModuleInterface, MessageRouter, Receptionist---the central classes that the others hang off\\
-gsdl3/src/java/org/greenstone/gsdl3/service 
-  & The various service modules---these things do the work\\
-gsdl3/src/java/org/greenstone/gsdl3/util
-  & Utility classes \\
-gsdl3/src/java/org/greenstone/gsdl3/collection 
-  & ServiceCluster and Collection classes\\
-gsdl3/src/java/org/greenstone/gsdl3/comms 
-  & Communicator classes, eg SOAP\\
-gsdl3/src/java/org/greenstone/gsdl3/build 
-  & stuff for collection building \\
-gsdl3/src/java/org/greenstone/gsdl3/action 
-  & Action classes used by the Receptionist---do the work of displaying the pages\\
-gsdl3/src/java/org/greenstone/gdbm 
-  & Java wrapper for gdbm---uses j-gdbm, a jni gdbm wrapper\\
-gsdl3/src/java/org/greenstone/testing
-  & Junit scaffolding for unit testing.\\
-gsdl3/src/java/org/greenstone/applet
- & where the code for applets goes \\
-gsdl3/src/java/org/greenstone/applet/phind
-  & the phind applet (phrase browsing) \\
-gsdl3/src/cpp/
-  & Place for any cpp source code---none yet \\
-gsdl3/packages 
-  & Imported packages from other systems eg mg, mgpp \\
-gsdl3/lib
-  & Shared library files\\
-gsdl3/lib/java
-  & Java jar files\\
-gsdl3/resources 
- & any resources that may be needed\\
-gsdl3/resources/java
- & properties files for java resource bundles - used to handle all the language specific text This directory is on the classpath, so any other Java resources can be placed here \\
-gsdl3/resources/soap
- & soap service description files \\
-gsdl3/bin
-  & executable stuff lives here\\
-gsdl3/bin/script
-  & some perl building scripts\\
-gsdl3/bin/linux
-  & linux executables for eg mgpp\\
-gsdl3/comms
-  & Put some stuff here for want of a better place---things to do with servers and communication. eg soap stuff, and tomcat servlet container\\
-gsdl3/docs
-  & Documentation :-)\\
-\hline
-gsdl3/web
-  & This is where the web site is defined. Any static html files can go here. This directory is the Tomcat root directory.\\
-gsdl3/web/WEB-INF
-  & The web.xml file lives here (servlet configuration information for tomcat)\\
-gsdl3/web/WEB-INF/classes
-  & Servlet classes go in here\\
-gsdl3/web/sites
-  & 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 (eg soap) to other sites\\
-gsdl3/web/sites/localsite 
-  & One site - the site configuration file lives here\\
-gsdl3/web/sites/localsite/collect 
-  & The collections directory \\
-gsdl3/web/sites/localsite/images 
-  & Site specific images \\
-gsdl3/web/sites/localsite/transforms 
-  & Site specific transforms \\
-gsdl3/web/interfaces
-  & Contains directories for different interfaces - an interface is defined by its images and xslt files \\
-gsdl3/web/interfaces/default
-  & The default interface\\
-gsdl3/web/interfaces/default/images
-  & The images for the default interface\\
-gsdl3/web/interfaces/default/transforms
-  & The XSLT files for the default interface\\
-\hline
-\end{tabular}}
-\end{table}
-
-\subsection{Installation guide}
-
-\newcommand{\gsdlhome}{\$GSDL3HOME}
-\newcommand{\gshome}{\$GSDLHOME}
-
-Currently, Greenstone3 is only available through CVS. The installation procedure has been semi-automated. Note, these instructions are for installation on linux. If you want to use Greenstone3 on Windows, download it using CVS, then follow the instructions in \gst{http://www.cs.waikato.ac.nz/\~mdewsnip/GSDL3Windows.html}.
-
-\subsubsection{Get the source}
-
-If you have a greenstone\_cvs account, you can use the following:
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-export CVS_RSH=ssh
-cvs -d :ext:@cvs.scms.waikato.ac.nz:/usr/local/global-cvs/
-                   gsdl-src co gsdl3
-\end{verbatim}\end{gsc}\end{quote}
-
-Otherwise, you can get it through anonymous access:
-
-\begin{quote}\begin{gsc}\begin{verbatim}
-cvs -d :pserver:cvs\_anon@cvs.scms.waikato.ac.nz:2402/usr/local/
-           global-cvs/gsdl-src co gsdl3
-\end{verbatim}\end{gsc}\end{quote}
-
-If you need it, the password for anonymous CVS access is \gst{anonymous}. Note that some versions of CVS have trouble accessing this repository. We are using version 1.11.1p1.
-
-\subsubsection{Compile and install Greenstone}\label{subsec:compile}
-
-An install.sh script has been constructed to compile and install Greenstone3. What you need to do is:
-
-\begin{quote}\begin{gsc}
-cd gsdl3\\
-source setup.bash\\
-install.bash\\
-source setup.bash\\
-\end{gsc}\end{quote}
-
-If you want to do Greenstone2 compatible building (currently the only type) you need to have Greenstone2 installed, \gst{source setup.bash} in the top level Greenstone2 directory, then re-\gst{source setup.bash} for Greenstone3. This is to set \gst{\gshome} for Tomcat.
-
-\noindent Note: \gst{source setup.bash} needs to be done once in any xterm window before doing a make or running Tomcat. setup.bash sets the environment variables \gst{CLASSPATH, PATH, JAVA\_HOME} etc.
-
-If you want to use SOAP to talk to remote sites, you also need to do the following:
-
-\begin{quote}\begin{gsc}
-install-soap.bash  
-\end{gsc}\end{quote}
-
-There is one java command that sometimes doesn't work under bash, so you may need to cut and paste it into the terminal to get it to work. See the output from the bash-script for details.
-
-To shutdown or startup Tomcat, the commands are:
-\begin{quote}\begin{gsc}
-\gsdlhome/comms/jakarta/tomcat/bin/shutdown.sh\\
-\gsdlhome/comms/jakarta/tomcat/bin/startup.sh\\
-\end{gsc}\end{quote}
-
-You don't want to run install.bash twice - it adds stuff into files.
-To update your installation, you can run update.bash - this updates your code form CVS, and remakes all the java stuff.
-
-
-\subsubsection{The sample sites}
-
-\noindent There are two Greenstone {\em sites} that come with the checkout: localsite, and soapsite. localsite has three collections, while soapsite has none. Each site has a configuration file which specifies the site name, site-wide services if any, and a list of remote sites to connect to.
-localsite does not connect to any other sites. soapsite specifies a SOAP connection to localsite.
-
-\subsubsection{Tomcat}\label{sec:tomcat}
-
-\noindent Tomcat is a servlet container. It is used to serve a Greenstone site using a servlet.
-
-The file \gst{\gsdlhome/web/WEB-INF/web.xml} contains the setup information for Tomcat---tells it what servlets to load, what initial parameters to pass them, and what web names map to the servlets.
-There are three servlets specified in web.xml: 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.
-
-The initialisation parameters used by the library servlets are as follows:
-
-\begin{tabular}{llp{5cm}}
-\bf name & \bf sample value & \bf description \\
-\hline
-gsdl3home & /research/kjdon/gsdl3 & the base directory of the gsdl3 installation \\
-sitename & localsite & the site to use \\
-interfacename & default & the interface to use\\
-libraryname & library & the name of the library program \\
-defaultlang & en & the default language for the interface\\
-receptionist & NZDLReceptionist & (optional) specifies an alternative Receptionist to use\\
-messagerouter & NewMessageRouter & (optional) specifies an alternative MessageRouter to use\\
-\hline
-\end{tabular}
-
-It is possible to run several servlets at once, with different combinations of sites and/or interfaces.
-
-The 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 \\
-\gst{localhost:8080/gsdl3/sites/localsite/collect/demo/images/}~.
-
-
-Tomcat runs by default on port 8080---this can be changed in server.xml. 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.
-
-
-
-\subsubsection{Serving your site using Tomcat}\label{subsec:runtomcat}
-
-\noindent To run Tomcat, you need to have sourced {\footnotesize \verb#setup.bash#} in \gsdlhome\  to set up {\footnotesize \$CLASSPATH} (see \ref{subsec:compile}). Then, 
-
-\begin{gsc}\begin{tt}
-\noindent cd \gsdlhome/comms/jakarta/tomcat/bin\\
-./startup.sh
-\end{tt}\end{gsc}
-
-\noindent ({\footnotesize \verb#./shutdown.sh#} shuts down Tomcat)
-\\
-\\
-\noindent The Tomcat server can be accessed on the web at \gst{http://localhost:8080}---this gets you to a welcome page.
-The Greenstone stuff is at \gst{http://localhost:8080/gsdl3}---this displays \gst{\gsdlhome/web/index.html}. You should be able to run the test servlet and both library servlets from this page.
-
-\noindent Note: Tomcat must be shutdown and restarted any time you make changes in the following for those changes to take effect:\\
-\begin{bulletedlist}
-\begin{gsc}
-\item \gsdlhome/web/WEB-INF/web.xml
-\item \gsdlhome/comms/jakarta/tomcat-tomcat-4.0.1/conf/server.xml
-\end{gsc}
-\item any classes or jar files used by the servlets
-\end{bulletedlist}
-\noindent Note: stdin and stdout for the servlets both go to\\
-\gst{\gsdlhome/comms/jakarta/tomcat/logs/catalina.out}
-
-On 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.
-
-Symlinks:
-
-Tomcat by default doesn't follow symlinks (although the symlink to lib seems to work). To make it follow symlinks, eg to have the collect directory of a site somewhere else, you need to add the following to tomcats server.xml \\
-(\$GSDL3HOME/comms/jakarta/tomcat/conf/server.xml):
-\gst{<Resources allowLinking='true'/>}
-This needs to go inside the gsdl3 context, i.e.
-
-\begin{quote}\begin{gsc}
-<Context path="/gsdl3" docBase="\$GSDL3HOME/web" debug="1" \\
-reloadable="true">\\
-   <Resources allowLinking='true'/>\\
-</Context>\\
-\end{gsc}\end{quote}
-By default, tomcat allows directory listings for everything in the docBase directory. For example, you can enter localhost:8080/gsdl3/sites and it will give you a list of all the sites. To turn this off, you need to edit Tomcat's default web.xml file (\$GSDL3HOME/comms/jakarta/tomcat/conf/web.xml):
-
-In the default servlet definition, change the 'listings' param to false.
-
-
-Running tomcat with apache.
-apache can be easily set up to proxy tomcat eg
-
-in the www.mysite.org
-\begin{quote}\begin{gsc}
-<VirtualHost a.b.c.d>\\
-ServerName www.mysite.org\\
-...\\
-ProxyPass /greenstone3 http://puka.cs.waikato.ac.nz:8080/gsdl3\\
-ProxyPassReverse /greenstone3 http://puka.cs.waikato.ac.nz:8080/gsdl3\\
-</VirtualHost>\\
-\end{gsc}\end{quote}
-can now access tomcat, instead of at puka.cs.waikato.ac.nz:8080/gsdl3, but at www.mysite.org/greenstone3
-
-if tomcat is running behind a proxy, and you want to access stuff like the infomine database where you need to make external connections, you need to fill in the proxy element in the siteConfig.xml file - unfortunately the password is added in plain text. but can make it so that only the server admin can see it.
-\subsubsection{Using SOAP to talk to a remote site}
-
-\noindent The previous installation stuff is fine if you only want to talk to local sites. However, if you want to connect using SOAP to a remote site, some more stuff needs to be done. soapsite specifies a SOAP connection to localsite. If you run soapsite without connecting to localsite, you don't get any collections. However, if you connect to localsite, you can see all of {\em its} collections.
-\\
-\\
-\noindent The SOAP server we use is actually run as a servlet in Tomcat. You need to set up SOAP, set up the SOAP server class which will be your SOAP web service, and then deploy that service.
-This is done by install-soap.bash.
-You can also deploy a service through the website.  If Tomcat is not running, start it up (see \ref{subsec:runtomcat}).
-
-\noindent The 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.
-
-\noindent To deploy the SOAPServer for localsite:
-
-\noindent Click on ``deploy'' and edit the following fields in the deploy form:
-
-\begin{tabular}{ll}
-ID: & org.greenstone.localsite\\
-Scope: (any will do) & Request---new instantiation for each request\\
-		&    Session---same instantiation across a session\\
-		&    Application---only uses one instantiation\\
-Methods: &process\\
-Java Provider / Provider Class: & org.greenstone.gsdl3.SOAPServer\\
-\end{tabular}
-
-\noindent Now 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.
-
-\noindent Information 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.
-
-\subsubsection{Debugging SOAP}
-
-If 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.
-To run it, type:
-
-\begin{quote}\gst{java org.apache.soap.util.net.TcpTunnelGui 8070 localhost 8080}
-\end{quote}
-
-8070 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}). 
-\begin{quote}\begin{gsc}\begin{verbatim}
-<site name="org.greenstone.localsite" 
-      address="http://localhost:8080/soap/servlet/rpcrouter" 
-      type="soap"/>
-\end{verbatim}\end{gsc}\end{quote}
-
-Note that \gst{http://localhost:8080/soap/servlet/rpcrouter} is the
-address for talking to the Tomcat SOAP servlet services.
-
-\section{Greenstone Customization}
-
-this is the dynamic stuff, immediate or through tomcat restart
-\subsection{How to define a new interface}
-
-Most of an interface is defined by XSLT files, which are stored in web/interfaces/interface-name/transform. A new interface needs a directory in web/interfaces. inside, needs images and transform directories. and interfaceConfig.xml file. Any xslt may be overridden for a new interface by putting the replacement in the new interface transform directory. If the appropriate xslt file is not there, the default one will be used - this enables just overriding a few xslt files as needed.
-xslt are looked for in order: collection, site, interface, default interface. This also applies to included xslts. (this doesn't work for colls/sites on remote computers. ). the xsl:include directives are preprocessed by the java code and full paths added based on availability of teh files, so that the correct one is used.
-you cannot include a template with teh same name as teh includer.
-\subsection{Adding a new language}
-
-Adding a new interface language to Greenstone 3 is easy. All of the language-dependent 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 (eg GS2Search.properties). To add another language these 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.
-
-Keys 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.
-\section{Greenstone Development}
-
-this is the customization that requires recompilation.
-Here are some random notes for developers who want to modify the source code.
-\subsection{Greenstone utility classes}
-
-These are found in \gst{gsdl3/src/java/org/greenstone/gsdl3/util} and provide a variety of useful functions. Table~\ref{tab:utils} gives a brief description of the various classes.
-
-\begin{table}
-\caption{The utility classes in org.greenstone.gsdl3.util}
-\label{tab:utils}
-\center{\footnotesize
-\begin{tabular}{lp{3.75in}}
-\hline
-\bf Utility class & \bf Description\\
-ConfigVars & holds the servlet startup variables, including library name, site name, interface name, default language\\
-Dictionary & wrapper around a ResourceBundle, providing strings with parameter\\
-GSCGI & class to map between short name cgi args and long name request parameters \\
-GSFile & class to create all Greenstone file paths eg used to locate configuration files, xslt files and collection data. \\
-GSHTML & provides convenience methods for dealing with HTML, eg making strings HTML safe\\
-GSPath & used to create, examine and modify message address paths\\
-GSStatus & some static codes for status messages\\ 
-GSXML & 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.\\
-GSXSLT & some manipulation functions for Greenstone XSLT\\
-Misc & miscellaneous functions\\
-OID & class to handle Greenstone (2) OIDs\\
-XMLConverter & provides methods to create new Documents, parse Strings or Files into Documents, and convert Nodes to Strings\\
-XMLTransformer & methods to transform XML using XSLT \\
-XSLTUtil & contains static methods to be called from within XSLT \\
-\hline
-\end{tabular}
-}
-\end{table}
-
-\subsection{Creating new services}
-
-*inherit from ServiceRack - abstract base class. this handles the main process method, determines hte 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.
-other request types (process) get sent to processXXX methods, where XXX is the service name.
-
-* what methods are expected
-
-*service type responses expected
-
-*a browse type service must also implement servicenameMetadataRetrieve service.
-
-* should a metadata retrieval service advertise what metadata is available??
-\subsection{creating new actions/pages}
-
-\subsection{Working with XML}
-
-We use the DOM model for handling XML. This involves Documents, Nodes, Elements etc. Node is the basic thing in the tree, all others inherit from this. A Document represents a whole document, and is a kind of container for all the nodes. Elements and Nodes are not supposed to exist outside of the context of a document, so you have to have a document to create them. The document is not the top level node in the tree, to get this, use Document.getDocumentElement(). If you create nodes etc but don't append them to something already in the document tree, they will be separate - but they still know who their owner document is.
-
-To create new Documents, and convert Strings or Files to Documents, use XMLConverter.
-eg:
-\begin{quote}\begin{gsc}
-XMLConverter converter = new XMLConverter();\\
-Document doc = converter.newDOM();\\
-
-File stylesheet = new File(``query.xsl'');\\
-Document style = converter.getDOM(stylesheet);\\
-
-String message = ``<message><request type='page'/></message>'';\\
-Document m = converter.getDOM(message);\\
-\end{gsc}\end{quote}
-
-To output a document as a String, use \gst{converter.getString(doc);}
-
-To add nodes and stuff to an empty document - create them, then append to the tree:
-\begin{quote}\begin{gsc}
-Document doc = converter.newDOM();\\
-Element e = doc.createElement(``message'');\\
-doc.appendChild(e);\\
-\end{gsc}\end{quote}
-
-Note that you can only append one node to a document---this will become the top level node. After that, you can append nodes to child nodes as you like, but a document is only allowed one top level node.
-
-Nodes can only be created by a Document. Document has creation methods for all types of Nodes, for example \gst{createElement(element\_name)}, \gst{createAttribute(attr\_name)},  \gst{createTextNode(text\_data)} etc.
-
-DOM006 Hierarchy request error: happens if you have more than one root node in your document
-
-\subsection{Greenstone XML}
-
-Greenstone format namespace: (at the moment)
-xmlns:gsf="http://www.greenstone.org/configformat"
-
-(xslt namespace: xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-no DTDs or Schema defined yet. Until there are, try and keep to the following rules:
-
-\begin{bulletedlist}
-
-\item always return expected elements even if empty, eg \gst{<paramList/>}.
-
-\item If you get the whole document it is called \gst{<document>}. However if you are returned a list of pointers to parts of the documents, they are \gst{<documentNode>}s.
-
-\item inside a list you can only have elements of the same name as the list. For example, a \gst{<paramList>} should only have \gst{<param>} elements inside it.
-
-\end{bulletedlist}
-\subsection{Working with XSLT}
-
-\begin{bulletedlist}
-\item {\em adding html to an xml doc:}
-
-eg I have a text node with html inside it inside a resource element
-to add that to a new XML doc, I use
-\gst{<xsl:value-of select='resource'>}
-
-if the output mode is xml or html, this will escape any special characters
-ie $<$ and $>$ etc
-
-use
-\gst{<xsl:value-of disable-output-escaping="yes" select='resource'>}
-instead.
-
-\item {\em including an xml doc into a stylesheet:}
-
-\gst{<xsl:variable name='import' select='document(``newdoc.xml'')'/>}
-
-then can use the info:
-
-\gst{<xsl:value-of select='\$import/element'/>}
-
-\item {\em selecting an ancestor:}
-
- the ancestor axis contains the parent of the context node, and its
- parent and so on. to pick one node among these:
- ancestor::elem-name. I dont know how this works if there are two
- nodes with the same name in the axis.
-
-\item {\em basic XSLT elements:}
-\begin{quote}\begin{footnotesize}\begin{verbatim}
-<xsl:template match='xxx' name='yyy'/>
-
-<xsl:apply-templates select='xxx'/>
-<xsl:call-templates name='yyy'/>
-
-<xsl:variable name='doc' select='document("layout.xml")'/>
-
-<xsl:value-of select='$doc/chapter1'/> $
-\end{verbatim}\end{footnotesize}\end{quote}
-
-\item {\em using namespaces:}
-If you are using the same namespace in more than one file, eg in the source xml and in the stylesheet, make sure that the URI for the xmlns:xxx thingy is the same in both cases---otherwise the names don't match. This includes http:// on the front.
-
-\item I don't think \gst{<xsl:with-param name='xxx' select='true'/>} is
-the same as \gst{<xsl:with-param name='xxx'>true</xsl:with-param>}.
-Use the second one.
-
-\item to select a node from a list based on an attribute value: for example
-\begin{quote}\begin{footnotesize}\begin{verbatim}
-<xsl:variable name='name'>CL1</xsl:variable>
-
-<xsl:value-of select="classifier[@name=\$name]/@content"/>
-\end{verbatim}\end{footnotesize}\end{quote}
-
-\item{\em using Java extension elements:}
-
-Declare the namespace for your java extensions using one of the following 
-three formats. 
-
-class format: \gst{xmlns:my-class="xalan://FQCN"} where FQCN is the fully qualified class name. Examples: \gst{xmlns:my-class="xalan://java.util.Hashtable"},  \gst{xmlns:my-class="xalan://mypackage.myclass"}
-
-package format: \gst{xmlns:my-class="xalan://PJPN"} where PJPN is a partial java package name. That is, it is the beginning of or the complete name of a java  package. Examples: \gst{xmlns:my-package="xalan://java.util"}, \gst{xmlns:my-package="xalan://mypackage"}
-
-Java format: \gst{xmlns:java="http://xml.apache.org/xalan/java"}
-
-Then, how you use the java classes and methods depends on which format you declared you namespace.
-
-class format:
-
-To create an instance of an object: \gst{prefix:new (args)}. Example: \gst{<xsl:variable name="myType" select="my-class:new()">}
-
-To invoke an instance method on a specified object: \gst{prefix:methodName (object, args)} where methodName is the name of the method to invoke on object with the args arguments. object must be an object of the class indicated by the namespace declaration. Example: \gst{<xsl:variable name="new-pop" select="my-class:valueOf(\$myType, string(@population))">}
-
-To invoke an instance method on a default object: \gst{prefix:methodName (args)}  where  methodName is the name of the method to invoke with the args arguments. If a matching method is found, a default instance of the class will be created if it does not already exist. Example: \gst{<xsl:variable name="new-pop" select="my-class:valueOf(string(@population))">}
-
-To invoke a static method: \gst{prefix:methodName (args)} where methodName is the name of the method to invoke with the args arguments. Example: \gst{<xsl:variable name="new-pop" select="my-class:printit(string(@population))">}
-
-package format:
-
-o create an instance of an object: 
-                   prefix:subpackage.class.new (args)
-
-                   where prefix is the extension namespace prefix, subpackage is the rest of the package name (the
-                   beginning of the package name was in the namespace declaration), and class is the name of the class.
-                   A new instance is to be created with the args constructor arguments (if any). All constructor methods
-                   are qualified for method selection. 
-                   Example: \gst{<xsl:variable name="myType" 
-                          select="my-package:extclass.new()">}
-
-                   To invoke an instance method on a specified instance: 
-                   prefix:methodName (object, args)
-
-                   where prefix is the extension namespace prefix and methodName is the name of the method to invoke
-                   on object with the args arguments. Only instance methods of the object with the name methodName
-                   are qualified methods. If a matching method is found, object will be used to identify the object instance
-                   and args will be passed to the invoked method. 
-                   Example: \gst{<xsl:variable name="new-pop"
-                        select="my-package:valueOf(\$myType, string(@population))">}
-
-                   To invoke a static method: 
-                   prefix:subpackage.class.methodName (args)
-
-                   where prefix is the extension namespace prefix, subpackage is the rest of the package name (the
-                   beginning of the package name was in the namespace declaration), class is the name of the class, and
-                   methodName is the name of the method to invoke with the args arguments. Only static methods with
-                   the name methodName are qualified methods. If a matching method is found, args will be passed to the
-                   invoked static method. 
-                   Example: \gst{<xsl:variable name="new-pop"
-                        select="my-package:extclass.printit(string(@population))">}
-
-
-                       Unlike the class format namespace, there is no concept of a default object since the namespace
-                       declaration does not identify a unique class.
-
-java format:
-
-
-
-
-                   To create an instance of an object: 
-                   prefix:FQCN.new (args)
-
-                   where prefix is the extension namespace prefix for the Java namespace and FQCN is the fully qualified
-                   class name of the class whose constructor is to be called. A new instance is to be created with the
-                   args constructor arguments (if any). All constructor methods are qualified for method selection. 
-                   Example: \gst{<xsl:variable name="myHash" 
-                          select="java:java.util.Hashtable.new()">}
-
-                   To invoke an instance method on a specified instance: 
-                   prefix:methodName (object, args)
-
-                   where prefix is the extension namespace prefix and methodName is the name of the method to invoke
-                   on object with the args arguments. Only instance methods of the object with the name methodName
-                   are qualified methods. If a matching method is found, object will be used to identify the object instance
-                   and args will be passed to the invoked method. 
-                   Example: \gst{<xsl:variable name="new-pop"
-                        select="java:put(\$myHash, string(@region), \$newpop)">}
-
-                   To invoke a static method: 
-                   prefix:FQCN.methodName (args)
-
-                   where prefix is the extension namespace prefix, FQCN is the fully qualified class name of the class
-                   whose static method is to be called, and methodName is the name of the method to invoke with the
-                   args arguments. Only static methods with the name methodName are qualified methods. If a matching
-                   method is found, args will be passed to the invoked static method. 
-                   Example: \gst{<xsl:variable name="new-pop"
-                        select="java:java.lang.Integer.valueOf(string(@population))">}
-
-
-                       Unlike the class format namespace, there is no concept of a default object since the namespace
-                       declaration does not identify a unique class.
-
-
-
-
-
-
-
-\end{bulletedlist}
-\subsubsection{What can I do to speed up XSL transformations?}
-
-This information taken from the Xalan FAQS page.
-
-\begin{bulletedlist}
-
-\item Use a Templates object (with a different Transformers for each
-transformation) to perform multiple transformations with the same set
-of stylesheet instructions.
-
-\item Set up your stylesheets to function efficiently.
-
-\item Don't use "//" (descendant axes) patterns near the root of a
-large document.
-
-\item Use xsl:key elements and the key() function as an efficient way
-to retrieve node sets.
-
-\item Where possible, use pattern matching rather than xsl:if or
-xsl:when statements.
-
-\item xsl:for-each is fast because it does not require pattern matching.
-
-\item avoid recursion
-
-\item Keep in mind that xsl:sort prevents incremental processing.
-
-\item When you create variables,\\
-\gst{<xsl:variable name="fooElem" select="foo"/>} is usually faster
-than \\
-\gst{<xsl:variable name="fooElem"><xsl:value-of-select="foo"/></xsl:variable>}.
-
-\item Be careful using the last() function.
-
-\item The use of index predicates within match patterns can be expensive.
-
-\item Decoding and encoding is expensive.
-
-\item For the ultimate in server-side scalability, perform transform
-operations on the client. 
-
-\end{bulletedlist}
-
-\subsection{Java gdbm}
-
-To talk to gdbm, a jni wrapper called java-gdbm is used. It was
-obtained from:\\ \gst{http://aurora.rg.iupui.edu/~schadow/dbm-java/pip/gdbm/}
-
-It uses packing objects to convert to and from an array of bytes (in
-gdbm file) from and to java objects. In my GDBMWrapper class I use
-StringPacking - uses UTF-8 encoding. but some stuff came out funny. so
-I had to changes the from\_bytes method in StringPacking.java to use
-new String(raw, "UTF-8") instead of new String(raw). this seems to
-work.
-
-Note---if we use this gdbm stuff to create the file too, may need to
-alter the to-bytes method.
-
-The makefile in j-gdbm is crap---it tries to get stuff from its
-original CVS tree.  I have created a new Makefile---in my-j-gdbm
-directory.  this stuff needs to go into CVS probably.
-
-
-
-\subsection{Resources}
-
-This is a list of some useful resources that we have come across during development of gsdl3. 
-
-Contents for 'The Java Native Interface Programmer's Guide and
-Specification' on-line\\ 
-\gst{http://java.sun.com/docs/books/jni/html/jniTOC.html}
-
-Java Native Interface Specification\\
-\gst{http://java.sun.com/j2se/1.4/docs/guide/jni/spec/jniTOC.doc.html}
-
-JNI Documentation Contents\\
-\gst{http://java.sun.com/j2se/1.4/docs/guide/jni/index.html}
-
-another JNI page\\
-\gst{http://mindprod.com/jni.html}
-
-Java 1.4 API index\\
-\gst{http://java.sun.com/j2se/1.4/docs/api/index.html}
-
-Java tutorial index\\
-\gst{http://java.sun.com/docs/books/tutorial/index.html}
-
-Safari books online - has Java, XML, XSLT, etc books\\
-\gst{http://proquest.safaribooksonline.com/mainhom.asp?home}
-
-Java 1.4 i18n FAQ\\
-\gst{http://www.sun.com/developers/gadc/faq/java/java1.4.html}
-
-Java and XSLT page\\
-\gst{http://www.javaolympus.com/java/Java\%20and\%20XSLT.html}
-
-Xalan-Java overview\\
-\gst{http://xml.apache.org/xalan-j/overview.html}
-
-Tomcat documentation index\\
-\gst{http://jakarta.apache.org/tomcat/tomcat-4.0-doc/index.html}
-
-Servlet and JSP tutorial\\
-\gst{http://www.apl.jhu.edu/~hall/java/Servlet-Tutorial/}
-
-Core Servlets and JavaServer Pages, book by Marty Hall. download the
-pdf from here (try before you buy link)\\ 
-\gst{http://www.coreservlets.com/}
-
-J-gdbm page\\
-\gst{http://aurora.rg.iupui.edu/~schadow/dbm-java/pip/gdbm/}
-
-Stuarts page of links\\
-\gst{http://www.cs.waikato.ac.nz/~nzdl/gsdl3/}
-
-a good basic xslt tutorial\\
-\gst{http://www.zvon.org/xxl/XSLTutorial/Books/Output/contents.html}
-
-JAXP (java api for xml processing) package overview\\
-\gst{http://java.sun.com/xml/jaxp/dist/1.1/docs/api/overview-summary.html}
-
-DeveloperWorks, xml zone\\
-\gst{http://www-106.ibm.com/developerworks/xml/}
-
-xslt.com\\
-\gst{http://www.xslt.com/}
-
-jeni tennison's xslt pages\\
-\gst{http://www.jenitennison.com/xslt/}
-
-apaches xml tools\\
-\gst{http://xml.apache.org/}
-
-
-%\clearpage
-%\addcontentsline{toc}{chapter}{Bibliography}
-%\bibliography{main}
-
-\end{document}
-
-
-
