Search in sources :

Example 6 with EPRPort

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

the class MonitorEventHandler method finishPredecessorNodes.

/**
 * Make preceding nodes done. This helps the monitoring GUI when a user subscribes from the middle of the workflow
 * execution.
 *
 * @param node
 */
private void finishPredecessorNodes(Node node) {
    for (Port inputPort : node.getInputPorts()) {
        for (Edge edge : inputPort.getEdges()) {
            Port fromPort = edge.getFromPort();
            if (!(fromPort instanceof EPRPort)) {
                Node fromNode = fromPort.getNode();
                finishNode(fromNode);
                finishPredecessorNodes(fromNode);
            }
        }
    }
    Port controlInPort = node.getControlInPort();
    if (controlInPort != null) {
        for (Node fromNode : controlInPort.getFromNodes()) {
            finishNode(fromNode);
            finishPredecessorNodes(fromNode);
        }
    }
}
Also used : EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) Port(org.apache.airavata.workflow.model.graph.Port) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) Node(org.apache.airavata.workflow.model.graph.Node) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) Edge(org.apache.airavata.workflow.model.graph.Edge)

Example 7 with EPRPort

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

the class GraphUtil method validateConnection.

/**
 * @param edge
 * @throws GraphException
 */
public static void validateConnection(Edge edge) throws GraphException {
    Port fromPort = edge.getFromPort();
    Port toPort = edge.getToPort();
    if (edge instanceof ControlEdge) {
        if (!(fromPort instanceof ControlPort && toPort instanceof ControlPort)) {
            throw new GraphException(MessageConstants.UNEXPECTED_ERROR);
        }
    } else if (edge instanceof DataEdge) {
        if (fromPort instanceof EPRPort) {
            // TODO
            return;
        }
        if (!(fromPort instanceof DataPort || fromPort instanceof EPRPort) || !(toPort instanceof DataPort)) {
            throw new GraphException(MessageConstants.UNEXPECTED_ERROR);
        }
        DataPort fromDataPort = (DataPort) fromPort;
        DataPort toDataPort = (DataPort) toPort;
        DataType fromType = fromDataPort.getType();
        DataType toType = toDataPort.getType();
        if (toDataPort.getEdges().size() > 1) {
            throw new GraphException(MessageConstants.MORE_THAN_ONE_CONNECTIONS);
        }
        // ok
        if (fromPort.getNode() instanceof WSNode) {
            if ("registerStream".equals(((WSNode) fromPort.getNode()).getOperationName())) {
                return;
            }
        }
        if (!(fromType == null || fromType.equals(WSConstants.XSD_ANY_TYPE) || fromType.equals(new QName(WSConstants.XSD_NS_URI, "anyType")) || toType == null || toType.equals(WSConstants.XSD_ANY_TYPE) || toType.equals(new QName(WSConstants.XSD_NS_URI, "anyType")) || fromType.equals(toType)) && (fromType == null || fromType.equals(WSConstants.LEAD_ANY_TYPE) || fromType.equals(new QName(WSConstants.LEAD_NS_URI, "anyType")) || toType == null || toType.equals(WSConstants.LEAD_ANY_TYPE) || toType.equals(new QName(WSConstants.LEAD_NS_URI, "anyType")) || fromType.equals(toType))) {
            throw new GraphException("Cannot connect ports with different types:" + " \nfrom=\t" + fromType + " \nto=\t" + toType + "");
        }
    }
}
Also used : GraphException(org.apache.airavata.workflow.model.graph.GraphException) DataPort(org.apache.airavata.workflow.model.graph.DataPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) WSNode(org.apache.airavata.workflow.model.graph.ws.WSNode) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) QName(javax.xml.namespace.QName) DataPort(org.apache.airavata.workflow.model.graph.DataPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort) Port(org.apache.airavata.workflow.model.graph.Port) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) DataType(org.apache.airavata.model.appcatalog.appinterface.DataType) ControlEdge(org.apache.airavata.workflow.model.graph.ControlEdge)

Example 8 with EPRPort

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

the class EndForEachNode 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 9 with EPRPort

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

the class ForEachNode method edgeWasAdded.

/**
 * @param edge
 * @throws GraphException
 */
@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.appcatalog.appinterface.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 10 with EPRPort

use of org.apache.airavata.workflow.model.graph.EPRPort 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);
    }
}
Also used : DataPort(org.apache.airavata.workflow.model.graph.DataPort) EPRPort(org.apache.airavata.workflow.model.graph.EPRPort) ControlPort(org.apache.airavata.workflow.model.graph.ControlPort)

Aggregations

EPRPort (org.apache.airavata.workflow.model.graph.EPRPort)10 DataPort (org.apache.airavata.workflow.model.graph.DataPort)7 Port (org.apache.airavata.workflow.model.graph.Port)6 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)5 ComponentDataPort (org.apache.airavata.workflow.model.component.ComponentDataPort)4 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)4 ControlPort (org.apache.airavata.workflow.model.graph.ControlPort)4 DataType (org.apache.airavata.model.application.io.DataType)3 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)2 QName (javax.xml.namespace.QName)1 ComponentControlPort (org.apache.airavata.workflow.model.component.ComponentControlPort)1 SystemComponentDataPort (org.apache.airavata.workflow.model.component.system.SystemComponentDataPort)1 ControlEdge (org.apache.airavata.workflow.model.graph.ControlEdge)1 Edge (org.apache.airavata.workflow.model.graph.Edge)1 GraphException (org.apache.airavata.workflow.model.graph.GraphException)1 Node (org.apache.airavata.workflow.model.graph.Node)1 InstanceDataPort (org.apache.airavata.workflow.model.graph.amazon.InstanceDataPort)1 PortImpl (org.apache.airavata.workflow.model.graph.impl.PortImpl)1 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)1 OutputNode (org.apache.airavata.workflow.model.graph.system.OutputNode)1