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

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

public class DevTimeReducer
extends java.lang.Object
implements TelemetryReducer

Returns a single stream providing DevTime data in hours.

Accepts the following options in the following order, although only User and isCumulative are supported at the current time.

  1. EventType: Supply an Event Type to restrict the DevTime to just the time associated with that Event Type. Default is "*" which indicates all file types are used in computing the DevTime.
  2. User: Supply a user email to get DevTime for just that user. Default is "*" indicating the aggregate DevTime of all project members.
  3. ResourceFilterPattern: Restricts the files over which the DevTime is computed. Default is "**".
  4. isCumulative: True or false. Default is false.

Author:
Hongbing Kou, Philip Johnson

Constructor Summary
DevTimeReducer()
           
 
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 eventType, java.lang.String member, org.hackystat.sensorbase.uripattern.UriPattern filePattern)
          Returns a DevTime value for the specified time interval, 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 eventType, java.lang.String member, org.hackystat.sensorbase.uripattern.UriPattern filePattern, boolean isCumulative, 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

DevTimeReducer

public DevTimeReducer()
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 eventType,
                          java.lang.String member,
                          org.hackystat.sensorbase.uripattern.UriPattern filePattern,
                          boolean isCumulative,
                          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.
eventType - The event type, or null to match all event types. (ignored)
member - Project member, or null to match all members.
filePattern - File filter pattern, or null to match all files. (ignored)
isCumulative - True for cumulative measure.
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 eventType,
                         java.lang.String member,
                         org.hackystat.sensorbase.uripattern.UriPattern filePattern)
                   throws TelemetryReducerException
Returns a DevTime value for the specified time interval, or null if no SensorData. Note that the DPD returns DevTime in minutes, but we are going to convert it to hours since that makes more sense for telemetry. NOTE: This function currently ignores the filePattern and eventType constraints and simply returns either total aggregate devTime (if member is null), or the devTime for a single member (if the memberEmail is supplied).

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).
eventType - The event type, or null to match all file types. (ignored)
member - The project member email, or null to match all members.
filePattern - File filter pattern, or null to match all files. (ignored)
Returns:
The DevTime, or null if there is no DevEvent SensorData for that time period.
Throws:
TelemetryReducerException - If anything goes wrong.