org.hackystat.sensor.ant.perforce
Class PerforceSensor

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by org.hackystat.sensor.ant.perforce.PerforceSensor
All Implemented Interfaces:
java.lang.Cloneable

public class PerforceSensor
extends org.apache.tools.ant.Task

A sensor for collecting Commit information from the Perforce CM system.

Author:
Philip Johnson

Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
PerforceSensor()
          Initialize a new instance of a PerforceSensor.
 
Method Summary
 void execute()
          Extracts commit information from Perforce server, and sends them to the Hackystat server.
 void setDefaultHackystatAccount(java.lang.String defaultHackystatAccount)
          Sets a default Hackystat account to which to send commit data when there is no Perforce user to Hackystat account mapping.
 void setDefaultHackystatPassword(java.lang.String defaultHackystatPassword)
          Sets the default Hackystat account password.
 void setDefaultHackystatSensorbase(java.lang.String defaultHackystatSensorbase)
          Sets the default Hackystat sensorbase server.
 void setDepotPath(java.lang.String depotPath)
          Sets the depot path in the Perforce server.
 void setFileNamePrefix(java.lang.String fileNamePrefix)
          Sets a string to be prepended to the file path in commit metric.
 void setFromDate(java.lang.String fromDateString)
          Sets the optional fromDate.
 void setIgnoreWhitespace(boolean ignoreWhitespace)
          True if whitespace changes should be ignored by the underlying Perforce diff2 program when calculating lines added, changed, and deleted.
 void setP4ExecutablePath(java.lang.String path)
          Sets the path to the p4 executable.
 void setP4SysDrive(java.lang.String sysdrive)
          Sets the path to the Window system drive.
 void setP4SysRoot(java.lang.String sysroot)
          Sets the path to the Window system root dir.
 void setPassword(java.lang.String password)
          Sets the password for the user name.
 void setPort(java.lang.String port)
          Sets the port to the Perforce server.
 void setToDate(java.lang.String toDateString)
          Sets the optional toDate.
 void setUserName(java.lang.String userName)
          Sets the user name to access the Perforce repository.
 void setVerbose(boolean isVerbose)
          Sets if verbose mode has been enabled.
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerforceSensor

public PerforceSensor()
Initialize a new instance of a PerforceSensor.

Method Detail

setUserName

public void setUserName(java.lang.String userName)
Sets the user name to access the Perforce repository.

Parameters:
userName - The user name.

setVerbose

public void setVerbose(boolean isVerbose)
Sets if verbose mode has been enabled.

Parameters:
isVerbose - true if verbose mode is enabled, false if not.

setPassword

public void setPassword(java.lang.String password)
Sets the password for the user name.

Parameters:
password - The password.

setIgnoreWhitespace

public void setIgnoreWhitespace(boolean ignoreWhitespace)
True if whitespace changes should be ignored by the underlying Perforce diff2 program when calculating lines added, changed, and deleted.

Parameters:
ignoreWhitespace - True if whitespace changes should be ignored.

setFileNamePrefix

public void setFileNamePrefix(java.lang.String fileNamePrefix)
Sets a string to be prepended to the file path in commit metric. Recall that Perforce sensor gets the depotPath to the file, however, most hackystat analysis requires fully qualified file path. This prefix can be used to turn relative file path into some pseudo fully qualified file path.

Parameters:
fileNamePrefix - The string to be prepended to the file path in commit metric.

setDefaultHackystatAccount

public void setDefaultHackystatAccount(java.lang.String defaultHackystatAccount)
Sets a default Hackystat account to which to send commit data when there is no Perforce user to Hackystat account mapping.

Parameters:
defaultHackystatAccount - The default Hackystat account.

setDefaultHackystatPassword

public void setDefaultHackystatPassword(java.lang.String defaultHackystatPassword)
Sets the default Hackystat account password.

Parameters:
defaultHackystatPassword - the default account password.

setDefaultHackystatSensorbase

public void setDefaultHackystatSensorbase(java.lang.String defaultHackystatSensorbase)
Sets the default Hackystat sensorbase server.

Parameters:
defaultHackystatSensorbase - the default sensorbase server.

setFromDate

public void setFromDate(java.lang.String fromDateString)
Sets the optional fromDate. If fromDate is set, toDate must be set. This field must be conform to yyyy/MM/dd format.

Parameters:
fromDateString - The first date from which we send commit information to Hackystat server.

setToDate

public void setToDate(java.lang.String toDateString)
Sets the optional toDate. If toDate is set, fromDate must be set. This field must be conform to yyyy/MM/dd format.

Parameters:
toDateString - The last date to which we send commit information to Hackystat server.

setPort

public void setPort(java.lang.String port)
Sets the port to the Perforce server. Example: "public.perforce.com:1666".

Parameters:
port - The port.

setP4ExecutablePath

public void setP4ExecutablePath(java.lang.String path)
Sets the path to the p4 executable. Example: "C:\\Program Files\\Perforce\\P4.EXE".

Parameters:
path - The path.

setP4SysRoot

public void setP4SysRoot(java.lang.String sysroot)
Sets the path to the Window system root dir. Default: "C:\\WINDOWS". This is needed by the p4 executable on Windows for reasons only it knows.

Parameters:
sysroot - The sysroot.

setP4SysDrive

public void setP4SysDrive(java.lang.String sysdrive)
Sets the path to the Window system drive. Default: "C:". This is needed by the p4 executable on Windows for reasons only it knows.

Parameters:
sysdrive - The sysdrive.

setDepotPath

public void setDepotPath(java.lang.String depotPath)
Sets the depot path in the Perforce server. Example: "//guest/philip_johnson/...".

Parameters:
depotPath - The depot path.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Extracts commit information from Perforce server, and sends them to the Hackystat server.

Overrides:
execute in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException - If the task fails.