org.hackystat.sensor.ant.antbuild
Class BuildSensorAntListener

java.lang.Object
  extended by org.hackystat.sensor.ant.antbuild.BuildSensorAntListener
All Implemented Interfaces:
java.util.EventListener, org.apache.tools.ant.BuildListener

public class BuildSensorAntListener
extends java.lang.Object
implements org.apache.tools.ant.BuildListener

Ant build sensor. It's implemented as an ant listener. Note that we are unable to access the Ant properties directly. Because of this almost all the Ant methods have a check to see if properties have been retrieved by this sensor. The order of the methods depends on the build so almost all methods need to do this check.

Author:
(Cedric) Qin Zhang, Julie Ann Sakuda

Constructor Summary
BuildSensorAntListener()
          Constructs an instance of the build sensor listener.
 
Method Summary
 void buildFinished(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant finishes the build.
 void buildStarted(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant starts the build.
 void messageLogged(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant logs a message.
 void targetFinished(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant finishes a build target.
 void targetStarted(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant starts a build target.
 void taskFinished(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant finishes a build task.
 void taskStarted(org.apache.tools.ant.BuildEvent buildEvent)
          Callback function when ant starts a build task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildSensorAntListener

public BuildSensorAntListener()
Constructs an instance of the build sensor listener. This constructor allows the build sensor to be installed using the -listener ant argument. Unfortunately, using this approach we lose the ability to pass in constructor arguments. This constructor must be public with no parameters.

Method Detail

buildStarted

public void buildStarted(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant starts the build. Note that the Ant properties at this point do not have any properties specified with '-D'. Do not try to get the property values here.

Specified by:
buildStarted in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

buildFinished

public void buildFinished(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant finishes the build. It sends out the build sensor data if build sensor is enabled.

Specified by:
buildFinished in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

targetStarted

public void targetStarted(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant starts a build target. It's used to record last ant target invoked.

Specified by:
targetStarted in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

targetFinished

public void targetFinished(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant finishes a build target.

Specified by:
targetFinished in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

taskStarted

public void taskStarted(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant starts a build task.

Specified by:
taskStarted in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

taskFinished

public void taskFinished(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant finishes a build task.

Specified by:
taskFinished in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.

messageLogged

public void messageLogged(org.apache.tools.ant.BuildEvent buildEvent)
Callback function when ant logs a message.

Specified by:
messageLogged in interface org.apache.tools.ant.BuildListener
Parameters:
buildEvent - The build event object.