net.sourceforge.basher.tasks
Class AbstractTask

java.lang.Object
  extended by net.sourceforge.basher.tasks.AbstractTask
All Implemented Interfaces:
Task
Direct Known Subclasses:
DecoratedTask

public abstract class AbstractTask
extends Object
implements Task

A base implementation of the Task interface. Provides some basic helper methods for dealing with a task execution.

Version:
1.0
Author:
Johan Lindquist

Field Summary
protected  org.apache.commons.logging.Log _log
          Instance logger
 
Constructor Summary
AbstractTask()
           
 
Method Summary
 boolean equals(Object o)
           
protected  void failed(String reason)
          Convenience method for sub-classes to signal a failure.
protected  void failed(String reason, Throwable cause)
          Convenience method for sub-classes to signal a failure.
 int hashCode()
           
protected  void notRun(String reason, Throwable cause)
          Convenience method for sub-classes to signal a not run.
 void setLog(org.apache.commons.logging.Log log)
          Sets the Log instance for this Task instance.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.basher.Task
executeTask
 

Field Detail

_log

protected org.apache.commons.logging.Log _log
Instance logger

Constructor Detail

AbstractTask

public AbstractTask()
Method Detail

notRun

protected void notRun(String reason,
                      Throwable cause)
Convenience method for sub-classes to signal a not run.

Parameters:
reason - The reason for not running
cause - The (optional) cause of not run
Throws:
TaskNotRunException - Will ALWAYS throw a TaskNotRunException to indicate the task didn't run.

failed

protected void failed(String reason,
                      Throwable cause)
Convenience method for sub-classes to signal a failure.

Parameters:
reason - The reason for the failure
cause - The (optional) cause of the failure
Throws:
TaskFailedException - Will ALWAYS throw a TaskFailedException to indicate a failure.

failed

protected void failed(String reason)
Convenience method for sub-classes to signal a failure.

Parameters:
reason - The reason for the failure
Throws:
TaskFailedException - Will ALWAYS throw a TaskFailedException to indicate a failure.

setLog

public void setLog(org.apache.commons.logging.Log log)
Sets the Log instance for this Task instance.

Parameters:
log - The log instance to use for logging.

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2006-2010 Basher Team. All Rights Reserved.