net.sf.filePiper.model
Interface PipelineEnvironment

All Known Implementing Classes:
BasicPipeLineEnvironment, GuiPipelineEnvironment

public interface PipelineEnvironment

Interface used by the whole pipeline to interact with its environment.
It's used to:

Author:
BEROL

Method Summary
 void abortProcessing()
          Tell this environment that the current file processing should be aborted.
 boolean canOverwriteFile(File fil)
          Check if an existing file can be overwritten by the pipe-line processing.
 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.
 boolean isAborted()
           
 boolean isErrored()
           
 boolean isRunning()
           
 void outputtingToFile(File dest)
          Notify the environment of the currently processed output file.
 void processInputFile(File src)
          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.
 

Method Detail

startProcessing

void startProcessing()
Notify the environment that the pipe-line processing has started.


scanningDirectory

void scanningDirectory(File dir)
Notify the environment that the pipeline is scanning directory to find file to process.


processInputFile

void processInputFile(File src)
Notify the environment of the currently processed input file.


outputtingToFile

void outputtingToFile(File dest)
Notify the environment of the currently processed output file.


fileSkipped

void fileSkipped(File dest)
Notify the environment of the currently processed output file is not written to avoid overriding an existing file.


finished

void finished(Exception e)
Notify the environment that the pipe-line processing is finished.

Parameters:
e - if not null, it means that the processing was stopped by this exception.

shouldContinue

boolean shouldContinue()
Check if the processing should continue. The environment can decide to abort the pipe-line processing by returning false.

Returns:
true to continue, false to abort.

canOverwriteFile

boolean canOverwriteFile(File fil)
Check if an existing file can be overwritten by the pipe-line processing.

Parameters:
fil - the existing file that is about to be overwritten.
Returns:
true to overwrite, false to skip.

abortProcessing

void abortProcessing()
Tell this environment that the current file processing should be aborted.
Once this method is called, shouldContinue() must return false.


getConsoleStream

OutputStream getConsoleStream()
Get an output stream to write to the console.

Returns:
an output stream to write to the console.

isRunning

boolean isRunning()

isAborted

boolean isAborted()

isErrored

boolean isErrored()


Copyright © 2010. All Rights Reserved.