net.sf.mybatchfwk
Class ExecutionReport

java.lang.Object
  extended by net.sf.mybatchfwk.ExecutionReport

public class ExecutionReport
extends java.lang.Object

A basic execution report.
It contains informations about the batch execution: begin date, end date, identity of completed and failed tasks.
It is used for creating reports (mail, logs, ...) after the batch has been completed or after a fatal error.

User can create his own execution report to store extra informations about the completions and the failures.

Author:
Jérôme Bertèche (cyberteche@users.sourceforge.net)

Field Summary
protected  java.util.Date beginDate
          Begin date of the execution
protected  java.util.Date endDate
          End date of the execution
protected  IExecutionHistory history
          The execution history
protected  long numberOfCompletedTasks
          The number of completed tasks
protected  long numberOfFailedTasks
          The number of failed tasks
 
Constructor Summary
ExecutionReport()
          Default constructor
ExecutionReport(IExecutionHistory history)
           
 
Method Summary
 java.util.Iterator completedTasksIdIterator()
          Return an iterator over the id of the completed tasks, provided by the execution history
 java.util.Iterator failedTasksIdIterator()
          Return an iterator over the id of the failed tasks, provided by the execution history
 java.util.Date getBeginDate()
          Return the begin date of the execution
 java.util.Date getEndDate()
          Return the end date of the execution
 IExecutionHistory getHistory()
           
 long getNumberOfCompletedTasks()
           
 long getNumberOfFailedTasks()
           
 void reportCompletion(ITask task)
          Store informations about a task completion.
 void reportFailure(ITask task, java.lang.Throwable throwable)
          Store informations about a task failure.
 void setBeginDate(java.util.Date beginDate)
          Set the begin date of the execution
 void setEndDate(java.util.Date endDate)
          Set the end date of the execution
 void setHistory(IExecutionHistory history)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

beginDate

protected java.util.Date beginDate
Begin date of the execution


endDate

protected java.util.Date endDate
End date of the execution


numberOfCompletedTasks

protected volatile long numberOfCompletedTasks
The number of completed tasks


numberOfFailedTasks

protected volatile long numberOfFailedTasks
The number of failed tasks


history

protected IExecutionHistory history
The execution history

Constructor Detail

ExecutionReport

public ExecutionReport()
Default constructor


ExecutionReport

public ExecutionReport(IExecutionHistory history)
Method Detail

reportCompletion

public void reportCompletion(ITask task)
Store informations about a task completion.

Parameters:
task - the completed task

reportFailure

public void reportFailure(ITask task,
                          java.lang.Throwable throwable)
Store informations about a task failure.

Parameters:
task - the failed task
throwable - the cause of the failure

completedTasksIdIterator

public java.util.Iterator completedTasksIdIterator()
                                            throws BatchException
Return an iterator over the id of the completed tasks, provided by the execution history

Returns:
Throws:
BatchException

failedTasksIdIterator

public java.util.Iterator failedTasksIdIterator()
                                         throws BatchException
Return an iterator over the id of the failed tasks, provided by the execution history

Returns:
Throws:
BatchException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getBeginDate

public java.util.Date getBeginDate()
Return the begin date of the execution

Returns:
a date

setBeginDate

public void setBeginDate(java.util.Date beginDate)
Set the begin date of the execution

Parameters:
beginDate - the begin date to set

getEndDate

public java.util.Date getEndDate()
Return the end date of the execution

Returns:
a date

setEndDate

public void setEndDate(java.util.Date endDate)
Set the end date of the execution

Parameters:
endDate - the end date to set

getNumberOfCompletedTasks

public long getNumberOfCompletedTasks()
Returns:
Returns the numberOfCompletedTasks.

getNumberOfFailedTasks

public long getNumberOfFailedTasks()
Returns:
Returns the numberOfFailedTasks.

getHistory

public IExecutionHistory getHistory()
Returns:
the history

setHistory

public void setHistory(IExecutionHistory history)
Parameters:
history - the history to set


Copyright © 2006 null. All Rights Reserved.