net.sf.mybatchfwk.history
Class FileExecutionHistory

java.lang.Object
  extended by net.sf.mybatchfwk.history.FileExecutionHistory
All Implemented Interfaces:
IExecutionHistory

public class FileExecutionHistory
extends java.lang.Object
implements IExecutionHistory

An history storage that store the id of the executed tasks into two files, one for the completed tasks, one another for the failed tasks.

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

Field Summary
static java.lang.String COMPLETED_TASKS_FILENAME
           
static java.lang.String FAILED_TASKS_FILENAME
           
static java.lang.String PROPERTY_STORAGE_FOLDER
           
 
Constructor Summary
FileExecutionHistory()
           
 
Method Summary
protected  void closeIndexer(KeysFileIndexer indexer)
          Close an indexer if it exists.
 void closeStorage()
          Close the storage system (called one time at the end of the batch)
 java.util.Iterator completedTasksIdIterator()
          Return an iterator over the id of the completed tasks
 java.util.Iterator failedTasksIdIterator()
          Return an iterator over the id of the completed tasks
 void initStorage(BatchConfiguration configuration)
          Init the storage system (called one time at the beginning of the batch)
 boolean isCompletedTask(java.lang.String id)
          Return true is this task has already been executed and completed
 boolean isFailedTask(java.lang.String id)
          Return true is this task has already been executed but failed
protected  void rotateFile(java.io.File file, java.io.File oldFile)
           
 void storeCompletedTaskId(java.lang.String id)
          Store the id of the completed task
 void storeFailedTaskId(java.lang.String id)
          Store the id of the failed task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_STORAGE_FOLDER

public static final java.lang.String PROPERTY_STORAGE_FOLDER
See Also:
Constant Field Values

COMPLETED_TASKS_FILENAME

public static final java.lang.String COMPLETED_TASKS_FILENAME
See Also:
Constant Field Values

FAILED_TASKS_FILENAME

public static final java.lang.String FAILED_TASKS_FILENAME
See Also:
Constant Field Values
Constructor Detail

FileExecutionHistory

public FileExecutionHistory()
Method Detail

initStorage

public void initStorage(BatchConfiguration configuration)
                 throws BatchException
Description copied from interface: IExecutionHistory
Init the storage system (called one time at the beginning of the batch)

Specified by:
initStorage in interface IExecutionHistory
Parameters:
configuration - the configuration of the batch
Throws:
BatchException

rotateFile

protected void rotateFile(java.io.File file,
                          java.io.File oldFile)
                   throws BatchException
Parameters:
file -
oldFile -
Throws:
BatchException

closeIndexer

protected void closeIndexer(KeysFileIndexer indexer)
Close an indexer if it exists. If an exception occured, then it is ignored.

Parameters:
indexer -

closeStorage

public void closeStorage()
                  throws BatchException
Description copied from interface: IExecutionHistory
Close the storage system (called one time at the end of the batch)

Specified by:
closeStorage in interface IExecutionHistory
Throws:
BatchException

isCompletedTask

public boolean isCompletedTask(java.lang.String id)
                        throws BatchException
Description copied from interface: IExecutionHistory
Return true is this task has already been executed and completed

Specified by:
isCompletedTask in interface IExecutionHistory
Parameters:
id - the id a a task
Throws:
BatchException

isFailedTask

public boolean isFailedTask(java.lang.String id)
                     throws BatchException
Description copied from interface: IExecutionHistory
Return true is this task has already been executed but failed

Specified by:
isFailedTask in interface IExecutionHistory
Throws:
BatchException

storeCompletedTaskId

public void storeCompletedTaskId(java.lang.String id)
                          throws BatchException
Description copied from interface: IExecutionHistory
Store the id of the completed task

Specified by:
storeCompletedTaskId in interface IExecutionHistory
Throws:
BatchException

storeFailedTaskId

public void storeFailedTaskId(java.lang.String id)
                       throws BatchException
Description copied from interface: IExecutionHistory
Store the id of the failed task

Specified by:
storeFailedTaskId in interface IExecutionHistory
Throws:
BatchException

completedTasksIdIterator

public java.util.Iterator completedTasksIdIterator()
                                            throws BatchException
Description copied from interface: IExecutionHistory
Return an iterator over the id of the completed tasks

Specified by:
completedTasksIdIterator in interface IExecutionHistory
Returns:
Throws:
BatchException

failedTasksIdIterator

public java.util.Iterator failedTasksIdIterator()
                                         throws BatchException
Description copied from interface: IExecutionHistory
Return an iterator over the id of the completed tasks

Specified by:
failedTasksIdIterator in interface IExecutionHistory
Returns:
Throws:
BatchException


Copyright © 2006 null. All Rights Reserved.