annotate gnv/src/main/java/de/intevation/gnv/action/WMSAction.java @ 1022:28a0628b11b0

Added license file and license header. gnv/trunk@1258 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:15:08 +0000
parents 541ff0db1b12
children
rev   line source
1022
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
1 /*
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
2 * Copyright (c) 2010 by Intevation GmbH
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
3 *
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
4 * This program is free software under the LGPL (>=v2.1)
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
5 * Read the file LGPL.txt coming with the software for details
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
6 * or visit http://www.gnu.org/licenses/ if it does not exist.
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
diff changeset
7 */
28a0628b11b0 Added license file and license header.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 994
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 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
10
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
11 import java.text.DateFormat;
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
12 import java.util.ArrayList;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
13 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
14 import java.util.Date;
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
15 import java.util.Iterator;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
16
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
17 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
18 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
19
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 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
21 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
22 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
23 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
24 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
25 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
26 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
27
976
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.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
29 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
30 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
31 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
32 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
33 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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 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
42 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
43
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 /**
690
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
45 * 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
46 * 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
47 * 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
48 * artifact). After calling this controller, the shapefiles are ready to be
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
49 * queried as WMS layers.
254f062e334b Added JavaDoc.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 684
diff changeset
50 *
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
51 * @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
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 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
54
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
55 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
56 "/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
57
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
58 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
59 "/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
60
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
61 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
62 "/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
63
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
64 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
65 "art:title/text()";
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
66
970
d91ffd0e8239 Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 705
diff changeset
67 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
68 "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
69
d91ffd0e8239 Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 705
diff changeset
70 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
71 "/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
72
cfc7bd35ee0b Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents: 976
diff changeset
73 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
74 "/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
75
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
76 /**
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 * 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
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 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
80
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 /**
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 * 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
83 */
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 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
85 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
86 }
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
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 @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
89 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
90 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
91 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
92 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
93 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
94 }
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
95
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
96 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
97 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
98 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
99 request);
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
100
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
101 OutputMode outputMode = sm.getOutputMode("wms");
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
102 Collection<InputParameter> ips = null;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
103 if (outputMode != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
104 Collection<OutputParameter> inputParameter =
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
105 outputMode.getOutputParameters();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
106
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
107 if (inputParameter != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
108 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
109 Iterator<OutputParameter> it = inputParameter.iterator();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
110 DiagrammOptions diagrammOptions = new DiagrammOptions();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
111
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
112 int params = 0;
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
113 while (it.hasNext()) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
114 String name = it.next().getName();
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
115 String[] values = request.getParameterValues(name);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
116 String value = request.getParameter(name);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
117 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
118 encode(values));
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
119 ips.add(ip);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
120
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
121 if (value != null) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
122 ++params;
705
f550bd27a3f1 Html characters in strings inserted by the user are quoted (issue221).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 690
diff changeset
123 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
124 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
125 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
126
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
127 if (params > 0) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
128 sm.setDiagrammOptions(diagrammOptions);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
129 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
130 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
131 }
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
132
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
133 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
134
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
135 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
136 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
137 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
138 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
139 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
140
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
141 // do wms publishing
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
142 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
143
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
144 // 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
145 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
146 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
147 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
148 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
149 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
150 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
151
cfc7bd35ee0b Set the map to the extent which was sent by the rest-server
Tim Englich <tim.englich@intevation.de>
parents: 976
diff changeset
152 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
153 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
154 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
155 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
156 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
157 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
158 request.getLocale());
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 680
diff changeset
159
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
160 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
161 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
162 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
163 }
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
164 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
165 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
166 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
167
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
168 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
169 }
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
170 }
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
171
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
172 if (logger.isDebugEnabled()) {
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
173 logger.debug("Mapserver path: " + mapserverPath);
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
174 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
175 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
176 }
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
177 // 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
178
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
179 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
180 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
181 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
182 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
183 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
184 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
185 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
186 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
187 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
188 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
189 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
190 // 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
191 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
192 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
193 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
194 }
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
195 }
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
196
668
ccd47d9887ec Added an options panel for wms customization (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 585
diff changeset
197
976
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
198
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
199
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
200 // 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
201
681
15ac78a91d1b Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 680
diff changeset
202 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
203 mapfilePath != null) {
677
8315b0a40329 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 676
diff changeset
204 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
205
d1ed5c51c0de Checkin of changes which are necessary for the checkin of Revision 1139.
Tim Englich <tim.englich@intevation.de>
parents: 970
diff changeset
206 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
207 "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
208 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
209 sm.setLocalMapService(mapService);
676
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
210 return super.execute(mapping, form, request, response);
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
211 }else{
970
d91ffd0e8239 Some small xpath changes for wms output regarding rev1134 (issue198).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 705
diff changeset
212 return super.execute(mapping, form, request, response);
676
707e142e7d44 Improved ExceptionHandling during WMS-Publishing.
Tim Englich <tim.englich@intevation.de>
parents: 668
diff changeset
213 }
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
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 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
216 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
217 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
218 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
219 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
220
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
221 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
222 }
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
223 }
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
224 }
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
225 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org