Changeset 794 for trunk/docs


Ignore:
Timestamp:
Dec 27, 2016, 6:34:38 PM (7 years ago)
Author:
djay
Message:

Add the initial C# language support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/services/howtos.rst

    r771 r794  
    66:ref:`services_index` are quite easy to create once you have installed the ZOO Kernel and have
    77chosen code (in the language of your choice) to turn into a ZOO service. Here are some
    8 HelloWorlds in Python, PHP, Java  and JavaScript with links to their corresponding
     8HelloWorlds in Python, PHP, Java, C#  and JavaScript with links to their corresponding
    99``.zcfg`` files.
     10
     11
     12.. contents:: :depth: 3
    1013
    1114
     
    199202----
    200203
    201 Specifically for the Java support, you may add the following two
     204Specifically for the Java support, you may add the following three
    202205sections to your ``main.cfg`` file:
    203206
     
    311314  }
    312315
     316C#
     317----
     318
     319Specifically for the C# support, you should add the following
     320section to your ``main.cfg`` file.
     321
     322
     323:[mono]:
     324   This section is used to define both ``libPath`` and ``etcPath``
     325   required by the Mono .NET Framework.
     326
     327ZOO-API
     328*******
     329
     330Before you build your first ZOO-Service implemented in Mono, you
     331should first build the ``ZMaps.dll`` containing the Mono ZOO-API.
     332
     333.. Note:: You should build ZOO-Kernel prior to follow this instructions.
     334
     335.. code-block:: guess
     336
     337  cd zoo-api/mono
     338  make
     339
     340Then you should copy the ``ZMaps.dll`` in your ``servicePath`` or in
     341the directory where your ``zoo_loader.cgi`` file is stored.
     342
     343The ZOO-API is available from a C# class named ZOO_API and provides
     344the following static variables:
     345
     346:int SERVICE_SUCCEEDED:
     347   Value to return in case your service end successfully.
     348:int SERVICE_FAILED:
     349   Value to retrun in case of failure.
     350
     351The ZOO-API provides the following static functions:
     352
     353:string Translate(String s):
     354   This function call the internal ZOO-Kernel function responsible for
     355   searching a translation of ``s`` in the zoo-services dictionary.
     356
     357:void UpdateStatus(ZMaps conf,String pourcent,String message):
     358   This function call the updateStatus ZOO-Kernel function responsible
     359   for updating the status of the running service (only usefull when
     360   the service has been called asynchronously).
     361
     362
     363C# ZCFG requirements
     364**********************************
     365
     366.. Note:: For each Service provided by your ZOO Mono Services Provider
     367          (your corresponding Mono class), the ZCFG File should have
     368          the name of the Mono public static function corresponding to the
     369          service (case-sensitive).
     370
     371The ZCFG file should contain the following :
     372
     373serviceType
     374    Mono
     375serviceProvider
     376    The full name of the C# dll containing the ZOO-Service Provider
     377    (including ``.dll``).
     378serviceNameSpace
     379    The namespace of the C# class containing the ZOO-Service Provider.
     380serviceClass
     381    The name of the C# class containing the ZOO-Service Provider definition.
     382
     383C# Data Structure used
     384********************************
     385
     386The three parameters of the function are passed to the Mono static
     387function as ``ZMaps`` which are basically
     388``Dictionary<String,_ZMaps>``.
     389
     390Sample ZOO C# Services Provider
     391******************************************
     392
     393.. literalinclude:: ../../zoo-project/zoo-services/hello-mono/test.cs
     394   :language: csharp
     395   :lines: 24-100
     396
    313397Javascript
    314398----------
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png