annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WMSBackgroundState.java @ 989:f3be883325ce

Add artifacts into datacage db at initial scan. flys-artifacts/trunk@2421 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 29 Jul 2011 07:56:28 +0000
parents ae198bef4ba0
children e7c1ebfc2701
rev   line source
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.states;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.util.List;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import org.apache.log4j.Logger;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
7 import org.w3c.dom.Node;
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
8
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.artifacts.CallMeta;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
11 import de.intevation.artifacts.common.utils.Config;
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
12
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import de.intevation.artifactdatabase.state.Facet;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.flys.artifacts.FLYSArtifact;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.model.WMSLayerFacet;
954
a5ea28339e5b Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
17 import de.intevation.flys.artifacts.resources.Resources;
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 public class WMSBackgroundState extends OutputState {
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
954
a5ea28339e5b Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
23 public static final String I18N_DESCRIPTION = "floodmap.wmsbackground";
a5ea28339e5b Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
24
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
25 public static final String XPATH_WMS_URL =
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
26 "/artifact-database/floodmap/background-layer/@url";
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
27
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
28 public static final String XPATH_WMS_LAYER =
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
29 "/artifact-database/floodmap/background-layer/@layer";
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
30
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
31
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
32 protected String url;
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
33 protected String layer;
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
34
954
a5ea28339e5b Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
35
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private static final Logger logger = Logger.getLogger(WMSBackgroundState.class);
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
38
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
39 @Override
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
40 public void setup(Node config) {
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
41 super.setup(config);
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
42
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
43 logger.debug("WMSBackgroundState.setup()");
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
44
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
45 this.url = Config.getStringXPath(XPATH_WMS_URL);
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
46 this.layer = Config.getStringXPath(XPATH_WMS_LAYER);
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
47 }
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
48
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
49
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 @Override
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 public Object computeInit(
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 FLYSArtifact artifact,
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 String hash,
958
ae198bef4ba0 Added configurations for river WMSe (currently for Saar, Mosel, Elbe).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 956
diff changeset
54 Object context,
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 CallMeta meta,
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 List<Facet> facets
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 ) {
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 logger.debug("WMSBackgroundState.computeInit()");
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
60 if (url == null || layer == null) {
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
61 logger.warn("No background layers currently configured:");
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
62 logger.warn("... add config for WMS url: " + XPATH_WMS_URL);
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
63 logger.warn("... add config for WMS layer: " + XPATH_WMS_LAYER);
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
64 return null;
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
65 }
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
66
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 WMSLayerFacet facet = new WMSLayerFacet(
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 0,
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 FLOODMAP_WMSBACKGROUND,
954
a5ea28339e5b Set the extent of created WMSLayerFacets.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 942
diff changeset
70 Resources.getMsg(meta, I18N_DESCRIPTION, I18N_DESCRIPTION),
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 ComputeType.INIT,
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 getID(), hash,
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
73 url);
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74
956
1cf7b4ee7b6d Made the background layer in floodmaps configurable.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 955
diff changeset
75 facet.addLayer(layer);
942
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 facets.add(facet);
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 return null;
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 }
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 }
796c54058dc4 Added artifacts/states for WMS background an river axis and a configuration for the output-defaults.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org