Skip to content

Commit cf23e6d

Browse files
committed
documentation on properties and synchronization
1 parent 8cbbb50 commit cf23e6d

File tree

6 files changed

+166
-6
lines changed

6 files changed

+166
-6
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
2+
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
3+
<article version="5.0" xmlns="http://docbook.org/ns/docbook"
4+
xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<info>
6+
<title>Synchronize directory to a collection</title>
7+
<date>3Q20</date>
8+
<keywordset>
9+
<keyword>synchronize</keyword>
10+
<keyword>filesystem</keyword>
11+
<keyword>collection</keyword>
12+
</keywordset>
13+
</info>
14+
15+
<!-- ================================================================== -->
16+
17+
<para>This article provides information on the synchronization of filesystem data to an exist-db collection.</para>
18+
19+
<!-- ================================================================== -->
20+
21+
<sect1 xml:id="intro">
22+
<title>Introduction</title>
23+
24+
<para>An editing workflow often operates on a filesystem directory that eventually may be published using exist-db.
25+
An <link xlink:href="https://search.maven.org/search?q=a:exist-db-addons">exist-db-addons</link> library,
26+
available in maven central, enables automatic publication of a directory to a collection.
27+
</para>
28+
<para>Files in a directory specified by the parameter <emphasis role="bold"
29+
>datadir</emphasis> will be synchronized to a collection specified by the parameter
30+
<emphasis role="bold">collection</emphasis> recursively. If the target collection
31+
does not exist it will be created. Files and collections that are new or newer than the
32+
one in the target collection will be written to that collection. Files and collections
33+
that are not present in the source directory will be removed from the collection, this
34+
can be turned off via a boolean parameter <emphasis role="bold"
35+
>removeNotInSource</emphasis>. Owner and group of collections and documents can be
36+
provided in parameters <emphasis role="bold">owner</emphasis> and <emphasis role="bold"
37+
>group</emphasis>, otherwise they will be the same as the owner and group of the
38+
parent collection of the provided collection parameter. After syncing cache is cleared
39+
to prevent problems, this can be turned off via boolean parameter <emphasis role="bold"
40+
>clearCache</emphasis>. NOTE that the sync will partially succeed when during
41+
syncing an exception occurs, collections and files added or removed before the exception
42+
will remain added/removed. Meant to be used as a start-up task, DataSyncTaskCron is
43+
meant to be scheduled as a cronjob. </para>
44+
</sect1>
45+
46+
<!-- ================================================================== -->
47+
48+
<sect1 xml:id="usage">
49+
<title>usage</title>
50+
<sect2>
51+
<title>Include exist-db-addons</title>
52+
<para>For example in a Dockerfile:</para>
53+
<para>
54+
<programlisting>
55+
ARG EXISTADDONSERSION=1.6
56+
COPY exist-db-addons-${EXISTADDONSERSION}.jar $EXIST_HOME/lib/
57+
ENV CLASSPATH=$EXIST_HOME/lib/exist.uber.jar:$EXIST_HOME/lib/exist-db-addons-${EXISTADDONSERSION}.jar
58+
</programlisting>
59+
</para>
60+
</sect2>
61+
<sect2>
62+
<title>configure in conf.xml</title>
63+
<para>The first job below will sync at start-up, the second will sync at 2am, <link xlink:href="../scheduler/scheduler.xml">see scheduler</link>
64+
<programlisting language="xml"><![CDATA[
65+
<job class="org.fryske_akademy.exist.jobs.DataSyncTask" type="system" period="10" repeat="0" >
66+
<parameter name="collection" value="xmldb:exist:///db/apps/teidictjson/data"/>
67+
<parameter name="datadir" value="/data"/>
68+
</job>
69+
<job class="org.fryske_akademy.exist.jobs.DataSyncTaskCron" type="system" cron-trigger="0 0 2 ? * *" >
70+
<parameter name="collection" value="xmldb:exist:///db/apps/teidictjson/data"/>
71+
<parameter name="datadir" value="/data"/>
72+
</job>
73+
]]>
74+
</programlisting></para>
75+
</sect2>
76+
</sect1>
77+
</article>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" schematypens="http://relaxng.org/ns/structure/1.0"?>
2+
<?xml-model href="http://docbook.org/xml/5.0/rng/docbook.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
3+
<article version="5.0" xmlns="http://docbook.org/ns/docbook"
4+
xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<info>
6+
<title>Application properties</title>
7+
<date>3Q20</date>
8+
<keywordset>
9+
<keyword>properties</keyword>
10+
</keywordset>
11+
</info>
12+
13+
<!-- ================================================================== -->
14+
15+
<para>This article provides information on working with property files for exist
16+
applications.</para>
17+
18+
<!-- ================================================================== -->
19+
20+
<sect1 xml:id="intro">
21+
<title>Introduction</title>
22+
23+
<para>For most applications it is a good idea to provide settings in a property file. An
24+
<link xlink:href="https://search.maven.org/search?q=a:exist-db-addons"
25+
>exist-db-addons</link> library, available in maven central, enables you to do so. </para>
26+
</sect1>
27+
28+
<!-- ================================================================== -->
29+
30+
<sect1 xml:id="usage">
31+
<title>usage</title>
32+
<sect2>
33+
<title>Include exist-db-addons</title>
34+
<para>For example in a Dockerfile:</para>
35+
<para>
36+
<programlisting>
37+
ARG EXISTADDONSERSION=1.6
38+
COPY exist-db-addons-${EXISTADDONSERSION}.jar $EXIST_HOME/lib/
39+
ENV CLASSPATH=$EXIST_HOME/lib/exist.uber.jar:$EXIST_HOME/lib/exist-db-addons-${EXISTADDONSERSION}.jar
40+
</programlisting>
41+
</para>
42+
</sect2>
43+
<sect2>
44+
<title>configure in conf.xml</title>
45+
<para><programlisting language="xml"><![CDATA[
46+
<module uri="http://exist-db.org/xquery/properties"
47+
class="org.fryske_akademy.exist.properties.PropertiesModule">
48+
<parameter name="basePath" value="/run/secrets"/>
49+
</module>
50+
]]>
51+
</programlisting></para>
52+
</sect2>
53+
<sect2>
54+
<title>use properties in xquery</title>
55+
<para><programlisting>
56+
declare namespace properties="http://exist-db.org/xquery/properties";
57+
58+
declare variable $teidictjson:props := properties:loadProperties("teidictjson.properties");
59+
60+
declare function teidictjson:getProperty($key as xs:string, $default as xs:string) as xs:string {
61+
if (map:contains($teidictjson:props,$key)) then
62+
map:get($teidictjson:props,$key)
63+
else
64+
$default
65+
};
66+
</programlisting></para>
67+
</sect2>
68+
<sect2>
69+
<title>optionally mount properties as docker secret</title>
70+
<para>In docker-compose.yml: <programlisting>
71+
secrets:
72+
- source: ${APPNAME}.properties
73+
target: teidictjson.properties
74+
mode: 0444
75+
secrets:
76+
fhwbjson.properties:
77+
external: true
78+
</programlisting></para>
79+
</sect2>
80+
</sect1>
81+
82+
83+
</article>

src/main/xar-resources/resources/scripts/bootstrap.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/xar-resources/resources/scripts/bootstrap.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/xar-resources/resources/styles/bootstrap.min.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/xar-resources/resources/styles/bootstrap.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)