Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.ui.servlet
Class ChartServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.hyperic.hq.ui.servlet.ParameterizedServlet
              extended by org.hyperic.hq.ui.servlet.ImageServlet
                  extended by org.hyperic.hq.ui.servlet.ChartServlet
All Implemented Interfaces:
java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig
Direct Known Subclasses:
AvailabilityStoplightChartServlet, HighLowChartServlet, VerticalChartServlet

public abstract class ChartServlet
extends ImageServlet

This servlet returns a response that contains the binary data of an image (JPEG or PNG) that can be viewed in a web browser.

The chart servlet takes the following parameters (any applicable defaults are in bold and required parameters are in italics):

key value
unitUnits <integer UNIT_NONE>
unitScale <integer SCALE_NONE>
showPeak (false | true)
showHighRange (false | true)
showValues (false | true)
showAverage (false | true)
showLowRange (false | true)
showLow (false | true)
showBaseline (false | true)
baseline* <double>
highRange* <double>
lowRange* <double>

* only used and required if corresponding showXXX parameter is true

The unitUnits and unitScale parameters must be valid integers from UnitsConstants.

See Also:
UnitsConstants, Serialized Form

Field Summary
static java.lang.String BASELINE_PARAM
          Request parameter for baseline.
static java.lang.String HIGHRANGE_PARAM
          Request parameter for baseline.
static int IMAGE_HEIGHT_DEFAULT
          Default image height.
static int IMAGE_WIDTH_DEFAULT
          Default image width.
static java.lang.String LOWRANGE_PARAM
          Request parameter for baseline.
static java.lang.String SHOW_AVERAGE_PARAM
          Request parameter for whether or not to show average.
static java.lang.String SHOW_BASELINE_PARAM
          Request parameter for whether or not to show baseline.
static java.lang.String SHOW_HIGHRANGE_PARAM
          Request parameter for whether or not to show high range.
static java.lang.String SHOW_LOW_PARAM
          Request parameter for whether or not to show the low.
static java.lang.String SHOW_LOWRANGE_PARAM
          Request parameter for whether or not to show low range.
static java.lang.String SHOW_PEAK_PARAM
          Request parameter for whether or not to show the peak.
static java.lang.String SHOW_VALUES_PARAM
          Request parameter for whether or not to show the actual values.
static java.lang.String UNIT_SCALE_PARAM
          Request parameter for unit scale.
static java.lang.String UNIT_UNITS_PARAM
          Request parameter for unit scale.
 
Fields inherited from class org.hyperic.hq.ui.servlet.ImageServlet
IMAGE_FORMAT_JPEG, IMAGE_FORMAT_PARAM, IMAGE_FORMAT_PNG, IMAGE_HEIGHT_PARAM, IMAGE_WIDTH_PARAM
 
Constructor Summary
ChartServlet()
           
 
Method Summary
protected abstract  Chart createChart(javax.servlet.http.HttpServletRequest request, ChartDataBean dataBean)
          Create and return the chart.
protected  java.lang.Object createImage(javax.servlet.http.HttpServletRequest request)
          Create the image being rendered.
protected  int getDefaultImageHeight()
          Return the default imageHeight.
protected  int getDefaultImageWidth()
          Return the default imageWidth.
protected  boolean getDefaultShowAverage()
          Return the default showAverage.
protected  boolean getDefaultShowBaseline()
          Return the default showBaseline.
protected  boolean getDefaultShowHighRange()
          Return the default showHighRange.
protected  boolean getDefaultShowLow()
          Return the default showLow.
protected  boolean getDefaultShowLowRange()
          Return the default Range.
protected  boolean getDefaultShowPeak()
          Return the default showPeak.
protected  boolean getDefaultShowValues()
          Return the default showValues.
protected  int getDefaultUnitScale()
          Return the default unitScale.
protected  int getDefaultUnitUnits()
          Return the default unitUnits.
 boolean getShowAvg()
          Return the value of property showAverage.
 boolean getShowLow()
          Return the value of property showLow.
 boolean getShowPeak()
          Return the value of property showPeak.
protected  void initializeChart(Chart chart, javax.servlet.http.HttpServletRequest request)
          Initialize the chart.
protected  void parseParameters(javax.servlet.http.HttpServletRequest request)
          This method will be called automatically by the ChartServlet.
protected abstract  void plotData(javax.servlet.http.HttpServletRequest request, Chart chart, ChartDataBean dataBean)
          This method will be called automatically by the ChartServlet.
protected  void renderJpegImage(javax.servlet.ServletOutputStream out, java.lang.Object imgObj)
          Render a JPEG version of the image into the output stream.
protected  void renderPngImage(javax.servlet.ServletOutputStream out, java.lang.Object imgObj)
          Render a PNG version of the image into the output stream.
 
Methods inherited from class org.hyperic.hq.ui.servlet.ImageServlet
doGet, getDefaultImageFormat, getImageHeight, getImageWidth, init
 
Methods inherited from class org.hyperic.hq.ui.servlet.ParameterizedServlet
invalidParamErr, invalidParamErr, invalidParamWarn, invalidParamWarn, invalidParamWarn, invalidParamWarn, invalidParamWarn, parseBooleanParameter, parseDoubleParameter, parseIntParameter, parseLongParameter, parseRequiredBooleanParameter, parseRequiredDoubleParameter, parseRequiredIntParameter, parseRequiredLongParameter, parseRequiredStringParameter, parseRequiredStringParameter, parseStringParameter, parseStringParameter, requiredParamErr
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNIT_UNITS_PARAM

public static final java.lang.String UNIT_UNITS_PARAM
Request parameter for unit scale.

See Also:
Constant Field Values

UNIT_SCALE_PARAM

public static final java.lang.String UNIT_SCALE_PARAM
Request parameter for unit scale.

See Also:
Constant Field Values

IMAGE_WIDTH_DEFAULT

public static final int IMAGE_WIDTH_DEFAULT
Default image width.

See Also:
Constant Field Values

IMAGE_HEIGHT_DEFAULT

public static final int IMAGE_HEIGHT_DEFAULT
Default image height.

See Also:
Constant Field Values

SHOW_PEAK_PARAM

public static final java.lang.String SHOW_PEAK_PARAM
Request parameter for whether or not to show the peak.

See Also:
Constant Field Values

SHOW_HIGHRANGE_PARAM

public static final java.lang.String SHOW_HIGHRANGE_PARAM
Request parameter for whether or not to show high range.

See Also:
Constant Field Values

SHOW_VALUES_PARAM

public static final java.lang.String SHOW_VALUES_PARAM
Request parameter for whether or not to show the actual values.

See Also:
Constant Field Values

SHOW_AVERAGE_PARAM

public static final java.lang.String SHOW_AVERAGE_PARAM
Request parameter for whether or not to show average.

See Also:
Constant Field Values

SHOW_LOWRANGE_PARAM

public static final java.lang.String SHOW_LOWRANGE_PARAM
Request parameter for whether or not to show low range.

See Also:
Constant Field Values

SHOW_LOW_PARAM

public static final java.lang.String SHOW_LOW_PARAM
Request parameter for whether or not to show the low.

See Also:
Constant Field Values

SHOW_BASELINE_PARAM

public static final java.lang.String SHOW_BASELINE_PARAM
Request parameter for whether or not to show baseline.

See Also:
Constant Field Values

BASELINE_PARAM

public static final java.lang.String BASELINE_PARAM
Request parameter for baseline.

See Also:
Constant Field Values

HIGHRANGE_PARAM

public static final java.lang.String HIGHRANGE_PARAM
Request parameter for baseline.

See Also:
Constant Field Values

LOWRANGE_PARAM

public static final java.lang.String LOWRANGE_PARAM
Request parameter for baseline.

See Also:
Constant Field Values
Constructor Detail

ChartServlet

public ChartServlet()
Method Detail

createImage

protected java.lang.Object createImage(javax.servlet.http.HttpServletRequest request)
                                throws javax.servlet.ServletException
Create the image being rendered.

Specified by:
createImage in class ImageServlet
Parameters:
request - the servlet request
Throws:
javax.servlet.ServletException

renderPngImage

protected void renderPngImage(javax.servlet.ServletOutputStream out,
                              java.lang.Object imgObj)
                       throws java.io.IOException
Render a PNG version of the image into the output stream.

Specified by:
renderPngImage in class ImageServlet
Parameters:
out - the output stream
Throws:
java.io.IOException

renderJpegImage

protected void renderJpegImage(javax.servlet.ServletOutputStream out,
                               java.lang.Object imgObj)
                        throws java.io.IOException
Render a JPEG version of the image into the output stream.

Specified by:
renderJpegImage in class ImageServlet
Parameters:
out - the output stream
Throws:
java.io.IOException

parseParameters

protected void parseParameters(javax.servlet.http.HttpServletRequest request)
This method will be called automatically by the ChartServlet. It should handle the parsing and error-checking of any specific parameters for the chart being rendered.

Specified by:
parseParameters in class ImageServlet
Parameters:
request - the HTTP request object

createChart

protected abstract Chart createChart(javax.servlet.http.HttpServletRequest request,
                                     ChartDataBean dataBean)
Create and return the chart. This method will be called after the parameters have been parsed.

Parameters:
request - TODO
dataBean - TODO
Returns:
the newly created chart

initializeChart

protected void initializeChart(Chart chart,
                               javax.servlet.http.HttpServletRequest request)
Initialize the chart. This method will be called after the parameters have been parsed and the chart has been created.

Parameters:
chart - the chart
request - TODO

plotData

protected abstract void plotData(javax.servlet.http.HttpServletRequest request,
                                 Chart chart,
                                 ChartDataBean dataBean)
                          throws javax.servlet.ServletException
This method will be called automatically by the ChartServlet. It should handle adding data to the chart, setting up the X and Y axis labels, etc.

Parameters:
request - the HTTP request
dataBean - TODO
Throws:
javax.servlet.ServletException

getShowLow

public boolean getShowLow()
Return the value of property showLow.


getShowPeak

public boolean getShowPeak()
Return the value of property showPeak.


getShowAvg

public boolean getShowAvg()
Return the value of property showAverage.


getDefaultUnitUnits

protected int getDefaultUnitUnits()
Return the default unitUnits.


getDefaultUnitScale

protected int getDefaultUnitScale()
Return the default unitScale.


getDefaultImageWidth

protected int getDefaultImageWidth()
Return the default imageWidth.

Overrides:
getDefaultImageWidth in class ImageServlet

getDefaultImageHeight

protected int getDefaultImageHeight()
Return the default imageHeight.

Overrides:
getDefaultImageHeight in class ImageServlet

getDefaultShowPeak

protected boolean getDefaultShowPeak()
Return the default showPeak.


getDefaultShowHighRange

protected boolean getDefaultShowHighRange()
Return the default showHighRange.


getDefaultShowValues

protected boolean getDefaultShowValues()
Return the default showValues.


getDefaultShowAverage

protected boolean getDefaultShowAverage()
Return the default showAverage.


getDefaultShowLowRange

protected boolean getDefaultShowLowRange()
Return the default Range.


getDefaultShowLow

protected boolean getDefaultShowLow()
Return the default showLow.


getDefaultShowBaseline

protected boolean getDefaultShowBaseline()
Return the default showBaseline.


Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.