Search in sources :

Example 46 with DataPort

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

the class ReceiveNode method removeOutputPort.

/**
 * @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 : SystemComponentDataPort(org.apache.airavata.workflow.model.component.system.SystemComponentDataPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort)

Example 47 with DataPort

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

the class DifferedInputNode method edgeWasAdded.

/**
 * Called when an Edge was added to the parameter port. Change the name of
 * this node.
 *
 * @throws GraphException
 *
 * @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasAdded(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
 */
@Override
protected void edgeWasAdded(Edge edge) throws GraphException {
    super.edgeWasAdded(edge);
    // TODO organize this.
    if (edge instanceof DataEdge) {
        DataEdge dataEdge = (DataEdge) edge;
        DataPort toPort = dataEdge.getToPort();
        DataType toType = toPort.getType();
        List<DataEdge> edges = getEdges();
        if (edges.size() == 1) {
            // The first edge.
            setParameterType(toType);
            if (!isConfigured() && toPort instanceof WSPort) {
                // Copy
                copyDefaultConfiguration((WSPort) toPort);
            }
        } else if (edges.size() > 1) {
            // Not the first edge.
            DataType parameterType = getParameterType();
            if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !parameterType.equals(toType)) {
                throw new GraphException("Cannot connect ports with different types.");
            }
        } else {
            // Should not happen.
            throw new WorkflowRuntimeException("edges.size(): " + edges.size());
        }
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) GraphException(org.apache.airavata.workflow.model.graph.GraphException) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataType(org.apache.airavata.model.application.io.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 48 with DataPort

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

the class SystemNode 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 {
    super.edgeWasAdded(edge);
    GraphUtil.validateConnection(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) {
            // setType() propagates the change to the whole workflow.
            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) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) 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 49 with DataPort

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

the class DifferedInputHandler method onlyWaitingOnIncompleteDifferedInputNode.

public static boolean onlyWaitingOnIncompleteDifferedInputNode(Node node) {
    List<DataPort> inputPorts = node.getInputPorts();
    boolean atleadOneDifferedInputNodeIsIncomplete = false;
    for (DataPort dataPort : inputPorts) {
        Node fromNode = dataPort.getFromNode();
        if (NodeController.isFinished(fromNode)) {
        // no op
        } else if (isDifferedInputNode(fromNode)) {
            // not finished
            if (!((DifferedInputNode) node).isConfigured()) {
                // not configured differed node this is what we are looking for
                // set the flag and ensure all the rest is finished
                atleadOneDifferedInputNodeIsIncomplete = true;
            }
        } else {
            // there is a not finished non differed input node
            return false;
        }
    }
    // if not finished nodes were found we wil not be here so
    return atleadOneDifferedInputNodeIsIncomplete;
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) DifferedInputNode(org.apache.airavata.workflow.model.graph.system.DifferedInputNode) Node(org.apache.airavata.workflow.model.graph.Node) DifferedInputNode(org.apache.airavata.workflow.model.graph.system.DifferedInputNode)

Example 50 with DataPort

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

the class DynamicNode method removeLastDynamicallyAddedInPort.

/**
 * @see org.apache.airavata.workflow.model.graph.dynamic.PortAddable#removeLastDynamicallyAddedInPort()
 */
@Override
public void removeLastDynamicallyAddedInPort() throws GraphException {
    List<DataPort> inputPorts = this.getInputPorts();
    if (inputPorts.size() == 1) {
        // This is the initial port, so leave it alone
        return;
    }
    DataPort portToBeRemoved = null;
    for (DataPort dataPort : inputPorts) {
        if (null == dataPort.getFromNode()) {
            getComponent().removeInputPort((DynamicComponentPort) dataPort.getComponentPort());
            portToBeRemoved = dataPort;
            break;
        }
    }
    if (null != portToBeRemoved) {
        this.removeInputPort(portToBeRemoved);
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort)

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