com.rhi.architecture.parc
Interface Filter

All Superinterfaces:
java.lang.Runnable
All Known Implementing Classes:
AbstractFilter, FilterSet

public interface Filter
extends java.lang.Runnable

Filter Interface. Component w/in the GOF Composite pattern w/ the added functionality of a 'Runnable' to support multi-threaded filter processing.

Since:
1.0
Author:
Pete McKinstry

Method Summary
 java.lang.String getName()
          For tracking purposes.
 void init(java.util.Properties p)
          Initialize any local resources
 void markForDeath()
          Tag this filter to shutdown.
 int numThreads()
          Return the suggested number of threads to launch for this Filter.
 void process()
          do filter processing.
 void reset()
          reset the filter to ensure that it's ready to process records again.
 void setErrorChannel(Consumer err)
          Set the holding bin used for errored records..
 void setExceptionHandler(ExceptionHandler h)
          Set the handler used for reporting fatal errors during Filter processing.
 void setInbound(Supplier c)
          Set the inbound delivery mechanism.
 void setOutbound(Consumer c)
          Set the outbound delivery mechanism.
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

init

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

Parameters:
p -
Throws:
InitializationException
Since:
1.0

process

public void process()
             throws ProcessingException
do filter processing.

Throws:
ProcessingException
Since:
1.0

setInbound

public void setInbound(Supplier c)
Set the inbound delivery mechanism.

Parameters:
c -
Since:
1.0

setOutbound

public void setOutbound(Consumer c)
Set the outbound delivery mechanism.

Parameters:
c -
Since:
1.0

setErrorChannel

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

Parameters:
err -
Since:
1.0

setExceptionHandler

public void setExceptionHandler(ExceptionHandler h)
Set the handler used for reporting fatal errors during Filter processing. Since each Filter is run w/in a thread, the call stack is not an appropriate mechanism for reporting critical processing errors. Therefore, a Handler object is provided for the Filter to use for logging unrecoverable processing errors. Note: This handler must assume that any error is fatal. Non-fatal errors should be handled by adding errors to the record(s) being processed.

Parameters:
h - - the exception handler to use when reporting exceptions
Since:
1.0

markForDeath

public void markForDeath()
Tag this filter to shutdown. Implementation may vary. For example, a filter may be marked for death, but not actually shutdown until it detects a certain number of empty cycles.

Since:
1.1

reset

public void reset()
reset the filter to ensure that it's ready to process records again. This method may have to be called after calling markForDeath() to reset the state of the Filter.

Since:
1.1

getName

public java.lang.String getName()
For tracking purposes. The framework requires a name of each concrete filter so that it can track which threads belong where. The name is used as a key into a HashMap, so it should be unique. Note: The result from a call to this.getClass().getName() is fine.

Returns:
String

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.

Returns:
int the number of threads to launch for this Filter.
Since:
1.1


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