net.sf.filePiper.model
Interface FileProcessor

All Known Implementing Classes:
ChunkProcessor, CopyProcessor, HeadProcessor, ImageSizerProcessor, ListFilesProcessor, NoOutputProcessor, OneToOneByteFileProcessor, OneToOneTextFileProcessor, ReplaceProcessor, SearchProcessor, TailProcessor, UnzipProcessor, ZipProcessor

public interface FileProcessor

Processor of a file.

Author:
berol

Field Summary
static int MANY
           
static int NONE
           
static int ONE
           
 
Method Summary
 void endBatch(FileProcessorEnvironment env)
          Notification that the current batch is finished.
 net.sf.sfac.gui.editor.ObjectEditor getEditor()
          Get a GUI editor for this object.
 int getOutputCardinality(int inputCardinality)
          Get the number of output streams generated for the given number of input streams.
 String getProcessorName()
           
 String getStatusMessage()
          Get the status of this processor to display in the status bar of the GUI during file processing.
 void init(net.sf.sfac.setting.Settings sett)
          Initialize this file processor just after instantiation (called only once).
 void process(InputStream is, InputFileInfo info, FileProcessorEnvironment env)
          Request to process the given input stream.
 void startBatch(FileProcessorEnvironment env)
          Notification that the processing of a batch of file is starting.
 

Field Detail

NONE

static final int NONE
See Also:
Constant Field Values

ONE

static final int ONE
See Also:
Constant Field Values

MANY

static final int MANY
See Also:
Constant Field Values
Method Detail

getProcessorName

String getProcessorName()
Returns:
A displayable name for this processor.

init

void init(net.sf.sfac.setting.Settings sett)
Initialize this file processor just after instantiation (called only once).
The settings passed here should be use to store all persistent data.

Parameters:
sett - Settings for this FileProcessor instance.

getOutputCardinality

int getOutputCardinality(int inputCardinality)
Get the number of output streams generated for the given number of input streams.
possible values are:

Parameters:
inputCardinality - ONE or MANY.

startBatch

void startBatch(FileProcessorEnvironment env)
                throws IOException
Notification that the processing of a batch of file is starting.
This method allows to initialize this FileProcessor before each file batch processing.

Parameters:
env -
Throws:
IOException

process

void process(InputStream is,
             InputFileInfo info,
             FileProcessorEnvironment env)
             throws IOException
Request to process the given input stream.
The output stream to use for output should be requested to the FileProcessorEnvironment.

Parameters:
is - the InputStream to process
info - Information about the input file to process
env - object used by this FileProcessor to interact with its environment.
Throws:
IOException - if something goes wrong.

endBatch

void endBatch(FileProcessorEnvironment env)
              throws IOException
Notification that the current batch is finished.

Parameters:
env -
Throws:
IOException

getEditor

net.sf.sfac.gui.editor.ObjectEditor getEditor()
Get a GUI editor for this object.


getStatusMessage

String getStatusMessage()
Get the status of this processor to display in the status bar of the GUI during file processing.

Warning: this method is called in a different Thread from the processing Thread (the Thread calling the process(..) method). It is usually called from the swing EventDispatchThread. So, be aware of possible threading synchronization problems while accessing the instance variables of your class.

Returns:
the status of this processor.


Copyright © 2010. All Rights Reserved.