|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object xsmeral.pipe.AbstractObjectProcessor xsmeral.pipe.LocalObjectFilter<I,O>
I
- Input object typeO
- Output object type@ObjectProcessorInterface(in=java.lang.Object.class, out=java.lang.Object.class) public class LocalObjectFilter<I,O>
An object processor that serves the role of a filter.
Receives objects, processes them and writes to the output buffer.
Provides default ObjectProcessorInterface
set to Object
s.
This implementation delegates all calls to an instance of LocalObjectSink
and LocalObjectSource
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface xsmeral.pipe.interfaces.ObjectProcessor |
---|
ObjectProcessor.Status |
Field Summary |
---|
Fields inherited from class xsmeral.pipe.AbstractObjectProcessor |
---|
canStart, context, status |
Constructor Summary | |
---|---|
LocalObjectFilter()
Instantiates the sink and the source |
|
LocalObjectFilter(BlockingQueue<O> outBuffer)
Instantiates a new sink and a source, setting the source to the supplied output buffer. |
Method Summary | |
---|---|
ObjectSink<O> |
getNext()
Returns the next processor in chain. |
BlockingQueue<O> |
getOutBuffer()
Returns the output buffer of this processor. |
ObjectSource<I> |
getPrev()
Returns the previous processor in chain. |
protected void |
handleStoppedSink()
Called in case the next processor is stopped during a write operation. |
protected void |
handleStoppedSource()
Called in case the previous processor is stopped during a read operation. |
void |
next(ObjectSink<O> sink)
Sets the next processor in the chain and sets this as its previous. |
void |
prev(ObjectSource<I> src)
Sets this processor as the next in the chain, after the given processor. |
protected void |
process()
Called by the processor itself from run() . |
protected I |
read()
Reads one object from the top of the buffer of the previous processor. |
void |
requestStop()
Requests the processor to stop and sets its status to STOPPING . |
void |
setNext(ObjectSink<O> sink)
Sets the next processor, without calling prev() on the sink. |
void |
setOutBuffer(BlockingQueue<O> buffer)
Sets the output buffer, used for object flow redirection. |
protected void |
write(O o)
Puts one object to the output buffer |
Methods inherited from class xsmeral.pipe.AbstractObjectProcessor |
---|
canStart, failStart, failStart, failStart, getContext, getInType, getOutType, getParams, getStatus, initContext, initContextSet, initialize, initializeInternal, initPostContext, initWithContext, postRun, preRun, run, setContext, stop, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface xsmeral.pipe.interfaces.ObjectSink |
---|
getInType |
Methods inherited from interface xsmeral.pipe.interfaces.ObjectSource |
---|
getOutType |
Constructor Detail |
---|
public LocalObjectFilter()
public LocalObjectFilter(BlockingQueue<O> outBuffer)
Method Detail |
---|
public final void prev(ObjectSource<I> src)
ObjectSink
prev
in interface ObjectSink<I>
src
- The previous processorpublic final void next(ObjectSink<O> sink)
ObjectSource
next
in interface ObjectSource<O>
sink
- The next processorpublic final ObjectSource<I> getPrev()
ObjectSink
getPrev
in interface ObjectSink<I>
public final ObjectSink<O> getNext()
ObjectSource
getNext
in interface ObjectSource<O>
public final BlockingQueue<O> getOutBuffer()
ObjectSource
getOutBuffer
in interface ObjectSource<O>
public void setOutBuffer(BlockingQueue<O> buffer)
public final void setNext(ObjectSink<O> sink)
prev()
on the sink.
protected final void write(O o) throws ProcessorStoppedException
o
- The object to write
SinkStoppedException
- If the sink is in
STOPPED
state and thus no longer reads the bufferhandleStoppedSink()
immediately before throwing.
ProcessorStoppedException
protected final I read() throws ProcessorStoppedException
SourceStoppedException
- If the previous processor is in
STOPPED
state.
Calls handleStoppedSource()
immediately before throwing.
ProcessorStoppedException
protected void handleStoppedSink()
write
operation.
Can be used, for example, to persist objects left in the buffer.
protected void handleStoppedSource()
read
operation.
public final void requestStop()
ObjectProcessor
STOPPING
.
There is no limit to the time it takes the processor to stop, it should
however stop as soon as possible.
requestStop
in interface ObjectProcessor
requestStop
in class AbstractObjectProcessor
protected void process() throws ProcessorStoppedException
run()
.
Should process one object and return.
More information in description of AbstractObjectProcessor
class, section "Running".
This implementation is empty and should be overridden.
process
in class AbstractObjectProcessor
ProcessorStoppedException
- If a neighboring processor has stopped.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |