com.rhi.architecture.parc.filter
Class FilterSet

java.lang.Object
  extended bycom.rhi.architecture.parc.filter.FilterSet
All Implemented Interfaces:
Filter, java.lang.Runnable

public final class FilterSet
extends java.lang.Object
implements Filter

FilterSet. Composite element of GOF pattern. Note: Since it's just a container, it has been marked as final. No sub-classing should be required.

Since:
1.0
Author:
Pete McKinstry

Constructor Summary
FilterSet()
          Default constructor.
 
Method Summary
 void addNode(Filter f)
          Add a new filter to the set.
 void addNode(Filter f, Channel c)
          Add a new filter to the set.
 ExceptionHandler getExceptionHandler()
           
 java.lang.String getName()
          Return the name of this Filter.
 void init(java.util.Properties p)
          Initialize any local resources
 void markForDeath()
          markForDeath sets a flag telling the Filter to shutdown at the next available opportunity.
 int numThreads()
          Return the suggested number of threads to launch for this Filter.
 void process()
          do filter processing.
 void reset()
          Reset the filter so that it's ready to process records again.
 void run()
          Runnable interface
 void setErrorChannel(Consumer err)
          Set the holding bin used for errored records..
 void setExceptionHandler(ExceptionHandler handler)
          Set the exception handler mechanism.
 void setInbound(Supplier s)
          Set the inbound delivery mechanism.
 void setOutbound(Consumer c)
          Set the outbound delivery mechanism.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterSet

public FilterSet()
Default constructor.

Since:
1.0
Method Detail

init

public void init(java.util.Properties p)
          throws InitializationException
Initialize any local resources

Specified by:
init in interface Filter
Parameters:
p -
Throws:
InitializationException
Since:
1.0

getName

public java.lang.String getName()
Return the name of this Filter.

Specified by:
getName in interface Filter
Returns:
String

addNode

public void addNode(Filter f)
Add a new filter to the set. New filters are appended to the end of the list & run in that order.
When a new filter is added to the set, a channel is created to connect the previously final filter to the new addition. When no channel is provided, a default general purpose channel is used.

Parameters:
f - Filter to be added to collection
Since:
1.0

addNode

public void addNode(Filter f,
                    Channel c)
Add a new filter to the set. New filters are appended to the end of the list & run in that order.
An optional Channel parameter can be provided as the preferred Channel implementation for the outbound side of this filter.

Parameters:
f - Filter to be added to collection
c - Channel to be used on outbound side of this filter.
Since:
1.0

process

public void process()
             throws ProcessingException
do filter processing.

Specified by:
process in interface Filter
Throws:
ProcessingException

markForDeath

public void markForDeath()
markForDeath sets a flag telling the Filter to shutdown at the next available opportunity. The filterset does not cycle continuously, so the implementation is a no-op.

Specified by:
markForDeath in interface Filter
Since:
1.1.

reset

public void reset()
Reset the filter so that it's ready to process records again. For the FilterSet, no reset logic is necessary.

Specified by:
reset in interface Filter
Since:
1.1

run

public void run()
Runnable interface

Specified by:
run in interface java.lang.Runnable

setInbound

public void setInbound(Supplier s)
Set the inbound delivery mechanism. The first filter in the set is hooked up to the input mechanism. (adapter)

Specified by:
setInbound in interface Filter
Parameters:
s -
Since:
1.0

setOutbound

public void setOutbound(Consumer c)
Set the outbound delivery mechanism. The final filter in the set is hooked up to the output mechanism. (adapter)

Specified by:
setOutbound in interface Filter
Parameters:
c -
Since:
1.0

setErrorChannel

public void setErrorChannel(Consumer err)
Set the holding bin used for errored records..

Specified by:
setErrorChannel in interface Filter
Parameters:
err -
Since:
1.0

setExceptionHandler

public void setExceptionHandler(ExceptionHandler handler)
Set the exception handler mechanism.

Specified by:
setExceptionHandler in interface Filter
Parameters:
handler -
Since:
1.0

getExceptionHandler

public ExceptionHandler getExceptionHandler()
Returns:
the exception handler

numThreads

public int numThreads()
Return the suggested number of threads to launch for this Filter. Obviously this requires that the application uses a Pipeline that implements multi-threading.
The FilterSet is a single threaded, serial processing composite Filter. If you wish to multi-thread, add the Filters to the pipe individually and use a MT pipeline implementation.

Specified by:
numThreads in interface Filter
Returns:
1 - run only 1 thread for this FilterSet.
Since:
1.1


Copyright © 2002-2004 Robert Half International. All Rights Reserved.