Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java @ 1065:cf421645a2d3
Made cache statistics available as MBeans (eg in JConsole).
gnv-artifacts/trunk@1157 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 04 Jun 2010 08:47:52 +0000 |
parents | 05bf8534a35a |
children | f953c9a559d8 |
rev | line source |
---|---|
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.artifacts; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.DefaultArtifact; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import de.intevation.artifactdatabase.XMLUtils; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 |
491
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
6 import de.intevation.artifacts.ArtifactNamespaceContext; |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import de.intevation.artifacts.CallContext; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import de.intevation.artifacts.CallMeta; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.apache.log4j.Logger; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Document; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Element; |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 /** |
789
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
18 * The default gnv artifact. The only thing defined here is a method to append |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
19 * the selected fis to the describe document. |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
20 * |
780
c4156275c1e1
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
725
diff
changeset
|
21 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 */ |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 public class GNVDefaultArtifact extends DefaultArtifact { |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
789
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
27 /** |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
28 * |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
29 */ |
725
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
491
diff
changeset
|
30 public static final String EXCEPTION_NO_INPUT = "no.input.data"; |
dde7f51dbe1e
Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
491
diff
changeset
|
31 |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 |
789
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
33 /** |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
34 * Constructor. |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
35 */ |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 public GNVDefaultArtifact() { |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 super(); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 } |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 |
789
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
41 /** |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
42 * Append the selected fis to the describe document. |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
43 * |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
44 * @param document |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
45 * @param staticNode |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
46 * @param context |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
47 * @param fisName |
0dc115cbef0d
Added javadoc for artifact package.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
780
diff
changeset
|
48 */ |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 protected void appendFis( |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 Document document, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 Element staticNode, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 CallContext context, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 String fisName |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 ) { |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 RessourceFactory resource = RessourceFactory.getInstance(); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 CallMeta callMeta = (CallMeta) context.getMeta(); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator( |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 document, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 XMLUtils.XFORM_URL, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 XMLUtils.XFORM_PREFIX |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 ); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 |
491
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
64 XMLUtils.ElementCreator artCreator = new XMLUtils.ElementCreator( |
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
65 document, |
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
66 ArtifactNamespaceContext.NAMESPACE_URI, |
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
67 ArtifactNamespaceContext.NAMESPACE_PREFIX |
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
68 ); |
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
69 |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 Element selectNode = creator.create("select1"); |
491
cbb6b592bc6f
Mark the fis select node with an attribute 'fis', which is important for the XSL sheet to create a link to step back to this point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
488
diff
changeset
|
71 artCreator.addAttr(selectNode, "fis", "true", true); |
488
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 Element labelNode = creator.create("label"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 labelNode.setTextContent( |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 resource.getRessource(callMeta.getLanguages(), "fis", "fis") |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 ); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Element choicesNode = creator.create("choices"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 Element itemNode = creator.create("item"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 creator.addAttr(itemNode, "selected", "true"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 Element choiceLabel = creator.create("label"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 choiceLabel.setTextContent(resource.getRessource( |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 callMeta.getLanguages(), |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 fisName, |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 fisName |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 )); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 Element choiceValue = creator.create("value"); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 choiceValue.setTextContent(fisName); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 itemNode.appendChild(choiceLabel); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 itemNode.appendChild(choiceValue); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 choicesNode.appendChild(itemNode); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 selectNode.appendChild(labelNode); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 selectNode.appendChild(choicesNode); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 staticNode.appendChild(selectNode); |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 } |
d265f5dc2979
Appended the selected fis to the describe document.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 } |
836
05bf8534a35a
Using unix line endings only.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
789
diff
changeset
|
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |