<% /* * 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.json.*, java.net.*, java.io.*, java.util.*, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler" %> <% session.setAttribute("time_zone","UTC"); session.setAttribute("start","1209400695191"); session.setAttribute("end","1209404295191"); if(session.getAttribute("cluster")==null) { ClusterConfig cc = new ClusterConfig(); Iterator ci = cc.getClusters(); String cluster = (String) ci.next(); session.setAttribute("cluster", cluster); } if(session.getAttribute("period")==null) { session.setAttribute("period","last1hr"); } String machine=""; if(session.getAttribute("hosts")==null) { session.setAttribute("hosts",machine); } if(session.getAttribute("time_type")==null) { session.setAttribute("time_type","last"); } String view_name = "default"; if(request.getParameter("view")!=null) { view_name=request.getParameter("view"); } TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); StringBuffer contents = new StringBuffer(); try { //use buffering, reading one line at a time //FileReader always assumes default encoding is OK! FileInputStream url = new FileInputStream(System.getProperty("CHUKWA_DATA_DIR")+"/views/"+view_name+".view"); DataInputStream in = new DataInputStream(url); String inputLine; while ((inputLine = in.readLine()) != null) { contents.append(inputLine); contents.append(System.getProperty("line.separator")); } in.close(); } catch (IOException ex){ ex.printStackTrace(); } JSONObject view = new JSONObject(contents.toString()); StringBuffer contents2 = new StringBuffer(); try { //use buffering, reading one line at a time //FileReader always assumes default encoding is OK! FileInputStream url2 = new FileInputStream(System.getProperty("CHUKWA_DATA_DIR")+"/views/workspace_view_list.cache"); DataInputStream in2 = new DataInputStream(url2); String inputLine2; while ((inputLine2 = in2.readLine()) != null) { contents2.append(inputLine2); contents2.append(System.getProperty("line.separator")); } in2.close(); } catch (IOException ex){ ex.printStackTrace(); } JSONArray views = new JSONArray(contents2.toString()); %> Hadoop Infrastructure Care Center

Views
<% for(int i=0;i<((JSONArray)view.get("pages")).length();i++) { String title = (String)((JSONObject)((JSONArray)view.get("pages")).get(i)).get("title"); %> <% } %>