eu.stratosphere.client.web.PlanDisplayServlet Maven / Gradle / Ivy
/***********************************************************************************************************************
* Copyright (C) 2010-2013 by the Stratosphere project (http://stratosphere.eu)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
**********************************************************************************************************************/
package eu.stratosphere.client.web;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
public class PlanDisplayServlet extends GUIServletStub {
/**
* Serial UID for serialization interoperability.
*/
private static final long serialVersionUID = 3610115341264927614L;
private final int runtimeVisualizationPort;
private String runtimeVisURL;
/**
* Default constructor. Sets up all CSS and JS files for the header.
*/
public PlanDisplayServlet(int runtimePort) {
super("Stratosphere Query Interface - Query Plan");
this.runtimeVisualizationPort = runtimePort;
addStyleSheet("css/js-graph-it.css");
addStyleSheet("css/pactgraphs.css");
addJavascriptFile("js/js-graph-it.js");
addJavascriptFile("js/progressbar.js");
addJavascriptFile("js/pactgraph.js");
}
@Override
public void printPage(PrintWriter writer, Map parameters, HttpServletRequest req) throws IOException {
String[] x = parameters.get("id");
String uid = (x != null && x.length >= 1) ? x[0] : null;
x = parameters.get("suspended");
String suspend = (x != null && x.length >= 1) ? x[0] : null;
// check, if all parameters are there
if (uid == null || suspend == null) {
writer.println(" ");
writer.println(" Parameters identifying the plan and the suspension strategy are missing.
");
writer.println(" ");
return;
}
if (this.runtimeVisURL == null) {
try {
URI request = new URI(req.getRequestURL().toString());
URI vizURI = new URI(request.getScheme(), null, request.getHost(), runtimeVisualizationPort, null, null, null);
this.runtimeVisURL = vizURI.toString();
System.out.println(this.runtimeVisURL);
} catch (URISyntaxException e) {
; // ignore and simply do not forward
}
}
boolean suspended = Boolean.parseBoolean(suspend);
// write the canvas for the graph area
writer.println(" \n"
+ " \n"
+ " \n"
+ " \n" + " \n"
+ " ");
if (suspended) {
writer.println(" ");
}
writer.println(" \n" + " ");
// write the canvas for the properties area
writer.println(" \n"
+ " Click a node to show the properties...
\n" + " ");
// write the page initialization code
writer.println(" ");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy