|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.hackystat.sensor.ant.task.HackystatSensorTask
public abstract class HackystatSensorTask
An abstract superclass containing instance variables and helper methods used by Hackystat Sensors implemented as Ant tasks. This includes almost all of the sensors except for the Ant Build sensor, which is implemented as a listener.
Field Summary | |
---|---|
protected java.util.List<DataFiles> |
dataFilesList
The list of datafile element instances found in the task. |
protected java.lang.String |
errMsgPrefix
The string that prefixes all error messages from this sensor. |
protected boolean |
failOnError
Whether or not to throw a BuildException if problems occur during sensor execution. |
protected java.lang.String |
msgPrefix
The string that prefixes all normal messages from this sensor. |
protected long |
runtime
Provides a fixed runtime value for use in sensors that need one. |
protected org.hackystat.sensorshell.SensorShellProperties |
sensorProps
Sensor properties to be used with the sensor. |
protected org.hackystat.sensorshell.SensorShell |
sensorShell
The sensor shell instance used by this sensor. |
protected java.util.List<SourceFiles> |
sourceFilesList
The list of sourcefile element instances found in this task. |
protected java.lang.String |
tool
The name of this tool, passed to SensorShell and also looked for in UserMap. |
protected java.lang.String |
toolAccount
Tool account in the UserMap to use, or null if not using UserMap. |
protected org.hackystat.utilities.tstamp.TstampSet |
tstampSet
Supports generation of unique timestamps. |
protected boolean |
verbose
Whether or not to print out additional messages during sensor execution. |
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 | |
---|---|
protected |
HackystatSensorTask(java.lang.String tool)
The standard constructor, which will instantiate a SensorShell using the configuration data in sensorshell.properties. |
protected |
HackystatSensorTask(java.lang.String host,
java.lang.String email,
java.lang.String password,
java.lang.String tool)
A special constructor to be used only for testing purposes, which will use the supplied SensorBase host, email, and password. |
Method Summary | |
---|---|
DataFiles |
createDataFiles()
Creates a returns a new DataFiles instance to Ant. |
SourceFiles |
createSourceFiles()
Creates a returns a new SourceFiles instance to Ant. |
void |
execute()
The execute() method invoked by Ant. |
abstract void |
executeInternal()
This must be implemented by all subclasses to provide the traditional Ant execute() method. |
protected java.util.List<java.io.File> |
getDataFiles()
Returns the list of files indicated in the datafiles element. |
protected java.util.List<java.io.File> |
getFiles(java.util.List<org.apache.tools.ant.types.FileSet> filesets)
Converts a list of FileSets into a list of their associated files. |
protected java.util.List<java.io.File> |
getSourceFiles()
Returns the list of files indicated in the sourcefiles element. |
protected void |
info(java.lang.String msg)
Output an informational message from sensor. |
protected boolean |
isUsingUserMap()
Returns true if the user has indicated they want to use the UserMap to obtain the SensorBase host, user, and password. |
protected void |
sendAndQuit()
Sends any accumulated data in the SensorShell to the server and quits the shell. |
void |
setFailOnError(java.lang.String mode)
Set the failOnError attribute to "on", "true", or "yes" to throw a BuildException if problems occur during execution. |
void |
setRetryAttempts(java.lang.String retryString)
Set the retryAttempts value to an integer, or set to default if the supplied value was not an integer. |
void |
setRetryWaitInterval(java.lang.String retryString)
Set the retryWaitIntervalSeconds value to an integer, or set to default if the supplied value was not an integer. |
protected void |
setupSensorShell()
Instantiates the internal sensorshell using either the data in the UserMap or the data in sensorshell.properties. |
void |
setUserMapTool(java.lang.String tool)
Allows the user to override the default tool string to be used to retrieve data from the UserMap. |
void |
setUserMapToolAccount(java.lang.String toolAccount)
If the user specifies a toolAccount, then the UserMap is consulted to specify the sensorshell host, user, and password data rather than sensorshell.properties. |
void |
setVerbose(java.lang.String mode)
Set the verbose attribute to "on", "true", or "yes" to enable trace messages while the sensor is running. |
protected void |
signalError(java.lang.String msg,
java.lang.Exception e)
Signals an error, which means throwing a BuildException if failOnError is true, or just logging the problem if it's not. |
protected void |
summaryInfo(java.util.Date startTime,
java.lang.String sdt,
int numEntries)
Logs a final summary message regarding the number of entries sent and the elapsed time. |
protected void |
verboseInfo(java.lang.String msg)
Output a verbose message if verbose is 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 |
Field Detail |
---|
protected java.util.List<DataFiles> dataFilesList
protected java.util.List<SourceFiles> sourceFilesList
protected boolean verbose
protected boolean failOnError
protected long runtime
protected org.hackystat.sensorshell.SensorShell sensorShell
protected org.hackystat.sensorshell.SensorShellProperties sensorProps
protected org.hackystat.utilities.tstamp.TstampSet tstampSet
protected java.lang.String tool
protected java.lang.String toolAccount
protected java.lang.String errMsgPrefix
protected java.lang.String msgPrefix
Constructor Detail |
---|
protected HackystatSensorTask(java.lang.String tool)
tool
- The tool associated with this sensor.protected HackystatSensorTask(java.lang.String host, java.lang.String email, java.lang.String password, java.lang.String tool)
host
- The host.email
- The email.password
- The password.tool
- The tool associated with this sensor.Method Detail |
---|
protected void setupSensorShell()
public void setVerbose(java.lang.String mode)
mode
- The new verbose value: should be "on", "true", or "yes" to enable.public void setRetryWaitInterval(java.lang.String retryString)
retryString
- The new retryWaitIntervalSeconds value, an integer, as a string.public void setRetryAttempts(java.lang.String retryString)
retryString
- The new retryAttempts value, an integer, as a string.public void execute() throws org.apache.tools.ant.BuildException
execute
in class org.apache.tools.ant.Task
org.apache.tools.ant.BuildException
- If there is an error after all the retries are done.public abstract void executeInternal()
public void setFailOnError(java.lang.String mode)
mode
- The new verbose value: should be "on", "true", or "yes" to enable.public void setUserMapTool(java.lang.String tool)
tool
- The tool containing the tool account to be used when sending data.public void setUserMapToolAccount(java.lang.String toolAccount)
toolAccount
- The tool account in the UserMap to use when sending data.public SourceFiles createSourceFiles()
public DataFiles createDataFiles()
protected java.util.List<java.io.File> getSourceFiles()
protected java.util.List<java.io.File> getDataFiles()
protected java.util.List<java.io.File> getFiles(java.util.List<org.apache.tools.ant.types.FileSet> filesets)
filesets
- The filesets of interest.
protected boolean isUsingUserMap()
protected final void verboseInfo(java.lang.String msg)
msg
- The message to print if verbose mode is enabled.protected final void info(java.lang.String msg)
msg
- The message.protected void summaryInfo(java.util.Date startTime, java.lang.String sdt, int numEntries)
startTime
- The start time of the sensor.sdt
- The type of data sent.numEntries
- The number of entries sent.protected void sendAndQuit()
protected void signalError(java.lang.String msg, java.lang.Exception e)
msg
- The informative error message from the client.e
- The exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |