1 | <accessor debug="false" trace="false"> |
---|
2 | <name>/rest/dcs</name> |
---|
3 | <descr>Get an overview of a DCS.</descr> |
---|
4 | <param mandatory="true"> |
---|
5 | <name>method</name> |
---|
6 | <descr>what do we want to do?</descr> |
---|
7 | <type canonical="true">string</type> |
---|
8 | </param> |
---|
9 | <param mandatory="true"> |
---|
10 | <name>dcs</name> |
---|
11 | <descr>the DCS id</descr> |
---|
12 | <type canonical="true">string</type> |
---|
13 | <source> |
---|
14 | <param/> |
---|
15 | <nvp/> |
---|
16 | <default> |
---|
17 | <string>0</string> |
---|
18 | </default> |
---|
19 | </source> |
---|
20 | </param> |
---|
21 | <param> |
---|
22 | <name>tree</name> |
---|
23 | <descr>show hierarchical DC relations (false, simple, complex, true)</descr> |
---|
24 | <type canonical="true">string</type> |
---|
25 | <source> |
---|
26 | <param/> |
---|
27 | <nvp/> |
---|
28 | <default> |
---|
29 | <string>false</string> |
---|
30 | </default> |
---|
31 | </source> |
---|
32 | </param> |
---|
33 | <!-- authorization --> |
---|
34 | <param> |
---|
35 | <name>credentials</name> |
---|
36 | <descr>the users credentials</descr> |
---|
37 | <type canonical="true">string</type> |
---|
38 | <source> |
---|
39 | <param/> |
---|
40 | <default> |
---|
41 | <string>guest:guest</string> |
---|
42 | </default> |
---|
43 | </source> |
---|
44 | </param> |
---|
45 | <!-- representation --> |
---|
46 | <param> |
---|
47 | <name>representation</name> |
---|
48 | <descr>the requested representation</descr> |
---|
49 | <type canonical="true">string</type> |
---|
50 | <source> |
---|
51 | <param/> |
---|
52 | <default> |
---|
53 | <string/> |
---|
54 | </default> |
---|
55 | </source> |
---|
56 | </param> |
---|
57 | <param> |
---|
58 | <name>Accept</name> |
---|
59 | <descr>the accepted representation</descr> |
---|
60 | <type canonical="true">string</type> |
---|
61 | <source> |
---|
62 | <param/> |
---|
63 | <default> |
---|
64 | <string/> |
---|
65 | </default> |
---|
66 | </source> |
---|
67 | </param> |
---|
68 | <params/> |
---|
69 | <idoc> |
---|
70 | <accessor-debug> |
---|
71 | <instr> |
---|
72 | <type>log</type> |
---|
73 | <operand>var:method</operand> |
---|
74 | </instr> |
---|
75 | <instr> |
---|
76 | <type>log</type> |
---|
77 | <operand>var:dcs</operand> |
---|
78 | </instr> |
---|
79 | <instr> |
---|
80 | <type>log</type> |
---|
81 | <operand>var:credentials</operand> |
---|
82 | </instr> |
---|
83 | </accessor-debug> |
---|
84 | <!-- determine the user logged in --> |
---|
85 | <instr> |
---|
86 | <type>sloot.xpath2eval</type> |
---|
87 | <operand>var:credentials</operand> |
---|
88 | <operator> |
---|
89 | <xpath>substring-before(.,':')</xpath> |
---|
90 | </operator> |
---|
91 | <param> |
---|
92 | <return> |
---|
93 | <canonical/> |
---|
94 | <string/> |
---|
95 | </return> |
---|
96 | </param> |
---|
97 | <target>var:user</target> |
---|
98 | </instr> |
---|
99 | <!-- if requested make sure the DCS gets reloaded by cutting its golden thread --> |
---|
100 | <if> |
---|
101 | <cond> |
---|
102 | <instr> |
---|
103 | <type>sloot.xpath2eval</type> |
---|
104 | <operand>var:params</operand> |
---|
105 | <operator> |
---|
106 | <xpath>exists(/nvp/reload)</xpath> |
---|
107 | </operator> |
---|
108 | <target>this:cond</target> |
---|
109 | </instr> |
---|
110 | </cond> |
---|
111 | <then> |
---|
112 | <instr> |
---|
113 | <type>sloot.xquery</type> |
---|
114 | <operator> |
---|
115 | <xquery> declare variable $dcs as node() external; <string>goldenthread:/dcs/{string($dcs)}</string> </xquery> |
---|
116 | </operator> |
---|
117 | <dcs>var:dcs</dcs> |
---|
118 | <target>var:thread</target> |
---|
119 | </instr> |
---|
120 | <instr> |
---|
121 | <type>sloot.cutGoldenThread</type> |
---|
122 | <param>var:thread</param> |
---|
123 | </instr> |
---|
124 | </then> |
---|
125 | </if> |
---|
126 | <!-- determine the requested representation --> |
---|
127 | <instr> |
---|
128 | <type>ISOcat.interface.rest.dcs.determine.representation</type> |
---|
129 | <representation>var:representation</representation> |
---|
130 | <accept>var:Accept</accept> |
---|
131 | <target>var:representation</target> |
---|
132 | </instr> |
---|
133 | <!-- only the XML representation can handle a non false value for the tree param --> |
---|
134 | <if> |
---|
135 | <cond> |
---|
136 | <instr> |
---|
137 | <type>sloot.xpath2eval</type> |
---|
138 | <operand>var:representation</operand> |
---|
139 | <operator> |
---|
140 | <xpath>.='xml'</xpath> |
---|
141 | </operator> |
---|
142 | <target>this:cond</target> |
---|
143 | </instr> |
---|
144 | </cond> |
---|
145 | <then> |
---|
146 | <instr> |
---|
147 | <type>copy</type> |
---|
148 | <operand>var:tree</operand> |
---|
149 | <target>var:tree</target> |
---|
150 | </instr> |
---|
151 | </then> |
---|
152 | <else> |
---|
153 | <instr> |
---|
154 | <type>copy</type> |
---|
155 | <operand> |
---|
156 | <string>false</string> |
---|
157 | </operand> |
---|
158 | <target>var:tree</target> |
---|
159 | </instr> |
---|
160 | </else> |
---|
161 | </if> |
---|
162 | <choose> |
---|
163 | <cond> |
---|
164 | <instr> |
---|
165 | <type>sloot.xpath2eval</type> |
---|
166 | <operand>var:method</operand> |
---|
167 | <operator> |
---|
168 | <xpath>.='POST'</xpath> |
---|
169 | </operator> |
---|
170 | <target>this:cond</target> |
---|
171 | </instr> |
---|
172 | </cond> |
---|
173 | <then> |
---|
174 | <if> |
---|
175 | <cond> |
---|
176 | <instr> |
---|
177 | <type>sloot.non-exists</type> |
---|
178 | <operand>var:params</operand> |
---|
179 | <target>this:cond</target> |
---|
180 | </instr> |
---|
181 | </cond> |
---|
182 | <then> |
---|
183 | <instr> |
---|
184 | <type>throw</type> |
---|
185 | <operand> |
---|
186 | <ex> |
---|
187 | <id>ISOcat[BAD REQUEST]</id> |
---|
188 | <message>The new DCS is absent.</message> |
---|
189 | </ex> |
---|
190 | </operand> |
---|
191 | </instr> |
---|
192 | </then> |
---|
193 | </if> |
---|
194 | <accessor-debug> |
---|
195 | <instr> |
---|
196 | <type>sloot.debug</type> |
---|
197 | <debug>var:accessor-debug</debug> |
---|
198 | <operand> |
---|
199 | <msg>DBG: new DCS</msg> |
---|
200 | </operand> |
---|
201 | </instr> |
---|
202 | <instr> |
---|
203 | <type>log</type> |
---|
204 | <operand>var:params</operand> |
---|
205 | </instr> |
---|
206 | </accessor-debug> |
---|
207 | <accessor-trace name="POST"> |
---|
208 | <instr> |
---|
209 | <type>ISOcat.manage.dcs.new</type> |
---|
210 | <dcs>var:params</dcs> |
---|
211 | <credentials>var:credentials</credentials> |
---|
212 | <target>this:response</target> |
---|
213 | </instr> |
---|
214 | </accessor-trace> |
---|
215 | <accessor-debug> |
---|
216 | <instr> |
---|
217 | <type>sloot.debug</type> |
---|
218 | <debug>var:accessor-debug</debug> |
---|
219 | <operand>this:response</operand> |
---|
220 | </instr> |
---|
221 | </accessor-debug> |
---|
222 | <instr> |
---|
223 | <type>copy</type> |
---|
224 | <operand> |
---|
225 | <HTTPResponseCode> |
---|
226 | <code>201</code> |
---|
227 | </HTTPResponseCode> |
---|
228 | </operand> |
---|
229 | <target>var:code</target> |
---|
230 | </instr> |
---|
231 | <instr> |
---|
232 | <type>HTTPResponseCode</type> |
---|
233 | <operand>this:response</operand> |
---|
234 | <param>var:code</param> |
---|
235 | <target>this:response</target> |
---|
236 | </instr> |
---|
237 | </then> |
---|
238 | <cond> |
---|
239 | <instr> |
---|
240 | <type>sloot.xpath2eval</type> |
---|
241 | <operand>var:method</operand> |
---|
242 | <operator> |
---|
243 | <xpath>.='PUT'</xpath> |
---|
244 | </operator> |
---|
245 | <target>this:cond</target> |
---|
246 | </instr> |
---|
247 | </cond> |
---|
248 | <then> |
---|
249 | <if> |
---|
250 | <cond> |
---|
251 | <instr> |
---|
252 | <type>sloot.non-exists</type> |
---|
253 | <operand>var:params</operand> |
---|
254 | <target>this:cond</target> |
---|
255 | </instr> |
---|
256 | </cond> |
---|
257 | <then> |
---|
258 | <instr> |
---|
259 | <type>throw</type> |
---|
260 | <operand> |
---|
261 | <ex> |
---|
262 | <id>ISOcat[BAD REQUEST]</id> |
---|
263 | <message>The DCS update is absent.</message> |
---|
264 | </ex> |
---|
265 | </operand> |
---|
266 | </instr> |
---|
267 | </then> |
---|
268 | </if> |
---|
269 | <accessor-debug> |
---|
270 | <instr> |
---|
271 | <type>sloot.debug</type> |
---|
272 | <debug>var:accessor-debug</debug> |
---|
273 | <operand> |
---|
274 | <msg>DBG: update DCS</msg> |
---|
275 | </operand> |
---|
276 | </instr> |
---|
277 | <instr> |
---|
278 | <type>log</type> |
---|
279 | <operand>var:params</operand> |
---|
280 | </instr> |
---|
281 | </accessor-debug> |
---|
282 | <accessor-trace name="PUT"> |
---|
283 | <instr> |
---|
284 | <type>ISOcat.manage.dcs.update</type> |
---|
285 | <id>var:dcs</id> |
---|
286 | <dcs>var:params</dcs> |
---|
287 | <credentials>var:credentials</credentials> |
---|
288 | <target>this:response</target> |
---|
289 | </instr> |
---|
290 | </accessor-trace> |
---|
291 | <accessor-debug> |
---|
292 | <instr> |
---|
293 | <type>sloot.debug</type> |
---|
294 | <debug>var:accessor-debug</debug> |
---|
295 | <operand>this:response</operand> |
---|
296 | </instr> |
---|
297 | </accessor-debug> |
---|
298 | </then> |
---|
299 | <cond> |
---|
300 | <instr> |
---|
301 | <type>sloot.xpath2eval</type> |
---|
302 | <operand>var:method</operand> |
---|
303 | <operator> |
---|
304 | <xpath>.='DELETE'</xpath> |
---|
305 | </operator> |
---|
306 | <target>this:cond</target> |
---|
307 | </instr> |
---|
308 | </cond> |
---|
309 | <then> |
---|
310 | <instr> |
---|
311 | <type>ISOcat.manage.dcs.delete</type> |
---|
312 | <dcs>var:dcs</dcs> |
---|
313 | <credentials>var:credentials</credentials> |
---|
314 | <target>this:response</target> |
---|
315 | </instr> |
---|
316 | <instr> |
---|
317 | <type>copy</type> |
---|
318 | <operand> |
---|
319 | <string>xml</string> |
---|
320 | </operand> |
---|
321 | <target>var:representation</target> |
---|
322 | </instr> |
---|
323 | </then> |
---|
324 | <else> |
---|
325 | <accessor-trace name="GET"> |
---|
326 | <instr> |
---|
327 | <type>ISOcat.manage.dcs</type> |
---|
328 | <dcs>var:dcs</dcs> |
---|
329 | <credentials>var:credentials</credentials> |
---|
330 | <tree>var:tree</tree> |
---|
331 | <target>var:result</target> |
---|
332 | </instr> |
---|
333 | <accessor-debug> |
---|
334 | <instr> |
---|
335 | <type>log</type> |
---|
336 | <operand>var:result</operand> |
---|
337 | </instr> |
---|
338 | </accessor-debug> |
---|
339 | </accessor-trace> |
---|
340 | <accessor-trace name="prune"> |
---|
341 | <if> |
---|
342 | <cond> |
---|
343 | <instr> |
---|
344 | <type>sloot.xpath2eval</type> |
---|
345 | <operand>var:result</operand> |
---|
346 | <operator> |
---|
347 | <xpath>exists(/dcs/dc[scope!='public'])</xpath> |
---|
348 | </operator> |
---|
349 | <target>this:cond</target> |
---|
350 | </instr> |
---|
351 | </cond> |
---|
352 | <then> |
---|
353 | <!-- remove DCs which the user doesn't have access to --> |
---|
354 | <instr> |
---|
355 | <type>ISOcat.manage.user.all</type> |
---|
356 | <credentials>var:credentials</credentials> |
---|
357 | <user>var:user</user> |
---|
358 | <target>var:access</target> |
---|
359 | </instr> |
---|
360 | <instr> |
---|
361 | <type>sloot.xquery</type> |
---|
362 | <operator> |
---|
363 | <dcs> |
---|
364 | { $result/dcs/@* } |
---|
365 | { for $dc in $result/dcs/dc where exists($access//dc[@ref=$dc/@ref]) return $dc } |
---|
366 | </dcs> |
---|
367 | </operator> |
---|
368 | <result>var:result</result> |
---|
369 | <access>var:access</access> |
---|
370 | <target>this:response</target> |
---|
371 | </instr> |
---|
372 | <accessor-debug> |
---|
373 | <instr> |
---|
374 | <type>log</type> |
---|
375 | <operand>this:response</operand> |
---|
376 | </instr> |
---|
377 | </accessor-debug> |
---|
378 | </then> |
---|
379 | <else> |
---|
380 | <instr> |
---|
381 | <type>copy</type> |
---|
382 | <operand>var:result</operand> |
---|
383 | <target>this:response</target> |
---|
384 | </instr> |
---|
385 | </else> |
---|
386 | </if> |
---|
387 | </accessor-trace> |
---|
388 | </else> |
---|
389 | </choose> |
---|
390 | <instr> |
---|
391 | <type>ISOcat.interface.rest.dcs.representation</type> |
---|
392 | <id>var:dcs</id> |
---|
393 | <dcs>this:response</dcs> |
---|
394 | <representation>var:representation</representation> |
---|
395 | <credentials>var:credentials</credentials> |
---|
396 | <nvp>var:params</nvp> |
---|
397 | <target>this:response</target> |
---|
398 | </instr> |
---|
399 | </idoc> |
---|
400 | <exception> |
---|
401 | <debug/> |
---|
402 | <trace>ffcpl:/trace/dcs.exception.xml</trace> |
---|
403 | <throw/> |
---|
404 | </exception> |
---|
405 | <response> |
---|
406 | <debug>ffcpl:/trace/dcs.response.xml</debug> |
---|
407 | </response> |
---|
408 | </accessor> |
---|