[206] | 1 | .. _services-zcfg: |
---|
| 2 | |
---|
| 3 | ZCFG : the ZOO Service Configuration File |
---|
[349] | 4 | ========================================= |
---|
| 5 | |
---|
[323] | 6 | :Authors: Nicolas Bozon, Gérald Fenoy, Jeff McKenna |
---|
[315] | 7 | :Last Updated: $Date: 2015-03-12 02:14:52 +0000 (Thu, 12 Mar 2015) $ |
---|
[206] | 8 | |
---|
| 9 | .. contents:: Table of Contents |
---|
| 10 | :depth: 3 |
---|
| 11 | :backlinks: top |
---|
| 12 | |
---|
| 13 | The ZOO Service configuration file (.zcfg) describes the service and will be parsed by |
---|
| 14 | the ZOO Kernel. We will describe here what such a file contains. |
---|
| 15 | You can also take a look at the existing examples of ZCFG files in the ``cgi-env`` directory |
---|
[529] | 16 | of each services available in the `ZOO-Project SVN source tree <http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-services>`__. |
---|
[206] | 17 | |
---|
| 18 | A ZOO Configuration file is divided into three distinct sections : |
---|
| 19 | |
---|
| 20 | 1. Main Metadata information |
---|
[469] | 21 | 2. List of Inputs metadata information (optional since `rev. 469 <http://zoo-project.org/trac/changeset/469>`__) |
---|
[206] | 22 | 3. List of Outputs metadata information |
---|
| 23 | |
---|
| 24 | .. Note:: The ZOO Service Configuration File is case sensitive. |
---|
| 25 | |
---|
| 26 | Main Metadata Information |
---|
| 27 | ------------------------- |
---|
| 28 | |
---|
| 29 | The fist part in a ZOO Configuration file contains the metadata information relative to the service. |
---|
| 30 | Note that the "name of your service" between brackets on the first line has to be the exact same name |
---|
| 31 | as the function you defined in your services provider code. In most cases, this name is also the name |
---|
| 32 | of the ZCFG file without the "``.zcfg``" extension. |
---|
| 33 | |
---|
| 34 | You can see below a description of the main metadata information: |
---|
| 35 | |
---|
[259] | 36 | .. code-block:: none |
---|
[206] | 37 | :linenos: |
---|
| 38 | |
---|
| 39 | [Name of your service] |
---|
| 40 | Title = Title of your service |
---|
| 41 | Abstract = Description of your service |
---|
| 42 | processVersion = Version number of your service |
---|
| 43 | storeSupported = true/false |
---|
| 44 | statusSupported = true/false |
---|
| 45 | serviceType = the programming language used to implement the service (C/Fortran/Python/Java/PHP/Javascript) |
---|
| 46 | serviceProvider = name of your services provider (shared library/Python Module/Java Class/PHP Script/JavaScript script) |
---|
| 47 | <MetaData> |
---|
| 48 | title = Metadata title of your service |
---|
| 49 | </MetaData> |
---|
| 50 | |
---|
[607] | 51 | .. Note:: you may add an ``extend`` key in case you use the `Process |
---|
| 52 | Profile Registry <process-profiles.html>`__. |
---|
| 53 | |
---|
[206] | 54 | List of Inputs |
---|
| 55 | -------------- |
---|
| 56 | |
---|
| 57 | The list of inputs contains metadata information of each supported input, and they are grouped using a ``<DataInputs>`` node. |
---|
| 58 | |
---|
| 59 | Each input is defined as : |
---|
| 60 | |
---|
| 61 | - a name (between brackets as for the name of the service before) |
---|
[485] | 62 | - various medata properties (``Title``, ``Abstract``, ``minOccurs``, ``maxOccurs`` and, in case of ComplexData, the optional ``maximumMegabytes``) |
---|
[206] | 63 | - a Type Of Data node (:ref:`description <typeDataNodes>`) |
---|
| 64 | |
---|
| 65 | A typical list of inputs (``<DataInputs>``) look like the following: |
---|
| 66 | |
---|
[259] | 67 | .. code-block:: none |
---|
[206] | 68 | :linenos: |
---|
| 69 | |
---|
| 70 | <DataInputs> |
---|
| 71 | [Name of the first input] |
---|
| 72 | Title = Title of the first input |
---|
| 73 | Abstract = Abstract describing the first input |
---|
| 74 | minOccurs = Minimum occurence of the first input |
---|
| 75 | maxOccurs = Maximum occurence of the first input |
---|
| 76 | <Type Of Data Node /> |
---|
| 77 | [Name of the second input] |
---|
| 78 | Title = Title of the second input |
---|
| 79 | Abstract = Abstract describing the second input |
---|
| 80 | minOccurs = Minimum occurence of the second input |
---|
| 81 | maxOccurs = Maximum occurence of the second input |
---|
| 82 | <Type Of Data Node /> |
---|
| 83 | </DataInputs> |
---|
| 84 | |
---|
| 85 | .. Note:: you can add ``<MetaData>`` node as in the main metadata information. |
---|
| 86 | |
---|
| 87 | List of Outputs |
---|
| 88 | --------------- |
---|
| 89 | |
---|
| 90 | The list of outputs is very similar to a list of inputs except it is specified as a ``<DataOutputs>`` node. |
---|
| 91 | |
---|
| 92 | A typical ``<DataOutputs>`` node looks like the following: |
---|
| 93 | |
---|
[259] | 94 | .. code-block:: none |
---|
[206] | 95 | :linenos: |
---|
| 96 | |
---|
| 97 | <DataOutputs> |
---|
| 98 | [Name of the output] |
---|
| 99 | Title = Title of the output |
---|
| 100 | Abstract = Description of the output |
---|
| 101 | <Type Of Data Node /> |
---|
| 102 | </DataOutputs> |
---|
| 103 | |
---|
| 104 | .. _typeDataNodes: |
---|
| 105 | |
---|
| 106 | Type Of Data Nodes |
---|
| 107 | ------------------ |
---|
| 108 | |
---|
| 109 | In the beginning of this ZCFG introduction, we spoke about "Type Of Data Nodes" to describe the data type of inputs and outputs. |
---|
| 110 | |
---|
| 111 | You can define your data as: |
---|
| 112 | |
---|
| 113 | - :ref:`LiteralData <LiteralData>` |
---|
| 114 | - :ref:`BoundingBoxData <BoundingBoxData>` |
---|
| 115 | - :ref:`ComplexData <ComplexData>` |
---|
| 116 | |
---|
[469] | 117 | Except for ``LiteralData``, each *Type Of Data* node must have at least one ``<Default>`` node. Even |
---|
| 118 | if empty, it **has to be present**. So, something |
---|
| 119 | like the following should be present in your ZCFG file: |
---|
[206] | 120 | |
---|
| 121 | .. code-block:: guess |
---|
| 122 | :linenos: |
---|
| 123 | |
---|
[469] | 124 | <Default /> |
---|
[206] | 125 | |
---|
[469] | 126 | Otherwise, ZOO-Kernel won't be able to parse your ZCFG correctly. |
---|
[206] | 127 | |
---|
| 128 | .. _LiteralData: |
---|
| 129 | |
---|
| 130 | LiteralData node |
---|
| 131 | **************** |
---|
| 132 | |
---|
| 133 | A ``<LiteralData>`` node contains: |
---|
| 134 | |
---|
[459] | 135 | - one (optional) ``AllowedValues`` key containing all value allowed for this input |
---|
[469] | 136 | - one (optional) ``range`` properties containing the range (``[``, ``]``) |
---|
[461] | 137 | - one (optional) ``rangeMin`` (``rangeMax``) properties containing the minimum (maximum) value of this range |
---|
[459] | 138 | - one (optional) ``rangeSpacing`` properties containing the regular distance or spacing between value in this range |
---|
[462] | 139 | - one (optional) ``rangeClosure`` properties containing the closure type (``c``, ``o``, ``oc``, ``co``) |
---|
[206] | 140 | - one ``<Default>`` node, |
---|
| 141 | - zero or more ``<Supported>`` nodes depending on the existence or the number of supported Units Of Measure (UOM), and |
---|
| 142 | - a ``dataType`` property. The ``dataType`` property defines the type of literal data, such as a string, an interger and so on |
---|
| 143 | (consult `the complete list <http://www.w3.org/TR/xmlschema-2/#built-in-datatypes>`__ of supported data types). |
---|
| 144 | |
---|
| 145 | ``<Default>`` and ``<Supported>`` nodes can contain the ``uom`` property to define which UOM has to be used for |
---|
| 146 | this input value. |
---|
| 147 | |
---|
| 148 | For input ``<LiteralData>`` nodes, you can add the ``value`` property to the ``<Default>`` node to define a default |
---|
| 149 | value for this input. This means that, when your Service will be run, even if the input wasn't defined, this default |
---|
| 150 | value will be set as the current value for this input. |
---|
| 151 | |
---|
| 152 | A typical ``<LiteralData>`` node, defining a ``float`` data type using meters or degrees for its UOM, looks like the |
---|
| 153 | following: |
---|
| 154 | |
---|
| 155 | .. code-block:: guess |
---|
| 156 | :linenos: |
---|
| 157 | |
---|
| 158 | <LiteralData> |
---|
| 159 | dataType = float |
---|
| 160 | <Default> |
---|
| 161 | uom = meters |
---|
| 162 | </Default> |
---|
| 163 | <Supported> |
---|
| 164 | uom = feet |
---|
| 165 | </Supported> |
---|
| 166 | </LiteralData> |
---|
| 167 | |
---|
[459] | 168 | |
---|
| 169 | A typical ``<LiteralData>`` node, defining a ``float`` data type which |
---|
| 170 | should take values contained in ``[0.0,100.0]``, looks like the following: |
---|
[460] | 171 | |
---|
[459] | 172 | .. code-block:: guess |
---|
| 173 | :linenos: |
---|
| 174 | |
---|
| 175 | <LiteralData> |
---|
| 176 | dataType = float |
---|
| 177 | rangeMin = 0.0 |
---|
| 178 | rangeMax = 100.0 |
---|
| 179 | rangeClosure = c |
---|
| 180 | <Default /> |
---|
| 181 | </LiteralData> |
---|
| 182 | |
---|
[469] | 183 | Or more simply: |
---|
| 184 | |
---|
| 185 | .. code-block:: guess |
---|
| 186 | :linenos: |
---|
| 187 | |
---|
| 188 | <LiteralData> |
---|
| 189 | dataType = float |
---|
| 190 | range = [0.0,100.0] |
---|
| 191 | <Default /> |
---|
| 192 | </LiteralData> |
---|
| 193 | |
---|
[459] | 194 | A typical ``<LiteralData>`` node, defining a ``string`` data type which |
---|
| 195 | support values ``hillshade``, ``slope``, ``aspect``, ``TRI``, ``TPI`` |
---|
| 196 | and ``roughness``, looks like the following: |
---|
[460] | 197 | |
---|
[459] | 198 | .. code-block:: guess |
---|
| 199 | :linenos: |
---|
| 200 | |
---|
| 201 | <LiteralData> |
---|
[463] | 202 | dataType = string |
---|
[459] | 203 | AllowedValues = hillshade,slope,aspect,TRI,TPI,roughness |
---|
| 204 | <Default /> |
---|
| 205 | </LiteralData> |
---|
| 206 | |
---|
[460] | 207 | Properties ``AllowedValues`` and ``range*`` can be conbined with both ``<Default>`` and |
---|
[469] | 208 | ``<Supported>`` nodes in the same was as ``<LiteralData>`` node. For |
---|
| 209 | instance, the following is supported: |
---|
[459] | 210 | |
---|
[469] | 211 | .. code-block:: guess |
---|
| 212 | :linenos: |
---|
| 213 | |
---|
| 214 | <LiteralData> |
---|
| 215 | dataType = int |
---|
| 216 | <Default> |
---|
| 217 | value = 11 |
---|
| 218 | AllowedValues = -10,-8,-7,-5,-1 |
---|
| 219 | rangeMin = 0 |
---|
| 220 | rangeMin = 100 |
---|
| 221 | rangeClosure = co |
---|
| 222 | </Default> |
---|
| 223 | <Supported> |
---|
| 224 | rangeMin = 200 |
---|
| 225 | rangeMin = 600 |
---|
| 226 | rangeClosure = co |
---|
| 227 | </Supported> |
---|
| 228 | <Supported> |
---|
| 229 | rangeMin = 750 |
---|
| 230 | rangeMin = 990 |
---|
| 231 | rangeClosure = co |
---|
| 232 | rangeSpacing = 10 |
---|
| 233 | </Supported> |
---|
| 234 | </LiteralData> |
---|
| 235 | |
---|
[206] | 236 | .. _BoundingBoxData: |
---|
| 237 | |
---|
| 238 | BoundingBoxData node |
---|
| 239 | ******************** |
---|
| 240 | |
---|
| 241 | A ``<BoundingBoxData>`` node contains: |
---|
| 242 | |
---|
| 243 | - one ``<Default>`` node with a CRS property defining the default Coordinate Reference Systems (CRS), and |
---|
| 244 | - one or more ``<Supported>`` nodes depending on the number of CRS your service supports (note that you can |
---|
| 245 | alternatively use a single ``<Supported>`` node with a comma-separated list of supported CRS). |
---|
| 246 | |
---|
| 247 | A typical ``<BoundingBoxData>`` node, for two supported CRS (`EPSG:4326 <http://www.epsg-registry.org/indicio/query?request=GetRepositoryItem&id=urn:ogc:def:crs:EPSG::4326>`__ |
---|
| 248 | and `EPSG:3785 <http://www.epsg-registry.org/indicio/query?request=GetRepositoryItem&id=urn:ogc:def:crs:EPSG::3785>`__), |
---|
| 249 | looks like the following: |
---|
| 250 | |
---|
| 251 | .. code-block:: guess |
---|
| 252 | :linenos: |
---|
| 253 | |
---|
| 254 | <BoundingBoxData> |
---|
| 255 | <Default> |
---|
| 256 | CRS = urn:ogc:def:crs:EPSG:6.6:4326 |
---|
| 257 | </Default> |
---|
| 258 | <Supported> |
---|
| 259 | CRS = urn:ogc:def:crs:EPSG:6.6:4326 |
---|
| 260 | </Supported> |
---|
| 261 | <Supported> |
---|
| 262 | CRS = urn:ogc:def:crs:EPSG:6.6:3785 |
---|
| 263 | </Supported> |
---|
| 264 | </BoundingBoxData> |
---|
| 265 | |
---|
| 266 | .. _ComplexData: |
---|
| 267 | |
---|
| 268 | ComplexData node |
---|
| 269 | **************** |
---|
| 270 | |
---|
| 271 | A ComplexData node contains: |
---|
| 272 | |
---|
| 273 | - a ``<Default>`` node and |
---|
| 274 | - one or more ``<Supported>`` nodes depending on the number of supported formats. A format is made up of this |
---|
| 275 | set of properties : ``mimeType``, ``encoding`` and optionaly ``schema``. |
---|
| 276 | |
---|
| 277 | For output ComplexData nodes, you can add the ``extension`` property to define what extension to use to name |
---|
| 278 | the file when storing the result is required. Obviously, you'll have to add the ``extension`` property to each |
---|
| 279 | supported format (for the ``<Default>`` and ``<Supported>`` nodes). |
---|
| 280 | |
---|
| 281 | You can also add the ``asReference`` property to the ``<Default>`` node to define if the output should be |
---|
| 282 | stored on server side per default. |
---|
| 283 | |
---|
| 284 | .. Note:: the client can always modify this behavior by setting ``asReference`` attribute to ``true`` or ``false`` |
---|
| 285 | for this output in the request ``ResponseDocument`` parameter. |
---|
| 286 | |
---|
| 287 | You can see below a sample ComplexData node for default ``application/json`` and ``text/xml`` (encoded in UTF-8 |
---|
| 288 | or base64) mimeTypes support: |
---|
| 289 | |
---|
| 290 | .. code-block:: guess |
---|
| 291 | :linenos: |
---|
| 292 | |
---|
| 293 | <ComplexData> |
---|
| 294 | <Default> |
---|
| 295 | mimeType = application/json |
---|
| 296 | encoding = UTF-8 |
---|
| 297 | </Default> |
---|
| 298 | <Supported> |
---|
| 299 | mimeType = text/xml |
---|
| 300 | encoding = base64 |
---|
| 301 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
| 302 | </Supported> |
---|
| 303 | <Supported> |
---|
| 304 | mimeType = text/xml |
---|
| 305 | encoding = UTF-8 |
---|
| 306 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
| 307 | </Supported> |
---|
| 308 | </ComplexData> |
---|