source: cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.interface.rest/module.xml @ 3423

Last change on this file since 3423 was 3423, checked in by andmor, 11 years ago

Added 'lang:groovy' import (used to resolve the cookie value).

File size: 11.0 KB
Line 
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>user/{user}</simple>
92                                 <compress/>
93                                 <Etag>MD5</Etag>
94                                 <preTarget>findUser</preTarget>
95                                 <!--<produces>text/plain</produces>-->
96                              </rest>
97                           </meta>
98                           <grammar>
99                              <active>
100                                 <identifier>active:org.schemacat.user.workspace</identifier>
101                                 <argument name="user"/>
102                              </active>
103                           </grammar>
104                           <request>
105                              <identifier>active:sloot.dpml</identifier>
106                              <argument name="operator">res:/interface/workspace.dpml</argument>
107                              <argument method="as-string" name="user">arg:user</argument>
108                           </request>
109                           <!--<header name="mime">text/plain</header>-->
110                        </endpoint>
111                        <endpoint>
112                           <!-- this falls through to the urn.org.isocat.schemacat.site module -->
113                           <meta>
114                              <rest>
115                                 <simple>site{file:(?i)(/index.html|/index.htm|/|)}</simple>
116                                 <compress/>
117                                 <Etag>MD5</Etag>
118                                 <preTarget>findUser</preTarget>
119                              </rest>
120                           </meta>
121                           <grammar>
122                              <active>
123                                 <identifier>active:org.schemacat.rest.index</identifier>
124                                 <argument name="file"/>
125                              </active>
126                           </grammar>
127                           <request>
128                              <identifier>active:org.schemacat.site.index</identifier>
129                           </request>
130                        </endpoint>
131                        <endpoint>
132                           <meta>
133                              <rest>
134                                 <simple>{file}</simple>
135                                 <compress/>
136                                 <Etag>MD5</Etag>
137                              </rest>
138                           </meta>
139                           <grammar>res:/schemacat/<group name="file"><regex type="anything"/></group></grammar>
140                           <request>
141                              <identifier>res:/schemacat/[[arg:file]]</identifier>
142                           </request>
143                        </endpoint>
144                        <endpoint>
145                           <!-- find user info -->
146                           <id>findUser</id>
147                           <grammar>
148                              <active>
149                                 <identifier>active:findUser</identifier>
150                                 <argument name="request"/>
151                              </active>
152                           </grammar>
153                           <request>
154                              <identifier>active:sloot.dpml</identifier>
155                              <argument name="operator">res:/interface/findUser.dpml</argument>
156                           </request>
157                        </endpoint>
158                        <endpoint>
159                           <!-- find the principal -->
160                           <id>findPrincipal</id>
161                           <grammar>
162                              <active>
163                                 <identifier>active:findPrincipal</identifier>
164                              </active>
165                           </grammar>
166                           <request>
167                              <identifier>active:sloot.dpml</identifier>
168                              <argument name="operator">res:/interface/findPrincipal.dpml</argument>
169                           </request>
170                        </endpoint>
171                     </config>
172                     <space>
173                        <fileset>
174                           <regex>res:/interface/.*</regex>
175                        </fileset>
176                        <fileset>
177                           <regex>res:/etc/system/LogConfig.xml</regex>
178                        </fileset>
179                        <fileset>
180                           <regex>res:/debug/.*</regex>
181                           <mutable/>
182                        </fileset>
183                        <import>
184                           <uri>urn:org:netkernel:lang:groovy</uri>
185                        </import>
186                        <import>
187                           <uri>urn:org:isocat:schemacat:access:data</uri>
188                        </import>
189                        <import>
190                           <uri>urn:org:isocat:schemacat:site</uri>
191                        </import>
192                        <import>
193                           <uri>urn:org:isocat:sloot</uri>
194                        </import>
195                     </space>
196                  </mapper>
197               </space>
198            </overlay>
199         </space>
200      </overlay>
201      <fileset>
202         <!--Icon-->
203         <regex>res:/pub/(.*)</regex>
204         <rewrite>res:/pub/$1</rewrite>
205      </fileset>
206      <import>
207         <private/>
208         <uri>urn:org:netkernel:ext:layer1</uri>
209      </import>
210      <import>
211         <private/>
212         <uri>urn:org:netkernel:tpt:http</uri>
213      </import>
214   </rootspace>
215   <rootspace name="SCHEMAcat - interface - REST - Documentation Space" public="true"
216      uri="urn:org:isocat:schemacat:interface:rest:doc">
217      <fileset>
218         <regex>res:/etc/system/(Books|Docs).xml</regex>
219      </fileset>
220      <fileset>
221         <regex>res:/doc/.*</regex>
222      </fileset>
223   </rootspace>
224   <rootspace name="SCHEMAcat - interface - REST - Unit Test Space" public="true"
225      uri="urn:org:isocat:schemacat:interface:rest:test">
226      <fileset>
227         <regex>res:/etc/system/Tests.xml</regex>
228      </fileset>
229      <fileset>
230         <regex>res:/test/.*</regex>
231      </fileset>
232      <endpoint>
233         <!-- stop any configuration from module under test from polluting address space -->
234         <prototype>Limiter</prototype>
235         <grammar>res:/etc/<regex type="anything"/>
236         </grammar>
237      </endpoint>
238      <import>
239         <!-- import the main space which we are testing -->
240         <uri>urn:org:isocat:schemacat:interface:rest</uri>
241      </import>
242      <import>
243         <uri>urn:org:netkernel:ext:layer1</uri>
244         <private/>
245      </import>
246   </rootspace>
247</module>
Note: See TracBrowser for help on using the repository browser.