= 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),
* [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), now use them together.
==== 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
}}}
Using ZOO Kernel from the command line is very usefull in development phase, this way you don't have to publish a not working ZOO Service Provider to test and check your service. It can be also useful for ZOO Kernel debuging purpose.
===== 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-services/demo/demo_service.zo /var/www/localhost/cgi-bin/test_service.zo
cp /path/to/trunk/zoo-services/*/cgi-bin/*zcfg /var/www/localhost/cgi-bin
cp /path/to/trunk/zoo-kernel/*cfg /var/www/localhost/cgi-bin
}}}
Create a file called {{{.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/?Service=WPS&request=GetCapabilities&Version=1.0.0 Shilpa !]
Some samples requests running on the Shilpa server (using KVP requests) :
* DescribeProcess samples :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Buffer Buffer]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Distance Distance]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/arithmetics/wps/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Multiply Multiply]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/wps/?Service=WPS&Request=DescribeProcess&Version=1.0.0&Language=en-CA&Identifier=Gdal_Translate Gdal_Translate]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?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/wps/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=Multiply&DataInputs=A=12@datatype=integer;B=10@datatype=integer&ResponseDocument=Result Execute Sample for Multiply Identifier].
* Basic GDAL Service Provider :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/driftx/wps/?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/wps/?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/wps/?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/wps/?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 :
* The WKS (Well Known Service :) ) Buffer Operation :
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?request=Execute&service=WPS&version=1.0.0&Identifier=Buffer&DataInputs=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&ResponseDocument=BufferedPolygon Sample using ResponseDocument] using a xlink:href [http://carto.languedoc-roussillon.ecologie.gouv.fr/webservices/wfs/diren_general/?VERSION=1.1.0&service=WFS&request=GetFeature&typename=Znieff1&maxfeatures=1 WFS query] URL-Encoded as a DataInputs value
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?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&ResponseDocument=BufferedPolygon&Lineage=true Same sample using lineage] (usefull to display the data).
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?request=Execute&service=WPS&version=1.0.0&Identifier=Buffer&DataInputs=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&RawDataOutput=BufferedPolygon Sample using RawDataOutput] using a xlink:href the same WFS query URL-Encoded as a DataInputs value than the first one
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?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/?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/?request=Execute&service=WPS&version=1.0.0&Identifier=ConvexHull&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 ConvexHull]
* [http://shilpa.media.osaka-cu.ac.jp/zoo/?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]
* Python samples :
* [http://demo.zoo-project.org/zoo/?request=Execute&service=WPS&version=1.0.0&Identifier=HelloPy&DataInputs=a=Your%20Name%20Here@datatype=string HelloPy]
* Java samples :
* [http://demo.zoo-project.org/zoo/wps/?request=Execute&service=WPS&version=1.0.0&language=en-CA&Identifier=HelloWorldJava&DataInputs=S=Venkatesh%20Raghavan@datatype=string&ResponseDocument=Result HelloWorldJava]
* Fortran samples :
* [http://demo.zoo-project.org/zoo/?request=Execute&service=WPS&version=1.0.0&Identifier=hellof&DataInputs=S=Your%20Name%20Here@datatype=string hellof]
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_post1.html this page], then press "run using XML Request" to see the ZooKernel process your query :
* A simple GetCapabilities request :
{{{
#!xml
1.0.0
}}}
* 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
}}}
* A sample using two different kind of entities (GML reference and JSON String) :
{{{
#!xml
Union
InputEntity1
InputEntity2
{"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]}
Result
}}}
* same Union sample using 2 embedded JSON Strings :
{{{
#!xml
Union
InputEntity1
{"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]}
InputEntity2
{"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]}
Result
}}}