org.hackystat.sensor.ant.perforce
Class PerforceCommitProcessor

java.lang.Object
  extended by org.hackystat.sensor.ant.perforce.PerforceCommitProcessor

public class PerforceCommitProcessor
extends java.lang.Object

Provides the interface to Perforce for the sensor. This code accomplishes the following:

Note that you must create a P4Environment instance and initialize it properly before invoking the PerforceCommitProcessor. See the main() method for example usage of this class.

Author:
Philip Johnson

Constructor Summary
PerforceCommitProcessor(P4Environment p4Environment, java.lang.String depotPath)
          Instantiates a PerforceCommitProcessor with the passed P4Environment instance and depotPath.
 
Method Summary
 void cleanup()
          This method should be invoked at the end of the sensor run, and will delete the client created for this task as well as invoke the Perforce library cleanUp() method.
 java.util.List<PerforceChangeListData> getChangeListDataList()
          Retrieve the list of PerforceChangeListData instances associated with this instance.
static void main(java.lang.String[] args)
          Exercises the methods in this class manually.
 void processChangeLists(java.lang.String startDate, java.lang.String endDate)
          Processes any ChangeLists that were submitted between startData and endDate to the depotPath.
 void setIgnoreWhitespace(boolean ignoreWhitespace)
          Controls whether the diff2 command will be passed the -dw option so that whitespace changes in the file are ignored.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerforceCommitProcessor

public PerforceCommitProcessor(P4Environment p4Environment,
                               java.lang.String depotPath)
                        throws java.lang.Exception
Instantiates a PerforceCommitProcessor with the passed P4Environment instance and depotPath.

Parameters:
p4Environment - The p4Environment.
depotPath - The depot path this processor will work on.
Throws:
java.lang.Exception - If problems occur instantiating this environment.
Method Detail

processChangeLists

public void processChangeLists(java.lang.String startDate,
                               java.lang.String endDate)
                        throws java.lang.Exception
Processes any ChangeLists that were submitted between startData and endDate to the depotPath.

Parameters:
startDate - The start date, in YYYY/MM/DD format.
endDate - The end date, in YYYY/MM/DD format.
Throws:
java.lang.Exception - If problems occur.

getChangeListDataList

public java.util.List<PerforceChangeListData> getChangeListDataList()
Retrieve the list of PerforceChangeListData instances associated with this instance.

Returns:
The list of PerforceChangeListData instances.

setIgnoreWhitespace

public void setIgnoreWhitespace(boolean ignoreWhitespace)
Controls whether the diff2 command will be passed the -dw option so that whitespace changes in the file are ignored.

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

cleanup

public void cleanup()
             throws java.lang.Exception
This method should be invoked at the end of the sensor run, and will delete the client created for this task as well as invoke the Perforce library cleanUp() method.

Throws:
java.lang.Exception - If problems occur.

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Exercises the methods in this class manually. Useful as a way to check that you have configured your p4 environment correctly if you are having problems with the sensor. Supply arguments in the following order. Examples given in parentheses:

Parameters:
args - Arguments are: port, user, password, depotPath, startDate, endDate.
Throws:
java.lang.Exception - If problems occur.