public abstract class TaskGeneratorBase extends java.lang.Object implements TaskGenerator
| Modifier and Type | Field and Description |
|---|---|
protected Log |
_log
local logger.
|
protected ObjectStoreService |
_objectStore
service reference to objectstore.
|
static java.lang.String |
PROPERTY_GENERATOR_NAME
name of property that specifies the generator name in the component description.
|
| Constructor and Description |
|---|
TaskGeneratorBase() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
activate(ComponentContext context)
get value of
PROPERTY_GENERATOR_NAME in component description. |
protected void |
addOutputBulks(Task task,
Bucket inputBucket,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap variableValues)
create a bulk Id for each output bucket and add it to the task.
|
protected void |
addOutputBulks(Task task,
Bucket inputBucket,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap variableValues,
java.lang.String suffix)
create a bulk Id for each output bucket and add it to the task.
|
protected void |
checkBucketCounts(java.util.Map<java.lang.String,Bucket> inputBuckets,
int expectedNumberOfInputBuckets,
java.util.Map<java.lang.String,Bucket> outputBuckets,
int expectedNumberOfOutputBuckets)
check number of buckets passed as input and output.
|
java.util.List<Task> |
createCompletionTasks(java.util.Map<java.lang.String,Bucket> inputBuckets,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap parameters,
java.lang.String workerName)
Creates tasks for the completion workflow run, i.e. the run just before the job run is completed to to some
cleanup/completion work.
|
java.util.List<Task> |
createRunOnceTasks(java.util.Map<java.lang.String,Bucket> inputBuckets,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap parameters,
java.lang.String workerName)
Creates tasks for the RunOnce mode, i.e. for all objects in the input bucket of the start action.
|
protected Task |
createSingleBulkTask(java.lang.String objectId,
java.lang.String inputSlotName,
Bucket inputBucket,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap parameters,
java.lang.String workerName) |
protected Task |
createTask(java.lang.String workerName,
AnyMap parameters) |
static java.lang.String |
createTaskId()
Creates an unique id.
|
java.util.List<Task> |
createTasks(java.util.Map<java.lang.String,java.util.List<BulkInfo>> changedInput,
java.util.Map<java.lang.String,Bucket> inputBuckets,
java.util.Map<java.lang.String,Bucket> outputBuckets,
AnyMap parameters,
java.lang.String workerName,
java.lang.String jobName,
java.lang.String jobRunId,
java.lang.String workflowRunId)
Create tasks based on additional job run information.
|
void |
finishTask(Task task,
TaskCompletionStatus taskState) |
java.lang.String |
getName() |
protected double |
getParameterValue(java.lang.String parameterValue,
double defaultValue)
Delivers value from given string value.
|
protected int |
getParameterValue(java.lang.String parameterValue,
int defaultValue)
Delivers value from given string value.
|
protected long |
getParameterValue(java.lang.String parameterValue,
long defaultValue)
Delivers value from given string value.
|
void |
setObjectStoreService(ObjectStoreService objectStore)
method for DS to set a service reference.
|
void |
unsetObjectStoreService(ObjectStoreService objectStore)
method for DS to unset a service reference.
|
void |
validateParameters(AnyMap parameters)
Check complex parameters in some task generators if desired.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateTaskspublic static final java.lang.String PROPERTY_GENERATOR_NAME
protected final Log _log
protected ObjectStoreService _objectStore
public static java.lang.String createTaskId()
public java.lang.String getName()
getName in interface TaskGeneratorpublic void finishTask(Task task, TaskCompletionStatus taskState) throws TaskGeneratorException
finishTask in interface TaskGeneratortask - The task to be cleaned uptaskState - TODOTaskGeneratorException - error while cleaning up for finished taskprotected void activate(ComponentContext context)
PROPERTY_GENERATOR_NAME in component description.context - OSGi service component context.protected Task createTask(java.lang.String workerName, AnyMap parameters)
workerName - name of workerparameters - task parametersprotected void addOutputBulks(Task task, Bucket inputBucket, java.util.Map<java.lang.String,Bucket> outputBuckets, AnyMap variableValues)
task - taskinputBucket - now unused, null is OKoutputBuckets - map of slot names to bucketsvariableValues - predefined (e.g. extracted from input bulks) values for data object type variables. May be null.protected void addOutputBulks(Task task, Bucket inputBucket, java.util.Map<java.lang.String,Bucket> outputBuckets, AnyMap variableValues, java.lang.String suffix)
task - taskinputBucket - now unused, null is OKoutputBuckets - map of slot names to bucketsvariableValues - predefined (e.g. extracted from input bulks) values for data object type variables. May be null.suffix - optional suffix for all bulk object Ids.protected void checkBucketCounts(java.util.Map<java.lang.String,Bucket> inputBuckets, int expectedNumberOfInputBuckets, java.util.Map<java.lang.String,Bucket> outputBuckets, int expectedNumberOfOutputBuckets) throws TaskGeneratorException
inputBuckets - .expectedNumberOfInputBuckets - .outputBuckets - .expectedNumberOfOutputBuckets - .TaskGeneratorException - if size of bucket maps does not match the corresponding expectedNumber argument.public java.util.List<Task> createTasks(java.util.Map<java.lang.String,java.util.List<BulkInfo>> changedInput, java.util.Map<java.lang.String,Bucket> inputBuckets, java.util.Map<java.lang.String,Bucket> outputBuckets, AnyMap parameters, java.lang.String workerName, java.lang.String jobName, java.lang.String jobRunId, java.lang.String workflowRunId) throws TaskGeneratorException
TaskGeneratorcreateTasks in interface TaskGeneratorchangedInput - key: slot containing added bulks, value: added bulksinputBuckets - key: input slot name, value: bucket for this slotoutputBuckets - key: output slot name, value: bucket for this slotparameters - key: param name, value: (evaluated) param valueworkerName - (action) worker for which to create new tasksjobName - name of current jobjobRunId - id of current job runworkflowRunId - id of current workflow runTaskGeneratorException - error while generating taskspublic java.util.List<Task> createRunOnceTasks(java.util.Map<java.lang.String,Bucket> inputBuckets, java.util.Map<java.lang.String,Bucket> outputBuckets, AnyMap parameters, java.lang.String workerName) throws TaskGeneratorException
TaskGeneratorcreateRunOnceTasks in interface TaskGeneratorinputBuckets - key: input slot name, value: bucket for this slotoutputBuckets - key: output slot name, value: bucket for this slotparameters - key: param name, value: (evaluated) param valueworkerName - (action) worker for which to create new tasksTaskGeneratorException - error while generating taskspublic java.util.List<Task> createCompletionTasks(java.util.Map<java.lang.String,Bucket> inputBuckets, java.util.Map<java.lang.String,Bucket> outputBuckets, AnyMap parameters, java.lang.String workerName) throws TaskGeneratorException
TaskGeneratorcreateCompletionTasks in interface TaskGeneratorinputBuckets - key: input slot name, value: bucket for this slotoutputBuckets - key: output slot name, value: bucket for this slotparameters - key: param name, value: (evaluated) param valueworkerName - (action) worker for which to create new tasksTaskGeneratorException - error while generating taskspublic void setObjectStoreService(ObjectStoreService objectStore)
objectStore - ObjectStoreService reference.public void unsetObjectStoreService(ObjectStoreService objectStore)
objectStore - ObjectStoreService reference.protected int getParameterValue(java.lang.String parameterValue,
int defaultValue)
parameterValue - The given parameter valueprotected long getParameterValue(java.lang.String parameterValue,
long defaultValue)
parameterValue - The given parameter valueprotected double getParameterValue(java.lang.String parameterValue,
double defaultValue)
parameterValue - The given parameter valuepublic void validateParameters(AnyMap parameters) throws TaskGeneratorException
validateParameters in interface TaskGeneratorparameters - The map with the parametersTaskGeneratorException - an exception if something is wrong with the parameters