org.hackystat.telemetry.analyzer.reducer.impl
Class FileMetricReducer

java.lang.Object
  extended by org.hackystat.telemetry.analyzer.reducer.impl.FileMetricReducer
All Implemented Interfaces:
TelemetryReducer

public class FileMetricReducer
extends java.lang.Object
implements TelemetryReducer

Returns a single stream providing FileMetric data.

Options:

  1. sizemetric: A string indicating the size metric to return, such as "TotalLines". Default is 'TotalLines'.
  2. tool: A string indicating the tool whose size data will be retrieved, such as "SCLC". Default is '*', indicating that any tool will do.

Author:
Philip Johnson, Cedric Zhang

Constructor Summary
FileMetricReducer()
           
 
Method Summary
 TelemetryStreamCollection compute(org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.utilities.time.interval.Interval interval, java.lang.String[] options)
          Computes and returns the required telemetry streams object.
(package private)  java.lang.Double getData(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.utilities.time.period.Day startDay, org.hackystat.utilities.time.period.Day endDay, java.lang.String sizeMetric, java.lang.String tool)
          Returns a FileMetric value for the specified time interval and sizeMetric, or null if no SensorData.
(package private)  TelemetryStream getStream(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.utilities.time.interval.Interval interval, java.lang.String sizeMetric, java.lang.String tool, java.lang.Object streamTagValue)
          Gets the telemetry stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileMetricReducer

public FileMetricReducer()
Method Detail

compute

public TelemetryStreamCollection compute(org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                                         org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                                         org.hackystat.utilities.time.interval.Interval interval,
                                         java.lang.String[] options)
                                  throws TelemetryReducerException
Computes and returns the required telemetry streams object.

Specified by:
compute in interface TelemetryReducer
Parameters:
project - The project.
dpdClient - The DPD Client.
interval - The interval.
options - The optional parameters.
Returns:
Telemetry stream collection.
Throws:
TelemetryReducerException - If there is any error.

getStream

TelemetryStream getStream(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                          org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                          org.hackystat.utilities.time.interval.Interval interval,
                          java.lang.String sizeMetric,
                          java.lang.String tool,
                          java.lang.Object streamTagValue)
                    throws java.lang.Exception
Gets the telemetry stream.

Parameters:
dpdClient - The DailyProjectData client we will contact for the data.
project - The project.
interval - The interval.
sizeMetric - The SizeMetric.
tool - The tool to get the size data from.
streamTagValue - The tag for the generated telemetry stream.
Returns:
The telemetry stream as required.
Throws:
java.lang.Exception - If there is any error.

getData

java.lang.Double getData(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                         org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                         org.hackystat.utilities.time.period.Day startDay,
                         org.hackystat.utilities.time.period.Day endDay,
                         java.lang.String sizeMetric,
                         java.lang.String tool)
                   throws TelemetryReducerException
Returns a FileMetric value for the specified time interval and sizeMetric, or null if no SensorData. We work backward through the time interval, and return the FileMetric value for the first day in the interval for which FileMetric data exists.

Parameters:
dpdClient - The DailyProjectData client we will use to get this data.
project - The project.
startDay - The start day (inclusive).
endDay - The end day (inclusive).
sizeMetric - The size metric.
tool - The tool name, or "*" if any tool will do.
Returns:
The FileMetric value, or null if there is no SensorData for that time period.
Throws:
TelemetryReducerException - If anything goes wrong.