SMILA 1.0 API documentation

org.eclipse.smila.processing.worker
Class ProcessingWorker

java.lang.Object
  extended by org.eclipse.smila.processing.worker.ProcessingWorker
All Implemented Interfaces:
Worker
Direct Known Subclasses:
PipeletProcessorWorker, PipelineProcessorWorker

public abstract class ProcessingWorker
extends java.lang.Object
implements Worker

Common stuff for PipeletProcessorWorker and PipelineProcessorWorker.


Field Summary
protected  boolean _binStorageAvailable
          use bin storage?
protected  BlackboardFactory _blackboardFactory
          blackboard factory.
protected  Log _log
          protected log.
static java.lang.String INPUT_SLOT_NAME
          the workers input slot name .
static java.lang.String KEY_KEEPATTACHMENTSINMEMORY
          name for "keep attachments in memory" parameter.
static java.lang.String KEY_WRITEATTACHMENTSTOOUTPUT
          name for "write attachments to output" parameter.
static java.lang.String OUTPUT_SLOT_NAME
          the workers output slot name .
protected static boolean s_noBinStorageAvailableLogged
          flag if the blackboard warning has already been logged to prevent excessive logging.
 
Constructor Summary
ProcessingWorker()
           
 
Method Summary
protected  void cleanupBlackboard(Blackboard blackboard, TaskContext taskContext)
           
protected  Blackboard getBlackboard(TaskContext taskContext)
          Creates the blackboard to hold the records during processing
abstract  boolean perform(AnyMap parameters, RecordInput recordInput, RecordOutput recordOutput, TaskContext taskContext)
           
 void perform(TaskContext taskContext)
          Performs a computation on the data available in the TaskContext, such as a task for this worker, input and (if configured) output slots.
 void setBlackboardFactory(BlackboardFactory factory)
          set blackboard factory reference (used by DS).
 void unsetBlackboardFactory(BlackboardFactory factory)
          remove blackboard factory reference (used by DS).
protected  void writeResultRecords(Blackboard blackboard, java.lang.String[] resultIds, RecordOutput recordOutput, TaskContext taskContext)
          append the resulting records to the bulk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.smila.taskworker.Worker
getName
 

Field Detail

INPUT_SLOT_NAME

public static final java.lang.String INPUT_SLOT_NAME
the workers input slot name .

See Also:
Constant Field Values

OUTPUT_SLOT_NAME

public static final java.lang.String OUTPUT_SLOT_NAME
the workers output slot name .

See Also:
Constant Field Values

KEY_KEEPATTACHMENTSINMEMORY

public static final java.lang.String KEY_KEEPATTACHMENTSINMEMORY
name for "keep attachments in memory" parameter.

See Also:
Constant Field Values

KEY_WRITEATTACHMENTSTOOUTPUT

public static final java.lang.String KEY_WRITEATTACHMENTSTOOUTPUT
name for "write attachments to output" parameter.

See Also:
Constant Field Values

s_noBinStorageAvailableLogged

protected static boolean s_noBinStorageAvailableLogged
flag if the blackboard warning has already been logged to prevent excessive logging.


_log

protected final Log _log
protected log.


_blackboardFactory

protected BlackboardFactory _blackboardFactory
blackboard factory. Set by DS


_binStorageAvailable

protected boolean _binStorageAvailable
use bin storage?

Constructor Detail

ProcessingWorker

public ProcessingWorker()
Method Detail

perform

public abstract boolean perform(AnyMap parameters,
                                RecordInput recordInput,
                                RecordOutput recordOutput,
                                TaskContext taskContext)
                         throws java.lang.Exception
Parameters:
parameters - task parameters, converted to an AnyMap
recordInput - input bulk
recordOutput - output bulk, can be null
taskContext - task context
Returns:
true if at least one record was processed successfully.
Throws:
java.lang.Exception - bulk could not be processed

perform

public void perform(TaskContext taskContext)
             throws java.lang.Exception
Description copied from interface: Worker
Performs a computation on the data available in the TaskContext, such as a task for this worker, input and (if configured) output slots. An implementor must make sure, calls to this method must be thread-safe!

Specified by:
perform in interface Worker
Parameters:
taskContext - the TaskContext information with which this operation can be performed.
Throws:
java.lang.Exception

writeResultRecords

protected void writeResultRecords(Blackboard blackboard,
                                  java.lang.String[] resultIds,
                                  RecordOutput recordOutput,
                                  TaskContext taskContext)
                           throws ObjectStoreException,
                                  java.io.IOException
append the resulting records to the bulk. Errors on blackboard access are catched and logged as warnings to the task log, as they are considered as record-specific non-recoverable errors. In any case, the blackboard is emptied afterwards and attachments should be removed from binary storage (if used).

Parameters:
recordOutput - where to write the records. Can be null (is optional in worker description)
Throws:
ObjectStoreException
java.io.IOException

cleanupBlackboard

protected void cleanupBlackboard(Blackboard blackboard,
                                 TaskContext taskContext)

getBlackboard

protected Blackboard getBlackboard(TaskContext taskContext)
                            throws java.lang.Exception
Creates the blackboard to hold the records during processing

Throws:
java.lang.Exception

setBlackboardFactory

public void setBlackboardFactory(BlackboardFactory factory)
set blackboard factory reference (used by DS).


unsetBlackboardFactory

public void unsetBlackboardFactory(BlackboardFactory factory)
remove blackboard factory reference (used by DS).


SMILA 1.0 API documentation