Package com.levigo.jadice.server.core
Class StreamWorker<T extends Node>
- java.lang.Object
-
- com.levigo.jadice.server.core.NodeWorker<T>
-
- com.levigo.jadice.server.core.StreamWorker<T>
-
- All Implemented Interfaces:
QualifiedLogEventReceiver
,WorkerController<T>
,Runnable
- Direct Known Subclasses:
AbstractMSWorker
,AbstractUnArchiveWorker
,CobraHTMLRendererWorker
,Csv2XlsxWorker
,DocumentPrintWorker
,DummyWorker
,HTML2TextWorker
,JadiceDocumentInfoWorker
,LibreOfficeConversionWorker
,MessageRFC822Worker
,MultipartAlternativeWorker
,MultipartAppleDoubleWorker
,MultipartEncryptedWorker
,MultipartMixedWorker
,MultipartRelatedWorker
,MultipartSignedWorker
,NotificationWorker
,NullWorker
,OLEExtractorWorker
,PageToImageWorker
,PDFAnnotationRemoverWorker
,PDFDecryptWorker
,PDFImageOptimizationWorker
,PDFMetadataWorker
,PDFRotationWorker
,PDFSplitWorker
,PlaintextToXMLWorker
,PortableCollectionDisassemblingWorker
,SeparatorPageWorker
,StreamAnalysisWorker
,TIFFSplitWorker
,TNEFWorker
,UnGZIPWorker
,URLOutputWorker
,Vcf2HtmlWorker
,XSLFOFormatterWorker
,XSLTransformationWorker
public abstract class StreamWorker<T extends Node> extends NodeWorker<T>
A special kind ofNodeWorker
which performs its work on a single stream at a time only. The streams are processed according to the following algorithm:- Look at one stream after another, in the same order as they arrive in the stream bundle.
- If
accept(StreamDescriptor)
returnstrue
for the stream,work(Stream)
on it. - Else if
reject(StreamDescriptor)
returnstrue
for the stream, throw an exception indicating a rejection. - Else just shunt the stream through to the output.
-
-
Constructor Summary
Constructors Constructor Description StreamWorker()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
accept(StreamDescriptor descriptor)
Check whether to accept a stream (and work on it) based on its descriptor.protected boolean
reject(StreamDescriptor descriptor)
Check whether to reject a stream based on its descriptor.protected void
work()
Implement this method to let the node perform some useful work.protected abstract void
work(Stream stream)
Implement this method in order to work on a single stream.-
Methods inherited from class com.levigo.jadice.server.core.NodeWorker
abort, abortNow, addInputBundle, addOutputBundle, doAbort, doAbortNow, error, error, error, fail, fail, fail, getController, getInputBundle, getInputBundles, getJob, getLimitSupport, getNode, getOutputBundle, getOutputBundles, getServerJob, getState, getStreamTransportFactory, getTransportSender, initialize, isAbortRequested, postWork, preWork, run, setDescriptor, setJob, toString, warn, warn, warn
-
-
-
-
Method Detail
-
work
protected final void work() throws Throwable
Description copied from class:NodeWorker
Implement this method to let the node perform some useful work.Implementors are free to throw whatever exception they see fit. If any
Throwable
is thrown from this method, the failure manager is notified about the fatal failure of the whole pipeline.- Specified by:
work
in classNodeWorker<T extends Node>
- Throws:
Throwable
- in case of processing failure
-
reject
protected boolean reject(StreamDescriptor descriptor)
Check whether to reject a stream based on its descriptor. The default implementation rejects all streams (but streams previously accepted will be worked on anyway, since accept takes precedence over reject).- Parameters:
descriptor
-- Returns:
- true - rejects all streams
-
accept
protected boolean accept(StreamDescriptor descriptor)
Check whether to accept a stream (and work on it) based on its descriptor. The default implementation accepts all streams.- Parameters:
descriptor
-StreamDescriptor
that shall be checked- Returns:
- true
-
-