com.jmw.tzap
Class AbstractFilter

java.lang.Object
  extended by com.jmw.tzap.AbstractFilter
Direct Known Subclasses:
InsertReferenceFilter, IteratingFilter, MergeFilter, SplitFilter, SplitFilter

public abstract class AbstractFilter
extends java.lang.Object

The abstract filter defineing the basic functionality shared by the derived filters.

Author:
Judah W.

Field Summary
protected static java.lang.String encoding
           
protected static int MSG_DEBUG
           
protected static int MSG_ERR
           
protected static int MSG_INFO
           
protected static int MSG_VERBOSE
           
protected static int MSG_WARN
           
protected static org.apache.tools.ant.Task task
           
 
Constructor Summary
AbstractFilter()
          constructor
 
Method Summary
abstract  FilterFile[] execute(FilterFile[] files)
          Processes all FilterFiles that this filter is supposed to filter.
 java.lang.String getName()
          Gets the name of this filter for display in log messages.
abstract  void load()
          Does any initilaztion of the filter before it can be used.
protected  void log(java.lang.String msg)
          Sends an info level log message to the task
protected  void log(java.lang.String msg, int level)
          Sends a log message of specified level to the task.
static void setEncoding(java.lang.String e)
          Sets the file encoding that the filters will be using.
static void setTask(org.apache.tools.ant.Task t)
          Sets the task that this filter is part of.
abstract  void unload()
          Does any clean up after the filter has been finished.
abstract  void validateParameters()
          Validates any parameters needed by the child filters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

encoding

protected static java.lang.String encoding

task

protected static org.apache.tools.ant.Task task

MSG_DEBUG

protected static int MSG_DEBUG

MSG_INFO

protected static int MSG_INFO

MSG_WARN

protected static int MSG_WARN

MSG_ERR

protected static int MSG_ERR

MSG_VERBOSE

protected static int MSG_VERBOSE
Constructor Detail

AbstractFilter

public AbstractFilter()
constructor

Method Detail

load

public abstract void load()
Does any initilaztion of the filter before it can be used. Note; Only called once, before any filters are run.


unload

public abstract void unload()
Does any clean up after the filter has been finished. Note; Only called once, when all files have been filtered.


execute

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

Parameters:
files - the FilterFiles that are to be filtered
Returns:
the filtered files
Throws:
java.lang.Exception - if something goes wrong during processing

validateParameters

public abstract void validateParameters()
                                 throws java.lang.Exception
Validates any parameters needed by the child filters.

Throws:
an - exception if parameter tests fail.
java.lang.Exception

setEncoding

public static void setEncoding(java.lang.String e)
Sets the file encoding that the filters will be using.

Parameters:
endcoding - the file encoding type

setTask

public static void setTask(org.apache.tools.ant.Task t)
Sets the task that this filter is part of. The purpose is to have a destination for log messages.

Parameters:
task - the containing task

getName

public java.lang.String getName()
Gets the name of this filter for display in log messages.

Returns:
the class name of the filter

log

protected void log(java.lang.String msg)
Sends an info level log message to the task

Parameters:
msg - the message

log

protected void log(java.lang.String msg,
                   int level)
Sends a log message of specified level to the task.
If there is no task associated with this filter, the message is sent to System.out.

Parameters:
msg - the message
level - the message level