use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class DifferedInputNode method getParameterType.
/**
* Returns the type of the parameter
*
* @return The type of the parameter (e.g. string, int)
*/
@Override
public DataType getParameterType() {
List<DataEdge> edges = getEdges();
DataType parameterType = super.getParameterType();
if (parameterType == null && getEdges().size() > 0) {
// This happens when the graph XML doesn't have parameterType.
DataEdge edge = edges.get(0);
DataPort toPort = edge.getToPort();
parameterType = toPort.getType();
}
return parameterType;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class InstanceComponentDataPort method createPort.
/**
* @see org.apache.airavata.workflow.model.component.ComponentDataPort#createPort()
*/
@Override
public DataPort createPort() {
DataPort n = new InstanceDataPort();
n.setName(PORT_NAME);
return n;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class Component method createPorts.
protected void createPorts(NodeImpl node) {
for (ComponentDataPort input : getInputPorts()) {
DataPort port = input.createPort();
node.addInputPort(port);
}
for (ComponentDataPort output : getOutputPorts()) {
DataPort port = output.createPort();
node.addOutputPort(port);
}
if (this.controlInPort != null) {
ControlPort port = this.controlInPort.createPort();
node.setControlInPort(port);
}
for (ComponentControlPort componentPort : this.controlOutPorts) {
ControlPort port = componentPort.createPort();
node.addControlOutPort(port);
}
if (this.eprPort != null) {
EPRPort port = this.eprPort.createPort();
node.setEPRPort(port);
}
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class InterpreterUtil method getInputsForForEachNode.
/**
* This method returns the input values for given foreach node
*
* @param forEachNode
* @param listOfValues
* @param invokerMap
* @return
* @throws WorkflowException
*/
public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
List<DataPort> inputPorts = forEachNode.getInputPorts();
Object returnValForProvenance = null;
for (DataPort inputPort : inputPorts) {
Node inputNode = inputPort.getFromNode();
// if input node for for-each is WSNode
if (inputNode instanceof InputNode) {
// for (DataPort dataPort : forEachNode.getInputPorts()) {
returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
if (null == returnValForProvenance) {
throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
}
String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
listOfValues.addAll(Arrays.asList(vals));
// }
}
}
return returnValForProvenance;
}
use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.
the class InterpreterUtil method findEndForEachFor.
/**
* @param node
* @return
*/
public static Node findEndForEachFor(ForEachNode node) {
Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
if (toNodes.size() != 1) {
throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
}
Node middleNode = toNodes.iterator().next();
List<DataPort> outputPorts = middleNode.getOutputPorts();
for (DataPort dataPort : outputPorts) {
if (dataPort.getToNodes().size() == 1) {
Node possibleEndForEachNode = dataPort.getToNodes().get(0);
if (possibleEndForEachNode instanceof EndForEachNode) {
return possibleEndForEachNode;
}
}
}
throw new WorkflowRuntimeException("EndForEachNode not found");
}
Aggregations