本文整理汇总了Java中org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity类的典型用法代码示例。如果您正苦于以下问题:Java AsynchronousActivity类的具体用法?Java AsynchronousActivity怎么用?Java AsynchronousActivity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsynchronousActivity类属于org.apache.taverna.workflowmodel.processor.activity包,在下文中一共展示了AsynchronousActivity类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InvokeCallBack
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity; //导入依赖的package包/类
protected InvokeCallBack(DispatchJobEvent jobEvent,
ReferenceService refService,
String invocationProcessIdentifier,
AsynchronousActivity<?> asyncActivity) {
this.jobEvent = jobEvent;
this.refService = refService;
this.invocationProcessIdentifier = invocationProcessIdentifier;
this.activity = asyncActivity;
}
示例2: invoke
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity; //导入依赖的package包/类
protected void invoke(final DispatchJobEvent jobEvent, final AsynchronousActivity<?> activity) {
// Register with the monitor
final String invocationProcessIdentifier = jobEvent.pushOwningProcess(
getNextProcessID()).getOwningProcess();
monMan.registerNode(activity, invocationProcessIdentifier,
new HashSet<MonitorableProperty<?>>());
monMan.registerNode(jobEvent, invocationProcessIdentifier,
new HashSet<MonitorableProperty<?>>());
/*
* The activity is an AsynchronousActivity so we invoke it with an
* AsynchronousActivityCallback object containing appropriate callback
* methods to push results, completions and failures back to the
* invocation layer.
*
* Get the registered DataManager for this process. In most cases this
* will just be a single DataManager for the entire workflow system but
* it never hurts to generalize
*/
InvocationContext context = jobEvent.getContext();
final ReferenceService refService = context.getReferenceService();
InvocationStartedProvenanceItem invocationItem = null;
ProvenanceReporter provenanceReporter = context.getProvenanceReporter();
if (provenanceReporter != null) {
IntermediateProvenance intermediateProvenance = findIntermediateProvenance();
if (intermediateProvenance != null) {
invocationItem = new InvocationStartedProvenanceItem();
IterationProvenanceItem parentItem = intermediateProvenance.getIterationProvItem(jobEvent);
invocationItem.setIdentifier(UUID.randomUUID().toString());
invocationItem.setActivity(activity);
invocationItem.setProcessId(jobEvent.getOwningProcess());
invocationItem.setInvocationProcessId(invocationProcessIdentifier);
invocationItem.setParentId(parentItem.getIdentifier());
invocationItem.setWorkflowId(parentItem.getWorkflowId());
invocationItem.setInvocationStarted(new Date(System.currentTimeMillis()));
provenanceReporter.addProvenanceItem(invocationItem);
}
}
/*
* Create a Map of EntityIdentifiers named appropriately given the
* activity mapping
*/
Map<String, T2Reference> inputData = new HashMap<>();
for (String inputName : jobEvent.getData().keySet()) {
String activityInputName = activity
.getInputPortMapping().get(inputName);
if (activityInputName != null)
inputData.put(activityInputName, jobEvent.getData()
.get(inputName));
}
/*
* Create a callback object to receive events, completions and failure
* notifications from the activity
*/
AsynchronousActivityCallback callback = new InvokeCallBack(
jobEvent, refService, invocationProcessIdentifier,
activity);
if (activity instanceof MonitorableAsynchronousActivity<?>) {
/*
* Monitorable activity so get the monitorable properties and push
* them into the state tree after launching the job
*/
MonitorableAsynchronousActivity<?> maa = (MonitorableAsynchronousActivity<?>) activity;
Set<MonitorableProperty<?>> props = maa
.executeAsynchWithMonitoring(inputData, callback);
monMan.addPropertiesToNode(invocationProcessIdentifier.split(":"), props);
} else {
/*
* Run the job, passing in the callback we've just created along
* with the (possibly renamed) input data map
*/
activity.executeAsynch(inputData, callback);
}
}
示例3: receiveJob
import org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity; //导入依赖的package包/类
/**
* Receive a job from the layer above and pick the first concrete activity
* from the list to invoke. Invoke this activity, creating a callback which
* will wrap up the result messages in the appropriate collection depth
* before sending them on (in general activities are not aware of their
* invocation context and should not be responsible for providing correct
* index arrays for results)
* <p>
* This layer will invoke the first invokable activity in the activity list,
* so any sane dispatch stack will have narrowed this down to a single item
* list by this point, i.e. by the insertion of a failover layer.
*/
@Override
public void receiveJob(final DispatchJobEvent jobEvent) {
for (Activity<?> activity : jobEvent.getActivities())
if (activity instanceof AsynchronousActivity) {
invoke(jobEvent, (AsynchronousActivity<?>) activity);
break;
}
}