= ZooKernel description page =
On this page you will find everything you need to know about the ZooKernel.
== Current status ==
Acutaly, you could compile and use the code available on the svn server on your own GNU / LINUX platform this way :
==== Requirements ====
To be able to compile the current source, you need to have some library allready installed on your system :
* [http://www.fastcgi.com/drupal/node/5 FastCGI] (installed in /path/to/trunk/dist/, using --prefix=/path/to/trunk/dist configure option),
* [http://dev.cartography.st/zoo-project/changeset/15 cgic] (same, use just {{{make}}} from the {{{/path/to/trunk/../third/cgic/}}} ) .
* [http://www.xmlsoft.org/index.html libxml2],
* [http://curl.haxx.se/ cURL],
* [http://www.python.org Python].
==== Getting the source code ====
To get the source code and compile on your platform, use the following command :
{{{
#!sh
cd zoo/trunk/
svn checkout svn+ssh://dev.cartography.st/mnt/data3/zoo-project/trunk/zoo-kernel zoo-kernel
}}}
==== Compiling the source code ====
First of all, you'll need to edit the Makefile and uncomment "{{{-DLINUX_FREE_ISSUE}}}" on the first line, then use the following commands :
{{{
#!sh
cd zoo-kernel
make
make zoo_loader.cgi
make demo_service.zo
}}}
Now, you get the ZooKernel (Shell and Cgi version) and two "service providers" of different kind : {{{demo_service.zo}}} (C++) and {{{test_service.py}}} (Python).
==== Using the code ====
===== From the command line =====
To run request with ZooKernel from command command line, use the following example :
{{{
#!sh
./service_loader ./ test_service.zo GetCapabilities
./service_loader ./Buffer.zcfg test_service.zo DescribeProcess
./service_loader ./Buffer.zcfg ./demo_service.zo Execute helloworld
./service_loader ./Buffer.zcfg ./demo_service.zo Execute printAgrument 1 2
./service_loader ./Buffer.zcfg ./demo_service.zo Execute printAgrument 1 2 bg
PYTHONPATH=. ./service_loader ./Distance.zcfg test_service Execute helloworld
}}}
===== From an apache web server =====
You could use the cgi version of zoo_loader on your own apache server. Do do this, use the following instruction.
Copy the cgi script, the demo service and the required files in your {{{cgi-bin}}} directory.
{{{
#!sh
cp /path/to/trunk/zoo-kernel/zoo_loader.cgi /var/www/localhost/cgi-bin
cp /path/to/trunk/zoo-kernel/demo_service.zo /var/www/localhost/cgi-bin/test_service.zo
cp /path/to/trunk/zoo-kernel/*zcfg /var/www/localhost/cgi-bin
cp /path/to/trunk/zoo-kernel/*cfg /var/www/localhost/cgi-bin
}}}
Create a file {{{.htaccess}}} in a zoo directory from the directory index of your apache instalaltion.
{{{
#!sh
cat > /var/www/localhost/htdocs/zoo/.htaccess << EOF
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !=%{DOCUMENT_ROOT}/login.php
RewriteRule (.*)/(.*)/(.*) /cgi-bin/zoo_loader.cgi?ServiceProvider=$2&metapath=$1 [L,QSA]
RewriteRule (.*)/(.*)/ /cgi-bin/zoo_loader.cgi?ServiceProvider=$2&metapath=$1 [L,QSA]
RewriteRule (.*)/(.*) /cgi-bin/zoo_loader.cgi?ServiceProvider=$1&metapath= [L,QSA]
EOF
}}}
Then you have to request your installation using your favorite browser. For instance, this [http://127.0.0.1/zoo/test_service.zo/?Service=WPS&Request=GetCapabilities&Version=1.0.0 link] should work from your Apache web server.
You could also see the Cgi Version from [http://shilpa.media.osaka-cu.ac.jp/zoo/test_service.zo/?Service=WPS&request=GetCapabilities&Version=1.0.0 Shilpa !]
Some samples requests running on the Shilpa server (using KVP only) :
* DescribeProcess samples :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/test_service.zo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Buffer Buffer]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/test_service.zo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Distance Distance]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/arithmetics/test_service.zo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Multiply Multiply]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/test_service.zo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Gdal_Translate Gdal_Translate]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/test_service.zo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Distance,Buffer Distance,Buffer]
* Execute samples :
* Arithmetics Service Provider :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/arithmetics/test_service.zo/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Multiply&DataInputs=A=12@datatype=integer@uom=meter;B=10@datatype=integer@uom=meter&ResponseDocument=BufferedPolygon&StoreExecuteResponse=true Execute Sample for Multiply Identifier].
* Basic GDAL Service Provider :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/gdal_service.zo/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Gdal_Translate&DataInputs=Format=AAIGrid@datatype=string;InputDSN=srtm_kashiwara@datatype=string;OutputDSN=demo007@datatype=string Using Gdal_Translate to convert a GeoTiff datasource to an AAIGrid datasource].
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/gdal_service.zo/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Gdal_Translate&DataInputs=Format=JPEG@datatype=string;InputDSN=srtm_kashiwara@datatype=string;OutputDSN=demo007@datatype=string Using Gdal_Translate to crop a GeoTiff datasource and potentialy convert datasource format]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/gdal_service.zo/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Gdal_Translate&DataInputs=Format=GIF@datatype=string;InputDSN=srtm_kashiwara@datatype=string;OutputDSN=srtm_kashiwara_output6@datatype=string;ProjWin=135.6212504,34.5820833,135.6679170,34.5670833,urn:ogc:def:crs:EPSG:6.6:4326,2;demo=Reference@xlink:href=http%3A%2F%2Fexamples.oreilly.com%2Fwebmapping%2Fch7%2Fairports.gml Use an xlink:href value] [http://examples.oreilly.com/webmapping/ch7/airports.gml (this is the used url)]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/gdal_service.zo/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Gdal_Translate&DataInputs=Format=GIF@datatype=string;InputDSN=srtm_kashiwara@datatype=string;OutputDSN=srtm_kashiwara_output6@datatype=string;ProjWin=135.6212504,34.5820833,135.6679170,34.5670833,urn:ogc:def:crs:EPSG:6.6:4326,2;demo=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1 Use a WFS Request as an xlink:href valur] [http://carto.languedoc-roussillon.ecologie.gouv.fr/webservices/wfs/diren_general/?VERSION=1.1.0&service=WFS&request=GetFeature&typename=Znieff1&maxfeatures=1 (the WFS request used)]. See [wiki:ApacheErrorLog here] to see maps data structure extracted from the apache error log correspoding to this request)
* Basic OGR Service :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/ogr_service.zo/?request=Execute&service=WPS&version=1.0.0&Identifier=Buffer&DataInputs=A=10@datatype=interger;BufferDistance=100@datatype=interger@uom=meter;InputPolygon=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1 The WKS (Well Known Service :) ) Buffer Operation] using a xlink:href WFS query URL-Encoded as a DataInputs value
* [http://shilpa.media.osaka-cu.ac.jp/zoo/ogr_service.zo/?request=Execute&service=WPS&version=1.0.0&Identifier=Distance&DataInputs=InputEntity1=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1;InputEntity2=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff2%26maxfeatures%3D1 Distance]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/ogr_service.zo/?request=Execute&service=WPS&version=1.0.0&Identifier=GetArea&DataInputs=InputEntity1=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1;BufferDistance=100@datatype=interger@uom=meter GetArea]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/ogr_service.zo/?request=Execute&service=WPS&version=1.0.0&Identifier=Buffer&DataInputs=InputPolygon=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1;BufferDistance=100@datatype=interger@uom=meter Buffer]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/ogr_service.zo/?request=Execute&service=WPS&version=1.0.0&Identifier=Boundary&DataInputs=InputPolygon=Reference@xlink:href=http%3A%2F%2Fcarto.languedoc-roussillon.ecologie.gouv.fr%2Fwebservices%2Fwfs%2Fdiren_general%2F%3FVERSION%3D1.1.0%26service%3DWFS%26request%3DGetFeature%26typename%3DZnieff1%26maxfeatures%3D1;BufferDistance=100@datatype=interger@uom=meter Boundary]
Some sample (using POST XML requests), to use those examples you will have to put the following XML documents in the textare on [http://shilpa.media.osaka-cu.ac.jp/demo/test_services_post.html this page], then press "run using XML Request" to see the ZooKernel process your query :
* A simple DescribeProcess request :
{{{
#!xml
Buffer
Boundary
GetArea
}}}
* A sample Execute request using ResponseDocument (same as previous example using Buffer from basic ogr service) :
{{{
#!xml
Buffer
InputPolygon
Playground area
BufferDistance
Distance which people will walk to get to a playground.
400
BufferedPolygon
Area serviced by playground.
Area within which most users of this playground will live.
}}}
* A sample Execute request using RawData (same as previous example using Buffer from basic ogr service) :
{{{
#!xml
Buffer
InputPolygon
Playground area
BufferDistance
Distance which people will walk to get to a playground.
400
BufferedPolygon
}}}
No sample using the GetCapabilities request, only because we get issue in another level for GetCapabilities request, even the KVP is not working for every ServiceProvider.