annotate flys-artifacts/doc/datacage-config-manual/content.tex @ 5779:ebec12def170

Datacage: Add a pool of builders to make it multi threadable. XML DOM is not thread safe. Therefore the old implementation only allowed one thread to use the builder at a time. As the complexity of the configuration has increased over time this has become a bottleneck of the whole application because it took quiet some time to build a result. Furthermore the builder code path is visited very frequent. So many concurrent requests were piled up resulting in long waits for the users. To mitigate this problem a round robin pool of builders is used now. Each of the pooled builders has an independent copy of the XML template and can be run in parallel. The number of builders is determined by the system property 'flys.datacage.pool.size'. It defaults to 4.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 21 Apr 2013 12:48:09 +0200
parents 1a79d47ed14b
children
rev   line source
3244
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
1 \section{Configuration of the Datacage}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
2
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
3 \subsection{Tasks and Recommendation types of the datacage}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
4
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
5 The datacage serves two purposes.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
6 It handles automatic 'recommendations', which are instructions
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
7 sent by the client to add newly created artifacts to the collection.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
8 From a user perspective, these artifacts mainly represent curves or data
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
9 points in the resulting diagrams.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
10 The second task is to let the user add already existing artifacts (i.e.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
11 previous calculations) or new artifacts with access to related data.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
12
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
13 Irrelevant of the type of elements (recommendations or user picked data) the
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
14 datacage can iterate over possible artifacts by accessing its own database.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
15 Thus, to create a list of matching entries, database queries are used.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
16
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
17 \subsection{Structure of the datacage configuration file meta-data.conf}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
18
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
19 The datacages behaviour is defined in the file conf/meta-data.xml .
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
20
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
21 In meta-data.xml, database queries are defined as \verb!<dc:statement>! elements,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
22 for example
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
23 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
24 <dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
25 SELECT id AS prot_id,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
26 description AS prot_description
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
27 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
28 </dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
29 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
30
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
31 As can be seen from the example, the datacage configuration file can maintain
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
32 its own stack of variables (\${river\_id} in above example).
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
33
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
34 The database query will usually deliver one or many results, over which is
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
35 iterated using the \verb!<dc:elements>! elements.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
36
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
37 Information from this results can be used for two goals.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
38 It can be taken as output, in which
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
39 case the client will either request the creation of these artifacts (considering
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
40 recommendations), or shown by the client in a the 'datacage widget',
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
41 the graphical representation of data which can be added in the current
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
42 context. The later is seen when the user clicks on the Datacage button in
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
43 a diagram.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
44 Or information can be used to feed a second (or third...) database query.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
45 Following above example:
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
46
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
47 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
48 <dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
49 SELECT id AS prot_id,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
50 description AS prot_description
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
51 FROM wsts WHERE kind = 1 AND river_id = ${river_id}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
52 </dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
53 <dc:elements>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
54 <additional>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
55 <dc:attribute name="name" value="${prot_description}"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
56 <dc:context>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
57 <dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
58 SELECT id AS prot_column_id,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
59 name AS prot_column_name,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
60 position AS prot_rel_pos
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
61 FROM wst_columns WHERE wst_id = ${prot_id}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
62 ORDER by position
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
63 </dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
64 <!-- ... -->
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
65 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
66
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
67 In both cases, an \verb!<dc:elements>! element makes database queries available.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
68 Also
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
69 note how the variables are defined in the first query and reused in the second
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
70 query (\$\{prot\_it\}).
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
71
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
72 Any alement not prefixed with "dc" represents a (sub-) node in the resulting
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
73 tree. The client will display these nodes and maybe subnodes in the datacage
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
74 widget - \verb!<additional>! in above example. The elements name is translated by
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
75 the client.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
76
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
77 While iterating the final results, \verb!<dc:attributes>! have to be specified
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
78 to define how the artifact is to be created.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
79
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
80 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
81 <dc:elements>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
82 <column>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
83 <dc:attribute name="name" value="${prot_column_name}"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
84 <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
85 <dc:attribute name="factory" value="staticwkms"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
86 </column>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
87 </dc:elements>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
88 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
89
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
90 The "name" attribute is what is to be displayed in the client, the "ids" are given
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
91 to the server and pass important information about the chosen data.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
92 The "factory" is chosen according to the type of data displayed.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
93
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
94 So far, three other elements have not yet been mentioned: \verb!<dc:comment>!,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
95 \verb!<dc:if>! and the \verb!<dc:when><dc:otherwise>! structure.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
96 \verb!<dc:comment>! is an element to allow comments. Choose these over standard
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
97 \verb=<!-- -->= xml comments, because they are not transferred to the client.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
98 \verb!<dc:if>! and \verb!<dc:when>! allow control (rather: definition) flow within
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
99 the configuration and work in analogy to the XSL-elements \verb!<xsl:if>!
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
100 and \verb!<xsl:when>!.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
101
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
102 When dealing with the behaviour specification of the datacage, multiple
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
103 interpretations for the term "context" are possible.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
104 A \verb!<dc:context>! element essentially means a database binding. Thus each
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
105 query (\verb!<dc:statement>!) needs to be nested in its own context.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
106 Furthermore, two types of databases with own bindings exist:
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
107 The "system" (default for \verb!<dc:context>!, \verb!<dc:context connection="system">!)
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
108 context allows queries related to the backend database with existing
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
109 data (e.g. measurements).
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
110 The "user" context (\verb!<dc:context connection="user">!) allows queries against
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
111 the database which stores information about already existing artifacts and
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
112 calculations.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
113
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
114 Another connotation for the term "context" is the situation from which
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
115 the datacage is queried. The standard case is a from the datacage widget.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
116 When the user opens the datacage from the graphical client, this is done
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
117 from one of possible multiple diagrams.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
118 When the datacage is queried, it gets as an argument the "out" of
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
119 the current artifact. The out corresponds to the diagram type.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
120
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
121 For example the inner block of
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
122
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
123 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
124 <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')">
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
125 <longitudinal_section>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
126 <dc:call-macro name="annotations"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
127 </longitudinal_section>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
128 </dc:if>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
129 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
130
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
131 will only be executed if called from the datacage within a
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
132 longitudinal\_section diagram.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
133
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
134 In the given example another concept of the datacage configuration is
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
135 encountered: Macros.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
136
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
137 Macros help to avoid duplication of parts of the document. As the datacage
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
138 of some diagrams should include the same type of data, the same query should
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
139 be executed in multiple situations.
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
140
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
141 Therefore a macro can be defined, like in
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
142
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
143 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
144 <dc:macro name="basedata_4_heightmarks-wq">
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
145 <heightmarks>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
146 <dc:context>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
147 <dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
148 SELECT id AS prot_id,
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
149 description AS prot_description
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
150 FROM wsts WHERE kind = 4 AND river_id = ${river_id}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
151 </dc:statement>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
152 <dc:elements>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
153 <!-- ... -->
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
154 </dc:macro>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
155 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
156
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
157 and invoked from another location within the document, e.g. with
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
158
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
159 \begin{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
160
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
161 <dc:call-macro name="basedata_4_heightmarks"/>
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
162 \end{lstlisting}
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
163 .
1a79d47ed14b Copied content from doc/datacage.txt to doc/datacage-config-manual (texed).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
diff changeset
164

http://dive4elements.wald.intevation.org