net.sf.filePiper.processors
Class SearchProcessor

java.lang.Object
  extended by net.sf.filePiper.processors.SearchProcessor
All Implemented Interfaces:
FileProcessor

public class SearchProcessor
extends Object
implements FileProcessor

Processor searching a string in input file(s) -- like grep.
The output of this processor is the list of matches.

Author:
BEROL

Field Summary
 
Fields inherited from interface net.sf.filePiper.model.FileProcessor
MANY, NONE, ONE
 
Constructor Summary
SearchProcessor()
           
 
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.
 net.sf.filePiper.processors.SearchProcessor.OutputType getOutputType()
           
 String getProcessorDescription()
           
 String getProcessorName()
           
 boolean getSearchByLine()
           
 net.sf.filePiper.processors.SearchProcessor.SearchMethod getSearchMethod()
           
 String getSearchString()
           
 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 settgns)
          Initialize this file processor just after instantiation (called only once).
 void process(BufferedReader in, InputFileInfo info, FileProcessorEnvironment env)
           
 void process(InputStream is, InputFileInfo info, FileProcessorEnvironment env)
          Request to process the given input stream.
 void setOutputType(net.sf.filePiper.processors.SearchProcessor.OutputType type)
           
 void setSearchByLine(boolean byLine)
           
 void setSearchMethod(net.sf.filePiper.processors.SearchProcessor.SearchMethod method)
           
 void setSearchString(String searchString)
           
 void startBatch(FileProcessorEnvironment env)
          Notification that the processing of a batch of file is starting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchProcessor

public SearchProcessor()
Method Detail

getProcessorName

public String getProcessorName()
Specified by:
getProcessorName in interface FileProcessor
Returns:
A displayable name for this processor.

getProcessorDescription

public String getProcessorDescription()

getSearchString

public String getSearchString()

setSearchString

public void setSearchString(String searchString)

getSearchByLine

public boolean getSearchByLine()

setSearchByLine

public void setSearchByLine(boolean byLine)

getSearchMethod

public net.sf.filePiper.processors.SearchProcessor.SearchMethod getSearchMethod()

setSearchMethod

public void setSearchMethod(net.sf.filePiper.processors.SearchProcessor.SearchMethod method)

getOutputType

public net.sf.filePiper.processors.SearchProcessor.OutputType getOutputType()

setOutputType

public void setOutputType(net.sf.filePiper.processors.SearchProcessor.OutputType type)

init

public void init(net.sf.sfac.setting.Settings settgns)
Description copied from interface: FileProcessor
Initialize this file processor just after instantiation (called only once).
The settings passed here should be use to store all persistent data.

Specified by:
init in interface FileProcessor
Parameters:
settgns - Settings for this FileProcessor instance.

startBatch

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

Specified by:
startBatch in interface FileProcessor
Throws:
IOException

process

public void process(InputStream is,
                    InputFileInfo info,
                    FileProcessorEnvironment env)
             throws IOException
Description copied from interface: FileProcessor
Request to process the given input stream.
The output stream to use for output should be requested to the FileProcessorEnvironment.

Specified by:
process in interface FileProcessor
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.

process

public void process(BufferedReader in,
                    InputFileInfo info,
                    FileProcessorEnvironment env)
             throws IOException
Throws:
IOException

endBatch

public void endBatch(FileProcessorEnvironment env)
              throws IOException
Description copied from interface: FileProcessor
Notification that the current batch is finished.

Specified by:
endBatch in interface FileProcessor
Throws:
IOException

getStatusMessage

public String getStatusMessage()
Description copied from interface: FileProcessor
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.

Specified by:
getStatusMessage in interface FileProcessor
Returns:
the status of this processor.

getOutputCardinality

public int getOutputCardinality(int inputCardinality)
Description copied from interface: FileProcessor
Get the number of output streams generated for the given number of input streams.
possible values are:

Specified by:
getOutputCardinality in interface FileProcessor
Parameters:
inputCardinality - ONE or MANY.

getEditor

public net.sf.sfac.gui.editor.ObjectEditor getEditor()
Description copied from interface: FileProcessor
Get a GUI editor for this object.

Specified by:
getEditor in interface FileProcessor


Copyright © 2011. All Rights Reserved.