當前位置: 首頁>>代碼示例>>Java>>正文


Java Datalink類代碼示例

本文整理匯總了Java中org.apache.taverna.workflowmodel.Datalink的典型用法代碼示例。如果您正苦於以下問題:Java Datalink類的具體用法?Java Datalink怎麽用?Java Datalink使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Datalink類屬於org.apache.taverna.workflowmodel包,在下文中一共展示了Datalink類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: receiveEvent

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
/**
 * Receive an input event, relay it through the internal output port to all
 * connected entities
 */
@Override
public void receiveEvent(WorkflowDataToken t) {
	WorkflowDataToken transformedToken = t.pushOwningProcess(dataflow.getLocalName());
	/*
	 * I'd rather avoid casting to the implementation but in this case we're
	 * in the same package - the only reason to do this is to allow dummy
	 * implementations of parts of this infrastructure during testing, in
	 * 'real' use this should always be a dataflowimpl
	 */
	if (dataflow instanceof DataflowImpl)
		((DataflowImpl) dataflow).tokenReceived(transformedToken
				.getOwningProcess(), t.getContext());
	for (Datalink dl : internalOutput.getOutgoingLinks())
		dl.getSink().receiveEvent(transformedToken);
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:20,代碼來源:DataflowInputPortImpl.java

示例2: getDisconnectDatalinkAndRemovePortsEdit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
public static Edit<?> getDisconnectDatalinkAndRemovePortsEdit(
		Datalink datalink, Edits edits) {
	List<Edit<?>> editList = new ArrayList<>();
	editList.add(edits.getDisconnectDatalinkEdit(datalink));
	if (datalink.getSource() instanceof ProcessorOutputPort) {
		ProcessorOutputPort processorOutputPort = (ProcessorOutputPort) datalink
				.getSource();
		if (processorOutputPort.getOutgoingLinks().size() == 1)
			editList.add(getRemoveProcessorOutputPortEdit(
					processorOutputPort, edits));
	}
	if (datalink.getSink() instanceof ProcessorInputPort)
		editList.add(getRemoveProcessorInputPortEdit(
				(ProcessorInputPort) datalink.getSink(), edits));
	return new CompoundEdit(editList);
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:17,代碼來源:Tools.java

示例3: AbstractDatalinkEdit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
protected AbstractDatalinkEdit(Datalink datalink) {
	if (datalink == null)
		throw new RuntimeException(
				"Cannot construct a datalink edit with null datalink");
	if (!(datalink instanceof DatalinkImpl))
		throw new RuntimeException(
				"Edit cannot be applied to a Datalink which isn't an instance of DatalinkImpl");
	this.datalink = (DatalinkImpl) datalink;
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:10,代碼來源:AbstractDatalinkEdit.java

示例4: applyEdit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Override
public final Datalink applyEdit() throws EditException {
	synchronized (datalink) {
		doEditAction(datalink);
	}
	return datalink;
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:8,代碼來源:AbstractDatalinkEdit.java

示例5: isInputPortConnected

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Override
public boolean isInputPortConnected(DataflowInputPort inputPort) {
	for (Datalink link : getLinks())
		if (link.getSource().equals(inputPort.getInternalOutputPort()))
			return true;
	return false;
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:8,代碼來源:DataflowImpl.java

示例6: applyEdit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Test
public void applyEdit() throws Exception {
	Edit<Merge> theEdit = edits.getConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
	assertEquals(0,merge.getInputPorts().size());
	assertNotNull(merge.getOutputPort());
	assertTrue(merge.getOutputPort() instanceof MergeOutputPort);
	assertEquals(0,merge.getOutputPort().getOutgoingLinks().size());
	
	assertSame(merge,((MergeOutputPort)merge.getOutputPort()).getMerge());
	
	theEdit.doEdit();
	assertEquals(1,merge.getInputPorts().size());
	assertTrue(merge.getInputPorts().get(0) instanceof MergeInputPort);
	assertEquals("source_portTotheMerge_input0",merge.getInputPorts().get(0).getName());
	assertSame(sourcePort,merge.getInputPorts().get(0).getIncomingLink().getSource());
	
	assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
	assertSame(sinkPort,merge.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
	
	assertEquals(1,sourcePort.getOutgoingLinks().size());
	assertTrue(sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() instanceof MergeInputPort);
	assertTrue(sinkPort.getIncomingLink().getSource() instanceof MergeOutputPort);
	
	assertSame(merge.getInputPorts().get(0),sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
	assertSame(sinkPort.getIncomingLink().getSource(),merge.getOutputPort());
	
	ProcessorImpl p3=new ProcessorImpl();
	ProcessorOutputPortImpl sourcePort2=new ProcessorOutputPortImpl(p3,"source_port2",0,0);
	
	Edit<Merge> theEdit2 = edits.getConnectMergedDatalinkEdit(merge,sourcePort2,sinkPort);
	theEdit2.doEdit();
	assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
	assertEquals(2,merge.getInputPorts().size());
	assertTrue(merge.getInputPorts().get(1) instanceof MergeInputPort);
	assertEquals("source_port2TotheMerge_input0",merge.getInputPorts().get(1).getName());
	assertSame(sourcePort2,merge.getInputPorts().get(1).getIncomingLink().getSource());
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:38,代碼來源:ConnectMergedDatalinkEditTest.java

示例7: testDoEditAction

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Test
public void testDoEditAction() throws EditException {
	Edit<Datalink> edit = edits.getConnectDatalinkEdit(datalink);
	assertEquals(0, datalink.getSource().getOutgoingLinks().size());
	assertNull(datalink.getSink().getIncomingLink());
	edit.doEdit();
	assertEquals(1, datalink.getSource().getOutgoingLinks().size());
	assertEquals(datalink, datalink.getSource().getOutgoingLinks()
			.iterator().next());
	assertEquals(datalink, datalink.getSink().getIncomingLink());
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:12,代碼來源:ConnectDatalinkEditTest.java

示例8: testUndoEditAction

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Test
public void testUndoEditAction() throws EditException {
	Edit<Datalink> edit = edits.getConnectDatalinkEdit(datalink);
	assertEquals(0, datalink.getSource().getOutgoingLinks().size());
	assertNull(datalink.getSink().getIncomingLink());
	edit.doEdit();
	assertEquals(1, datalink.getSource().getOutgoingLinks().size());
	assertNotNull(datalink.getSink().getIncomingLink());
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:10,代碼來源:ConnectDatalinkEditTest.java

示例9: setUp

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
	activity = new DataflowActivity();
	Edits edits = new EditsImpl();
	activity.setEdits(edits);
	dataflow = edits.createDataflow();
	edits.getCreateDataflowInputPortEdit(dataflow, "input", 0, 0).doEdit();
	edits.getCreateDataflowOutputPortEdit(dataflow, "output").doEdit();
	Datalink datalink = edits.createDatalink(dataflow.getInputPorts().get(0)
			.getInternalOutputPort(), dataflow.getOutputPorts().get(0).getInternalInputPort());
	edits.getConnectDatalinkEdit(datalink).doEdit();
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:13,代碼來源:DataflowActivityTest.java

示例10: getMoveDatalinkSinkEdit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
public static Edit<?> getMoveDatalinkSinkEdit(Dataflow dataflow,
		Datalink datalink, EventHandlingInputPort sink, Edits edits) {
	List<Edit<?>> editList = new ArrayList<>();
	editList.add(edits.getDisconnectDatalinkEdit(datalink));
	if (datalink.getSink() instanceof ProcessorInputPort)
		editList.add(getRemoveProcessorInputPortEdit(
				(ProcessorInputPort) datalink.getSink(), edits));
	editList.add(getCreateAndConnectDatalinkEdit(dataflow,
			datalink.getSource(), sink, edits));
	return new CompoundEdit(editList);
}
 
開發者ID:apache,項目名稱:incubator-taverna-engine,代碼行數:12,代碼來源:Tools.java

示例11: visit

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
public VisitReport visit(ExternalToolActivity o,
		List<Object> ancestry) {
	List<VisitReport> reports = new ArrayList<VisitReport>();
		Processor p = (Processor) VisitReport.findAncestor(ancestry, Processor.class);
		Dataflow d = (Dataflow) VisitReport.findAncestor(ancestry, Dataflow.class);
		
		for (ActivityInputPort aip : o.getInputPorts()) {
			Set<String> sinkMimeSet = getMimeTypesForInput(o, aip);
			if (sinkMimeSet.isEmpty()) {
				continue;
			}
			ProcessorInputPort pip = Tools.getProcessorInputPort(p, (Activity<?>) o, aip);
			
			for (Datalink dl : d.getLinks()) {

				if (dl.getSink().equals(pip)) {
					Port source = dl.getSource();
					Set<VisitReport> subReports = checkSource(dl, source, d, (Activity) o, aip, sinkMimeSet);
					for (VisitReport vr : subReports) {
						vr.setProperty("sinkProcessor", p);
					    vr.setProperty("activity", o);
					    vr.setProperty("sinkPort", pip);
					}
					reports.addAll(subReports);
				}
			}
		}
		
	if (reports.isEmpty()) {
		return null;
	}
	if (reports.size() == 1) {
		return reports.get(0);
	}
	else {
		return new VisitReport(HealthCheck.getInstance(), o, "Collation", HealthCheck.DEFAULT_VALUE, reports);
	}
}
 
開發者ID:apache,項目名稱:incubator-taverna-common-activities,代碼行數:39,代碼來源:ExternalToolActivityMimeTypeChecker.java

示例12: checkSource

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
private Set<VisitReport> checkSource(Datalink datalink, Port source, Dataflow d, Activity o, ActivityInputPort aip, Set<String> sinkMimeSet) {
	Set<VisitReport> reports = new HashSet<VisitReport>();
	if (source instanceof ProcessorPort) {
		ProcessorPort processorPort = (ProcessorPort) source;
		Processor sourceProcessor = processorPort.getProcessor();
		Activity sourceActivity = sourceProcessor.getActivityList().get(0);
		if (sourceActivity instanceof ExternalToolActivity) {
			ActivityOutputPort aop = getActivityOutputPort(sourceActivity, processorPort);
			Set<String> sourceMimeTypes = getMimeTypesForOutput((ExternalToolActivity) sourceActivity, aop);
			if (!sourceMimeTypes.isEmpty()) {
				Set<String> sinkMimeTypesClone  = new HashSet<String>();
				sinkMimeTypesClone.addAll(sinkMimeSet);
				sinkMimeTypesClone.retainAll(sourceMimeTypes);
				if (sinkMimeTypesClone.isEmpty()) {
					VisitReport vr = new VisitReport(HealthCheck.getInstance(), o, "Incompatible mime types", HealthCheck.INCOMPATIBLE_MIMETYPES, Status.WARNING);
					vr.setProperty("sourcePort", processorPort);
					vr.setProperty("sourceProcessor", sourceProcessor);
					vr.setProperty("link", datalink);
					reports.add(vr);
				}
			}
		}
	} else if (source instanceof MergeOutputPort) {
		Merge merge = ((MergePort) source).getMerge();
		for (MergeInputPort mip : merge.getInputPorts()) {
			for (Datalink dl : d.getLinks()) {
				if (dl.getSink().equals(mip)) {
					reports.addAll(checkSource(dl, dl.getSource(), d, o, aip, sinkMimeSet));
				}
			}
			
		}
	}
	return reports;
}
 
開發者ID:apache,項目名稱:incubator-taverna-common-activities,代碼行數:36,代碼來源:ExternalToolActivityMimeTypeChecker.java

示例13: explanationUnresolvedOutput

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
private static JComponent explanationUnresolvedOutput(VisitReport vr) {
	DataflowOutputPort dop = (DataflowOutputPort) vr.getSubject();
	Datalink incomingLink = dop.getInternalInputPort().getIncomingLink();
	String message;
	if (incomingLink == null) {
		message = "The workflow output port is not connected.";
	} else {
		message = "The workflow output port is connected to a service or port that has errors.";
	}
	return createPanel(new Object[] { message });
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:12,代碼來源:BasicExplainer.java

示例14: solutionUnresolvedOutput

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
private JComponent solutionUnresolvedOutput(VisitReport vr) {
	JButton deleteButton = null;

	DataflowOutputPort port = (DataflowOutputPort) vr.getSubject();
	DataflowOutputPort dop = (DataflowOutputPort) vr.getSubject();
	Datalink incomingLink = dop.getInternalInputPort().getIncomingLink();
	String message;
	if (incomingLink == null) {
		message = "Connect the workflow output port to a service or a workflow input port.  Alternatively,";
		final Dataflow d = fileManager.getCurrentDataflow();
		final DataflowOutputPort p = port;
		deleteButton = new JButton(new AbstractAction("Remove port") {
			public void actionPerformed(ActionEvent e) {
				Edit removeEdit = editManager.getEdits()
						.getRemoveDataflowOutputPortEdit(d, p);
				try {
					editManager.doDataflowEdit(d, removeEdit);
				} catch (EditException ex) {
					logger.error("Could not perform edit", ex);
				}
			}
		});
	} else {
		message = "Fix the errors of the service that the output port is connected to.";
	}
	return createPanel(new Object[] { message, deleteButton });
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:28,代碼來源:BasicExplainer.java

示例15: solutionIncompatibleMimetypes

import org.apache.taverna.workflowmodel.Datalink; //導入依賴的package包/類
private JComponent solutionIncompatibleMimetypes(VisitReport vr) {
	JButton sinkButton = new JButton();
	Processor sinkProcessor = (Processor) (vr.getProperty("sinkProcessor"));
	Processor sourceProcessor = (Processor) vr
			.getProperty("sourceProcessor");
	sinkButton.setAction(new ReportViewConfigureAction(sinkProcessor));
	sinkButton.setText("Configure " + sinkProcessor.getLocalName());
	JButton sourceButton = new JButton();
	sourceButton.setAction(new ReportViewConfigureAction(sourceProcessor));
	sourceButton.setText("Configure " + sourceProcessor.getLocalName());

	JButton deleteLinkButton = new JButton();
	final Datalink link = (Datalink) vr.getProperty("link");
	final Dataflow d = fileManager.getCurrentDataflow();
	deleteLinkButton.setAction(new AbstractAction("Remove link") {
		public void actionPerformed(ActionEvent e) {
			Edit removeLinkEdit = Tools
					.getDisconnectDatalinkAndRemovePortsEdit(link, editManager.getEdits());
			try {
				editManager.doDataflowEdit(d, removeLinkEdit);
			} catch (EditException ex) {
				logger.error("Could not perform edit", ex);
			}
		}
	});

	return createPanel(new Object[] {
			"Change the source or destination mimetype or remove the link",
			sourceButton, sinkButton, deleteLinkButton });
}
 
開發者ID:apache,項目名稱:incubator-taverna-workbench,代碼行數:31,代碼來源:BasicExplainer.java


注:本文中的org.apache.taverna.workflowmodel.Datalink類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。