annotate gnv/src/main/java/de/intevation/gnv/action/WMSAction.java @ 994:541ff0db1b12

Added the informations about how the WMS which was published during the Workflow to the GUI gnv/trunk@1195 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 11 Jun 2010 08:08:33 +0000
parents 33198e55371c
children 28a0628b11b0
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 {
991
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 984
diff changeset
84 if (isSessionExhausted(request)) {
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 984
diff changeset
85 return sessionExhaustedForward(mapping, form, request, response);
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 984
diff changeset
86 }
33198e55371c Improved session handling in the gui. If a session has timed out, the user gets to the start point - the fis selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 984
diff changeset
87
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
88 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
89 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
90 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
91 request);
668
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 OutputMode outputMode = sm.getOutputMode("wms");
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
94 Collection<InputParameter> ips = null;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
95 if (outputMode != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
96 Collection<OutputParameter> inputParameter =
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
97 outputMode.getOutputParameters();
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 if (inputParameter != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
100 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
101 Iterator<OutputParameter> it = inputParameter.iterator();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
102 DiagrammOptions diagrammOptions = new DiagrammOptions();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
103
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
104 int params = 0;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
105 while (it.hasNext()) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
106 String name = it.next().getName();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
107 String[] values = request.getParameterValues(name);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
108 String value = request.getParameter(name);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
109 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
110 encode(values));
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
111 ips.add(ip);
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 if (value != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
114 ++params;
705
f550bd27a3f1 Html characters in strings inserted by the user are quoted (issue221).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 690
diff changeset
115 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
116 }
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 if (params > 0) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
120 sm.setDiagrammOptions(diagrammOptions);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
121 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
122 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
123 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
124
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
125 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
126
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 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
128 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
129 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
130 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
131 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
132
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
133 // do wms publishing
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
134 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
135
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
136 // 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
137 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
138 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
139 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
140 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
141 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
142 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
143
cfc7bd35ee0b Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents: 976
diff changeset
144 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
145 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
146 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
147 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
148 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
149 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
150 request.getLocale());
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 680
diff changeset
151
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
152 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
153 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
154 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
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 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
157 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
158 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
159
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
160 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
161 }
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
162 }
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
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
164 if (logger.isDebugEnabled()) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
165 logger.debug("Mapserver path: " + mapserverPath);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
166 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
167 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
168 }
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
169 // 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
170
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
171 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
172 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
173 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
174 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
175 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
176 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
177 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
178 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
179 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
180 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
181 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
182 // 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
183 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
184 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
185 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
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
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
189
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
190
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
191
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
192 // 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
193
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 680
diff changeset
194 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
195 mapfilePath != null) {
677
8315b0a40329 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 676
diff changeset
196 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
197
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
198 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
199 "UMN", mapserverPath,
994
541ff0db1b12 Added the informations about how the WMS which was published during the
Tim Englich <tim.englich@intevation.de>
parents: 991
diff changeset
200 bbox,ttl);
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
201 sm.setLocalMapService(mapService);
676
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
202 return super.execute(mapping, form, request, response);
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
203 }else{
970
d91ffd0e8239 Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 705
diff changeset
204 return super.execute(mapping, form, request, response);
676
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
205 }
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
206 }
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 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
208 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
209 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
210 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
211 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
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 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
214 }
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
215 }
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
216 }
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
217 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org