1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <module version="2.0"> |
---|
3 | <meta> |
---|
4 | <identity> |
---|
5 | <uri>urn:org:isocat:schemacat:interface:rest</uri> |
---|
6 | <version>1.0.0</version> |
---|
7 | </identity> |
---|
8 | <info> |
---|
9 | <name>SCHEMAcat - interface - REST</name> |
---|
10 | <description>REST interface for SCHEMAcat</description> |
---|
11 | <icon>res:/schemacat/pub/icon.png</icon> |
---|
12 | </info> |
---|
13 | </meta> |
---|
14 | <system> |
---|
15 | <dynamic/> |
---|
16 | </system> |
---|
17 | <rootspace name="SCHEMAcat - interface - REST - Development Space" |
---|
18 | uri="urn:org:isocat:schemacat:interface:rest"> |
---|
19 | <fileset> |
---|
20 | <regex>res:/etc/system/SimpleDynamicImportHook.xml</regex> |
---|
21 | </fileset> |
---|
22 | <overlay> |
---|
23 | <!-- this scratch pad is used to store the user info --> |
---|
24 | <prototype>ScratchPad</prototype> |
---|
25 | <space> |
---|
26 | <overlay> |
---|
27 | <!-- all endpoints firs run findUser to store the user info in the scratch pad --> |
---|
28 | <prototype>RESTOverlay</prototype> |
---|
29 | <config> |
---|
30 | <basepath>/schemacat/</basepath> |
---|
31 | </config> |
---|
32 | <space> |
---|
33 | <mapper> |
---|
34 | <config> |
---|
35 | <endpoint> |
---|
36 | <meta> |
---|
37 | <rest> |
---|
38 | <method>GET</method> |
---|
39 | <simple>users/{userID:([^/]+)}{slash:(/|)}</simple> |
---|
40 | <compress/> |
---|
41 | <Etag>MD5</Etag> |
---|
42 | <preTarget>findUser</preTarget> |
---|
43 | <produces>application/json</produces> |
---|
44 | </rest> |
---|
45 | </meta> |
---|
46 | <grammar> |
---|
47 | <active> |
---|
48 | <identifier>active:org.schemacat.rest.user.json</identifier> |
---|
49 | <argument name="userID" min="1" max="1"/> |
---|
50 | <argument name="slash"/> |
---|
51 | </active> |
---|
52 | </grammar> |
---|
53 | <request> |
---|
54 | <identifier>active:JSONFromXML</identifier> |
---|
55 | <argument name="operand"> |
---|
56 | <request> |
---|
57 | <identifier>active:sloot.dpml</identifier> |
---|
58 | <argument name="operator">res:/interface/user.dpml</argument> |
---|
59 | <argument name="userID" method="as-string">arg:userID</argument> |
---|
60 | </request> |
---|
61 | </argument> |
---|
62 | </request> |
---|
63 | </endpoint> |
---|
64 | <endpoint> |
---|
65 | <meta> |
---|
66 | <rest> |
---|
67 | <method>GET</method> |
---|
68 | <simple>users/{userID:([^/]+)}{slash:(/|)}</simple> |
---|
69 | <compress/> |
---|
70 | <Etag>MD5</Etag> |
---|
71 | <preTarget>findUser</preTarget> |
---|
72 | <produces>application/xml</produces> |
---|
73 | </rest> |
---|
74 | </meta> |
---|
75 | <grammar> |
---|
76 | <active> |
---|
77 | <identifier>active:org.schemacat.rest.user.xml</identifier> |
---|
78 | <argument name="userID" min="1" max="1"/> |
---|
79 | <argument name="slash"/> |
---|
80 | </active> |
---|
81 | </grammar> |
---|
82 | <request> |
---|
83 | <identifier>active:sloot.dpml</identifier> |
---|
84 | <argument name="operator">res:/interface/user.dpml</argument> |
---|
85 | <argument name="userID" method="as-string">arg:userID</argument> |
---|
86 | </request> |
---|
87 | </endpoint> |
---|
88 | <endpoint> |
---|
89 | <meta> |
---|
90 | <rest> |
---|
91 | <method>GET</method> |
---|
92 | <simple>users{slash:(/|)}</simple> |
---|
93 | <compress/> |
---|
94 | <Etag>MD5</Etag> |
---|
95 | <preTarget>findUser</preTarget> |
---|
96 | <produces>application/json</produces> |
---|
97 | </rest> |
---|
98 | </meta> |
---|
99 | <grammar> |
---|
100 | <active> |
---|
101 | <identifier>active:org.schemacat.rest.users.json</identifier> |
---|
102 | <argument name="slash"/> |
---|
103 | </active> |
---|
104 | </grammar> |
---|
105 | <request> |
---|
106 | <identifier>active:JSONFromXML</identifier> |
---|
107 | <argument name="operand"> |
---|
108 | <request> |
---|
109 | <identifier>active:sloot.dpml</identifier> |
---|
110 | <argument name="operator">res:/interface/users.dpml</argument> |
---|
111 | </request> |
---|
112 | </argument> |
---|
113 | </request> |
---|
114 | </endpoint> |
---|
115 | <endpoint> |
---|
116 | <meta> |
---|
117 | <rest> |
---|
118 | <method>GET</method> |
---|
119 | <simple>users{slash:(/|)}</simple> |
---|
120 | <compress/> |
---|
121 | <Etag>MD5</Etag> |
---|
122 | <preTarget>findUser</preTarget> |
---|
123 | <produces>application/xml</produces> |
---|
124 | </rest> |
---|
125 | </meta> |
---|
126 | <grammar> |
---|
127 | <active> |
---|
128 | <identifier>active:org.schemacat.rest.users.xml</identifier> |
---|
129 | <argument name="slash"/> |
---|
130 | </active> |
---|
131 | </grammar> |
---|
132 | <request> |
---|
133 | <identifier>active:sloot.dpml</identifier> |
---|
134 | <argument name="operator">res:/interface/users.dpml</argument> |
---|
135 | </request> |
---|
136 | </endpoint> |
---|
137 | <endpoint> |
---|
138 | <meta> |
---|
139 | <rest> |
---|
140 | <method>GET</method> |
---|
141 | <simple>users/{userID}/schemas{slash:(/|)}</simple> |
---|
142 | <compress/> |
---|
143 | <Etag>MD5</Etag> |
---|
144 | <preTarget>findUser</preTarget> |
---|
145 | <produces>application/json</produces> |
---|
146 | </rest> |
---|
147 | </meta> |
---|
148 | <grammar> |
---|
149 | <active> |
---|
150 | <identifier>active:org.schemacat.rest.user.schemas.json</identifier> |
---|
151 | <argument name="userID" min="1" max="1"/> |
---|
152 | <argument name="slash"/> |
---|
153 | </active> |
---|
154 | </grammar> |
---|
155 | <request> |
---|
156 | <identifier>active:JSONFromXML</identifier> |
---|
157 | <argument name="operand"> |
---|
158 | <request> |
---|
159 | <identifier>active:sloot.dpml</identifier> |
---|
160 | <argument name="operator">res:/interface/userSchemas.dpml</argument> |
---|
161 | <argument method="as-string" name="userID">arg:userID</argument> |
---|
162 | </request> |
---|
163 | </argument> |
---|
164 | </request> |
---|
165 | </endpoint> |
---|
166 | <endpoint> |
---|
167 | <meta> |
---|
168 | <rest> |
---|
169 | <method>GET</method> |
---|
170 | <simple>users/{userID}/schemas{slash:(/|)}</simple> |
---|
171 | <compress/> |
---|
172 | <Etag>MD5</Etag> |
---|
173 | <preTarget>findUser</preTarget> |
---|
174 | <produces>application/xml</produces> |
---|
175 | </rest> |
---|
176 | </meta> |
---|
177 | <grammar> |
---|
178 | <active> |
---|
179 | <identifier>active:org.schemacat.rest.user.schemas.xml</identifier> |
---|
180 | <argument name="userID" min="1" max="1"/> |
---|
181 | <argument name="slash"/> |
---|
182 | </active> |
---|
183 | </grammar> |
---|
184 | <request> |
---|
185 | <identifier>active:sloot.dpml</identifier> |
---|
186 | <argument name="operator">res:/interface/userSchemas.dpml</argument> |
---|
187 | <argument method="as-string" name="userID">arg:userID</argument> |
---|
188 | </request> |
---|
189 | </endpoint> |
---|
190 | <endpoint> |
---|
191 | <meta> |
---|
192 | <rest> |
---|
193 | <method>GET</method> |
---|
194 | <simple>schemas{slash:(/|)}</simple> |
---|
195 | <compress/> |
---|
196 | <Etag>MD5</Etag> |
---|
197 | <preTarget>findUser</preTarget> |
---|
198 | <produces>application/json</produces> |
---|
199 | </rest> |
---|
200 | </meta> |
---|
201 | <grammar> |
---|
202 | <active> |
---|
203 | <identifier>active:org.schemacat.rest.schemas.json</identifier> |
---|
204 | <argument name="slash"/> |
---|
205 | </active> |
---|
206 | </grammar> |
---|
207 | <request> |
---|
208 | <identifier>active:JSONFromXML</identifier> |
---|
209 | <argument name="operand"> |
---|
210 | <request> |
---|
211 | <identifier>active:sloot.dpml</identifier> |
---|
212 | <argument name="operator">res:/interface/schemas.dpml</argument> |
---|
213 | </request> |
---|
214 | </argument> |
---|
215 | </request> |
---|
216 | </endpoint> |
---|
217 | <endpoint> |
---|
218 | <meta> |
---|
219 | <rest> |
---|
220 | <method>GET</method> |
---|
221 | <simple>schemas{slash:(/|)}</simple> |
---|
222 | <compress/> |
---|
223 | <Etag>MD5</Etag> |
---|
224 | <preTarget>findUser</preTarget> |
---|
225 | <produces>application/xml</produces> |
---|
226 | </rest> |
---|
227 | </meta> |
---|
228 | <grammar> |
---|
229 | <active> |
---|
230 | <identifier>active:org.schemacat.rest.schemas.xml</identifier> |
---|
231 | <argument name="slash"/> |
---|
232 | </active> |
---|
233 | </grammar> |
---|
234 | <request> |
---|
235 | <identifier>active:sloot.dpml</identifier> |
---|
236 | <argument name="operator">res:/interface/schemas.dpml</argument> |
---|
237 | </request> |
---|
238 | </endpoint> |
---|
239 | <endpoint> |
---|
240 | <meta> |
---|
241 | <rest> |
---|
242 | <method>GET</method> |
---|
243 | <simple>schemas/public{slash:(/|)}</simple> |
---|
244 | <compress/> |
---|
245 | <Etag>MD5</Etag> |
---|
246 | <preTarget>findUser</preTarget> |
---|
247 | <produces>application/json</produces> |
---|
248 | </rest> |
---|
249 | </meta> |
---|
250 | <grammar> |
---|
251 | <active> |
---|
252 | <identifier>active:org.schemacat.rest.schemas.public.json</identifier> |
---|
253 | <argument name="slash"/> |
---|
254 | </active> |
---|
255 | </grammar> |
---|
256 | <request> |
---|
257 | <identifier>active:JSONFromXML</identifier> |
---|
258 | <argument name="operand"> |
---|
259 | <request> |
---|
260 | <identifier>active:sloot.dpml</identifier> |
---|
261 | <argument name="operator">res:/interface/publicSchemas.dpml</argument> |
---|
262 | </request> |
---|
263 | </argument> |
---|
264 | </request> |
---|
265 | </endpoint> |
---|
266 | <endpoint> |
---|
267 | <meta> |
---|
268 | <rest> |
---|
269 | <method>GET</method> |
---|
270 | <simple>schemas/public{slash:(/|)}</simple> |
---|
271 | <compress/> |
---|
272 | <Etag>MD5</Etag> |
---|
273 | <preTarget>findUser</preTarget> |
---|
274 | <produces>application/xml</produces> |
---|
275 | </rest> |
---|
276 | </meta> |
---|
277 | <grammar> |
---|
278 | <active> |
---|
279 | <identifier>active:org.schemacat.rest.schemas.public.xml</identifier> |
---|
280 | <argument name="slash"/> |
---|
281 | </active> |
---|
282 | </grammar> |
---|
283 | <request> |
---|
284 | <identifier>active:sloot.dpml</identifier> |
---|
285 | <argument name="operator">res:/interface/publicSchemas.dpml</argument> |
---|
286 | </request> |
---|
287 | </endpoint> |
---|
288 | <endpoint> |
---|
289 | <meta> |
---|
290 | <rest> |
---|
291 | <method>GET</method> |
---|
292 | <simple>schemas/{schemaID:([^/]+)}{slash:(/|)}</simple> |
---|
293 | <compress/> |
---|
294 | <Etag>MD5</Etag> |
---|
295 | <preTarget>findUser</preTarget> |
---|
296 | <produces>application/json</produces> |
---|
297 | </rest> |
---|
298 | </meta> |
---|
299 | <grammar> |
---|
300 | <active> |
---|
301 | <identifier>active:org.schemacat.rest.schema.json</identifier> |
---|
302 | <argument name="schemaID" min="1" max="1"/> |
---|
303 | <argument name="slash"/> |
---|
304 | </active> |
---|
305 | </grammar> |
---|
306 | <request> |
---|
307 | <identifier>active:JSONFromXML</identifier> |
---|
308 | <argument name="operand"> |
---|
309 | <request> |
---|
310 | <identifier>active:sloot.dpml</identifier> |
---|
311 | <argument name="operator">res:/interface/schema.dpml</argument> |
---|
312 | <argument method="as-string" name="schemaID">arg:schemaID</argument> |
---|
313 | </request> |
---|
314 | </argument> |
---|
315 | </request> |
---|
316 | </endpoint> |
---|
317 | <endpoint> |
---|
318 | <meta> |
---|
319 | <rest> |
---|
320 | <method>GET</method> |
---|
321 | <simple>schemas/{schemaID:([^/]+)}{slash:(/|)}</simple> |
---|
322 | <compress/> |
---|
323 | <Etag>MD5</Etag> |
---|
324 | <preTarget>findUser</preTarget> |
---|
325 | <produces>application/xml</produces> |
---|
326 | </rest> |
---|
327 | </meta> |
---|
328 | <grammar> |
---|
329 | <active> |
---|
330 | <identifier>active:org.schemacat.rest.schema.xml</identifier> |
---|
331 | <argument name="schemaID" min="1" max="1"/> |
---|
332 | <argument name="slash"/> |
---|
333 | </active> |
---|
334 | </grammar> |
---|
335 | <request> |
---|
336 | <identifier>active:sloot.dpml</identifier> |
---|
337 | <argument name="operator">res:/interface/schema.dpml</argument> |
---|
338 | <argument method="as-string" name="schemaID">arg:schemaID</argument> |
---|
339 | </request> |
---|
340 | </endpoint> |
---|
341 | <endpoint> |
---|
342 | <!-- this falls through to the urn.org.isocat.schemacat.site module --> |
---|
343 | <meta> |
---|
344 | <rest> |
---|
345 | <simple>site{file:(?i)(/index.html|/index.htm|/|)}</simple> |
---|
346 | <compress/> |
---|
347 | <Etag>MD5</Etag> |
---|
348 | <preTarget>findUser</preTarget> |
---|
349 | </rest> |
---|
350 | </meta> |
---|
351 | <grammar> |
---|
352 | <active> |
---|
353 | <identifier>active:org.schemacat.rest.index</identifier> |
---|
354 | <argument name="file"/> |
---|
355 | </active> |
---|
356 | </grammar> |
---|
357 | <request> |
---|
358 | <identifier>active:org.schemacat.site.index</identifier> |
---|
359 | </request> |
---|
360 | </endpoint> |
---|
361 | <endpoint> |
---|
362 | <meta> |
---|
363 | <rest> |
---|
364 | <simple>site/{file}</simple> |
---|
365 | <compress/> |
---|
366 | <Etag>MD5</Etag> |
---|
367 | </rest> |
---|
368 | </meta> |
---|
369 | <grammar>res:/schemacat/<group name="file"><regex type="anything"/></group></grammar> |
---|
370 | <request> |
---|
371 | <identifier>res:/schemacat/site/[[arg:file]]</identifier> |
---|
372 | </request> |
---|
373 | </endpoint> |
---|
374 | <endpoint> |
---|
375 | <!-- find user info --> |
---|
376 | <id>findUser</id> |
---|
377 | <grammar> |
---|
378 | <active> |
---|
379 | <identifier>active:findUser</identifier> |
---|
380 | <argument name="request"/> |
---|
381 | </active> |
---|
382 | </grammar> |
---|
383 | <request> |
---|
384 | <identifier>active:sloot.dpml</identifier> |
---|
385 | <argument name="operator">res:/interface/findUser.dpml</argument> |
---|
386 | </request> |
---|
387 | </endpoint> |
---|
388 | <endpoint> |
---|
389 | <!-- find the principal --> |
---|
390 | <id>findPrincipal</id> |
---|
391 | <grammar> |
---|
392 | <active> |
---|
393 | <identifier>active:findPrincipal</identifier> |
---|
394 | </active> |
---|
395 | </grammar> |
---|
396 | <request> |
---|
397 | <identifier>active:sloot.dpml</identifier> |
---|
398 | <argument name="operator">res:/interface/findPrincipal.dpml</argument> |
---|
399 | </request> |
---|
400 | </endpoint> |
---|
401 | <endpoint> |
---|
402 | <!-- true if requester (from scratchpad) is present in authorized IDs or has an authorized role--> |
---|
403 | <id>isAuthorized</id> |
---|
404 | <grammar> |
---|
405 | <active> |
---|
406 | <identifier>active:isAuthorized</identifier> |
---|
407 | <argument name="authorizedIDs" min="1" max="1"/> |
---|
408 | <argument name="authorizedRoles" min="1" max="1"/> |
---|
409 | </active> |
---|
410 | </grammar> |
---|
411 | <request> |
---|
412 | <identifier>active:sloot.dpml</identifier> |
---|
413 | <argument name="operator">res:/interface/isAuthorized.dpml</argument> |
---|
414 | <argument name="authorizedIDs">arg:authorizedIDs</argument> |
---|
415 | <argument name="authorizedRoles">arg:authorizedRoles</argument> |
---|
416 | </request> |
---|
417 | </endpoint> |
---|
418 | <endpoint> |
---|
419 | <grammar> |
---|
420 | <active> |
---|
421 | <identifier>active:interface.rest.HTTPresponse.forbidden</identifier> |
---|
422 | </active> |
---|
423 | </grammar> |
---|
424 | <request> |
---|
425 | <identifier>active:groovy</identifier> |
---|
426 | <argument name="operator"> |
---|
427 | <!-- TODO: check if this is the proper way to generata a forbidden response --> |
---|
428 | <literal type="string"> |
---|
429 | context.createResponseFrom("<html lang='en' xmlns='http://www.w3.org/1999/xhtml'><body><img src='/schemacat/site/images/HTTPstatus/403-Forbidden.jpg'/></body></html>").setMimeType("text/html"); |
---|
430 | context.sink("httpResponse:/code", 403); |
---|
431 | </literal> |
---|
432 | </argument> |
---|
433 | </request> |
---|
434 | </endpoint> |
---|
435 | </config> |
---|
436 | <space> |
---|
437 | <fileset> |
---|
438 | <regex>res:/interface/.*</regex> |
---|
439 | </fileset> |
---|
440 | <fileset> |
---|
441 | <regex>res:/etc/system/LogConfig.xml</regex> |
---|
442 | </fileset> |
---|
443 | <fileset> |
---|
444 | <regex>res:/debug/.*</regex> |
---|
445 | <mutable/> |
---|
446 | </fileset> |
---|
447 | <import> |
---|
448 | <uri>urn:org:netkernel:lang:groovy</uri> |
---|
449 | </import> |
---|
450 | <import> |
---|
451 | <uri>urn:org:netkernel:json:core</uri> |
---|
452 | </import> |
---|
453 | <import> |
---|
454 | <uri>urn:org:isocat:schemacat:access:data</uri> |
---|
455 | </import> |
---|
456 | <import> |
---|
457 | <uri>urn:org:isocat:schemacat:site</uri> |
---|
458 | </import> |
---|
459 | <import> |
---|
460 | <uri>urn:org:isocat:sloot</uri> |
---|
461 | </import> |
---|
462 | </space> |
---|
463 | </mapper> |
---|
464 | </space> |
---|
465 | </overlay> |
---|
466 | </space> |
---|
467 | </overlay> |
---|
468 | <fileset> |
---|
469 | <!--Icon--> |
---|
470 | <regex>res:/pub/(.*)</regex> |
---|
471 | <rewrite>res:/pub/$1</rewrite> |
---|
472 | </fileset> |
---|
473 | <import> |
---|
474 | <private/> |
---|
475 | <uri>urn:org:netkernel:ext:layer1</uri> |
---|
476 | </import> |
---|
477 | <import> |
---|
478 | <private/> |
---|
479 | <uri>urn:org:netkernel:tpt:http</uri> |
---|
480 | </import> |
---|
481 | </rootspace> |
---|
482 | <rootspace name="SCHEMAcat - interface - REST - Documentation Space" public="true" |
---|
483 | uri="urn:org:isocat:schemacat:interface:rest:doc"> |
---|
484 | <fileset> |
---|
485 | <regex>res:/etc/system/(Books|Docs).xml</regex> |
---|
486 | </fileset> |
---|
487 | <fileset> |
---|
488 | <regex>res:/doc/.*</regex> |
---|
489 | </fileset> |
---|
490 | </rootspace> |
---|
491 | <rootspace name="SCHEMAcat - interface - REST - Unit Test Space" public="true" |
---|
492 | uri="urn:org:isocat:schemacat:interface:rest:test"> |
---|
493 | <fileset> |
---|
494 | <regex>res:/etc/system/Tests.xml</regex> |
---|
495 | </fileset> |
---|
496 | <fileset> |
---|
497 | <regex>res:/test/.*</regex> |
---|
498 | </fileset> |
---|
499 | <endpoint> |
---|
500 | <!-- stop any configuration from module under test from polluting address space --> |
---|
501 | <prototype>Limiter</prototype> |
---|
502 | <grammar>res:/etc/<regex type="anything"/> |
---|
503 | </grammar> |
---|
504 | </endpoint> |
---|
505 | <import> |
---|
506 | <!-- import the main space which we are testing --> |
---|
507 | <uri>urn:org:isocat:schemacat:interface:rest</uri> |
---|
508 | </import> |
---|
509 | <import> |
---|
510 | <uri>urn:org:netkernel:ext:layer1</uri> |
---|
511 | <private/> |
---|
512 | </import> |
---|
513 | </rootspace> |
---|
514 | </module> |
---|