org.apache.hadoop.chukwa.analysis.salsa.visualization
Class Swimlanes

java.lang.Object
  extended by org.apache.hadoop.chukwa.analysis.salsa.visualization.Swimlanes

public class Swimlanes
extends Object

Static image generation for Swimlanes visualization for scalable rendering on front-end client (web-browser) Handles database data retrieval, transforming data to form for visualization elements, and initializing and calling visualization elements


Nested Class Summary
static class Swimlanes.CoordScaler
          Provides convenient rescaling of raw values to be plotted to actual pixels for plotting on image
protected  class Swimlanes.MapReduceSwimlanes
          Modifier for generic Swimlanes plots to plot shuffle, sort, and reducer states of same reduce on same line
static class Swimlanes.SwimlanesStateAction
          Prefuse action for plotting a line for each state
static class Swimlanes.SwimlanesStatePalette
          Provide constant mapping between state names and colours so that even if particular states are missing, the colours are fixed for each state
 
Field Summary
protected  String abc
           
protected  String cluster
           
protected  Rectangle2D dataBound
           
protected  prefuse.Display dis
           
protected  String jobname
           
protected  Rectangle2D labelBottomBound
           
protected  boolean offline_use
           
protected  HashMap<String,String> param_map
           
protected  boolean plot_legend
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  String shuffle_option
           
protected  String table
           
protected  String timezone
           
protected  prefuse.Visualization viz
           
protected  Rectangle2D xlabBound
           
protected  Rectangle2D ylabBound
           
 
Constructor Summary
Swimlanes()
           
Swimlanes(javax.servlet.http.HttpServletRequest request)
           
Swimlanes(String timezone, String cluster, String event_type, HashMap<String,String> valmap)
           
Swimlanes(String timezone, String cluster, String event_type, HashMap<String,String> valmap, int width, int height)
           
Swimlanes(String timezone, String cluster, String event_type, HashMap<String,String> valmap, int width, int height, String legend_opt)
           
 
Method Summary
protected  void addAxisNames()
           
protected  void addLegend()
           
protected  prefuse.data.Table addTimeCol(prefuse.data.Table origTable, String srcFieldName, String srcMillisecondFieldName, String dstFieldName)
          Adds a column to given table by converting timestamp to long with seconds since epoch, and adding milliseconds from additional column in original table
protected  prefuse.data.Table addTimeOffsetCol(prefuse.data.Table origTable, String srcFieldName, String srcMillisecondFieldName, String dstFieldName, long timeOffset)
          Adds a column with number of seconds of timestamp elapsed since lowest start time; allows times to be plotted as a delta of the start time
 prefuse.data.Table getData()
           
 boolean getImage(OutputStream output, String img_fmt, double scale)
          Generates image in specified format, and writes image as binary output to supplied output stream
 void run()
           
 void setDimensions(int width, int height)
          Set dimensions of image to be generated Call before calling @see #run
 void setJobName(String s)
          Set job ID to filter results on Call before calling @see #run
 void setLegend(boolean legendopt)
          Specify whether to print legend of states Advisable to not print legend for excessively small images since legend has fixed point size Call before calling @see #run
protected  prefuse.data.Table setupDataTable()
           
protected  void setupRenderer()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

offline_use

protected boolean offline_use

request

protected javax.servlet.http.HttpServletRequest request

abc

protected String abc

param_map

protected HashMap<String,String> param_map

cluster

protected String cluster

timezone

protected String timezone

shuffle_option

protected String shuffle_option

table

protected final String table

plot_legend

protected boolean plot_legend

jobname

protected String jobname

dis

protected prefuse.Display dis

viz

protected prefuse.Visualization viz

dataBound

protected Rectangle2D dataBound

xlabBound

protected Rectangle2D xlabBound

ylabBound

protected Rectangle2D ylabBound

labelBottomBound

protected Rectangle2D labelBottomBound
Constructor Detail

Swimlanes

public Swimlanes()

Swimlanes

public Swimlanes(String timezone,
                 String cluster,
                 String event_type,
                 HashMap<String,String> valmap)
Parameters:
timezone - Timezone string from environment
cluster - Cluster name from environment
event_type - Whether to display shuffles or not
valmap - HashMap of key/value pairs simulating parameters from a HttpRequest

Swimlanes

public Swimlanes(String timezone,
                 String cluster,
                 String event_type,
                 HashMap<String,String> valmap,
                 int width,
                 int height)

Swimlanes

public Swimlanes(String timezone,
                 String cluster,
                 String event_type,
                 HashMap<String,String> valmap,
                 int width,
                 int height,
                 String legend_opt)

Swimlanes

public Swimlanes(javax.servlet.http.HttpServletRequest request)
Method Detail

setJobName

public void setJobName(String s)
Set job ID to filter results on Call before calling @see #run


setDimensions

public void setDimensions(int width,
                          int height)
Set dimensions of image to be generated Call before calling @see #run


setLegend

public void setLegend(boolean legendopt)
Specify whether to print legend of states Advisable to not print legend for excessively small images since legend has fixed point size Call before calling @see #run


getImage

public boolean getImage(OutputStream output,
                        String img_fmt,
                        double scale)
Generates image in specified format, and writes image as binary output to supplied output stream


addTimeCol

protected prefuse.data.Table addTimeCol(prefuse.data.Table origTable,
                                        String srcFieldName,
                                        String srcMillisecondFieldName,
                                        String dstFieldName)
Adds a column to given table by converting timestamp to long with seconds since epoch, and adding milliseconds from additional column in original table

Parameters:
origTable - Table to add to
srcFieldName - Name of column containing timestamp
srcMillisecondFieldName - Name of column containing millisecond value of time
dstFieldName - Name of new column to add
Returns:
Modified table with added column

addTimeOffsetCol

protected prefuse.data.Table addTimeOffsetCol(prefuse.data.Table origTable,
                                              String srcFieldName,
                                              String srcMillisecondFieldName,
                                              String dstFieldName,
                                              long timeOffset)
Adds a column with number of seconds of timestamp elapsed since lowest start time; allows times to be plotted as a delta of the start time

Parameters:
origTable - Table to add column to
srcFieldName - Name of column containing timestamp
srcMillisecondFieldName - Name of column containing millisecond value of time
dstFieldName - Name of new column to add
Returns:
Modified table with added column

setupRenderer

protected void setupRenderer()

setupDataTable

protected prefuse.data.Table setupDataTable()

addAxisNames

protected void addAxisNames()

addLegend

protected void addLegend()

run

public void run()

getData

public prefuse.data.Table getData()


Copyright © ${year} The Apache Software Foundation