You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by ey...@apache.org on 2015/09/13 22:28:01 UTC
[8/9] chukwa git commit: CHUKWA-779. Remove support for JSP pages.
(Eric Yang)
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/heatmap-datanode-data-js.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/heatmap-datanode-data-js.jsp b/src/main/web/hicc/jsp/heatmap-datanode-data-js.jsp
deleted file mode 100644
index 2e93a23..0000000
--- a/src/main/web/hicc/jsp/heatmap-datanode-data-js.jsp
+++ /dev/null
@@ -1,255 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.util.Calendar, java.util.Date, java.sql.*, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*,java.lang.Math, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.lang.StringBuilder, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro, org.apache.hadoop.chukwa.database.DatabaseConfig, org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page session="true" %>
-<%
-
-// TODO: Read parameters from query string or environment to choose mode
-// of data desired, e.g. duration, # transactions, etc. ;
-// use widget properties to create selectors for these various modes
-
-response.setContentType("text/javascript");
-
-// initial setup
-XssFilter xf = new XssFilter(request);
-TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
-long start = time.getStartTime();
-long end = time.getEndTime();
-String cluster = (String) session.getAttribute("cluster");
-String table = "filesystem_fsm";
-
-// decide type of statistics we want
-String query_stats_mode = (String) xf.getParameter("heatmap_datanode_stattype");
-if (query_stats_mode == null || query_stats_mode.length() <= 0) {
- query_stats_mode = new String("transaction_count");
-}
-
-// decide type of state we're interested in
-String query_state = (String) xf.getParameter("heatmap_datanode_state");
-out.println("/" + "/ " + "state: " + query_state);
-if (query_state == null || query_state.length() <= 0) {
- query_state = new String("read_local");
-}
-
-// actual work: process query
-if(xf.getParameter("event_type")!=null) {
- table = xf.getParameter("event_type");
-}
-String query = "select block_id,start_time,finish_time,start_time_millis,finish_time_millis,status,state_name,hostname,other_host,bytes from ["+table+"] where finish_time between '[start]' and '[end]' and state_name like '" + query_state + "'";
-Macro mp = new Macro(start,end,query, request);
-query = mp.toString() + " order by start_time";
-
-out.println("/" + "/" + "datanode: " + query + " cluster: " + cluster);
-
-ArrayList<HashMap<String, Object>> events = new ArrayList<HashMap<String, Object>>();
-
-Connection conn = null;
-Statement stmt = null;
-ResultSet rs = null;
-
-DatabaseWriter dbw = new DatabaseWriter(cluster);
-try {
- rs = dbw.query(query);
- ResultSetMetaData rmeta = rs.getMetaData();
- int col = rmeta.getColumnCount();
- while (rs.next()) {
- HashMap<String, Object> event = new HashMap<String, Object>();
- long event_time=0;
- for(int i=1;i<=col;i++) {
- if(rmeta.getColumnType(i)==java.sql.Types.TIMESTAMP) {
- event.put(rmeta.getColumnName(i),rs.getTimestamp(i).getTime());
- } else {
- event.put(rmeta.getColumnName(i),rs.getString(i));
- }
- }
- events.add(event);
- }
-} catch (SQLException ex) {
- // handle any errors
- //out.println("SQLException: " + ex.getMessage());
- //out.println("SQLState: " + ex.getSQLState());
- //out.println("VendorError: " + ex.getErrorCode());
-} finally {
- // it is a good idea to release
- // resources in a finally{} block
- // in reverse-order of their creation
- // if they are no-longer needed
- dbw.close();
-}
-%>
-
-function generateData() {
-<%
- SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss");
- HashMap<String, Integer> reduce_ytick_ids = new HashMap<String, Integer>();
-
- out.println("/" + "/ " + events.size() + " results returned.");
-
- HashSet<String> host_set = new HashSet<String>();
- HashMap<String, Integer> host_indices = new HashMap<String, Integer>();
-
- // collect hosts
- for(int i = 0; i < events.size(); i++) {
- HashMap<String, Object> event = events.get(i);
- String curr_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- host_set.add(curr_host);
- host_set.add(other_host);
- }
- int num_hosts = host_set.size();
-
- Iterator<String> host_iter = host_set.iterator();
- for (int i = 0; i < num_hosts && host_iter.hasNext(); i++) {
- String curr_host = host_iter.next();
- host_indices.put(curr_host, new Integer(i));
- }
-
- out.println("/" + "/" + " Number of hosts: " + num_hosts);
- long stats[][] = new long[num_hosts][num_hosts];
- long count[][] = new long[num_hosts][num_hosts]; // used for averaging
-
- int start_millis = 0, end_millis = 0;
-
- // deliberate design choice to duplicate code PER possible operation
- // otherwise we have to do the mode check N times, for N states returned
- if (query_stats_mode.equals("transaction_count")) {
- for(int i=0;i<events.size();i++) {
- HashMap<String, Object> event = events.get(i);
- start=(Long)event.get("start_time");
- end=(Long)event.get("finish_time");
- start_millis = Integer.parseInt(((String)event.get("start_time_millis")));
- end_millis = Integer.parseInt(((String)event.get("finish_time_millis")));
- String cell = (String) event.get("state_name");
- String this_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- int this_host_idx = host_indices.get(this_host).intValue();
- int other_host_idx = host_indices.get(other_host).intValue();
-
- // from, to
- stats[this_host_idx][other_host_idx] += 1;
- }
- } else if (query_stats_mode.equals("avg_duration")) {
- for(int i=0;i<events.size();i++) {
- HashMap<String, Object> event = events.get(i);
- start=(Long)event.get("start_time");
- end=(Long)event.get("finish_time");
- start_millis = Integer.parseInt(((String)event.get("start_time_millis")));
- end_millis = Integer.parseInt(((String)event.get("finish_time_millis")));
- String cell = (String) event.get("state_name");
- String this_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- int this_host_idx = host_indices.get(this_host).intValue();
- int other_host_idx = host_indices.get(other_host).intValue();
-
- long curr_val = end_millis - start_millis + ((end - start)*1000);
-
- // from, to
- stats[this_host_idx][other_host_idx] += curr_val;
- count[this_host_idx][other_host_idx] += 1;
- }
- for (int i = 0; i < num_hosts; i++) {
- for (int j = 0; j < num_hosts; j++) {
- if (count[i][j] > 0) stats[i][j] = stats[i][j] / count[i][j];
- }
- }
- } else if (query_stats_mode.equals("avg_volume")) {
- for(int i=0;i<events.size();i++) {
- HashMap<String, Object> event = events.get(i);
- start=(Long)event.get("start_time");
- end=(Long)event.get("finish_time");
- start_millis = Integer.parseInt(((String)event.get("start_time_millis")));
- end_millis = Integer.parseInt(((String)event.get("finish_time_millis")));
- String cell = (String) event.get("state_name");
- String this_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- int this_host_idx = host_indices.get(this_host).intValue();
- int other_host_idx = host_indices.get(other_host).intValue();
-
- long curr_val = Long.parseLong((String)event.get("bytes"));
-
- // from, to
- stats[this_host_idx][other_host_idx] += curr_val;
- count[this_host_idx][other_host_idx] += 1;
- }
- for (int i = 0; i < num_hosts; i++) {
- for (int j = 0; j < num_hosts; j++) {
- if (count[i][j] > 0) stats[i][j] = stats[i][j] / count[i][j];
- }
- }
- } else if (query_stats_mode.equals("total_duration")) {
- for(int i=0;i<events.size();i++) {
- HashMap<String, Object> event = events.get(i);
- start=(Long)event.get("start_time");
- end=(Long)event.get("finish_time");
- start_millis = Integer.parseInt(((String)event.get("start_time_millis")));
- end_millis = Integer.parseInt(((String)event.get("finish_time_millis")));
- String cell = (String) event.get("state_name");
- String this_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- int this_host_idx = host_indices.get(this_host).intValue();
- int other_host_idx = host_indices.get(other_host).intValue();
-
- double curr_val = end_millis - start_millis + ((end - start)*1000);
-
- // from, to
- stats[this_host_idx][other_host_idx] += curr_val;
- }
- } else if (query_stats_mode.equals("total_volume")) {
- for(int i=0;i<events.size();i++) {
- HashMap<String, Object> event = events.get(i);
- start=(Long)event.get("start_time");
- end=(Long)event.get("finish_time");
- start_millis = Integer.parseInt(((String)event.get("start_time_millis")));
- end_millis = Integer.parseInt(((String)event.get("finish_time_millis")));
- String cell = (String) event.get("state_name");
- String this_host = (String) event.get("hostname");
- String other_host = (String) event.get("other_host");
- int this_host_idx = host_indices.get(this_host).intValue();
- int other_host_idx = host_indices.get(other_host).intValue();
-
- long curr_val = Long.parseLong((String)event.get("bytes"));
-
- // from, to
- stats[this_host_idx][other_host_idx] += curr_val;
- }
- }
-
-%>
-heatmap_size = <%= num_hosts %>;
-heatmap_data = [<%
- for (int i = 0; i < num_hosts; i++) {
- for (int j = 0; j < num_hosts; j++) {
- if (i > 0 || j > 0) out.println(",");
- out.print("[" + i + "," + j + "," + stats[j][i] + "]");
- }
- }
-%>];
-heatmap_names = [<%
- host_iter = host_set.iterator();
- for (int i = 0; i < num_hosts && host_iter.hasNext(); i++) {
- if (i > 0) out.print(",");
- out.print("'" + host_iter.next() + "'");
- }
-%>];
-
- $("#resultcountholder").text("<%= events.size() %> states returned.");
-
-}
-
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/heatmap-static.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/heatmap-static.jsp b/src/main/web/hicc/jsp/heatmap-static.jsp
deleted file mode 100644
index d6df7ec..0000000
--- a/src/main/web/hicc/jsp/heatmap-static.jsp
+++ /dev/null
@@ -1,71 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "org.apache.hadoop.chukwa.analysis.salsa.visualization.Heatmap" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.ImageSlicer" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.ExceptionUtil" %>
-<%@ page import = "java.io.FileOutputStream" %>
-<%@ page import = "java.io.File" %>
-<%@ page import = "java.util.HashMap" %>
-<%@ page import = "java.util.HashMap" %>
-<%@ page import = "org.apache.commons.logging.Log" %>
-<%@ page import = "org.apache.commons.logging.LogFactory" %>
-<%
- Log log = LogFactory.getLog(Heatmap.class);
- XssFilter xf = new XssFilter(request);
- String boxId = xf.getParameter("boxId");
- int max = 0;
- try {
- StringBuilder fileName = new StringBuilder();
- fileName.append(System.getenv("CHUKWA_HOME"));
- fileName.append(File.separator);
- fileName.append("webapps");
- fileName.append(File.separator);
- fileName.append("sandbox");
- fileName.append(File.separator);
- fileName.append(boxId);
- fileName.append(xf.getParameter("_s"));
- fileName.append(".png");
- StringBuilder baseFileName = new StringBuilder();
- baseFileName.append(boxId);
- baseFileName.append(xf.getParameter("_s"));
- baseFileName.append(".png");
-
- FileOutputStream fos = new FileOutputStream(fileName.toString());
-
- Heatmap sw = new Heatmap(request);
- sw.setDimensions(2000,2000);
- sw.run();
- if(sw.getImage(fos,"PNG", 1.0)) {
- fos.close();
- ImageSlicer slicer = new ImageSlicer();
- max = slicer.process(baseFileName.toString());
- }
- RequestDispatcher disp = getServletContext().getRequestDispatcher("/jsp/image-viewer.jsp");
- request.setAttribute("image-viewer",baseFileName.toString());
- request.setAttribute("maxLevel",max);
- disp.forward(request, response);
- } catch(Exception e) {
- response.setHeader("boxId", xf.getParameter("boxId"));
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- out.println("No data available.");
- log.error(ExceptionUtil.getStackTrace(e));
- }
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/heatmap.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/heatmap.jsp b/src/main/web/hicc/jsp/heatmap.jsp
deleted file mode 100644
index b16e718..0000000
--- a/src/main/web/hicc/jsp/heatmap.jsp
+++ /dev/null
@@ -1,136 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.util.Hashtable, java.util.Enumeration, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler, java.text.NumberFormat, org.apache.hadoop.chukwa.util.XssFilter" %>
-<%
- XssFilter xf = new XssFilter(request);
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- response.setHeader("boxId", xf.getParameter("boxId"));
-
- String width = "700";
- if(xf.getParameter("width")!=null) {
- width=xf.getParameter("width");
- }
-
- String height = "400";
- if(xf.getParameter("height")!=null) {
- height=xf.getParameter("height");
- }
-
- String yLabel = "device";
- if(xf.getParameter("yLabel")!=null) {
- yLabel=xf.getParameter("yLabel");
- }
-
- String url = "/hicc/v1/heatmap/SystemMetrics/cpu.combined.?max=100";
- if(xf.getParameter("url")!=null) {
- url=xf.getParameter("url");
- }
-
- String title = "CPU Utilization";
- if(xf.getParameter("title")!=null) {
- title=xf.getParameter("title");
- }
-%>
-<!DOCTYPE html>
-<html lang="en">
- <head>
- <style>
-
- #heatmapArea {
- display: block;
- position:absolute;
- float:left;
- width: <%= width %>px;
- height: <%= height %>px;
- top:0;
- left: 50px;
- }
-
- #yaxis {
- text-align: center;
- width: 50px;
- height: <%= height %>px;
- line-height: 400px;
- }
-
- p {
- border:0px solid red;
- writing-mode:lr-tb;
- -webkit-transform:rotate(270deg);
- -moz-transform:rotate(270deg);
- -o-transform: rotate(270deg);
- white-space:nowrap;
- bottom:0;
- }
-
- #xaxis {
- width: <%= width %>px;
- position: relative;
- left: 0px;
- height: 20px;
- text-align: center;
- display: block;
- }
-
- body {
- color:#333;
- font-family: Oswald, Helvetica, Arial;
- font-weight:normal;
- }
-
- </style>
- <link href="/hicc/css/default.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <div id="yaxis">
- <p id="yLabel"></p>
- </div>
- <div id="heatmapArea"></div>
- <div id="xaxis">Time</div>
- <script src="/hicc/js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript" src="/hicc/js/heatmap.js"></script>
- <script type="text/javascript">
- function load() {
- $.ajax({
- url: "<%= url %>",
- dataType: "json",
- success: function(data) {
- $('#yLabel').html(data.series + " <%= yLabel %>(s)");
- var config = {
- element: document.getElementById("heatmapArea"),
- radius: data.radius/6,
- opacity: 50,
- legend: {
- position: 'br',
- title: '<%= title %> Distribution'
- }
- };
- var heatmap = h337.create(config);
- heatmap.store.setDataSet(data);
- setTimeout(load, 5000);
- }
- });
- }
- window.onload = function() {
- setTimeout(load, 5000);
- };
- </script>
- </body>
-</html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/heatmap_datanode.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/heatmap_datanode.jsp b/src/main/web/hicc/jsp/heatmap_datanode.jsp
deleted file mode 100644
index df6ce67..0000000
--- a/src/main/web/hicc/jsp/heatmap_datanode.jsp
+++ /dev/null
@@ -1,349 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.util.Calendar, java.util.Date, java.sql.*, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*,java.lang.Math, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.lang.StringBuilder, org.apache.hadoop.chukwa.util.XssFilter" %>
-<% response.setContentType("text/html"); %>
-<%
-
-XssFilter xf = new XssFilter(request);
-
-// decide type of statistics we want
-String query_stats_mode = (String) xf.getParameter("heatmap_datanode_stattype");
-if (query_stats_mode == null || query_stats_mode.length() <= 0) {
- query_stats_mode = new String("transaction_count");
-}
-
-// decide type of state we're interested in
-String query_state = (String) xf.getParameter("heatmap_datanode_state");
-if (query_state == null || query_state.length() <= 0) {
- query_state = new String("read_local");
-}
-
-HashMap<String, String> prettyStateNames = new HashMap<String, String>();
-
-prettyStateNames.put("read_local", "Local Block Reads");
-prettyStateNames.put("write_local", "Local Block Writes");
-prettyStateNames.put("read_remote", "Remote Block Reads");
-prettyStateNames.put("write_remote", "Remote Block Writes");
-prettyStateNames.put("write_replicated", "Replicated Block Writes");
-
-HashMap<String, String> prettyStatisticNames = new HashMap<String, String>();
-
-prettyStatisticNames.put("transaction_count", "Number of Transactions");
-prettyStatisticNames.put("avg_duration", "Average Duration<br />(ms)");
-prettyStatisticNames.put("avg_volume", "Average Volume<br />(bytes)");
-prettyStatisticNames.put("total_duration", "Total Duration<br />(ms)");
-prettyStatisticNames.put("total_volume", "Total Volume<br />(bytes)");
-
-%>
- <html><head>
-
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>2D Spectrum Viewer</title>
- <link href="/hicc/css/heatmap/layout.css" rel="stylesheet" type="text/css">
- <script language="javascript" type="text/javascript" src="/hicc/js/jquery-1.3.2.min.js"></script>
- <script language="javascript" type="text/javascript" src="/hicc/js/jquery.flot.pack.js"></script>
-
- <script language="javascript" type="text/javascript" src="/hicc/js/excanvas.pack.js"></script>
- <script id="source" language="javascript" type="text/javascript" src="heatmap-datanode-data-js.jsp?heatmap_datanode_stattype=<%= query_stats_mode %>&heatmap_datanode_state=<%= query_state %>"></script>
- <script>
- function activateplot()
- {
- document.getElementById('clearSelection').click();
- }
- </script>
- <script id="source2" language="javascript" type="text/javascript">
-// to eventually be moved out
-// this takes the data structures from the data generation and
-// generates data structures for flot to plot
-
- function d2h(d) {return (Math.round(d).toString(16));}
-
- // external vars: heatmap_size, heatmap_data, heatmap_names
- function generateGraph()
- {
- var tmpstring = ' ';
- var count = 0;
- var minvalue = 0, maxvalue = 0;
- var COLOR_MAX = 255;
- var COLOR_MIN = 0;
- var SCALE=1;
-
- color_array = new Array(heatmap_size * heatmap_size);
- graph_data_array = new Array(heatmap_size * heatmap_size);
- graph_data_array_small = new Array(heatmap_size * heatmap_size);
- series_array = new Array(heatmap_size * heatmap_size);
- ticknames_array = new Array(heatmap_size);
- graph_tooltips = new Array(heatmap_size+1);
-
- var minstarted = 0;
- for (i = 0; i < heatmap_size; i++) {
- graph_tooltips[i+1] = new Array(heatmap_size+1);
- for (j = 0; j < heatmap_size; j++) {
- // determine min/max
- if (count <= 0) {
- if (heatmap_data[count][2] > 0) {
- minvalue = heatmap_data[count][2];
- minstarted = 1;
- }
- maxvalue = heatmap_data[count][2];
- } else {
- if (heatmap_data[count][2] > 0) {
- if (minstarted > 0) {
- minvalue = heatmap_data[count][2] > minvalue ? minvalue : heatmap_data[count][2];
- } else {
- minvalue = heatmap_data[count][2];
- minstarted = 1;
- }
- }
- maxvalue = heatmap_data[count][2] < maxvalue ? maxvalue : heatmap_data[count][2];
- }
- // create coordinates
- // graph_data_array[count] = {
- // data: [i+1,j+1]
- // };
- // graph_data_array[count] = new Array(2);
- // graph_data_array[count][0] = i+1;
- // graph_data_array[count][1] = j+1;
-
- graph_tooltips[i+1][j+1] = 'State: <%= prettyStateNames.get(query_state) %><br />Statistic: <%= prettyStatisticNames.get(query_stats_mode) %><br />Value: '
- + heatmap_data[count][2] + "<br />From: " + heatmap_names[i] + "<br />"
- + "To: " + heatmap_names[j];
-
- count++;
- }
- ticknames_array[i] = [i+1, heatmap_names[i]];
- }
-
- $("#scale_max_placeholder").text(maxvalue);
- $("#scale_mid_placeholder").text(((maxvalue-minvalue)/2)+minvalue);
- $("#scale_min_placeholder").text(minvalue);
-
- var colorMap = new Array(7);
- colorMap[0]="0000ff";
- colorMap[1]="0099ff";
- colorMap[2]="00ffff";
- colorMap[3]="00ff00";
- colorMap[4]="ffff00";
- colorMap[5]="ff9900";
- colorMap[6]="ff0000";
- count = 0;
- for (i = 0; i < heatmap_size; i++) {
- for (j = 0; j < heatmap_size; j++) {
- var opacity=0.9;
- if (heatmap_data[count][2] == 0) {
- colorstring = '000099';
- opacity=0;
- } else {
- opacity=0.9;
- var index = Math.round((heatmap_data[count][2] - minvalue) / (maxvalue - minvalue) * 7);
- if(index>6) {
- index=6;
- } else if(index<0) {
- index=0;
- }
- if(index==6) {
- opacity=0.9;
- } else if(index==5) {
- opacity=0.8;
- } else if(index==4) {
- opacity=0.7;
- } else if(index==3) {
- opacity=0.6;
- } else if(index==2) {
- opacity=0.5;
- } else if(index==1) {
- opacity=0.4;
- } else if(index==0) {
- opacity=0.3;
- }
- colorstring = colorMap[index];
- }
-
- colorstring = '#' + colorstring;
- color_array[count] = colorstring;
- series_array[count] = { lines: {show: true, radius:999} };
-
- graph_data_array[count] = {
- points: {show: true, radius: 20*opacity, lineWidth: 0, fill: opacity, fillColor: false },
- color: colorstring,
- data: [[(heatmap_data[count][0]+1)/SCALE, (heatmap_data[count][1]+1)/SCALE]]
- }
- graph_data_array_small[count] = {
- points: {show: true, radius: 4*opacity, lineWidth: 0, fill: opacity, fillColor: false},
- color: colorstring,
- data: [[(heatmap_data[count][0]+1)/SCALE, (heatmap_data[count][1]+1)/SCALE]]
- }
-
- count++;
- }
- }
-
- graph_options = {
- grid: { hoverable: true, backgroundColor: '#000099' },
- yaxis: {autoscaleMargin: 0.1, ticks: [] },
- xaxis: {autoscaleMargin: 0.1, ticks: [] },
- selection: { mode: "xy" },
- shadowSize: 0
- };
- graph_options_small = {
- grid: { hoverable: true, backgroundColor: '#000099' },
- yaxis: {autoscaleMargin: 0.1, ticks: [] },
- xaxis: {autoscaleMargin: 0.1, ticks: [] },
- selection: { mode: "xy" },
- shadowSize: 0
- };
- }
- </script>
- <script id="source3" language="javascript" type="text/javascript">
-// to eventually be moved out
-// this generates the actual flot options
-
-function plotGraph() {
-
-var placeholder = $("#placeholder");
-var plot = $.plot(placeholder, graph_data_array, graph_options);
-
-var smallplotplaceholder = $("#smallplotplaceholder");
-var smallplot = $.plot(smallplotplaceholder, graph_data_array_small, graph_options_small);
-
-placeholder.bind("plotselected", function (event, ranges) {
- if (ranges.xaxis.to - ranges.xaxis.from < 0.00001)
- ranges.xaxis.to = ranges.xaxis.from + 0.00001;
- if (ranges.yaxis.to - ranges.yaxis.from < 0.00001)
- ranges.yaxis.to = ranges.yaxis.from + 0.00001;
-
- plot = $.plot(placeholder, graph_data_array,
- $.extend(true, {}, graph_options, {
- grid: { hoverable: true },
- xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to },
- yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }
- }
- )
-);
-
-// don't fire event on the overview to prevent eternal loop
-smallplot.setSelection(ranges, true);
-
-});
-
-smallplotplaceholder.bind("plotselected", function (event, ranges) {
- plot.setSelection(ranges);
-});
-
-
-
-// Hover text
-var previousPoint = null;
-$("#placeholder").bind("plothover", function (event, pos, item) {
- if (item) {
- if (previousPoint != item.datapoint) {
- previousPoint = item.datapoint;
-
- $("#tooltip").remove();
- var x = item.datapoint[0].toFixed(2),
- y = item.datapoint[1].toFixed(2);
-
- showTooltip(item.pageX, item.pageY, lookupStateInfo(item.datapoint[0], item.datapoint[1]));
-
- } else {
- $("#tooltip").remove();
- previousPoint = null;
- }
- }
-});
-
-}
-
-function lookupStateInfo(x,y) {
- return graph_tooltips[x][y];
-}
-
-function showTooltip(x, y, contents) {
- $('<div id="tooltip">' + contents + '</div>').css( {
- position: 'absolute',
- display: 'none',
- top: y + 5,
- left: x + 5,
- border: '1px solid #fdd',
- padding: '2px',
- 'background-color': '#fee',
- opacity: 0.80
- }).appendTo("body").fadeIn(200);
-}
-
- </script>
- </head><div FirebugVersion="1.3.3" style="display: none;" id="_firebugConsole"></div><body onload="generateData(); generateGraph(); plotGraph();">
- <table cellpadding="0" cellspacing="0">
- <tbody>
- <tr>
-
- <td align="right" valign="top" rowspan="1"><div id="placeholder" style="width: 400px; height: 400px; position: relative;"><canvas width="400" height="400"></canvas><canvas style="position: absolute; left: 0px; top: 0px;" width="400" height="400"></canvas></div></td>
-
- <td rowspan="1"><div style="width:10px"> </div></td>
-
- <td align="middle"><div id="smallplotplaceholder", style="width:100px;height:100px;"><canvas style="position: absolute; left: 0px; top: 0px;" width="100" height="100"></canvas></div>
-
- <br />
-
- State: <b><%= prettyStateNames.get(query_state) %></b><br />
- Statistic: <b><%= prettyStatisticNames.get(query_stats_mode) %></b>
-
- </td>
-
- </tr>
-
- <tr>
- <td colspan="3" align="middle" valign="top">
-
- <br />
-
- <span id="resultcountholder">No results returned. </span>
-
- <br />
-
- <table cellpadding="0" cellspacing="4"><tbody>
- <tr><th colspan="2">Scale</th></tr>
- <tr>
- <td bgcolor="#ff0000"> </td>
- <td bgcolor="#ff9900"> </td>
- <td bgcolor="#ffff00"> </td>
- <td bgcolor="#00ff00"> </td>
- <td bgcolor="#00ffff"> </td>
- <td bgcolor="#0099ff"> </td>
- <td bgcolor="#0000ff"> </td>
- <td bgcolor="#000099"> </td>
- </tr>
-
- <tr>
- <td><span id="scale_max_placeholder"></span></td>
- <td> </td>
- <td> </td>
- <td><span id="scale_mid_placeholder"></span></td>
- <td> </td>
- <td> </td>
- <td><span id="scale_min_placeholder"></span></td>
- <td>0</td>
- </tr>
- </tbody></table>
- </td>
- </tr>
-
- </tbody></table>
- </body></html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/help.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/help.jsp b/src/main/web/hicc/jsp/help.jsp
deleted file mode 100644
index 9d0fdb2..0000000
--- a/src/main/web/hicc/jsp/help.jsp
+++ /dev/null
@@ -1,48 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<html>
-<head>
-<link href="css/default.css" rel="stylesheet" type="text/css">
-</head>
-<body>
-<!-- TODO: check the parameter ID and forward to the proper help content -->
-<h1>Custom Period Input String Format</h1>
-You can type in normal English time string or absolute time string to specify the date. For example:
-<ul>
-<li>Time relative to now
- <ul>
- <li>2 months ago</li>
- <li>3 weeks ago</li>
- <li>2 hours ago</li>
- <li>20 minutes ago</li>
- </ul>
-</li>
-<li>Absolute Time
- <ul>
- <li>may 27 2009</li>
- <li>may 27 5:00 pm</li>
- <li>may 27 09 4:30</li>
- <li>2009/04/12 04:30:50</li>
- <li>2009-04-12 04:30:50</li>
- </ul>
-</li>
-</ul>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/host_selector.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/host_selector.jsp b/src/main/web/hicc/jsp/host_selector.jsp
deleted file mode 100644
index 9ff8670..0000000
--- a/src/main/web/hicc/jsp/host_selector.jsp
+++ /dev/null
@@ -1,47 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.text.SimpleDateFormat" %>
-<%@ page import = "java.text.NumberFormat" %>
-<%@ page import = "java.util.Hashtable" %>
-<%@ page import = "java.util.Enumeration" %>
-<%@ page import = "java.util.Calendar" %>
-<%@ page import = "java.util.Date" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%
- RequestDispatcher disp = null;
- XssFilter xf = new XssFilter(request);
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- response.setHeader("boxId", xf.getParameter("boxId"));
- String hostSelectorType="dropdown";
- if(request.getParameter("style")!=null) {
- hostSelectorType=xf.getParameter("style");
- }
- if(hostSelectorType.intern()=="role".intern()) {
- disp = getServletContext( ).getRequestDispatcher("/jsp/host_selector_role.jsp");
- disp.forward(request, response);
- } else if(hostSelectorType.intern()=="dropdown".intern()) {
- disp = getServletContext( ).getRequestDispatcher("/jsp/host_selector_dropdown.jsp");
- disp.forward(request, response);
- } else if(hostSelectorType.intern()=="user".intern()) {
- disp = getServletContext( ).getRequestDispatcher("/jsp/host_selector_user.jsp");
- disp.forward(request, response);
- }
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/host_selector_dropdown.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/host_selector_dropdown.jsp b/src/main/web/hicc/jsp/host_selector_dropdown.jsp
deleted file mode 100644
index f8e316b..0000000
--- a/src/main/web/hicc/jsp/host_selector_dropdown.jsp
+++ /dev/null
@@ -1,92 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "javax.servlet.http.*" %>
-<%@ page import = "java.sql.*" %>
-<%@ page import = "java.io.*" %>
-<%@ page import = "java.util.Calendar" %>
-<%@ page import = "java.util.Date" %>
-<%@ page import = "java.text.SimpleDateFormat" %>
-<%@ page import = "java.util.*" %>
-<%@ page import = "org.json.*" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
-<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page import = "org.apache.hadoop.chukwa.datastore.ChukwaHBaseStore" %>
-<%@ page import = "org.apache.commons.logging.Log" %>
-<%@ page import = "org.apache.commons.logging.LogFactory" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.ExceptionUtil" %>
-<%
- Log log = LogFactory.getLog(this.getClass());
- XssFilter xf = new XssFilter(request);
- String boxId = xf.getParameter("boxId");
- response.setHeader("boxId", xf.getParameter("boxId"));
-%>
-<div class="panel">
-<h2>Hosts</h2>
-<fieldset>
-<div class="row">
-<select id="<%= boxId %>group_items" name="<%= boxId %>group_items" MULTIPLE size=10 class="formSelect" style="width:200px;">
-<%
- JSONArray machineNames = null;
- if(session.getAttribute("cache.machine_names")!=null) {
- machineNames = new JSONArray(session.getAttribute("cache.machine_names").toString());
- }
- String cluster=xf.getParameter("cluster");
- if(cluster!=null && !cluster.equals("null")) {
- session.setAttribute("cluster",cluster);
- } else {
- cluster = (String) session.getAttribute("cluster");
- if(cluster==null || cluster.equals("null")) {
- cluster="demo";
- session.setAttribute("cluster",cluster);
- }
- }
- ClusterConfig cc = new ClusterConfig();
- TimeHandler time = new TimeHandler(request,(String)session.getAttribute("time_zone"));
- String startS = time.getStartTimeText();
- String endS = time.getEndTimeText();
- try {
- HashMap<String, String> hosts = new HashMap<String, String>();
- try {
- String[] selected_hosts = ((String)session.getAttribute("hosts")).split(",");
- for(String name: selected_hosts) {
- hosts.put(name,name);
- }
- } catch (NullPointerException e) {
- }
- Set<String> machines = ChukwaHBaseStore.getSourceNames("ChukwaMetrics");
- for(String machine : machines) {
- if(hosts.containsKey(machine)) {
- out.println("<option selected>"+machine+"</option>");
- } else {
- out.println("<option>"+machine+"</option>");
- }
- }
- } catch (Exception e) {
- log.error(ExceptionUtil.getStackTrace(e));
- }
-%>
-</select></div>
-<div class="row">
-<input type="button" onClick="save_host('<%= boxId %>');" name="Apply" value="Apply">
-</div>
-</fieldset>
-</div>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/host_selector_role.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/host_selector_role.jsp b/src/main/web/hicc/jsp/host_selector_role.jsp
deleted file mode 100644
index 33e62d0..0000000
--- a/src/main/web/hicc/jsp/host_selector_role.jsp
+++ /dev/null
@@ -1,90 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "javax.servlet.http.*" %>
-<%@ page import = "java.sql.*" %>
-<%@ page import = "java.io.*" %>
-<%@ page import = "java.util.Calendar" %>
-<%@ page import = "java.util.Date" %>
-<%@ page import = "java.text.SimpleDateFormat" %>
-<%@ page import = "java.util.*" %>
-<%@ page import = "org.json.*" %>
-<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<% XssFilter xf = new XssFilter(request);
- String boxId = xf.getParameter("boxId");
- response.setHeader("boxId", xf.getParameter("boxId"));
- TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
- long start = time.getStartTime();
- long end = time.getEndTime();
- String cluster = (String) session.getAttribute("cluster");
- boolean first = false;
- String[] types = {"namenode","datanode","jobtracker","tasktracker"};
- String[] queries = {"select distinct host from [dfs_namenode] where timestamp between '[start]' and '[end]'",
- "select distinct host from [hadoop_jvm] where process_name='datanode' and timestamp between '[start]' and '[end]'",
- "select distinct host from [hadoop_jvm] where process_name='jobtracker' and timestamp between '[start]' and '[end]'",
- "select distinct host from [hadoop_jvm] where process_name='tasktracker' and timestamp between '[start]' and '[end]'"};
- int i = 0;
- StringBuffer hosts = new StringBuffer();
- JSONObject roles = new JSONObject();
- for(String type : types) {
- if(xf.getParameter(type)!=null) {
- Macro mp = new Macro(start, end, queries[i]);
- String query = mp.toString();
- DatabaseWriter db = new DatabaseWriter(cluster);
- try {
- ResultSet rs = db.query(query);
- while(rs.next()) {
- if(!first) {
- hosts.append(",");
- }
- hosts.append(rs.getString(1));
- first=false;
- }
- roles.put(type,"checked");
- } catch(SQLException ex) {
- System.out.println("SQLException "+ ex + " on query " + query);
- // Ignore if there is no data for the cluster.
- } finally {
- db.close();
- }
- } else {
- roles.put(type,"");
- }
- i++;
- }
- if(xf.getParameter("save")!=null) {
- session.setAttribute("hosts",hosts.toString());
- session.setAttribute("host.selector.role",roles.toString());
- } else {
- if(session.getAttribute("host.selector.role")!=null) {
- roles = new JSONObject(session.getAttribute("host.selector.role").toString());
- }
- }
-%>
-HDFS Cluster<br>
-<input type="checkbox" id="<%= boxId %>namenode" value="true" <%= roles.get("namenode") %>> Name Nodes<br>
-<input type="checkbox" id="<%= boxId %>datanode" value="true" <%= roles.get("datanode") %>> Data Nodes<br><br>
-Map Reduce Cluster<br>
-<input type="checkbox" id="<%= boxId %>jobtracker" value="true" <%= roles.get("jobtracker") %>> Job Tracker<br>
-<input type="checkbox" id="<%= boxId %>tasktracker" value="true" <%= roles.get("tasktracker") %>> Task Trackers<br><br>
-<input type="button" onClick="save_host_role('<%= boxId %>');" name="Apply" value="Apply">
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/host_selector_user.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/host_selector_user.jsp b/src/main/web/hicc/jsp/host_selector_user.jsp
deleted file mode 100644
index 0f67a35..0000000
--- a/src/main/web/hicc/jsp/host_selector_user.jsp
+++ /dev/null
@@ -1,35 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "javax.servlet.http.*" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<% XssFilter xf = new XssFilter(request);
- String boxId = xf.getParameter("boxId");
- response.setHeader("boxId", xf.getParameter("boxId"));
-%>
-<h2>Hosts</h2>
-<textarea id="<%= boxId %>group_items" name="<%= boxId %>group_items" class="formSelect" style="width:200px;"><%
- if(session.getAttribute("hosts")!=null) {
- String[] machineNames = (session.getAttribute("hosts").toString()).split(",");
- for(String node: machineNames) {
- out.println(node);
- }
- }
-%></textarea><br>
-<input type="button" onClick="save_host_user('<%= boxId %>');" name="Apply" value="Apply">
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/image-viewer.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/image-viewer.jsp b/src/main/web/hicc/jsp/image-viewer.jsp
deleted file mode 100644
index d739077..0000000
--- a/src/main/web/hicc/jsp/image-viewer.jsp
+++ /dev/null
@@ -1,195 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page import = "java.util.regex.Matcher" %>
-<%@ page import = "java.util.regex.Pattern" %>
-<%
- Pattern p = Pattern.compile("(.*)\\.(.*)");
- Matcher m = p.matcher(request.getAttribute("image-viewer").toString());
- String filename = "";
- if(m.matches()) {
- filename = m.group(1);
- }
- int maxLevel = Integer.parseInt(request.getAttribute("maxLevel").toString());
-%>
-<html>
- <head>
- <style type="text/css" title="text/css">
- <!--
- body
- {
- color: black;
- background-color: white;
- font-family: helvetica, arial, sans-serif;
- }
-
- .imageViewer
- {
- position: relative;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- }
-
- .imageViewer .well, .imageViewer .surface
- {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- position: absolute;
- top: 0px;
- left: 0px;
- cursor: default;
- border: 1px solid black;
- }
-
- .imageViewer .well
- {
- background-color: gray;
- background-image: url("/hicc/images/blank.gif");
- overflow: hidden;
- }
-
- .imageViewer .surface
- {
- background-color: transparent;
- background-image: url("/hicc/images/blank.gif");
- background-repeat: no-repeat;
- background-position: center center;
- }
-
- .imageViewer .status
- {
- margin: 0;
- padding: 0;
- position: absolute;
- top: 480px;
- left: 0px;
- display: none;
- }
-
- .imageViewer .well .tile
- {
- border: 0;
- margin: 0;
- padding: 0;
- position: absolute;
- top: 0px;
- left: 0px;
- display: block;
- }
-
- .imageViewer .zoom
- {
- background-color: white;
- position: absolute;
- top: 0px;
- right: 0px;
- width: 32px;
- height: 20px;
- margin: 0;
- padding: 0 0 0 4px;
- font-size: 20px;
- line-height: 20px;
- font-weight: bold;
- border-left: 1px solid black;
- border-top: 1px solid black;
- }
-
- .imageViewer .zoom a
- {
- text-decoration: none;
- color: black;
- }
-
- .imageViewer .zoom .dump
- {
- font-size: 16px;
- }
-
- h1, .description
- {
- margin-left: 100px;
- width: 400px;
- }
-
- h1
- {
- margin-top: 40px;
- }
-
- h1 em
- {
- font-size: 50%;
- color: gray;
- }
-
- -->
- </style>
-
- <script src="/hicc/js/gsv.js" type="text/javascript"></script>
- <script src="/hicc/js/behaviour.js" type="text/javascript"></script>
-
- <script type="text/javascript">
- <!--
-
- Behaviour.register({
- '.imageViewer' : function(el) {
- prepareViewer(el, '/sandbox/<%= filename %>', 256);
- },
- '.imageViewer .zoom .up' : function(el) {
- el.onclick = function() {
- zoomImageUp(el.parentNode.parentNode, undefined, <%= maxLevel %>);
- return false;
- }
- },
- '.imageViewer .zoom .down' : function(el) {
- el.onclick = function() {
- zoomImageDown(el.parentNode.parentNode, undefined, <%= maxLevel %>);
- return false;
- }
- },
- '.imageViewer .zoom .dump' : function(el) {
- el.onclick = function() {
- dumpInfo(el.parentNode.parentNode);
- return false;
- }
- }
- });
-
- //-->
- </script>
- </head>
-<body>
- <div class="imageViewer">
- <div class="well"> </div>
- <div class="surface"> </div>
- <p class="status"> </p>
- <p class="zoom">
-
- <a class="up" href="#">+</a>
- <a class="down" href="#">-</a>
- <!-- a class="dump" href="#">?</a -->
- </p>
- </div>
-</body>
-</html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/job_viewer.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/job_viewer.jsp b/src/main/web/hicc/jsp/job_viewer.jsp
deleted file mode 100644
index 56dbc32..0000000
--- a/src/main/web/hicc/jsp/job_viewer.jsp
+++ /dev/null
@@ -1,133 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*, org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro, org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig, java.util.ArrayList, org.apache.hadoop.hbase.HBaseConfiguration, org.apache.hadoop.hbase.client.HTableInterface, org.apache.hadoop.hbase.client.HTablePool, org.apache.hadoop.hbase.client.Result, org.apache.hadoop.hbase.client.ResultScanner, org.apache.hadoop.hbase.client.Scan, org.apache.hadoop.conf.Configuration" %>
-<%! final static private Configuration hconf = HBaseConfiguration.create(); %>
-<%! final static private HTablePool pool = new HTablePool(hconf, 60); %>
-<%
- XssFilter xf = new XssFilter(request);
- NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
- SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss");
- response.setHeader("boxId", xf.getParameter("boxId"));
- response.setContentType("text/html; chartset=UTF-8//IGNORE"); %>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
-<link href="/hicc/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css"/>
-<script type="text/javascript" src="/hicc/js/jquery-1.3.2.min.js"></script>
-<script type="text/javascript" src="/hicc/js/flexigrid.js"></script>
-</head>
-<body>
-<div class="flexigrid">
-<%
- String boxId=xf.getParameter("boxId");
- String cluster = (String) session.getAttribute("cluster");
-
- TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
- long start = time.getStartTime();
- long end = time.getEndTime();
-
- HTableInterface table = pool.getTable("Jobs");
- String family = "summary";
-
- Scan scan = new Scan();
- scan.addColumn(family.getBytes(), "jobId".getBytes());
- scan.addColumn(family.getBytes(), "user".getBytes());
- scan.addColumn(family.getBytes(), "submitTime".getBytes());
- scan.addColumn(family.getBytes(), "launchTime".getBytes());
- scan.addColumn(family.getBytes(), "finishTime".getBytes());
- scan.addColumn(family.getBytes(), "status".getBytes());
- scan.addColumn(family.getBytes(), "cluster".getBytes());
- scan.addColumn(family.getBytes(), "queue".getBytes());
- scan.addColumn(family.getBytes(), "numMaps".getBytes());
- scan.addColumn(family.getBytes(), "numReduces".getBytes());
- scan.addColumn(family.getBytes(), "numSlotsPerMap".getBytes());
- scan.addColumn(family.getBytes(), "numSlotsPerReduce".getBytes());
- scan.addColumn(family.getBytes(), "mapSlotSeconds".getBytes());
- scan.addColumn(family.getBytes(), "reduceSlotsSeconds".getBytes());
- scan.addColumn(family.getBytes(), "status".getBytes());
- scan.setTimeRange(start, end);
- scan.setMaxVersions();
-
- ResultScanner results = table.getScanner(scan);
- Iterator<Result> it = results.iterator();
-%>
-<table id="job_summary">
-<tr>
- <td>Job ID</td>
- <td>Cluster</td>
- <td>User</td>
- <td>Queue</td>
- <td>Status</td>
- <td>Submit Time</td>
- <td>Launch Time</td>
- <td>Finish Time</td>
- <td>Number of Maps</td>
- <td>Number of Reduces</td>
- <td>Number of Slots Per Map</td>
- <td>Number of Slots Per Reduce</td>
- <td>Map Slots Seconds</td>
- <td>Reduce Slots Seconds</td>
-</tr>
-<%
- while(it.hasNext()) {
- Result result = it.next();
- boolean print = true;
- if(xf.getParameter("job_id")!=null) {
- print = false;
- }
- String jobId = new String(result.getValue(family.getBytes(), "jobId".getBytes()));
- if(jobId.equals(xf.getParameter("job_id"))) {
- print = true;
- }
- if(cluster!=null && cluster.equals(new String(result.getValue(family.getBytes(), "cluster".getBytes())))) {
- print = true;
- }
- if(print) {
-%>
-<tr>
- <td><%= new String(result.getValue(family.getBytes(), "jobId".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "cluster".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "user".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "queue".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "status".getBytes())) %></td>
- <td><%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "submitTime".getBytes())))) %></td>
- <td><%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "launchTime".getBytes())))) %></td>
- <td><%= format.format(Long.parseLong(new String(result.getValue(family.getBytes(), "finishTime".getBytes())))) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "numMaps".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "numReduces".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "numSlotsPerMap".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "numSlotsPerReduce".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "mapSlotSeconds".getBytes())) %></td>
- <td><%= new String(result.getValue(family.getBytes(), "reduceSlotsSeconds".getBytes())) %></td>
-</tr>
-<%
- }
- }
- results.close();
- table.close();
-%>
-</table>
-<script type="text/javascript">
-$(document).ready(function(){
- $('#job_summary').flexigrid({title:'Job Summary',height:'340'});
-});
-</script>
-</div></body></html>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/jobs_viewer.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/jobs_viewer.jsp b/src/main/web/hicc/jsp/jobs_viewer.jsp
deleted file mode 100644
index 549f8b5..0000000
--- a/src/main/web/hicc/jsp/jobs_viewer.jsp
+++ /dev/null
@@ -1,130 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat,java.sql.*,java.io.*, org.json.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro, org.apache.hadoop.chukwa.util.XssFilter, org.apache.hadoop.chukwa.database.DatabaseConfig" %>
-<%
- XssFilter xf = new XssFilter(request);
- NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
- response.setHeader("boxId", xf.getParameter("boxId"));
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- String boxId=xf.getParameter("boxId");
- String cluster = (String) session.getAttribute("cluster");
- DatabaseWriter dbw = new DatabaseWriter(cluster);
- String path = "";
- Calendar now = Calendar.getInstance();
- HashMap<String, Integer> index = new HashMap<String, Integer>();
- long start = 0;
- long end = now.getTimeInMillis();
- String startS="";
- String endS="";
- String[] columns = xf.getParameterValues("column");
- TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
- startS = time.getStartTimeText();
- endS = time.getEndTimeText();
- start = time.getStartTime();
- end = time.getEndTime();
- Macro mp = new Macro(start,end,"[util]", request);
- int averageBy=600;
- String tmpTable = mp.toString();
- DatabaseConfig dbc = new DatabaseConfig();
- String[] tableList = dbc.findTableNameForCharts("util", start, end);
- if(tableList[0].endsWith("_week")) {
- averageBy=600;
- } else if(tableList[0].endsWith("_month")) {
- averageBy=600;
- } else if(tableList[0].endsWith("_quarter")) {
- averageBy=1800;
- } else if(tableList[0].endsWith("_year")) {
- averageBy=10800;
- } else if(tableList[0].endsWith("_decade")) {
- averageBy=43200;
- }
- String query = "select count(*) from [mr_job] where finish_time between '[start]' and '[end]';";
- mp = new Macro(start,end,query, request);
- query = mp.toString();
- ResultSet rs = dbw.query(query);
- int total = 0;
- if(rs.next()) {
- total = rs.getInt(1);
- }
- StringBuilder queryBuilder = new StringBuilder();
- queryBuilder.append("select job_id,submit_time,launch_time,finish_time,status from [mr_job] where finish_time between '[start]' and '[end]' ");
- if(xf.getParameter("user")!=null) {
- queryBuilder.append("and user='");
- queryBuilder.append(xf.getParameter("user"));
- queryBuilder.append("'");
- }
- int pageNum = 0;
- if(xf.getParameter("page")!=null) {
- pageNum = Integer.parseInt(xf.getParameter("page"));
- int rp = Integer.parseInt(xf.getParameter("rp"));
- queryBuilder.append(" limit ");
- queryBuilder.append((pageNum-1)*rp);
- queryBuilder.append(",");
- queryBuilder.append(rp);
- }
- mp = new Macro(start,end,queryBuilder.toString(), request);
- query = mp.toString();
- rs = dbw.query(query);
- ResultSetMetaData rmeta = rs.getMetaData();
- int col = rmeta.getColumnCount();
- JSONObject data = new JSONObject();
- JSONArray rows = new JSONArray();
- while(rs.next()) {
- JSONArray cells = new JSONArray();
- for(int i=1;i<=col;i++) {
- if(i==1) {
- StringBuilder sb = new StringBuilder();
- sb.append("<a href='/hicc/jsp/job_viewer.jsp?job_id=");
- sb.append(rs.getString(i));
- sb.append("&height=");
- sb.append(xf.getParameter("height"));
- sb.append("'>");
- sb.append(rs.getString(i));
- sb.append("</a>");
- cells.put(sb.toString());
- } else {
- if(rmeta.getColumnType(i)==java.sql.Types.BIGINT ||
- rmeta.getColumnType(i)==java.sql.Types.TINYINT ||
- rmeta.getColumnType(i)==java.sql.Types.INTEGER) {
- cells.put(nf.format(rs.getInt(i)));
- } else if(rmeta.getColumnType(i)==java.sql.Types.FLOAT ||
- rmeta.getColumnType(i)==java.sql.Types.DOUBLE ||
- rmeta.getColumnType(i)==java.sql.Types.DECIMAL ) {
- cells.put(nf.format(rs.getDouble(i)));
- } else {
- cells.put(rs.getString(i));
- }
- }
- }
- JSONObject row = new JSONObject();
- if(rs.getString(1)!=null) {
- row.put("id",rs.getString(1));
- } else {
- row.put("id","null");
- }
- row.put("cell",cells);
- rows.put(row);
- }
- data.put("page",pageNum);
- data.put("rows",rows);
- data.put("total",total);
- dbw.close();
- out.println(data.toString());
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/permlink.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/permlink.jsp b/src/main/web/hicc/jsp/permlink.jsp
deleted file mode 100644
index 7e89fc9..0000000
--- a/src/main/web/hicc/jsp/permlink.jsp
+++ /dev/null
@@ -1,46 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "javax.servlet.http.*, java.net.URLEncoder, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*" %>
-<%!
- public static String HTMLEntityEncode( String s ) {
- StringBuffer buf = new StringBuffer();
- int len = (s == null ? -1 : s.length());
- for ( int i = 0; i < len; i++ ) {
- char c = s.charAt( i );
- if ( c>='a' && c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' ) {
- buf.append( c );
- } else {
- buf.append( "&#" + (int)c + ";" );
- }
- }
- return buf.toString();
- }
-%>
-<%
- StringBuffer buf = new StringBuffer();
- for (Enumeration e = session.getAttributeNames() ; e.hasMoreElements() ;) {
- String name = (String) e.nextElement();
- if(name.indexOf("_session.cache.")==-1) {
- buf.append("_session."+name+"="+URLEncoder.encode(session.getAttribute(name).toString(),"UTF-8"));
- }
- buf.append("&");
- }
- out.println(buf.toString());
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/query.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/query.jsp b/src/main/web/hicc/jsp/query.jsp
deleted file mode 100644
index 89f6eca..0000000
--- a/src/main/web/hicc/jsp/query.jsp
+++ /dev/null
@@ -1,113 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat" %>
-<%@ page import = "java.sql.*" %>
-<%@ page import = "java.io.*" %>
-<%@ page import = "org.json.*" %>
-<%@ page import = "java.util.Calendar" %>
-<%@ page import = "java.util.Date" %>
-<%@ page import = "java.text.SimpleDateFormat" %>
-<%@ page import = "java.util.*" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %>
-<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %>
-<%
- XssFilter xf = new XssFilter(request);
- NumberFormat nf = new DecimalFormat("###,###,###,##0.00");
- response.setHeader("boxId", xf.getParameter("boxId"));
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- String boxId=xf.getParameter("boxId");
- String cluster = (String) session.getAttribute("cluster");
- DatabaseWriter dbw = new DatabaseWriter(cluster);
- String path = "";
- Calendar now = Calendar.getInstance();
- HashMap<String, Integer> index = new HashMap<String, Integer>();
- long start = 0;
- long end = now.getTimeInMillis();
- String startS="";
- String endS="";
- String[] columns = xf.getParameterValues("column");
- TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone"));
- startS = time.getStartTimeText();
- endS = time.getEndTimeText();
- start = time.getStartTime();
- end = time.getEndTime();
- String queryMacro = session.getAttribute("query_"+xf.getParameter("boxId")).toString();
- Macro mp = new Macro(start,end,queryMacro, request);
- int pageNum = 0;
- int rp = 15;
- if(xf.getParameter("page")!=null) {
- pageNum = Integer.parseInt(xf.getParameter("page"));
- rp = Integer.parseInt(xf.getParameter("rp"));
- }
- int total=0;
- if(xf.getParameter("total")!=null) {
- total = Integer.parseInt(xf.getParameter("total"));
- }
- StringBuilder query = new StringBuilder();
- String q = mp.toString();
- query.append(q);
-
- if(q.indexOf("select ")!=-1 && q.indexOf("limit")==-1) {
- query.append(" limit ");
- query.append(pageNum);
- query.append(",");
- query.append(rp);
- }
-
- ResultSet rs = dbw.query(query.toString());
- ResultSetMetaData rmeta = rs.getMetaData();
- int col = rmeta.getColumnCount();
- JSONObject data = new JSONObject();
- JSONArray rows = new JSONArray();
- while(rs.next()) {
- JSONArray cells = new JSONArray();
- for(int i=1;i<=col;i++) {
- if(rmeta.getColumnType(i)==java.sql.Types.BIGINT) {
- cells.put(nf.format(rs.getBigDecimal(i)));
- } else if(rmeta.getColumnType(i)==java.sql.Types.TINYINT ||
- rmeta.getColumnType(i)==java.sql.Types.INTEGER) {
- cells.put(nf.format(rs.getInt(i)));
- } else if(rmeta.getColumnType(i)==java.sql.Types.FLOAT ||
- rmeta.getColumnType(i)==java.sql.Types.DOUBLE ||
- rmeta.getColumnType(i)==java.sql.Types.DECIMAL ) {
- cells.put(nf.format(rs.getDouble(i)));
- } else {
- cells.put(rs.getString(i));
- }
- }
- JSONObject row = new JSONObject();
- if(rs.getString(1)!=null) {
- row.put("id",rs.getString(1));
- } else {
- row.put("id","null");
- }
- row.put("cell",cells);
- rows.put(row);
- }
- data.put("page",pageNum);
- data.put("rows",rows);
- data.put("total",total);
- dbw.close();
- out.println(data.toString());
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/session.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/session.jsp b/src/main/web/hicc/jsp/session.jsp
deleted file mode 100644
index 8973a0a..0000000
--- a/src/main/web/hicc/jsp/session.jsp
+++ /dev/null
@@ -1,31 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "javax.servlet.http.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, org.apache.hadoop.chukwa.util.XssFilter" %>
-<%
- XssFilter xf = new XssFilter(request);
- for (Enumeration e = request.getParameterNames() ; e.hasMoreElements() ;) {
- String name = (String) e.nextElement();
- if(name.equals("_delete")) {
- session.setAttribute(xf.getParameter(name),null);
- } else {
- session.setAttribute(xf.filter(name),xf.getParameter(name));
- }
- }
-%>
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/sql_client.jsp
----------------------------------------------------------------------
diff --git a/src/main/web/hicc/jsp/sql_client.jsp b/src/main/web/hicc/jsp/sql_client.jsp
deleted file mode 100644
index c7cada9..0000000
--- a/src/main/web/hicc/jsp/sql_client.jsp
+++ /dev/null
@@ -1,69 +0,0 @@
-<%
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-%>
-<%@ page import = "java.text.SimpleDateFormat" %>
-<%@ page import = "java.text.NumberFormat" %>
-<%@ page import = "java.util.Hashtable" %>
-<%@ page import = "java.util.Enumeration" %>
-<%@ page import = "java.util.Calendar" %>
-<%@ page import = "java.util.Date" %>
-<%@ page import = "java.util.regex.Pattern" %>
-<%@ page import = "java.util.regex.Matcher" %>
-<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %>
-<%@ page import = "org.apache.hadoop.chukwa.util.ExceptionUtil" %>
-<%
- RequestDispatcher disp = null;
- XssFilter xf = new XssFilter(request);
- response.setContentType("text/html; chartset=UTF-8//IGNORE");
- response.setHeader("boxId", xf.getParameter("boxId"));
- Pattern pDelete = Pattern.compile("delete*from", Pattern.CASE_INSENSITIVE);
- Pattern pInsert = Pattern.compile("insert ", Pattern.CASE_INSENSITIVE);
- Pattern pReplace = Pattern.compile("replace ", Pattern.CASE_INSENSITIVE);
- Pattern pDrop = Pattern.compile("drop ", Pattern.CASE_INSENSITIVE);
- Pattern pUpdate = Pattern.compile("update ", Pattern.CASE_INSENSITIVE);
- try {
- String format="table";
- if(request.getParameter("render")!=null) {
- format=xf.getParameter("render");
- }
- if(pDelete.matcher(xf.getParameter("query")).matches() ||
- pInsert.matcher(xf.getParameter("query")).matches() ||
- pReplace.matcher(xf.getParameter("query")).matches() ||
- pDrop.matcher(xf.getParameter("query")).matches() ||
- pUpdate.matcher(xf.getParameter("query")).matches()) {
- throw new Exception("Read only query supported");
- }
- if(format.intern()=="table".intern()) {
- disp = getServletContext( ).getRequestDispatcher("/jsp/table.jsp");
- disp.forward(request, response);
- } else if(format.intern()=="area".intern() ||
- format.intern()=="bar".intern() ||
- format.intern()=="line".intern() ||
- format.intern()=="point".intern() ||
- format.intern()=="stack-area".intern()) {
- disp = getServletContext( ).getRequestDispatcher("/jsp/single-series-chart-javascript.jsp");
- disp.forward(request, response);
- }
- } catch(Exception ex) {
- out.println("Unsupported query.<pre>");
- out.println(ExceptionUtil.getStackTrace(ex));
- out.println("</pre>");
- }
-%>