[greenstone-devel] Re: About How to call functions in Greenstone3

From Anupama of Greenstone Team
DateFri May 30 14:41:40 2008
Subject [greenstone-devel] Re: About How to call functions in Greenstone3
In-Reply-To (483EEDCD-30803-cis-strath-ac-uk)
Hi Suthanya,

Before I continue I have to explain that
1. I have no practical experience with servlets.
2. I have no experience at all with NetBeans (under a year ago I learnt
to use Eclipse and I've stuck with it since then).

However, I think there is something else that might help you.

You wrote that:
> I develop it based on Greenstone 3. I think I will design my user
> interfaces by Java Servlet because greenstone 3 developed by Java and
> Java Servlet and I will call some functions from greenstone( eg. Search
> and retrieval functions) and display the results on my interfaces.

And:
> Could you give me some guide about How to call some functions from
> Greenstone3 please? I read the manual already.I am sorry i didn't have
> knowledge about this.

The GS3 Web Services Demo-Client application calls on Greenstone's
search and retrieval functions. It may serve as a starting point for you.
You can obtain the zipped files of the whole application including its
documentation from
http://trac.greenstone.org/browser/other-projects/trunk/gs3-webservices-democlient/dist
(or if you want the code from SVN, get it from
http://svn.greenstone.org/other-projects/trunk/gs3-webservices-democlient)

Documentation on how to use it is in its doc/HowToFiles folder, which I
will be referring to below.

In particular, you may find it helpful to look at the following 3
classes off
http://svn.greenstone.org/other-projects/trunk/gs3-webservices-democlient/:
- src/GS3DemoClient/org/greenstone/gs3services/QBRSOAPServer.java
-
src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3WebServicesQBRAPI.java
(-
src/GS3DemoClient/org/greenstone/gs3client/dlservices/GS3ServicesAPIA.java)

The first of these three, QBRSOAPServer.java is a class that has been
turned into web services for Greenstone 3. It makes GS3's Query, Browse
and Retrieve functionality available as web service operations.
If you want to access Greenstone's search and retrieve functionality
through QBRSOAPServer's web services, then reading the document
gs3-webservices-democlient/docs/HowToFiles/1GettingGS3WebServicesRunning.html
will tell you that you require an up-to-date Greenstone 3 from svn and
then will go through how to deploy the QBRSOAPServer web services.

Since you've already read the GS3 developer's manual, you might have
come across the concept of Message Passing in Chapter 3 (section 3.3):
request messages are sent to Greenstone 3's MessageRouter class and
Greenstone 3 sends response messages back. Request messages can be for
queries, classifiers, document and metadata retrieval and other operations.
Request and response messages are in XML format. The methods of web
service class QBRSOAPServer create the request messages from method
parameters. They will return whatever XML is returned from the
MessageRouter.

If you can, have a look at those 3 classes (QBRSOAPServer.java,
GS3WebServicesQBRAPI.java and GS3ServicesAPIA.java) to see how they call
upon GS3's search, browse and retrieve functions. And then maybe try
deploying the QBRSOAPServer on your GS3.
The GS3 demo client application makes use of the QBRSOAPServer web
services (see
gs3-webservices-democlient/docs/HowToFiles/0InstallDemoClientInBrief.html
on how to run the demo-client app). It goes through the GS3
QBRSOAPServer in order to make use of GS3's query, browse and retrieve
functions.

Perhaps you may want to use the QBRSOAPServer web services yourself or
just include it as (a basis for?) a regular class when your application
needs to use GS3's "QBR" (Query, Browse, Retrieve) stuff:

1. If you want to use the QBRSOAPServer web services, have a look at
that GS3WebServicesQBRAPI.java to see how it invokes the web services.
Alternatively, if you want to avoid dealing with "web services"
altogether, you can include GS3WebServicesQBRAPI.java (and
GS3ServicesAPIA.java) which will allow you to treat the web service
operations as regular methods. You call the methods of
GS3WebServicesQBRAPI.java (or GS3ServicesAPIA.java) and they will invoke
the corresponding web service operations for you.
If you go this route, make sure to include the jar files in
gs3-webservices-democlient/lib

2. If you want to include QBRSOAPServer as a regular class (or write a
similar class yourself), then
- to compile, it will need the following jar files from Greenstone's own
lib folder at greenstone3/web/WEB-INF/lib: gsdl3.jar, log4j-?.jar,
xercesImpl.jar, mail.jar, javagdbm.jar, mg.jar, mgpp.jar, lucene-?.jar
- to run, it needs the jar files javagdbm.jar, mg.jar, mgpp.jar and
LuceneWrapper.jar (all from greenstone3/web/WEB-INF/lib) and the
xml-apis.jar from greenstone3/web/WEB-INF/applet
AND to run you also need to set the Virtual Machine argument to:
Djava.library.path=/research/ak19/greenstone3/lib/jni

If you want to completely avoid dealing with XML messages--including the
response messages that QBRSOAPServer returns--you might find the classes
in the jar file QBRdata.jar helpful. This jar file is at at
http://trac.greenstone.org/browser/other-projects/trunk/gs3-webservices-democlient/lib
while the source code for its classes is at
http://trac.greenstone.org/browser/other-projects/trunk/gs3-webservices-democlient/src/GS3DemoClient/org/greenstone/gs3client/data

I see that this email has so many links, file names and jar file names
in it that it may all seem confusing, but just start by looking at those
3 class files. The methods of class QBRSOAPServer.java create XML
messages according to the Greenstone manual (chapter 3), so having
manual.pdf open on the side may help. The manual is linked off
http://wiki.greenstone.org/wiki/index.php/Greenstone3

Regards,
Anupama


Suthanya Doung-In wrote:
> Dear Anupama,
>
> I would like to develop the my own user interfaces of digital
> library. I develop it based on Greenstone 3. I think I will design my
> user interfaces by Java Servlet because greenstone 3 developed by Java
> and Java Servlet and I will call some functions from greenstone( eg.
> Search and retrieval functions) and display the results on my interfaces.
>
> Before, I have ever contacted to you by email about greenstone3. I am
> sorry that i disappear for a while.
>
> Could you give me some guide about How to call some functions from
> Greenstone3 please? I read the manual already.I am sorry i didn't have
> knowledge about this.
>
> I download source code greenstone3 (for Windows ) . My operating system
> is Windows XP.
>
> First, I would like to compile and run LibraryServlet.java and see the
> result. I import Jar files from GSDL3webWEB-INFlib into Netbean
> 5.5.1 and then import source codes from GSDL3srcjavaorg. Finally, I
> import all codes in the ?GSDL3? folder to Netnean program.
>
> I sent the file that I capture the screens (step by step)about how did i
> import the source codes. I try to do many times but it?s still have
> errors. Please find the attached file.
>
> Many thanks in advance.
>
> Best Wishes,
> Suthanya Doung-in