SMILA (incubation) 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  BlackboardFactory _blackboardFactory
          blackboard factory.
protected  Log _log
          protected log.
protected  boolean _tryToUseBinStorage
          use bin storage?
static java.lang.String INPUT_SLOT_NAME
          the workers input slot name .
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  Blackboard getBlackboard()
          Creates a blackboard.
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, TaskLog taskLog)
          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

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


_tryToUseBinStorage

protected boolean _tryToUseBinStorage
use bin storage?

Constructor Detail

ProcessingWorker

public ProcessingWorker()
Method Detail

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

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

writeResultRecords

protected void writeResultRecords(Blackboard blackboard,
                                  java.lang.String[] resultIds,
                                  RecordOutput recordOutput,
                                  TaskLog taskLog)
                           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.

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

getBlackboard

protected Blackboard getBlackboard()
                            throws java.lang.Exception
Creates a blackboard.

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 (incubation) API documentation