Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/action/WMSAction.java @ 681:15ac78a91d1b
Removed trailing whitespace.
gnv/trunk@852 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 29 Mar 2010 08:04:15 +0000 |
parents | ba3370dbc8c5 |
children | d49e8695786c |
rev | line source |
---|---|
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.gnv.action; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
3 import java.text.DateFormat; |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
4 import java.util.ArrayList; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
5 import java.util.Collection; |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
6 import java.util.Date; |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
7 import java.util.Iterator; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
8 |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.servlet.http.HttpServletRequest; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.servlet.http.HttpServletResponse; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import org.apache.log4j.Logger; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import org.apache.struts.action.ActionForm; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.apache.struts.action.ActionForward; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.apache.struts.action.ActionMapping; |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
16 import org.w3c.dom.Document; |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
17 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
18 import de.intevation.gnv.action.sessionmodel.DiagrammOptions; |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.gnv.action.sessionmodel.SessionModel; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
24 import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
25 import de.intevation.gnv.artifactdatabase.objects.InputParameter; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
26 import de.intevation.gnv.artifactdatabase.objects.OutputMode; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
27 import de.intevation.gnv.artifactdatabase.objects.OutputParameter; |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
28 import de.intevation.gnv.util.XMLUtils; |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 /** |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 */ |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 public class WMSAction extends DescribeUIAction { |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
34 |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
35 public static final String XPATH_MAPSERVER_PATH = |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
36 "/art:meta/art:mapserver/art:server/text()"; |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
37 |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
38 public static final String XPATH_MAPSERVER_MAPFILE = |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
39 "/art:meta/art:mapserver/art:map/text()"; |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
40 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
41 public static final String XPATH_LAYER_TITLE = |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
42 "/art:meta/art:layer/art:title/text()"; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
43 |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
44 public static final String XPATH_LAYER_TTL = |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
45 "/art:meta/art:layer/art:ttl/text()"; |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
46 |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 /** |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 * the logger, used to log exceptions and additonaly information |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 */ |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 private static Logger logger = Logger.getLogger(WMSAction.class); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 /** |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 * Constructor |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 */ |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 public WMSAction() { |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 super(); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 } |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 @Override |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 public ActionForward execute(ActionMapping mapping, ActionForm form, |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 HttpServletRequest request, |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 HttpServletResponse response) throws Exception { |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 logger.debug("WMSAction.execute"); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 try { |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 SessionModel sm = SessionModelFactory.getInstance().getSessionModel( |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 request); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
67 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
68 OutputMode outputMode = sm.getOutputMode("wms"); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
69 Collection<InputParameter> ips = null; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
70 if (outputMode != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
71 Collection<OutputParameter> inputParameter = |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
72 outputMode.getOutputParameters(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
73 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
74 if (inputParameter != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
75 ips = new ArrayList<InputParameter>(inputParameter.size()); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
76 Iterator<OutputParameter> it = inputParameter.iterator(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
77 DiagrammOptions diagrammOptions = new DiagrammOptions(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
78 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
79 int params = 0; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
80 while (it.hasNext()) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
81 String name = it.next().getName(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
82 String[] values = request.getParameterValues(name); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
83 String value = request.getParameter(name); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
84 InputParameter ip = new DefaultInputParameter(name, |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
85 values); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
86 ips.add(ip); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
87 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
88 if (value != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
89 ++params; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
90 diagrammOptions.setValue(name, value); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
91 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
92 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
93 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
94 if (params > 0) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
95 sm.setDiagrammOptions(diagrammOptions); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
96 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
97 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
98 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
99 |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 ArtifactObject artifact = sm.getCurrentArtifact(); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 ArtifactDatabaseClientFactory factory = |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 ArtifactDatabaseClientFactory.getInstance(); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 ArtifactDatabaseClient adc = factory.getArtifactDatabaseClient( |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 getLocale(request)); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 ArtifactObject artifactfactory = sm.getSelectedArtifactFactory(); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 // do wms publishing |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
109 Document meta = adc.publishWMS(artifactfactory,artifact,ips); |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
110 String mapserverPath = XMLUtils.getStringXPath( |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
111 meta, XPATH_MAPSERVER_PATH); |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
112 String mapfilePath = XMLUtils.getStringXPath( |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
113 meta, XPATH_MAPSERVER_MAPFILE); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
114 String layer = XMLUtils.getStringXPath( |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
115 meta, XPATH_LAYER_TITLE); |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
116 String tmpTTL = XMLUtils.getStringXPath( |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
117 meta, XPATH_LAYER_TTL); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
118 layer = layer != null ? layer : artifact.getId(); |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
119 |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
120 String ttl = null; |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
121 if (tmpTTL != null) { |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
122 DateFormat df = DateFormat.getDateTimeInstance( |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
123 DateFormat.LONG, |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
124 DateFormat.LONG, |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
125 request.getLocale()); |
681
15ac78a91d1b
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
680
diff
changeset
|
126 |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
127 try { |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
128 long tmp = Long.parseLong(tmpTTL); |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
129 ttl = df.format(new Date(tmp)); |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
130 } |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
131 catch (NumberFormatException nfe) { |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
132 logger.error("Error while parsing time to live."); |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
133 logger.error(nfe,nfe); |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
134 |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
135 ttl = ""; |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
136 } |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
137 } |
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
138 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
139 if (logger.isDebugEnabled()) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
140 logger.debug("Mapserver path: " + mapserverPath); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
141 logger.debug("Mapfile path: " + mapfilePath); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
142 logger.debug("Layer title: " + layer); |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
143 logger.debug("Layer ttl: " + ttl); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
144 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
145 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
146 request.setAttribute("wms", true); |
585
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
147 request.setAttribute("mapserver", mapserverPath); |
2e690cb2247c
Show information about MapServer path and layer name after publishing calculated shapefiles as wms. Use MapServer settings configured in conf.xml to feed OpenLayers client.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
570
diff
changeset
|
148 request.setAttribute("mapfile", mapfilePath); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
149 request.setAttribute("layer", layer); |
680
ba3370dbc8c5
Parse time to live of a wms-layer from meta document and show it in html gui (issue197).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
677
diff
changeset
|
150 request.setAttribute("ttl", ttl); |
681
15ac78a91d1b
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
680
diff
changeset
|
151 if (mapserverPath != null && |
676
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
152 mapfilePath != null && |
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
153 layer != null){ |
677
8315b0a40329
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
676
diff
changeset
|
154 request.setAttribute("wms_published", Boolean.TRUE); |
676
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
155 return super.execute(mapping, form, request, response); |
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
156 }else{ |
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
157 return super.getExceptionForward(mapping); |
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
158 } |
570
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
159 } |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
160 catch (Exception e) { |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
161 logger.error(e, e); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
162 request.setAttribute( |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
163 CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
164 e.getMessage()); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
166 return super.getExceptionForward(mapping); |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
167 } |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
168 } |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
169 |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
170 } |
cbd397712ecf
Render an OpenLayers map with the layer even published after triggering shapefile and mapfile creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
171 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |