Search in sources :

Example 26 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.

the class EndDoWhileNode method edgeWasAdded.

/**
 * @throws GraphException
 * @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.graph.Edge)
 */
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
    // XXX cannot detect if the type is array or not from WSDL at this
    // point. so no check here.
    // super.edgeWasAdded(edge);
    Port fromPort = edge.getFromPort();
    Port toPort = edge.getToPort();
    if (edge instanceof DataEdge) {
        if (fromPort instanceof EPRPort) {
            // TODO
            return;
        }
        DataPort fromDataPort = (DataPort) fromPort;
        DataPort toDataPort = (DataPort) toPort;
        DataType fromType = fromDataPort.getType();
        DataType toType = toDataPort.getType();
        if (fromDataPort.getNode() == this) {
            if (!(toType == null || toType.equals(WSConstants.XSD_ANY_TYPE))) {
                fromDataPort.copyType(toDataPort);
            }
        } else if (toDataPort.getNode() == this) {
            if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE))) {
                toDataPort.copyType(fromDataPort);
            }
        } else {
            throw new WorkflowRuntimeException();
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) Port(org.apache.airavata.workflow.model.graph.Port) DataType(org.apache.airavata.model.application.io.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 27 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.

the class EndDoWhileNode method portTypeChanged.

/**
 * @see org.apache.airavata.workflow.model.graph.system.SystemNode#portTypeChanged(org.apache.airavata.workflow.model.graph.system.SystemDataPort)
 */
@Override
protected void portTypeChanged(SystemDataPort port) throws GraphException {
    super.portTypeChanged(port);
    List<DataPort> inputPorts = getInputPorts();
    List<DataPort> outputPorts = getOutputPorts();
    Kind kind = port.getKind();
    int index;
    if (kind == Kind.DATA_IN) {
        index = inputPorts.indexOf(port);
    } else if (kind == Kind.DATA_OUT) {
        index = outputPorts.indexOf(port);
    } else {
        throw new WorkflowRuntimeException();
    }
    SystemDataPort inputPort = (SystemDataPort) inputPorts.get(index);
    SystemDataPort outputPort = (SystemDataPort) outputPorts.get(index);
    DataType inputType = inputPort.getType();
    DataType outputType = outputPort.getType();
    DataType portType = port.getType();
    if (portType == null || portType.equals(WSConstants.XSD_ANY_TYPE)) {
        // Do nothing
        return;
    }
    if (port == inputPort) {
        // input -> output
        if (outputType.equals(WSConstants.XSD_ANY_TYPE)) {
            outputPort.copyType(port, 1);
        } else if (outputType.equals(portType)) {
        // Do nothing.
        } else {
        // XXX cannot parse array from WSDL.
        // String message = "The type of input " + index + " ("
        // + inputType + ") of " + getID()
        // + " must be same as the type of output " + index + " ("
        // + outputType + ").";
        // throw new GraphException(message);
        }
    } else if (port == outputPort) {
        // output -> input1
        if (inputType.equals(WSConstants.XSD_ANY_TYPE)) {
            inputPort.copyType(port, -1);
        } else if (inputType.equals(portType)) {
        // Do nothing.
        } else {
        // XXX cannot parse array from WSDL.
        // String message = "The type of input " + index + " ("
        // + inputType + ") of " + getID()
        // + " must be same as the type of output " + index + " ("
        // + outputType + ").";
        // throw new GraphException(message);
        }
    } else {
        throw new WorkflowRuntimeException();
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) Kind(org.apache.airavata.workflow.model.graph.Port.Kind) DataType(org.apache.airavata.model.application.io.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 28 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.

the class EndDoWhileNode method addOutputPort.

/**
 * Adds additional output port.
 */
public void addOutputPort() {
    EndDoWhileComponent component = getComponent();
    ComponentDataPort outputPort = component.getOutputPort();
    DataPort port = outputPort.createPort();
    addOutputPort(port);
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) EndDoWhileComponent(org.apache.airavata.workflow.model.component.system.EndDoWhileComponent) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

Example 29 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.

the class EndForEachNode method removeOutputPort.

/**
 * Removes the last output port.
 *
 * @throws GraphException
 */
public void removeOutputPort() throws GraphException {
    List<DataPort> outputPorts = getOutputPorts();
    // Remove the last one.
    DataPort outputPort = outputPorts.get(outputPorts.size() - 1);
    removeOutputPort(outputPort);
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

Example 30 with DataPort

use of org.apache.airavata.workflow.model.graph.DataPort in project airavata by apache.

the class EndForEachNode method addInputPort.

/**
 * Adds additional input port.
 */
public void addInputPort() {
    EndForEachComponent component = getComponent();
    ComponentDataPort input = component.getInputPort();
    DataPort port = input.createPort();
    addInputPort(port);
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort) EndForEachComponent(org.apache.airavata.workflow.model.component.system.EndForEachComponent) ComponentDataPort(org.apache.airavata.workflow.model.component.ComponentDataPort)

Aggregations

DataPort (org.apache.airavata.workflow.model.graph.DataPort)100 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)39 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)26 Node (org.apache.airavata.workflow.model.graph.Node)26 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)20 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)16 GraphException (org.apache.airavata.workflow.model.graph.GraphException)15 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)13 DataType (org.apache.airavata.model.application.io.DataType)12 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)12 Port (org.apache.airavata.workflow.model.graph.Port)11 WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)10 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)9 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)8 NodeImpl (org.apache.airavata.workflow.model.graph.impl.NodeImpl)8 LinkedList (java.util.LinkedList)7 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)7 EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)7 EndForEachNode (org.apache.airavata.workflow.model.graph.system.EndForEachNode)6 ForEachNode (org.apache.airavata.workflow.model.graph.system.ForEachNode)6