org.hackystat.sensor.ant.svn
Class SvnSensor

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

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

Ant task to extract the svn commits and send those information to Hackystat server. Note: For binary files, the values for lines addes, lines deleted, and total lines are meaningless.

Author:
Qin ZHANG, Austen Ito (v8 port)

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
SvnSensor()
           
 
Method Summary
 void execute()
          Extracts commit information from SVN 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 svn committer 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 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 setLastIntervalInMinutes(java.lang.String lastIntervalInMinutes)
          Sets the last interval in minutes.
 void setPassword(java.lang.String password)
          Sets the password for the user name.
 void setRepositoryName(java.lang.String repositoryName)
          Sets the svn repository name.
 void setRepositoryUrl(java.lang.String repositoryUrl)
          Sets the url to the svn repository.
 void setToDate(java.lang.String toDateString)
          Sets the optional toDate.
 void setUserName(java.lang.String userName)
          Sets the user name to access the SVN 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

SvnSensor

public SvnSensor()
Method Detail

setRepositoryName

public void setRepositoryName(java.lang.String repositoryName)
Sets the svn repository name. This name can be any string. It's used in commit metric to identify from which svn repository metric is retrieved.

Parameters:
repositoryName - The name of the svn repository.

setRepositoryUrl

public void setRepositoryUrl(java.lang.String repositoryUrl)
Sets the url to the svn repository. It can points to any subdirectory in the repository. However, note that this sensor only supports http|https|svn protocol.

Parameters:
repositoryUrl - The url to the svn repository.

setUserName

public void setUserName(java.lang.String userName)
Sets the user name to access the SVN repository. If not set, then anonymous credential is used.

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.

setFileNamePrefix

public void setFileNamePrefix(java.lang.String fileNamePrefix)
Sets a string to be prepended to the file path in commit metric. Recall that svn sensor can only get relative file path to the svn repository root, 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 svn committer 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.

setLastIntervalInMinutes

public void setLastIntervalInMinutes(java.lang.String lastIntervalInMinutes)
Sets the last interval in minutes.

Parameters:
lastIntervalInMinutes - The preceding interval in minutes to poll.

execute

public void execute()
             throws org.apache.tools.ant.BuildException
Extracts commit information from SVN 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.