source: cats/ISOcat/trunk/mod-ISOcat-manage-system/manage/dump.acc @ 5786

Last change on this file since 5786 was 5786, checked in by Menzo Windhouwer, 10 years ago

M mod-ISOcat-manage-system/module.xml
M mod-ISOcat-manage-system/manage/dump.acc

  • more complete ISOcat dump

M mod-ISOcat-site/pub/isocat.pub

  • fixed DCIF schema reference
File size: 9.6 KB
Line 
1<accessor debug="true">
2    <name>/isocat/manage/dump</name>
3    <descr>Dump ISOcat into a directory</descr>
4    <param mandatory="true">
5        <name>dir</name>
6        <descr>the directory to dump in</descr>
7        <type canonical="true">string</type>
8        <source>
9            <param/>
10            <nvp/>
11        </source>
12    </param>
13    <idoc>
14        <instr>
15            <type>sloot.xquery</type>
16            <operator>
17                <fls>
18                    <root>file://{string($dir)}</root>
19                    <recursive/>
20                </fls>
21            </operator>
22            <dir>var:dir</dir>
23            <target>var:fls</target>
24        </instr>
25        <accessor-debug>
26            <instr>
27                <type>log</type>
28                <operand>var:fls</operand>
29            </instr>
30        </accessor-debug>
31        <instr>
32            <type>fls</type>
33            <operator>var:fls</operator>
34            <target>var:res</target>
35        </instr>
36        <accessor-debug>
37            <instr>
38                <type>log</type>
39                <operand>var:res</operand>
40            </instr>
41        </accessor-debug>
42        <if>
43            <cond>
44                <instr>
45                    <type>sloot.xpath2eval</type>
46                    <operand>var:res</operand>
47                    <operator>
48                        <xpath>/fls/dir/(text())[1]='rest'</xpath>
49                    </operator>
50                    <target>this:cond</target>
51                </instr>
52            </cond>
53            <then>
54                <instr>
55                    <type>throw</type>
56                    <operand>
57                        <ex>
58                            <id>ISOcat[BAD REQUEST]</id>
59                            <message>Dump directory already contains a filled rest directory!</message>
60                        </ex>
61                    </operand>
62                </instr>
63            </then>
64            <else>
65                <!-- noop -->
66                <instr>
67                    <type>copy</type>
68                    <operand>
69                        <null/>
70                    </operand>
71                    <target>var:void</target>
72                </instr>
73            </else>
74        </if>
75        <!-- Data Categories -->
76        <instr>
77            <type>ISOcat.access.data.query</type>
78            <query>
79                <sql>
80                    SELECT
81                        id
82                    FROM
83                        core_data_category
84                    --LIMIT 1
85                    ;
86                </sql>
87            </query>
88            <target>var:dcs</target>
89        </instr>
90        <instr>
91            <type>sloot.xquery</type>
92            <operator>
93                <idoc>
94                            {
95                                for $id in $dcs//row/id return
96                                    for $ext in ('.dcif','.html','.rdf') return
97                    <instr>
98                        <type>copy</type>
99                        <operand>ffcpl:/isocat/rest/dc/{string($id)}{$ext}+method@data:text/plain,GET</operand>
100                        <target>file://{string($dir)}/rest/dc/{string($id)}{$ext}</target>
101                    </instr>
102                            }
103                            {
104                                for $id in $dcs//row/id return
105                                <instr>
106                                        <type>xslt2</type>
107                                        <operand>ffcpl:/isocat/rest/dc/{string($id)}.dcif+dcif-cleanup@data:text/plain,false+method@data:text/plain,GET</operand>
108                                        <operator>
109                                                <xsl:stylesheet
110                                                        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
111                                                        version="2.0">
112                                                        <xsl:output method="xml" encoding="utf-8"/>
113                                                       
114                                                        <xsl:template match="@*|node()">
115                                                                <xsl:copy>
116                                                                        <xsl:apply-templates select="@*|node()"/>
117                                                                </xsl:copy>
118                                                        </xsl:template>
119                                                       
120                                                        <xsl:template match="/html/head/link/@href" priority="1">
121                                                                <xsl:copy>
122                                                                        <xsl:value-of select="replace(.,'.*/interface/','/interface/')"/>
123                                                                </xsl:copy>
124                                                        </xsl:template>
125
126                                                        <xsl:template match="/html/head/script/@src" priority="1">
127                                                                <xsl:copy>
128                                                                        <xsl:value-of select="replace(.,'.*/interface/','/interface/')"/>
129                                                                </xsl:copy>
130                                                        </xsl:template>
131                                                       
132                                                </xsl:stylesheet>
133                                               
134                                        </operator>
135                                        <target>file://{string($dir)}/rest/dc/{string($id)}.html</target>
136                                </instr>
137                        }
138                        {
139                                for $id in $dcs//row/id return
140                        <instr>
141                                <type>copy</type>
142                                <operand>ffcpl:/isocat/rest/dc/{string($id)}.dcif+dcif-cleanup@data:text/plain,false+method@data:text/plain,GET</operand>
143                                <target>file://{string($dir)}/rest/dc/{string($id)}.cat</target>
144                        </instr>
145                        }
146                        <instr>
147                                <type>copy</type>
148                                <operand>ffcpl:/interface/JSXAPPS/ISOcat/css/style.css</operand>
149                                <target>file://{string($dir)}/interface/JSXAPPS/ISOcat/css/style.css</target>
150                            </instr>
151                        <instr>
152                                <type>copy</type>
153                                <operand>ffcpl:/interface/addins/jquery/js/jquery-1.6.4.js</operand>
154                                <target>file://{string($dir)}/interface/addins/jquery/js/jquery-1.6.4.js</target>
155                        </instr>
156                </idoc>
157            </operator>
158            <dir>var:dir</dir>
159            <dcs>var:dcs</dcs>
160            <target>var:dpml</target>
161        </instr>
162        <accessor-debug>
163            <instr>
164                <type>log</type>
165                <operand>var:dpml</operand>
166            </instr>
167        </accessor-debug>
168        <instr>
169            <type>dpml</type>
170            <operand>var:dpml</operand>
171            <target>var:void</target>
172        </instr>
173        <!-- Data Category Selections -->
174        <instr>
175                <type>ISOcat.access.data.query</type>
176                <query>
177                        <sql>
178                                SELECT
179                                        id
180                                FROM
181                                        core_data_category_selection
182                                --LIMIT 1
183                                ;
184                        </sql>
185                </query>
186                <target>var:dcss</target>
187        </instr>
188        <instr>
189                <type>sloot.xquery</type>
190                <operator>
191                        <idoc>
192                                {
193                                                for $id in $dcss//row/id return
194                                                for $ext in ('.dcif','.xml','.html') return
195                                <instr>
196                                        <type>copy</type>
197                                        <operand>ffcpl:/isocat/rest/dcs/{string($id)}{$ext}+method@data:text/plain,GET</operand>
198                                        <target>file://{string($dir)}/rest/dcs/{string($id)}{$ext}</target>
199                                </instr>
200                                }
201                        </idoc>
202                </operator>
203                <dir>var:dir</dir>
204                <dcss>var:dcss</dcss>
205                <target>var:dpml</target>
206        </instr>
207        <accessor-debug>
208                <instr>
209                        <type>log</type>
210                        <operand>var:dpml</operand>
211                </instr>
212        </accessor-debug>
213        <instr>
214                <type>dpml</type>
215                <operand>var:dpml</operand>
216                <target>var:void</target>
217        </instr>
218        <!-- Profiles -->
219        <instr>
220                <type>ISOcat.access.data.query</type>
221                <query>
222                        <sql>
223                                SELECT
224                                id
225                                FROM
226                                core_profile
227                                --LIMIT 1
228                                ;
229                        </sql>
230                </query>
231                <target>var:profs</target>
232        </instr>
233        <instr>
234                <type>sloot.xquery</type>
235                <operator>
236                        <idoc>
237                                {
238                                        for $id in $profs//row/id return
239                                                for $ext in ('.dcif','.xml','.html') return
240                                <instr>
241                                        <type>copy</type>
242                                        <operand>ffcpl:/isocat/rest/profile/{string($id)}{$ext}+method@data:text/plain,GET</operand>
243                                        <target>file://{string($dir)}/rest/profile/{string($id)}{$ext}</target>
244                                </instr>
245                                }
246                        </idoc>
247                </operator>
248                <dir>var:dir</dir>
249                <profs>var:profs</profs>
250                <target>var:dpml</target>
251        </instr>
252        <accessor-debug>
253                <instr>
254                        <type>log</type>
255                        <operand>var:dpml</operand>
256                </instr>
257        </accessor-debug>
258        <instr>
259                <type>dpml</type>
260                <operand>var:dpml</operand>
261                <target>var:void</target>
262        </instr>
263        <!-- Schemas -->
264        <instr>
265                <type>sloot.xquery</type>
266                <operator>
267                        <idoc>
268                                {
269                                                for $schema in ('DCIF','DCIF-1_3_2','DCIF-1_3_1','DCIF-1_3','DCIF-1_2_1','DCIF-1_2','DCIF-1_1_2','DCIF-1_1_1','DCIF-1_1','DCIF-1_0','DCR','DCR-1_2','DCR-1_1','DCR-1_0') return
270                                                for $ext in ('.html','.rng','.rnc') return
271                                <instr>
272                                        <type>copy</type>
273                                        <operand>ffcpl:/isocat/12620/schemas/{string($schema)}{$ext}</operand>
274                                        <target>file://{string($dir)}/12620/schemas/{string($schema)}{$ext}</target>
275                                </instr>
276                                }
277                        </idoc>
278                </operator>
279                <dir>var:dir</dir>
280                <target>var:dpml</target>
281        </instr>
282        <accessor-debug>
283                <instr>
284                        <type>log</type>
285                        <operand>var:dpml</operand>
286                </instr>
287        </accessor-debug>
288        <instr>
289                <type>dpml</type>
290                <operand>var:dpml</operand>
291                <target>var:void</target>
292        </instr>
293        <instr>
294            <type>copy</type>
295            <operand>
296                <html>
297                    <head>
298                        <title>ISOcat dump</title>
299                        <meta http-equiv="refresh" content="1;URL=/introspect/pluginpanel+plugin@ep:mod_ISOcat_manage_system_plugin"/>
300                    </head>
301                    <body>DONE</body>
302                </html>
303            </operand>
304            <target>this:response</target>
305        </instr>
306    </idoc>
307    <response>
308        <mime>text/html</mime>
309    </response>
310</accessor>
Note: See TracBrowser for help on using the repository browser.