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

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

added some more info

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