au.com.prunge.jgenfile.impl
Class ConstantCanCreateFileOperation

java.lang.Object
  |
  +--au.com.prunge.jgenfile.impl.AbstractOperation
        |
        +--au.com.prunge.jgenfile.impl.AbstractItemOperation
              |
              +--au.com.prunge.jgenfile.impl.AbstractDirectoryOperation
                    |
                    +--au.com.prunge.jgenfile.impl.ConstantCanCreateFileOperation
All Implemented Interfaces:
CanCreateFileOperation, ConstantOperation, DirectoryOperation, ItemOperation, Operation

public class ConstantCanCreateFileOperation
extends AbstractDirectoryOperation
implements CanCreateFileOperation, ConstantOperation

A can create file operation that returns a constant value of either true or false.

Version:
1.0
Author:
Peter Runge

Constructor Summary
ConstantCanCreateFileOperation(au.com.prunge.jgenfile.Directory directory, boolean canCreateFile)
          Constructs a ConstantCanCreateFileOperation.
 
Method Summary
 boolean canCreateFile()
          Returns whether a file in a directory can be created.
 void runImpl()
          The actual run() implementation goes in this method.
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractDirectoryOperation
getDirectory
 
Methods inherited from class au.com.prunge.jgenfile.impl.AbstractItemOperation
getItem
 
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.DirectoryOperation
getDirectory
 
Methods inherited from interface au.com.prunge.jgenfile.ItemOperation
getItem
 
Methods inherited from interface au.com.prunge.jgenfile.Operation
abort, addOperationHints, getLastRunException, getOperationHint, getOperationHints, hasRun, run, setOperationHint, setOperationHints
 

Constructor Detail

ConstantCanCreateFileOperation

public ConstantCanCreateFileOperation(au.com.prunge.jgenfile.Directory directory,
                                      boolean canCreateFile)
Constructs a ConstantCanCreateFileOperation.

Parameters:
directory - the directory the operation is for.
canCreateFile - the constant result of this operation.
Method Detail

canCreateFile

public boolean canCreateFile()
                      throws OperationNotFinishedException,
                             JGenFileException
Description copied from interface: CanCreateFileOperation
Returns whether a file in a directory can be created.

Specified by:
canCreateFile in interface CanCreateFileOperation
Returns:
true if a file can be created, false if not.
Throws:
JGenFileException - if another error occurs.
OperationNotFinishedException - if this method was called and the run() method has not finished or has not been called.
See Also:
CanCreateFileOperation.canCreateFile()

runImpl

public void runImpl()
             throws JGenFileException,
                    OperationNotSupportedException
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.
OperationNotSupportedException
See Also:
au.com.prunge.jgenfile.AbstractOperation#runImpl()