au.com.prunge.jgenfile.impl
Class DefaultBatchOperation

java.lang.Object
  |
  +--au.com.prunge.jgenfile.impl.AbstractOperation
        |
        +--au.com.prunge.jgenfile.impl.AbstractFileSystemOperation
              |
              +--au.com.prunge.jgenfile.impl.DefaultBatchOperation
All Implemented Interfaces:
BatchOperation, FileSystemOperation, Operation

public class DefaultBatchOperation
extends AbstractFileSystemOperation
implements BatchOperation

A batch operation that simply runs all its child operations.

File system implementors are encouraged to write their own batch operations that can efficiently combine operations instead of using this class.

Version:
1.0
Author:
Peter Runge

Constructor Summary
DefaultBatchOperation(au.com.prunge.jgenfile.FileSystem fileSystem, List operationList, boolean abortOnError)
          Constructs a DefaultBatchOperation.
 
Method Summary
 boolean getAbortOnError()
           
 List getOperations()
          Returns a list of operations this batch operation will execute.
 void runImpl()
          The actual run() implementation goes in this method.
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractFileSystemOperation
getFileSystem
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractOperation
abort, addOperationHints, checkRun, getLastRunException, getOperationHint, getOperationHints, hasRun, run, setLastRunException, setOperationHint, setOperationHints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface au.com.prunge.jgenfile.FileSystemOperation
getFileSystem
 
Methods inherited from interface au.com.prunge.jgenfile.Operation
abort, addOperationHints, getLastRunException, getOperationHint, getOperationHints, hasRun, run, setOperationHint, setOperationHints
 

Constructor Detail

DefaultBatchOperation

public DefaultBatchOperation(au.com.prunge.jgenfile.FileSystem fileSystem,
                             List operationList,
                             boolean abortOnError)
Constructs a DefaultBatchOperation.

Parameters:
fileSystem - the file system this operation is for.
operationList - a list of opreations this batch operation should run.
abortOnError - true to abort running other operations if an error occurs, false to attempt to run all other operations.
Throws:
NullPointerException - if operationList is null.
Method Detail

getOperations

public List getOperations()
Description copied from interface: BatchOperation
Returns a list of operations this batch operation will execute.

Specified by:
getOperations in interface BatchOperation
Returns:
a list of operations.
See Also:
BatchOperation.getOperations()

getAbortOnError

public boolean getAbortOnError()
Specified by:
getAbortOnError in interface BatchOperation
Returns:
whether this operation will abort if an error occurs executing one of its component operations.
See Also:
BatchOperation.getAbortOnError()

runImpl

public void runImpl()
             throws JGenFileException
Description copied from class: AbstractOperation
The actual run() implementation goes in this method. Setting the last run exception and setting hasRun to true is not required by this method as it is handled by the run() method in this class.

If this method completes successfully (i.e. without throwing an exception), the last run exception is set to null indicating no exception occurred and subsequent calls to hasRun() will return true.

If this method throws an exception, the last run exception is filled in and hasRun() subsequent calls to hasRun() will return false.

Specified by:
runImpl in class AbstractOperation
Throws:
JGenFileException - if an error occurs.
See Also:
au.com.prunge.jgenfile.AbstractOperation#runImpl()