本文整理汇总了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);
}
示例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);
}
示例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;
}
示例4: applyEdit
import org.apache.taverna.workflowmodel.Datalink; //导入依赖的package包/类
@Override
public final Datalink applyEdit() throws EditException {
synchronized (datalink) {
doEditAction(datalink);
}
return datalink;
}
示例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;
}
示例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());
}
示例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());
}
示例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());
}
示例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();
}
示例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);
}
示例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 });
}
示例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 });
}
示例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 });
}