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 | <!-- TODO: all these .../rest/users/<user> endpoints should return some user info, the schemas would be returned from .../rest/users/<userID>/schemas --> |
---|
36 | <!-- TODO: where do we allow an optional trailing slash? .../rest/users(/)? but also .../rest/users/<user>(/)? ... look around a bit, what is common practice? --> |
---|
37 | <endpoint> |
---|
38 | <meta> |
---|
39 | <rest> |
---|
40 | <method>GET</method> |
---|
41 | <simple>users/{userID:([^/]+)}{slash:(/|)}</simple> |
---|
42 | <compress/> |
---|
43 | <Etag>MD5</Etag> |
---|
44 | <preTarget>findUser</preTarget> |
---|
45 | <produces>application/json</produces> |
---|
46 | </rest> |
---|
47 | </meta> |
---|
48 | <grammar> |
---|
49 | <active> |
---|
50 | <identifier>active:org.schemacat.user.json</identifier> |
---|
51 | <argument name="userID" min="1" max="1"/> |
---|
52 | <argument name="slash"/> |
---|
53 | </active> |
---|
54 | </grammar> |
---|
55 | <request> |
---|
56 | <identifier>active:JSONFromXML</identifier> |
---|
57 | <argument name="operand"> |
---|
58 | <request> |
---|
59 | <identifier>active:sloot.dpml</identifier> |
---|
60 | <argument name="operator">res:/interface/user.dpml</argument> |
---|
61 | <argument name="userID" method="as-string">arg:userID</argument> |
---|
62 | </request> |
---|
63 | </argument> |
---|
64 | </request> |
---|
65 | </endpoint> |
---|
66 | <endpoint> |
---|
67 | <meta> |
---|
68 | <rest> |
---|
69 | <method>GET</method> |
---|
70 | <simple>users/{userID:([^/]+)}{slash:(/|)}</simple> |
---|
71 | <compress/> |
---|
72 | <Etag>MD5</Etag> |
---|
73 | <preTarget>findUser</preTarget> |
---|
74 | <produces>application/xml</produces> |
---|
75 | </rest> |
---|
76 | </meta> |
---|
77 | <grammar> |
---|
78 | <active> |
---|
79 | <identifier>active:org.schemacat.user.xml</identifier> |
---|
80 | <argument name="userID" min="1" max="1"/> |
---|
81 | <argument name="slash"/> |
---|
82 | </active> |
---|
83 | </grammar> |
---|
84 | <request> |
---|
85 | <identifier>active:sloot.dpml</identifier> |
---|
86 | <argument name="operator">res:/interface/user.dpml</argument> |
---|
87 | <argument name="userID" method="as-string">arg:userID</argument> |
---|
88 | </request> |
---|
89 | </endpoint> |
---|
90 | <!-- |
---|
91 | <endpoint> |
---|
92 | <!-/- the user isn't specified in the endpoint URL and it has a trailling slash /, use the requester ID from the scratch pad -/-> |
---|
93 | <meta> |
---|
94 | <rest> |
---|
95 | <method>GET</method> |
---|
96 | <simple>users/</simple> |
---|
97 | <compress/> |
---|
98 | <Etag>MD5</Etag> |
---|
99 | <preTarget>findUser</preTarget> |
---|
100 | <produces>application/xml</produces> |
---|
101 | </rest> |
---|
102 | </meta> |
---|
103 | <grammar> |
---|
104 | <active> |
---|
105 | <identifier>active:org.schemacat.user.xml</identifier> |
---|
106 | <argument name="userID" min="1" max="1"/> |
---|
107 | </active> |
---|
108 | </grammar> |
---|
109 | <request> |
---|
110 | <identifier>active:sloot.dpml</identifier> |
---|
111 | <argument name="operator">res:/interface/userSchemas.dpml</argument> |
---|
112 | <argument name="userID"> |
---|
113 | <request> |
---|
114 | <identifier>active:sloot.xpath2</identifier> |
---|
115 | <argument name="operand">scratch:user</argument> |
---|
116 | <argument name="operator"> |
---|
117 | <literal type="string">string(/sc:user/@xml:id)</literal> |
---|
118 | </argument> |
---|
119 | </request> |
---|
120 | </argument> |
---|
121 | </request> |
---|
122 | </endpoint> |
---|
123 | <endpoint> |
---|
124 | <!-/- no trailling slash /, resource refers to all the users -/-> |
---|
125 | <meta> |
---|
126 | <rest> |
---|
127 | <method>GET</method> |
---|
128 | <simple>users</simple> |
---|
129 | <compress/> |
---|
130 | <Etag>MD5</Etag> |
---|
131 | <preTarget>findUser</preTarget> |
---|
132 | <produces>application/xml</produces> |
---|
133 | </rest> |
---|
134 | </meta> |
---|
135 | <grammar> |
---|
136 | <active> |
---|
137 | <identifier>active:org.schemacat.user.xml</identifier> |
---|
138 | </active> |
---|
139 | </grammar> |
---|
140 | <request> |
---|
141 | <identifier>active:sloot.dpml</identifier> |
---|
142 | <argument name="operator">res:/interface/users.dpml</argument> |
---|
143 | <argument name="userID"> |
---|
144 | <request> |
---|
145 | <identifier>active:sloot.xpath2</identifier> |
---|
146 | <argument name="operand">scratch:user</argument> |
---|
147 | <argument name="operator"> |
---|
148 | <literal type="string">string(/sc:user/@xml:id)</literal> |
---|
149 | </argument> |
---|
150 | </request> |
---|
151 | </argument> |
---|
152 | </request> |
---|
153 | </endpoint>--> |
---|
154 | <endpoint> |
---|
155 | <meta> |
---|
156 | <rest> |
---|
157 | <method>GET</method> |
---|
158 | <simple>users/{userID}/schemas</simple> |
---|
159 | <compress/> |
---|
160 | <Etag>MD5</Etag> |
---|
161 | <preTarget>findUser</preTarget> |
---|
162 | <produces>application/json</produces> |
---|
163 | </rest> |
---|
164 | </meta> |
---|
165 | <grammar> |
---|
166 | <active> |
---|
167 | <identifier>active:org.schemacat.user.schemas.json</identifier> |
---|
168 | <argument name="userID" min="1" max="1"/> |
---|
169 | </active> |
---|
170 | </grammar> |
---|
171 | <request> |
---|
172 | <identifier>active:JSONFromXML</identifier> |
---|
173 | <argument name="operand"> |
---|
174 | <request> |
---|
175 | <identifier>active:sloot.dpml</identifier> |
---|
176 | <argument name="operator">res:/interface/userSchemas.dpml</argument> |
---|
177 | <argument method="as-string" name="userID">arg:userID</argument> |
---|
178 | </request> |
---|
179 | </argument> |
---|
180 | </request> |
---|
181 | </endpoint> |
---|
182 | <endpoint> |
---|
183 | <meta> |
---|
184 | <rest> |
---|
185 | <method>GET</method> |
---|
186 | <simple>users/{userID}/schemas</simple> |
---|
187 | <compress/> |
---|
188 | <Etag>MD5</Etag> |
---|
189 | <preTarget>findUser</preTarget> |
---|
190 | <produces>application/xml</produces> |
---|
191 | </rest> |
---|
192 | </meta> |
---|
193 | <grammar> |
---|
194 | <active> |
---|
195 | <identifier>active:org.schemacat.user.schemas.xml</identifier> |
---|
196 | <argument name="userID" min="1" max="1"/> |
---|
197 | </active> |
---|
198 | </grammar> |
---|
199 | <request> |
---|
200 | <identifier>active:sloot.dpml</identifier> |
---|
201 | <argument name="operator">res:/interface/userSchemas.dpml</argument> |
---|
202 | <argument method="as-string" name="userID">arg:userID</argument> |
---|
203 | </request> |
---|
204 | </endpoint> |
---|
205 | <endpoint> |
---|
206 | <!-- this falls through to the urn.org.isocat.schemacat.site module --> |
---|
207 | <meta> |
---|
208 | <rest> |
---|
209 | <simple>site{file:(?i)(/index.html|/index.htm|/|)}</simple> |
---|
210 | <compress/> |
---|
211 | <Etag>MD5</Etag> |
---|
212 | <preTarget>findUser</preTarget> |
---|
213 | </rest> |
---|
214 | </meta> |
---|
215 | <grammar> |
---|
216 | <active> |
---|
217 | <identifier>active:org.schemacat.rest.index</identifier> |
---|
218 | <argument name="file"/> |
---|
219 | </active> |
---|
220 | </grammar> |
---|
221 | <request> |
---|
222 | <identifier>active:org.schemacat.site.index</identifier> |
---|
223 | </request> |
---|
224 | </endpoint> |
---|
225 | <endpoint> |
---|
226 | <meta> |
---|
227 | <rest> |
---|
228 | <simple>site/{file}</simple> |
---|
229 | <compress/> |
---|
230 | <Etag>MD5</Etag> |
---|
231 | </rest> |
---|
232 | </meta> |
---|
233 | <grammar>res:/schemacat/<group name="file"><regex type="anything"/></group></grammar> |
---|
234 | <request> |
---|
235 | <identifier>res:/schemacat/site/[[arg:file]]</identifier> |
---|
236 | </request> |
---|
237 | </endpoint> |
---|
238 | <endpoint> |
---|
239 | <!-- find user info --> |
---|
240 | <id>findUser</id> |
---|
241 | <grammar> |
---|
242 | <active> |
---|
243 | <identifier>active:findUser</identifier> |
---|
244 | <argument name="request"/> |
---|
245 | </active> |
---|
246 | </grammar> |
---|
247 | <request> |
---|
248 | <identifier>active:sloot.dpml</identifier> |
---|
249 | <argument name="operator">res:/interface/findUser.dpml</argument> |
---|
250 | </request> |
---|
251 | </endpoint> |
---|
252 | <endpoint> |
---|
253 | <!-- find the principal --> |
---|
254 | <id>findPrincipal</id> |
---|
255 | <grammar> |
---|
256 | <active> |
---|
257 | <identifier>active:findPrincipal</identifier> |
---|
258 | </active> |
---|
259 | </grammar> |
---|
260 | <request> |
---|
261 | <identifier>active:sloot.dpml</identifier> |
---|
262 | <argument name="operator">res:/interface/findPrincipal.dpml</argument> |
---|
263 | </request> |
---|
264 | </endpoint> |
---|
265 | <endpoint> |
---|
266 | <!-- true if requester is admin or authorized (owner or reader) --> |
---|
267 | <id>isAuthorized</id> |
---|
268 | <grammar> |
---|
269 | <active> |
---|
270 | <identifier>active:isAuthorized</identifier> |
---|
271 | <argument name="authorizedIDs" min="1" max="1"/> |
---|
272 | </active> |
---|
273 | </grammar> |
---|
274 | <request> |
---|
275 | <identifier>active:sloot.dpml</identifier> |
---|
276 | <argument name="operator">res:/interface/isAuthorized.dpml</argument> |
---|
277 | <argument name="authorizedIDs">arg:authorizedIDs</argument> |
---|
278 | </request> |
---|
279 | </endpoint> |
---|
280 | </config> |
---|
281 | <space> |
---|
282 | <fileset> |
---|
283 | <regex>res:/interface/.*</regex> |
---|
284 | </fileset> |
---|
285 | <fileset> |
---|
286 | <regex>res:/etc/system/LogConfig.xml</regex> |
---|
287 | </fileset> |
---|
288 | <fileset> |
---|
289 | <regex>res:/debug/.*</regex> |
---|
290 | <mutable/> |
---|
291 | </fileset> |
---|
292 | <import> |
---|
293 | <uri>urn:org:netkernel:lang:groovy</uri> |
---|
294 | </import> |
---|
295 | <import> |
---|
296 | <uri>urn:org:netkernel:json:core</uri> |
---|
297 | </import> |
---|
298 | <import> |
---|
299 | <uri>urn:org:isocat:schemacat:access:data</uri> |
---|
300 | </import> |
---|
301 | <import> |
---|
302 | <uri>urn:org:isocat:schemacat:site</uri> |
---|
303 | </import> |
---|
304 | <import> |
---|
305 | <uri>urn:org:isocat:sloot</uri> |
---|
306 | </import> |
---|
307 | </space> |
---|
308 | </mapper> |
---|
309 | </space> |
---|
310 | </overlay> |
---|
311 | </space> |
---|
312 | </overlay> |
---|
313 | <fileset> |
---|
314 | <!--Icon--> |
---|
315 | <regex>res:/pub/(.*)</regex> |
---|
316 | <rewrite>res:/pub/$1</rewrite> |
---|
317 | </fileset> |
---|
318 | <import> |
---|
319 | <private/> |
---|
320 | <uri>urn:org:netkernel:ext:layer1</uri> |
---|
321 | </import> |
---|
322 | <import> |
---|
323 | <private/> |
---|
324 | <uri>urn:org:netkernel:tpt:http</uri> |
---|
325 | </import> |
---|
326 | </rootspace> |
---|
327 | <rootspace name="SCHEMAcat - interface - REST - Documentation Space" public="true" |
---|
328 | uri="urn:org:isocat:schemacat:interface:rest:doc"> |
---|
329 | <fileset> |
---|
330 | <regex>res:/etc/system/(Books|Docs).xml</regex> |
---|
331 | </fileset> |
---|
332 | <fileset> |
---|
333 | <regex>res:/doc/.*</regex> |
---|
334 | </fileset> |
---|
335 | </rootspace> |
---|
336 | <rootspace name="SCHEMAcat - interface - REST - Unit Test Space" public="true" |
---|
337 | uri="urn:org:isocat:schemacat:interface:rest:test"> |
---|
338 | <fileset> |
---|
339 | <regex>res:/etc/system/Tests.xml</regex> |
---|
340 | </fileset> |
---|
341 | <fileset> |
---|
342 | <regex>res:/test/.*</regex> |
---|
343 | </fileset> |
---|
344 | <endpoint> |
---|
345 | <!-- stop any configuration from module under test from polluting address space --> |
---|
346 | <prototype>Limiter</prototype> |
---|
347 | <grammar>res:/etc/<regex type="anything"/> |
---|
348 | </grammar> |
---|
349 | </endpoint> |
---|
350 | <import> |
---|
351 | <!-- import the main space which we are testing --> |
---|
352 | <uri>urn:org:isocat:schemacat:interface:rest</uri> |
---|
353 | </import> |
---|
354 | <import> |
---|
355 | <uri>urn:org:netkernel:ext:layer1</uri> |
---|
356 | <private/> |
---|
357 | </import> |
---|
358 | </rootspace> |
---|
359 | </module> |
---|