当前位置: 首页>>代码示例>>Java>>正文


Java AsynchronousActivity类代码示例

本文整理汇总了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;
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:10,代码来源:Invoke.java

示例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);
	}
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:80,代码来源:Invoke.java

示例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;
		}
}
 
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:21,代码来源:Invoke.java


注:本文中的org.apache.taverna.workflowmodel.processor.activity.AsynchronousActivity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。