xsmeral.pipe.interfaces
Interface ObjectProcessor

All Superinterfaces:
ContextAware, Runnable
All Known Implementing Classes:
AbstractObjectProcessor, LocalObjectFilter, LocalObjectSink, LocalObjectSource

public interface ObjectProcessor
extends Runnable, ContextAware

An object processor is a runnable command which performs a specific task. Object processors are usually executed in a chain, with objects flowing from the first one to the last, each one performing a transformation on the object or emitting new objects based on information from the one received.


Nested Class Summary
static class ObjectProcessor.Status
          Describes the status of the processor
 
Method Summary
 boolean canStart()
          Indicates whether the processor is ready to start (is correctly initialized).
 Class getInType()
          Returns the input type of this processor.
 Class getOutType()
          Returns the output type of this processor.
 ObjectProcessor.Status getStatus()
          Returns current status of this processor.
 ObjectProcessor initialize(Map<String,String> params)
          Initializes the processor.
 void requestStop()
          Requests the processor to stop and sets its status to STOPPING.
 void run()
          Starts the processing, putting the processor into running state.
 
Methods inherited from interface xsmeral.pipe.context.ContextAware
getContext, initContext, setContext
 

Method Detail

initialize

ObjectProcessor initialize(Map<String,String> params)
Initializes the processor. Should only be called once per instance. After returning from this method, the processor should be ready to start (or indicate inability to start when queried by canStart).

Parameters:
params - Initialization parameters, substitute for constructor arguments
Returns:
Should return this, so that the processor can be instantiated and initialized in one command:
    new SomeProcessor().initialize(params);

getInType

Class getInType()
Returns the input type of this processor.


getOutType

Class getOutType()
Returns the output type of this processor.


getStatus

ObjectProcessor.Status getStatus()
Returns current status of this processor.


run

void run()
Starts the processing, putting the processor into running state.

Specified by:
run in interface Runnable

requestStop

void requestStop()
Requests the processor to stop and sets its status to STOPPING. There is no limit to the time it takes the processor to stop, it should however stop as soon as possible.
Only the first processor in chain should be requested to stop.


canStart

boolean canStart()
Indicates whether the processor is ready to start (is correctly initialized).

Returns:
True, if the processor is ready to start.