1 | .. _services-zcfg: |
---|
2 | |
---|
3 | ZCFG : the ZOO Service Configuration File |
---|
4 | ========================================= |
---|
5 | |
---|
6 | :Authors: Nicolas Bozon, Gérald Fenoy, Jeff McKenna |
---|
7 | :Last Updated: $Date: 2014-04-01 22:24:10 +0000 (Tue, 01 Apr 2014) $ |
---|
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 |
---|
16 | of each services available in the `ZOO-Project SVN source tree <http://zoo-project.org/trac/browser/trunk/zoo-services>`__. |
---|
17 | |
---|
18 | A ZOO Configuration file is divided into three distinct sections : |
---|
19 | |
---|
20 | 1. Main Metadata information |
---|
21 | 2. List of Inputs metadata information |
---|
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 | |
---|
36 | .. code-block:: none |
---|
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 | |
---|
51 | List of Inputs |
---|
52 | -------------- |
---|
53 | |
---|
54 | The list of inputs contains metadata information of each supported input, and they are grouped using a ``<DataInputs>`` node. |
---|
55 | |
---|
56 | Each input is defined as : |
---|
57 | |
---|
58 | - a name (between brackets as for the name of the service before) |
---|
59 | - various medata properties (``Title``, ``Abstract``, ``minOccurs`` and ``maxOccurs``) |
---|
60 | - a Type Of Data node (:ref:`description <typeDataNodes>`) |
---|
61 | |
---|
62 | A typical list of inputs (``<DataInputs>``) look like the following: |
---|
63 | |
---|
64 | .. code-block:: none |
---|
65 | :linenos: |
---|
66 | |
---|
67 | <DataInputs> |
---|
68 | [Name of the first input] |
---|
69 | Title = Title of the first input |
---|
70 | Abstract = Abstract describing the first input |
---|
71 | minOccurs = Minimum occurence of the first input |
---|
72 | maxOccurs = Maximum occurence of the first input |
---|
73 | <Type Of Data Node /> |
---|
74 | [Name of the second input] |
---|
75 | Title = Title of the second input |
---|
76 | Abstract = Abstract describing the second input |
---|
77 | minOccurs = Minimum occurence of the second input |
---|
78 | maxOccurs = Maximum occurence of the second input |
---|
79 | <Type Of Data Node /> |
---|
80 | </DataInputs> |
---|
81 | |
---|
82 | .. Note:: you can add ``<MetaData>`` node as in the main metadata information. |
---|
83 | |
---|
84 | List of Outputs |
---|
85 | --------------- |
---|
86 | |
---|
87 | The list of outputs is very similar to a list of inputs except it is specified as a ``<DataOutputs>`` node. |
---|
88 | |
---|
89 | A typical ``<DataOutputs>`` node looks like the following: |
---|
90 | |
---|
91 | .. code-block:: none |
---|
92 | :linenos: |
---|
93 | |
---|
94 | <DataOutputs> |
---|
95 | [Name of the output] |
---|
96 | Title = Title of the output |
---|
97 | Abstract = Description of the output |
---|
98 | <Type Of Data Node /> |
---|
99 | </DataOutputs> |
---|
100 | |
---|
101 | .. _typeDataNodes: |
---|
102 | |
---|
103 | Type Of Data Nodes |
---|
104 | ------------------ |
---|
105 | |
---|
106 | In the beginning of this ZCFG introduction, we spoke about "Type Of Data Nodes" to describe the data type of inputs and outputs. |
---|
107 | |
---|
108 | You can define your data as: |
---|
109 | |
---|
110 | - :ref:`LiteralData <LiteralData>` |
---|
111 | - :ref:`BoundingBoxData <BoundingBoxData>` |
---|
112 | - :ref:`ComplexData <ComplexData>` |
---|
113 | |
---|
114 | Except for ``LiteralData``, each *Type Of Data* node must have at least one ``<Default>`` and one ``<Supported>`` node. Even |
---|
115 | if one of those are empty, it **has to be present** with an opening and closing tag on two different lines. So, something |
---|
116 | like the following: |
---|
117 | |
---|
118 | .. code-block:: guess |
---|
119 | :linenos: |
---|
120 | |
---|
121 | <Default> |
---|
122 | </Default> |
---|
123 | |
---|
124 | Otherwise, ZOO-Kernel won't be able to parse your ZCFG and will fail to process requests. |
---|
125 | |
---|
126 | .. _LiteralData: |
---|
127 | |
---|
128 | LiteralData node |
---|
129 | **************** |
---|
130 | |
---|
131 | A ``<LiteralData>`` node contains: |
---|
132 | |
---|
133 | - one (optional) ``AllowedValues`` key containing all value allowed for this input |
---|
134 | - one (optional) ``rangeMin`` (``rangeMax``) properties containing the minimum (maximum) value of this range |
---|
135 | - one (optional) ``rangeSpacing`` properties containing the regular distance or spacing between value in this range |
---|
136 | - one (optional) ``rangeClosure`` properties containing the closure type (``c``, ``o``, ``oc``, ``co``) |
---|
137 | - one ``<Default>`` node, |
---|
138 | - zero or more ``<Supported>`` nodes depending on the existence or the number of supported Units Of Measure (UOM), and |
---|
139 | - a ``dataType`` property. The ``dataType`` property defines the type of literal data, such as a string, an interger and so on |
---|
140 | (consult `the complete list <http://www.w3.org/TR/xmlschema-2/#built-in-datatypes>`__ of supported data types). |
---|
141 | |
---|
142 | ``<Default>`` and ``<Supported>`` nodes can contain the ``uom`` property to define which UOM has to be used for |
---|
143 | this input value. |
---|
144 | |
---|
145 | For input ``<LiteralData>`` nodes, you can add the ``value`` property to the ``<Default>`` node to define a default |
---|
146 | value for this input. This means that, when your Service will be run, even if the input wasn't defined, this default |
---|
147 | value will be set as the current value for this input. |
---|
148 | |
---|
149 | A typical ``<LiteralData>`` node, defining a ``float`` data type using meters or degrees for its UOM, looks like the |
---|
150 | following: |
---|
151 | |
---|
152 | .. code-block:: guess |
---|
153 | :linenos: |
---|
154 | |
---|
155 | <LiteralData> |
---|
156 | dataType = float |
---|
157 | <Default> |
---|
158 | uom = meters |
---|
159 | </Default> |
---|
160 | <Supported> |
---|
161 | uom = feet |
---|
162 | </Supported> |
---|
163 | </LiteralData> |
---|
164 | |
---|
165 | |
---|
166 | A typical ``<LiteralData>`` node, defining a ``float`` data type which |
---|
167 | should take values contained in ``[0.0,100.0]``, looks like the following: |
---|
168 | |
---|
169 | .. code-block:: guess |
---|
170 | :linenos: |
---|
171 | |
---|
172 | <LiteralData> |
---|
173 | dataType = float |
---|
174 | rangeMin = 0.0 |
---|
175 | rangeMax = 100.0 |
---|
176 | rangeClosure = c |
---|
177 | <Default /> |
---|
178 | </LiteralData> |
---|
179 | |
---|
180 | A typical ``<LiteralData>`` node, defining a ``string`` data type which |
---|
181 | support values ``hillshade``, ``slope``, ``aspect``, ``TRI``, ``TPI`` |
---|
182 | and ``roughness``, looks like the following: |
---|
183 | |
---|
184 | .. code-block:: guess |
---|
185 | :linenos: |
---|
186 | |
---|
187 | <LiteralData> |
---|
188 | dataType = float |
---|
189 | AllowedValues = hillshade,slope,aspect,TRI,TPI,roughness |
---|
190 | <Default /> |
---|
191 | </LiteralData> |
---|
192 | |
---|
193 | Properties ``AllowedValues`` and ``range*`` can be conbined with both ``<Default>`` and |
---|
194 | ``<Supported>`` nodes in the same ``<LiteralData>`` node. |
---|
195 | |
---|
196 | .. _BoundingBoxData: |
---|
197 | |
---|
198 | BoundingBoxData node |
---|
199 | ******************** |
---|
200 | |
---|
201 | A ``<BoundingBoxData>`` node contains: |
---|
202 | |
---|
203 | - one ``<Default>`` node with a CRS property defining the default Coordinate Reference Systems (CRS), and |
---|
204 | - one or more ``<Supported>`` nodes depending on the number of CRS your service supports (note that you can |
---|
205 | alternatively use a single ``<Supported>`` node with a comma-separated list of supported CRS). |
---|
206 | |
---|
207 | 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>`__ |
---|
208 | and `EPSG:3785 <http://www.epsg-registry.org/indicio/query?request=GetRepositoryItem&id=urn:ogc:def:crs:EPSG::3785>`__), |
---|
209 | looks like the following: |
---|
210 | |
---|
211 | .. code-block:: guess |
---|
212 | :linenos: |
---|
213 | |
---|
214 | <BoundingBoxData> |
---|
215 | <Default> |
---|
216 | CRS = urn:ogc:def:crs:EPSG:6.6:4326 |
---|
217 | </Default> |
---|
218 | <Supported> |
---|
219 | CRS = urn:ogc:def:crs:EPSG:6.6:4326 |
---|
220 | </Supported> |
---|
221 | <Supported> |
---|
222 | CRS = urn:ogc:def:crs:EPSG:6.6:3785 |
---|
223 | </Supported> |
---|
224 | </BoundingBoxData> |
---|
225 | |
---|
226 | .. _ComplexData: |
---|
227 | |
---|
228 | ComplexData node |
---|
229 | **************** |
---|
230 | |
---|
231 | A ComplexData node contains: |
---|
232 | |
---|
233 | - a ``<Default>`` node and |
---|
234 | - one or more ``<Supported>`` nodes depending on the number of supported formats. A format is made up of this |
---|
235 | set of properties : ``mimeType``, ``encoding`` and optionaly ``schema``. |
---|
236 | |
---|
237 | For output ComplexData nodes, you can add the ``extension`` property to define what extension to use to name |
---|
238 | the file when storing the result is required. Obviously, you'll have to add the ``extension`` property to each |
---|
239 | supported format (for the ``<Default>`` and ``<Supported>`` nodes). |
---|
240 | |
---|
241 | You can also add the ``asReference`` property to the ``<Default>`` node to define if the output should be |
---|
242 | stored on server side per default. |
---|
243 | |
---|
244 | .. Note:: the client can always modify this behavior by setting ``asReference`` attribute to ``true`` or ``false`` |
---|
245 | for this output in the request ``ResponseDocument`` parameter. |
---|
246 | |
---|
247 | You can see below a sample ComplexData node for default ``application/json`` and ``text/xml`` (encoded in UTF-8 |
---|
248 | or base64) mimeTypes support: |
---|
249 | |
---|
250 | .. code-block:: guess |
---|
251 | :linenos: |
---|
252 | |
---|
253 | <ComplexData> |
---|
254 | <Default> |
---|
255 | mimeType = application/json |
---|
256 | encoding = UTF-8 |
---|
257 | </Default> |
---|
258 | <Supported> |
---|
259 | mimeType = text/xml |
---|
260 | encoding = base64 |
---|
261 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
262 | </Supported> |
---|
263 | <Supported> |
---|
264 | mimeType = text/xml |
---|
265 | encoding = UTF-8 |
---|
266 | schema = http://fooa/gml/3.1.0/polygon.xsd |
---|
267 | </Supported> |
---|
268 | </ComplexData> |
---|