Mercurial > dive4elements > gnv-client
annotate gnv/src/main/java/de/intevation/gnv/action/WMSAction.java @ 984:cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
gnv/trunk@1167 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 07 Jun 2010 14:52:45 +0000 |
parents | d1ed5c51c0de |
children | 33198e55371c |
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; |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
16 import org.w3c.dom.Document; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
17 import org.w3c.dom.Node; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
18 import org.w3c.dom.NodeList; |
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
|
19 |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
20 import de.intevation.gnv.action.sessionmodel.DiagrammOptions; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
21 import de.intevation.gnv.action.sessionmodel.SessionModel; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
22 import de.intevation.gnv.action.sessionmodel.SessionModelFactory; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
23 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
24 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
25 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
26 import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
27 import de.intevation.gnv.artifactdatabase.objects.InputParameter; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
28 import de.intevation.gnv.artifactdatabase.objects.OutputMode; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
29 import de.intevation.gnv.artifactdatabase.objects.OutputParameter; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
30 import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
31 import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
32 import de.intevation.gnv.artifactdatabase.objects.map.Layer; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
33 import de.intevation.gnv.artifactdatabase.objects.map.MapService; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
34 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
|
35 |
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
|
36 /** |
690
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
37 * This controller is used to publish the results of the current artifact as |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
38 * WMS. The wms export mode of the artifact server is triggered which feeds a |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
39 * MapServer with the given shapefiles (path to the shapefiles is stored in the |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
40 * artifact). After calling this controller, the shapefiles are ready to be |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
41 * queried as WMS layers. |
254f062e334b
Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
684
diff
changeset
|
42 * |
684
57fa8019fbdc
Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
683
diff
changeset
|
43 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
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
|
44 */ |
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
|
45 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
|
46 |
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
|
47 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
|
48 "/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
|
49 |
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
|
50 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
|
51 "/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
|
52 |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
53 public static final String XPATH_LAYERNODESET = |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
54 "/art:meta/art:layer"; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
55 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
56 public static final String XPATH_LAYER_TITLE = |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
57 "art:title/text()"; |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
58 |
970
d91ffd0e8239
Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
705
diff
changeset
|
59 public static final String XPATH_LAYER_NAME = |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
60 "art:name/text()"; |
970
d91ffd0e8239
Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
705
diff
changeset
|
61 |
d91ffd0e8239
Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
705
diff
changeset
|
62 public static final String XPATH_TTL = |
d91ffd0e8239
Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
705
diff
changeset
|
63 "/art:meta/art:mapserver/art:ttl/text()"; |
984
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
64 |
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
65 public static final String XPATH_BBOX = |
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
66 "/art:meta/art:mapserver/art:Box/art:coordinates/text()"; |
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
|
67 |
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
|
68 /** |
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
|
69 * 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
|
70 */ |
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
|
71 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
|
72 |
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
|
73 /** |
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
|
74 * 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
|
75 */ |
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
|
76 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
|
77 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
|
78 } |
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
|
79 |
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
|
80 @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
|
81 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
|
82 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
|
83 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
|
84 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
|
85 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
|
86 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
|
87 request); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
88 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
89 OutputMode outputMode = sm.getOutputMode("wms"); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
90 Collection<InputParameter> ips = null; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
91 if (outputMode != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
92 Collection<OutputParameter> inputParameter = |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
93 outputMode.getOutputParameters(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
94 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
95 if (inputParameter != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
96 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
|
97 Iterator<OutputParameter> it = inputParameter.iterator(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
98 DiagrammOptions diagrammOptions = new DiagrammOptions(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
99 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
100 int params = 0; |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
101 while (it.hasNext()) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
102 String name = it.next().getName(); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
103 String[] values = request.getParameterValues(name); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
104 String value = request.getParameter(name); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
105 InputParameter ip = new DefaultInputParameter(name, |
705
f550bd27a3f1
Html characters in strings inserted by the user are quoted (issue221).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
690
diff
changeset
|
106 encode(values)); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
107 ips.add(ip); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
108 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
109 if (value != null) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
110 ++params; |
705
f550bd27a3f1
Html characters in strings inserted by the user are quoted (issue221).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
690
diff
changeset
|
111 diagrammOptions.setValue(name, encode(value)); |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
112 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
113 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
114 |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
115 if (params > 0) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
116 sm.setDiagrammOptions(diagrammOptions); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
117 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
118 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
119 } |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
120 |
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
|
121 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
|
122 |
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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 |
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
|
129 // do wms publishing |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
130 Document meta = adc.publishWMS(artifactfactory,artifact,ips); |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
131 |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
132 // read the Server-information |
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
|
133 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
|
134 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
|
135 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
|
136 meta, XPATH_MAPSERVER_MAPFILE); |
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
|
137 String tmpTTL = XMLUtils.getStringXPath( |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
138 meta, XPATH_TTL); |
984
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
139 |
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
140 String bbox = XMLUtils.getStringXPath(meta, XPATH_BBOX); |
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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 request.getLocale()); |
681
15ac78a91d1b
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
680
diff
changeset
|
147 |
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
|
148 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
|
149 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
|
150 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
|
151 } |
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
|
152 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
|
153 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
|
154 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
|
155 |
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
|
156 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
|
157 } |
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
|
158 } |
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
|
159 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
160 if (logger.isDebugEnabled()) { |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
161 logger.debug("Mapserver path: " + mapserverPath); |
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
162 logger.debug("Mapfile path: " + mapfilePath); |
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
|
163 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
|
164 } |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
165 // read the layer information |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
166 |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
167 NodeList layerNodes = XMLUtils.getNodeSetXPath(meta, |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
168 XPATH_LAYERNODESET); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
169 Collection<Layer> layers = null; |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
170 if (layerNodes != null && layerNodes.getLength() > 0){ |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
171 layers = new ArrayList<Layer>(layerNodes.getLength()); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
172 for (int i = 0 ; i < layerNodes.getLength(); i++){ |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
173 Node tmpLayerNode = layerNodes.item(i); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
174 String layerName = XMLUtils.getStringXPath( |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
175 tmpLayerNode, XPATH_LAYER_NAME); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
176 String layerTitle = XMLUtils.getStringXPath( |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
177 tmpLayerNode, XPATH_LAYER_TITLE); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
178 // TODO: write layerTitle to title and not to id |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
179 Layer currentLayer = new DefaultLayer(layerTitle, layerName, |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
180 false, null); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
181 layers.add(currentLayer); |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
182 } |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
183 } |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
184 |
668
ccd47d9887ec
Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
585
diff
changeset
|
185 |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
186 |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
187 |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
188 // TODO PUT MAPFILEPATH AND TTL to MapServiceObject |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
189 |
681
15ac78a91d1b
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
680
diff
changeset
|
190 if (mapserverPath != null && |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
191 mapfilePath != null) { |
677
8315b0a40329
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
676
diff
changeset
|
192 request.setAttribute("wms_published", Boolean.TRUE); |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
193 |
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
194 MapService mapService = new DefaultMapService("0815", layers, |
984
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
195 "UMN", mapserverPath, |
cfc7bd35ee0b
Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents:
976
diff
changeset
|
196 bbox); |
976
d1ed5c51c0de
Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents:
970
diff
changeset
|
197 sm.setLocalMapService(mapService); |
676
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
198 return super.execute(mapping, form, request, response); |
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
199 }else{ |
970
d91ffd0e8239
Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
705
diff
changeset
|
200 return super.execute(mapping, form, request, response); |
676
707e142e7d44
Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents:
668
diff
changeset
|
201 } |
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
|
202 } |
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
|
203 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
|
204 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
|
205 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
|
206 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
|
207 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
|
208 |
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
|
209 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
|
210 } |
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
|
211 } |
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
|
212 } |
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
|
213 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |