net.sf.filePiper.model
Class BasicPipeLineEnvironment

java.lang.Object
  extended by net.sf.filePiper.model.BasicPipeLineEnvironment
All Implemented Interfaces:
PipelineEnvironment

public class BasicPipeLineEnvironment
extends Object
implements PipelineEnvironment


Constructor Summary
BasicPipeLineEnvironment(Pipeline processPipeline)
           
 
Method Summary
 void abortProcessing()
          Tell this environment that the current file processing should be aborted.
 boolean canOverwriteFile(File newFil)
          Always overwrite by default.
 void dumpStatus()
           
 void fileSkipped(File dest)
          Notify the environment of the currently processed output file is not written to avoid overriding an existing file.
 void finished(Exception e)
          Notify the environment that the pipe-line processing is finished.
 OutputStream getConsoleStream()
          Get an output stream to write to the console.
 File getCurrentInputFile()
           
 File getCurrentOutputFile()
           
 File getCurrentScannedDirectory()
           
 Exception getException()
           
 int getInputFileCount()
           
 int getOutputFileCount()
           
 int getSkippedFileCount()
           
 boolean isAborted()
           
 boolean isErrored()
           
 boolean isOutputToConsole()
           
 boolean isRunning()
           
 void outputtingToFile(File newDest)
          Notify the environment of the currently processed output file.
 void processInputFile(File newSrc)
          Notify the environment of the currently processed input file.
 void scanningDirectory(File dir)
          Notify the environment that the pipeline is scanning directory to find file to process.
 boolean shouldContinue()
          Check if the processing should continue.
 void startProcessing()
          Notify the environment that the pipe-line processing has started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicPipeLineEnvironment

public BasicPipeLineEnvironment(Pipeline processPipeline)
Method Detail

dumpStatus

public void dumpStatus()

abortProcessing

public void abortProcessing()
Description copied from interface: PipelineEnvironment
Tell this environment that the current file processing should be aborted.
Once this method is called, shouldContinue() must return false.

Specified by:
abortProcessing in interface PipelineEnvironment

isRunning

public boolean isRunning()
Specified by:
isRunning in interface PipelineEnvironment

isAborted

public boolean isAborted()
Specified by:
isAborted in interface PipelineEnvironment

isErrored

public boolean isErrored()
Specified by:
isErrored in interface PipelineEnvironment

getInputFileCount

public int getInputFileCount()

getOutputFileCount

public int getOutputFileCount()

getSkippedFileCount

public int getSkippedFileCount()

isOutputToConsole

public boolean isOutputToConsole()

getException

public Exception getException()

startProcessing

public void startProcessing()
Description copied from interface: PipelineEnvironment
Notify the environment that the pipe-line processing has started.

Specified by:
startProcessing in interface PipelineEnvironment

scanningDirectory

public void scanningDirectory(File dir)
Description copied from interface: PipelineEnvironment
Notify the environment that the pipeline is scanning directory to find file to process.

Specified by:
scanningDirectory in interface PipelineEnvironment

processInputFile

public void processInputFile(File newSrc)
Description copied from interface: PipelineEnvironment
Notify the environment of the currently processed input file.

Specified by:
processInputFile in interface PipelineEnvironment

outputtingToFile

public void outputtingToFile(File newDest)
Description copied from interface: PipelineEnvironment
Notify the environment of the currently processed output file.

Specified by:
outputtingToFile in interface PipelineEnvironment

getCurrentScannedDirectory

public File getCurrentScannedDirectory()

getCurrentInputFile

public File getCurrentInputFile()

getCurrentOutputFile

public File getCurrentOutputFile()

finished

public void finished(Exception e)
Description copied from interface: PipelineEnvironment
Notify the environment that the pipe-line processing is finished.

Specified by:
finished in interface PipelineEnvironment
Parameters:
e - if not null, it means that the processing was stopped by this exception.

shouldContinue

public boolean shouldContinue()
Description copied from interface: PipelineEnvironment
Check if the processing should continue. The environment can decide to abort the pipe-line processing by returning false.

Specified by:
shouldContinue in interface PipelineEnvironment
Returns:
true to continue, false to abort.

canOverwriteFile

public boolean canOverwriteFile(File newFil)
Always overwrite by default.

Specified by:
canOverwriteFile in interface PipelineEnvironment
Parameters:
newFil - the existing file that is about to be overwritten.
Returns:
true to overwrite, false to skip.

fileSkipped

public void fileSkipped(File dest)
Description copied from interface: PipelineEnvironment
Notify the environment of the currently processed output file is not written to avoid overriding an existing file.

Specified by:
fileSkipped in interface PipelineEnvironment

getConsoleStream

public OutputStream getConsoleStream()
Description copied from interface: PipelineEnvironment
Get an output stream to write to the console.

Specified by:
getConsoleStream in interface PipelineEnvironment
Returns:
an output stream to write to the console.


Copyright © 2010. All Rights Reserved.