com.jmw.tzap
Class IteratingFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
      extended by com.jmw.tzap.IteratingFilter
Direct Known Subclasses:
AppendFileFilter, AppendFilter, ExtractLinesFilter, FindAllFilter, FindFilter, ReplaceFilter, ReplaceFilterPlus, ReplaceListFilter, XSLTFilter

public abstract class IteratingFilter
extends AbstractFilter

Base class for simple filters, runs all FilterFiles through the filter one at a time.

Author:
Judah W.
See Also:
FilterFile

Field Summary
 
Fields inherited from class com.jmw.tzap.AbstractFilter
encoding, MSG_DEBUG, MSG_ERR, MSG_INFO, MSG_VERBOSE, MSG_WARN, task
 
Constructor Summary
IteratingFilter()
          constructor
 
Method Summary
abstract  java.lang.StringBuffer doFilter(java.lang.StringBuffer sb, java.lang.String fileName)
          Does the actual filtering.
 FilterFile[] execute(FilterFile[] files)
          Processes all FilterFiles that this filter is supposed to filter one at a time.
 void load()
          Does any initilaztion of the filter before it can be used.
 void unload()
          Does any clean up after the filter has been finished.
 
Methods inherited from class com.jmw.tzap.AbstractFilter
getName, log, log, setEncoding, setTask, validateParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IteratingFilter

public IteratingFilter()
constructor

Method Detail

load

public void load()
Description copied from class: AbstractFilter
Does any initilaztion of the filter before it can be used. Note; Only called once, before any filters are run.

Specified by:
load in class AbstractFilter

unload

public void unload()
Description copied from class: AbstractFilter
Does any clean up after the filter has been finished. Note; Only called once, when all files have been filtered.

Specified by:
unload in class AbstractFilter

doFilter

public abstract java.lang.StringBuffer doFilter(java.lang.StringBuffer sb,
                                                java.lang.String fileName)
Does the actual filtering.

Parameters:
sb - the file to be filtered as a StringBuffer
fileName - the name that this file is called on disk
Returns:
the filtered file as a StringBuffer

execute

public FilterFile[] execute(FilterFile[] files)
                     throws java.lang.Exception
Processes all FilterFiles that this filter is supposed to filter one at a time.

Specified by:
execute in class AbstractFilter
Parameters:
files - the FilterFiles that are to be filtered
Returns:
the filtered files
Throws:
java.lang.Exception - if something goes wrong during filtering