source: ISOcat/trunk/mod-ISOcat-interface-rest/interface/dc-scope.acc @ 2029

Last change on this file since 2029 was 2029, checked in by mwindhouwer, 12 years ago

Initial import of all the *cats, i.e., ISOcat, RELcat and SCHEMAcat.

File size: 4.3 KB
Line 
1<accessor debug="false">
2        <name>/rest/dc/scope</name>
3        <descr>Get or set the scope of a DC.</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>dc</name>
11                <descr>the DC key</descr>
12                <type canonical="true">string</type>
13        </param>
14        <param>
15                <name>credentials</name>
16                <descr>the user credentials</descr>
17                <source>
18                        <param/>
19                        <default>data:text/plain,guest:guest</default>
20                </source>
21        </param>
22        <param>
23                <name>representation</name>
24                <descr>the requested representation</descr>
25                <type canonical="true">string</type>
26                <source>
27                        <param/>
28                        <default>
29                                <string/>
30                        </default>
31                </source>
32        </param>
33        <param>
34                <name>Accept</name>
35                <descr>the accepted representation</descr>
36                <type canonical="true">string</type>
37                <source>
38                        <param/>
39                        <default>
40                                <string/>
41                        </default>
42                </source>
43        </param>
44        <params/>
45        <idoc>
46                <!-- determine the requested representation -->
47                <if>
48                        <cond>
49                                <instr>
50                                        <type>sloot.xpath2eval</type>
51                                        <operand>var:representation</operand>
52                                        <operator>
53                                                <xpath>.=''</xpath>
54                                        </operator>
55                                        <target>this:cond</target>
56                                </instr>
57                        </cond>
58                        <then>
59                                <instr>
60                                        <type>sloot.mimeparse</type>
61                                        <accept>var:Accept</accept>
62                                        <types>xml:application/xml</types>
63                                        <target>var:representation</target>
64                                </instr>
65                        </then>
66                </if>
67                <choose>
68                        <cond>
69                                <instr>
70                                        <type>sloot.xpath2eval</type>
71                                        <operand>var:method</operand>
72                                        <operator>
73                                                <xpath>.='GET'</xpath>
74                                        </operator>
75                                        <target>this:cond</target>
76                                </instr>
77                        </cond>
78                        <then>
79                                <instr>
80                                        <type>ISOcat.manage.dc.scope</type>
81                                        <dc>var:dc</dc>
82                                        <credentials>var:credentials</credentials>
83                                        <target>var:response</target>
84                                </instr>
85                        </then>
86                        <cond>
87                                <instr>
88                                        <type>sloot.xpath2eval</type>
89                                        <operand>var:method</operand>
90                                        <operator>
91                                                <xpath>.='POST'</xpath>
92                                        </operator>
93                                        <target>this:cond</target>
94                                </instr>
95                        </cond>
96                        <then>
97                                <if>
98                                        <cond>
99                                                <instr>
100                                                        <type>sloot.non-exists</type>
101                                                        <operand>var:params</operand>
102                                                        <target>this:cond</target>
103                                                </instr>
104                                        </cond>
105                                        <then>
106                                                <instr>
107                                                        <type>throw</type>
108                                                        <operand>
109                                                                <ex>
110                                                                        <id>ISOcat[BAD REQUEST]</id>
111                                                                        <message>The DC scope update is absent.</message>
112                                                                </ex>
113                                                        </operand>
114                                                </instr>
115                                        </then>
116                                </if>
117                                <if>
118                                        <cond>
119                                                <instr>
120                                                        <type>sloot.xpath2eval</type>
121                                                        <operand>var:dc</operand>
122                                                        <operator>
123                                                                <xpath>.='0'</xpath>
124                                                        </operator>
125                                                        <target>this:cond</target>
126                                                </instr>
127                                        </cond>
128                                        <then>
129                                                <instr>
130                                                        <type>throw</type>
131                                                        <operand>
132                                                                <ex>
133                                                                        <id>ISOcat[BAD REQUEST]</id>
134                                                                        <message>The updated DC scope should already have an id.</message>
135                                                                </ex>
136                                                        </operand>
137                                                </instr>
138                                        </then>
139                                </if>
140                                <instr>
141                                        <type>ISOcat.manage.dc.scope.update</type>
142                                        <dc>var:dc</dc>
143                                        <scope>var:params</scope>
144                                        <credentials>var:credentials</credentials>
145                                        <target>var:response</target>
146                                </instr>
147                        </then>
148                        <else>
149                                <instr>
150                                        <type>throw</type>
151                                        <operand>
152                                                <ex>
153                                                        <id>ISOcat[METHOD NOT ALLOWED]</id>
154                                                        <message>This method is not suppored by this resource.</message>
155                                                </ex>
156                                        </operand>
157                                </instr>
158                        </else>
159                </choose>
160                <choose>
161                        <cond>
162                                <instr>
163                                        <type>sloot.xpath2eval</type>
164                                        <operand>var:representation</operand>
165                                        <operator>
166                                                <xpath>.='xml'</xpath>
167                                        </operator>
168                                        <target>this:cond</target>
169                                </instr>
170                        </cond>
171                        <then>
172                                <instr>
173                                        <type>cast</type>
174                                        <operand>var:response</operand>
175                                        <operator>
176                                                <cast>
177                                                        <mimetype>application/xml</mimetype>
178                                                </cast>
179                                        </operator>
180                                        <target>this:response</target>
181                                </instr>
182                        </then>
183                        <else>
184                                <instr>
185                                        <type>throw</type>
186                                        <operand>
187                                                <ex>
188                                                        <id>ISOcat[NOT FOUND]</id>
189                                                        <message>This representation isn't supported by this resource.</message>
190                                                </ex>
191                                        </operand>
192                                </instr>
193                        </else>
194                </choose>
195        </idoc>
196        <exception>
197                <debug/>
198                <trace>ffcpl:/trace/dc-scope.exception.xml</trace>
199                <throw/>
200        </exception>
201        <response>
202                <debug>ffcpl:/trace/dc-scope.response.xml</debug>
203                <expire>now</expire>
204        </response>
205</accessor>
206
Note: See TracBrowser for help on using the repository browser.