Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/StaticFLYSArtifact.java @ 1945:f2c14e09a8f1
Adjusted to doOut signature change.
flys-artifacts/trunk@3335 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 30 Nov 2011 10:13:16 +0000 |
parents | c62ff9e72cea |
children | baefcfba97aa |
rev | line source |
---|---|
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.util.List; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import org.apache.log4j.Logger; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import org.w3c.dom.Document; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import org.w3c.dom.Element; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import de.intevation.artifacts.ArtifactNamespaceContext; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import de.intevation.artifacts.CallContext; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.artifactdatabase.ProtocolUtils; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import de.intevation.artifactdatabase.state.Facet; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.artifactdatabase.state.Output; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import de.intevation.artifactdatabase.state.State; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.common.utils.XMLUtils.ElementCreator; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 public abstract class StaticFLYSArtifact extends FLYSArtifact { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 private static final Logger logger = |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 Logger.getLogger(StaticFLYSArtifact.class); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 @Override |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 public Document describe(Document data, CallContext cc) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 logger.debug("Describe artifact: " + identifier()); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 Document desc = XMLUtils.newDocument(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 ElementCreator creator = new ElementCreator( |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 desc, |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 ArtifactNamespaceContext.NAMESPACE_URI, |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 Element root = ProtocolUtils.createRootNode(creator); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 desc.appendChild(root); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 ProtocolUtils.appendDescribeHeader(creator, root, identifier(), hash()); |
943
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
43 root.appendChild(createOutputModes(cc, desc, creator)); |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 return desc; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
943
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
49 protected Element createOutputModes( |
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
50 CallContext cc, |
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
51 Document doc, |
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
52 ElementCreator creator) |
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
53 { |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 Element outs = ProtocolUtils.createArtNode( |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 creator, "outputmodes", null, null); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 State state = getCurrentState(cc); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 List<Output> list = state.getOutputs(); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 if (list != null && list.size() > 0) { |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
61 List<Facet> fs = facets.get(state.getID()); |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
62 if (fs != null && fs.size() > 0) { |
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
63 List<Output> generated = generateOutputs(list, fs); |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 |
1771
c62ff9e72cea
Restore mapping of state id to facets (revert, rev 3083 and 3088).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1765
diff
changeset
|
65 logger.debug("Found " + fs.size() + " current facets."); |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 if (!generated.isEmpty()) { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 ProtocolUtils.appendOutputModes( |
943
5de90b0cff8e
The WMSLayerFacet now writes the WMS URL and layernames to its XML representation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
937
diff
changeset
|
68 doc, outs, generated); |
937
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 else { |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 logger.debug("No facets found for the current state."); |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 return outs; |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 } |
9e813e9137a5
Added a monitor that creates new artifacts for default themes in charts and maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |