本文整理了Java中net.sf.taverna.t2.workflowmodel.processor.activity.Activity.getInputPorts()
方法的一些代码示例,展示了Activity.getInputPorts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getInputPorts()
方法的具体详情如下:
包路径:net.sf.taverna.t2.workflowmodel.processor.activity.Activity
类名称:Activity
方法名:getInputPorts
[英]An Activity contains a set of named input ports. Names must be unique within this set.
[中]活动包含一组命名的输入端口。名称在此集合中必须是唯一的。
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api
public static ActivityInputPort getActivityInputPort(Activity<?> activity,
String portName) {
ActivityInputPort activityInputPort = null;
for (ActivityInputPort inputPort : activity.getInputPorts()) {
if (inputPort.getName().equals(portName)) {
activityInputPort = inputPort;
break;
}
}
return activityInputPort;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
public static ActivityInputPort getActivityInputPort(Activity<?> activity,
String portName) {
ActivityInputPort activityInputPort = null;
for (ActivityInputPort inputPort : activity.getInputPorts()) {
if (inputPort.getName().equals(portName)) {
activityInputPort = inputPort;
break;
}
}
return activityInputPort;
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-impl
private List<ProcessorInputPort> determineInputPortsForRemoval(Processor p,Activity<?>a) {
List<ProcessorInputPort> result = new ArrayList<ProcessorInputPort>();
for (ProcessorInputPort pPort : p.getInputPorts()) {
boolean found=false;
for (ActivityInputPort aPort : a.getInputPorts()) {
if (aPort.getName().equals(pPort.getName())) {
if (pPort.getDepth() == aPort.getDepth()) {
found=true;
}
break;
}
}
if (!found) {
result.add(pPort);
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
public static Collection<Processor> getProcessorsWithActivityInputPort(
Dataflow dataflow, ActivityInputPort inputPort) {
Set<Processor> processors = new HashSet<Processor>();
for (Processor processor : dataflow.getProcessors()) {
// Does it contain a nested workflow?
if (containsNestedWorkflow(processor)) {
// Get the nested workflow and check all its nested processors
Dataflow nestedWorkflow = ((NestedDataflow) processor.getActivityList().get(0))
.getNestedDataflow();
Collection<Processor> nested_processors = getProcessorsWithActivityInputPort(
nestedWorkflow, inputPort);
if (!nested_processors.isEmpty())
processors.addAll(nested_processors);
}
// Check all processor's activities (even if the processor contained a nested workflow,
// as its dataflow activity still contains input and output ports)
for (Activity<?> activity : processor.getActivityList()) {
if (activity.getInputPorts().contains(inputPort)) {
processors.add(processor);
}
}
}
return processors;
}
代码示例来源:origin: net.sf.taverna.t2/workflowmodel-impl
private List<ProcessorInputPort> determineInputPortsForRemoval(Processor p,Activity<?>a) {
List<ProcessorInputPort> result = new ArrayList<ProcessorInputPort>();
for (ProcessorInputPort pPort : p.getInputPorts()) {
boolean found=false;
for (ActivityInputPort aPort : a.getInputPorts()) {
if (aPort.getName().equals(pPort.getName())) {
if (pPort.getDepth() == aPort.getDepth()) {
found=true;
}
break;
}
}
if (!found) {
result.add(pPort);
}
}
return result;
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api
public static Collection<Processor> getProcessorsWithActivityInputPort(
Dataflow dataflow, ActivityInputPort inputPort) {
Set<Processor> processors = new HashSet<Processor>();
for (Processor processor : dataflow.getProcessors()) {
// Does it contain a nested workflow?
if (containsNestedWorkflow(processor)) {
// Get the nested workflow and check all its nested processors
Dataflow nestedWorkflow = ((NestedDataflow) processor
.getActivityList().get(0)).getNestedDataflow();
Collection<Processor> nested_processors = getProcessorsWithActivityInputPort(
nestedWorkflow, inputPort);
if (!nested_processors.isEmpty())
processors.addAll(nested_processors);
}
// Check all processor's activities (even if the processor contained
// a nested workflow,
// as its dataflow activity still contains input and output ports)
for (Activity<?> activity : processor.getActivityList()) {
if (activity.getInputPorts().contains(inputPort)) {
processors.add(processor);
}
}
}
return processors;
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
@Test
public void testAlternateProcessorTranslation() throws Exception {
Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
assertEquals(1, dataflow.getProcessors().size());
Processor processor = dataflow.getProcessors().get(0);
assertEquals(2, processor.getActivityList().size());
assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
@Test
public void testAlternateProcessorTranslation() throws Exception {
Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
assertEquals(1, dataflow.getProcessors().size());
Processor processor = dataflow.getProcessors().get(0);
assertEquals(2, processor.getActivityList().size());
assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}
代码示例来源:origin: net.sf.taverna.t2.compatibility/compatibility-impl
@Test
public void testAlternateProcessorTranslation() throws Exception {
Dataflow dataflow = translateScuflFile("alternate_test_workflow.xml");
assertEquals(1, dataflow.getProcessors().size());
Processor processor = dataflow.getProcessors().get(0);
assertEquals(2, processor.getActivityList().size());
assertEquals(1, processor.getActivityList().get(0).getInputPorts().size());
assertEquals("input", processor.getActivityList().get(0).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(0).getOutputPorts().size());
assertEquals("output", processor.getActivityList().get(0).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPorts().size());
assertEquals("in", processor.getActivityList().get(1).getInputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getOutputPorts().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPorts().iterator().next().getName());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().keySet().size());
assertEquals("input", processor.getActivityList().get(1).getInputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getInputPortMapping().values().size());
assertEquals("in", processor.getActivityList().get(1).getInputPortMapping().values().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().keySet().size());
assertEquals("output", processor.getActivityList().get(1).getOutputPortMapping().keySet().iterator().next());
assertEquals(1, processor.getActivityList().get(1).getOutputPortMapping().values().size());
assertEquals("out", processor.getActivityList().get(1).getOutputPortMapping().values().iterator().next());
}
代码示例来源:origin: net.sf.taverna.t2.core/workflowmodel-api
/**
* Create a DisabledActivity that represents a specific Activity that is now
* disabled e.g. by its remote endpoint going offline. Note that in this
* case, the ports of the DisabledActivity and their mapping to the
* containing Processor's ports can be inherited from the Activity that is
* now disabled.
*
* @param activity The Activity that is now disabled.
*/
public DisabledActivity(Activity<?> activity) {
this(activity, activity.getConfiguration());
for (ActivityInputPort aip : activity.getInputPorts()) {
this.addInput(aip.getName(), aip.getDepth(), aip
.allowsLiteralValues(), aip.getHandledReferenceSchemes(),
aip.getTranslatedElementClass());
}
for (OutputPort op : activity.getOutputPorts()) {
this.addOutput(op.getName(), op.getDepth(), op.getGranularDepth());
}
this.getInputPortMapping().clear();
this.getInputPortMapping().putAll(activity.getInputPortMapping());
this.getOutputPortMapping().clear();
this.getOutputPortMapping().putAll(activity.getOutputPortMapping());
}
代码示例来源:origin: net.sf.taverna.t2/wsdl-activity-translator
@Test
public void testSimplePorts() throws Exception {
WSDLActivityTranslator translator = new WSDLActivityTranslator();
Activity<?> activity = translator.doTranslation(processor);
assertEquals("no inputs were expected",0,activity.getInputPorts().size());
assertEquals("2 outputs were expected (remember 1 extra for attachment list!).",2,activity.getOutputPorts().size());
List<String> portNames = new ArrayList<String>();
portNames.add("attachmentList");
portNames.add("getSupportedDBsReturn");
boolean found=false;
for (OutputPort port : activity.getOutputPorts()) {
if (port.getName().equals("getSupportedDBsReturn")) {
found=true;
}
assertEquals("the port '"+port.getName()+"' should have a depth of 1 (i.e. a list)",1,port.getDepth());
}
if (!found) {
fail("There should be an output port named getSupportedDBsReturn");
}
}
代码示例来源:origin: net.sf.taverna.t2.workbench/iteration-strategy-ui
@Before
public void makeDataflow() throws EditException {
List<Edit<?>> compoundEdit = new ArrayList<Edit<?>>();
dataflow = fileManager.newDataflow();
Edits edits = EditsRegistry.getEdits();
proc1 = edits.createProcessor("processor1");
compoundEdit.add(edits.getAddProcessorEdit(dataflow, proc1));
Processor proc2 = edits.createProcessor("processor2");
compoundEdit.add(edits.getAddProcessorEdit(dataflow, proc2));
ProcessorInputPort in1 = edits.createProcessorInputPort(proc1, "in1", 0);
compoundEdit.add(edits.getAddProcessorInputPortEdit(proc1, in1));
ProcessorInputPort in2 = edits
.createProcessorInputPort(proc1, "in2", 0);
compoundEdit.add(edits.getAddProcessorInputPortEdit(proc1, in2));
Activity<EchoConfig> activity = new AsynchEchoActivity();
compoundEdit.add(edits.getConfigureActivityEdit(activity,
new EchoConfig()));
compoundEdit.add(edits.getAddActivityEdit(proc1, activity));
compoundEdit.add(edits.getDefaultDispatchStackEdit(proc1));
editManager.doDataflowEdit(dataflow, new CompoundEdit(compoundEdit));
activityInputPort = activity.getInputPorts().iterator().next();
}
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2.compatibility/compatibility-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
@SuppressWarnings("null")
@Test
public void testRemovalOfUnboundPorts() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("unbound_ports.xml");
Processor processor_A=null;
Processor processor_B=null;
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
@SuppressWarnings("null")
@Test
public void testRemovalOfUnboundPorts() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("unbound_ports.xml");
Processor processor_A=null;
Processor processor_B=null;
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2/cyclone-impl
@SuppressWarnings("null")
@Test
public void testBoundPortOverridesDefault() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("bound_port_overides_default.xml");
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
Processor processor_A=null;
Processor processor_B=null;
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: net.sf.taverna.t2.compatibility/compatibility-impl
@SuppressWarnings("null")
@Test
public void testRemovalOfUnboundPorts() throws Exception {
Dataflow dataflow = loadAndTranslateWorkflow("unbound_ports.xml");
Processor processor_A=null;
Processor processor_B=null;
assertEquals("there should only be 2 processors",2,dataflow.getProcessors().size());
for (Processor p : dataflow.getProcessors()) {
if (p.getLocalName().equals("Processor_A")) processor_A=p;
if (p.getLocalName().equals("Processor_B")) processor_B=p;
}
assertNotNull("Could not find processor A",processor_A);
assertNotNull("Could not find processor B",processor_B);
assertEquals("processor_A should have no inputs",0,processor_A.getInputPorts().size());
assertEquals("processor_A should have 1 output",1,processor_A.getOutputPorts().size());
assertEquals("processor_B should have 1 input",1,processor_B.getInputPorts().size());
assertEquals("processor_B should have 1 input named input_1","input_1",processor_B.getInputPorts().get(0).getName());
assertEquals("processor_B should have 1 output",1,processor_B.getOutputPorts().size());
assertEquals("processor_B should have 1 activity",1,processor_B.getActivityList().size());
Activity<?>activity = processor_B.getActivityList().get(0);
assertEquals("activity should have 3 input ports",3,activity.getInputPorts().size());
}
代码示例来源:origin: uk.org.taverna.platform/taverna-capability-impl
@Override
public void addDynamicPorts(uk.org.taverna.scufl2.api.activity.Activity scufl2Activity,
Configuration configuration) throws ActivityNotFoundException,
ActivityConfigurationException {
Activity<?> activity = createActivity(scufl2Activity.getConfigurableType(), configuration);
Set<ActivityInputPort> inputPorts = activity.getInputPorts();
for (ActivityInputPort inputPort : inputPorts) {
InputActivityPort inputActivityPort = new InputActivityPort(scufl2Activity,
inputPort.getName());
inputActivityPort.setDepth(inputPort.getDepth());
}
Set<OutputPort> outputPorts = activity.getOutputPorts();
for (OutputPort outputPort : outputPorts) {
OutputActivityPort outputActivityPort = new OutputActivityPort(scufl2Activity,
outputPort.getName());
outputActivityPort.setDepth(outputPort.getDepth());
outputActivityPort.setGranularDepth(outputPort.getGranularDepth());
}
}
代码示例来源:origin: net.sf.taverna.t2/compatibility-impl
assertEquals(2, activity.getInputPorts().size());
assertEquals(1, activity.getOutputPorts().size());
for (Port inPort : activity.getInputPorts()) {
if (inPort.getName().equals("input1"))
in1 = inPort;
内容来源于网络,如有侵权,请联系作者删除!