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