com.ebay.carad.os.vitalsigns.listeners
Class UptimeReporter

java.lang.Object
  extended by com.ebay.carad.os.vitalsigns.listeners.AbstractReportingListener
      extended by com.ebay.carad.os.vitalsigns.listeners.UptimeReporter
All Implemented Interfaces:
IReportingListener, java.lang.Cloneable

public class UptimeReporter
extends AbstractReportingListener
implements IReportingListener, java.lang.Cloneable

Create a chart for last 4 week's outages. TODO : this class still needs to be ported to work with the OS version of vitalsigns

Version:
$Id$
Author:
Jeremy Kraybill, Jeremy Thomerson

Field Summary
private  ISqlDAO mSqlDAO
           
 
Constructor Summary
UptimeReporter()
          Basic constructor.
 
Method Summary
 java.lang.Object clone()
           
private  org.jfree.chart.JFreeChart createChart(org.jfree.data.category.IntervalCategoryDataset dataset)
          Creates a chart.
 org.jfree.data.category.IntervalCategoryDataset createDataset(java.util.List data)
          Creates a sample dataset for the outage report.
private static java.util.Date date(java.util.Calendar calendar)
          Utility method for creating a simple date from a calendar object.
private static java.util.Date date(int inHour, int inMinute)
          Utility method for creating Date objects.
 org.jfree.data.gantt.TaskSeries initializeSeries()
          Initializes a task series, with maintenance hours highlighted at top.
 java.lang.String report(IDashboardReport config, IDashboardAgent agent)
          Basic reporting method.
 void reportRan(IDashboardAgent agent, IDashboardReport report)
           
 void setSqlDAO(ISqlDAO sqlDAO)
           
private  void writeHTML(IDashboardReport config, java.lang.String chartBase, IReportingListenerContainer agent)
           
 
Methods inherited from class com.ebay.carad.os.vitalsigns.listeners.AbstractReportingListener
reportingComplete, reportingException, reportingPreStart
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ebay.carad.os.vitalsigns.listeners.IReportingListener
reportingComplete, reportingException, reportingPreStart
 

Field Detail

mSqlDAO

private ISqlDAO mSqlDAO
Constructor Detail

UptimeReporter

public UptimeReporter()
Basic constructor.

Method Detail

initializeSeries

public org.jfree.data.gantt.TaskSeries initializeSeries()
Initializes a task series, with maintenance hours highlighted at top.

Returns:
an initialized series, ready to have new tasks added

createDataset

public org.jfree.data.category.IntervalCategoryDataset createDataset(java.util.List data)
Creates a sample dataset for the outage report.

Parameters:
data - a list of maps, representing the times of outages. Expect each map to contain "logtime" as a key.
Returns:
The dataset.

date

private static java.util.Date date(int inHour,
                                   int inMinute)
Utility method for creating Date objects.

Parameters:
inHour - the hour
inMinute - the minute
Returns:
a date.

date

private static java.util.Date date(java.util.Calendar calendar)
Utility method for creating a simple date from a calendar object.

Parameters:
calendar - the calendar to use
Returns:
a date.

createChart

private org.jfree.chart.JFreeChart createChart(org.jfree.data.category.IntervalCategoryDataset dataset)
Creates a chart.

Parameters:
dataset - the dataset
Returns:
the chart

report

public java.lang.String report(IDashboardReport config,
                               IDashboardAgent agent)
                        throws java.io.IOException
Basic reporting method. Generates a graph of name reportX.jpg, and a corresponding HTML file.

Parameters:
config - my config
agent - my agent
Returns:
an empty string
Throws:
java.io.IOException - if bad things happen

writeHTML

private void writeHTML(IDashboardReport config,
                       java.lang.String chartBase,
                       IReportingListenerContainer agent)
                throws java.io.IOException
Throws:
java.io.IOException

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

setSqlDAO

public void setSqlDAO(ISqlDAO sqlDAO)

reportRan

public void reportRan(IDashboardAgent agent,
                      IDashboardReport report)
Specified by:
reportRan in interface IReportingListener
Overrides:
reportRan in class AbstractReportingListener


Copyright © 2004-2009. All Rights Reserved.