Search in sources :

Example 6 with WSPort

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

the class S3InputNode method edgeWasAdded.

/**
 * Called whan an Edge was added to the parameter port. Change the name of this node.
 *
 * @throws GraphException
 *
 * @see org.apache.airavata.workflow.model.graph.impl.NodeImpl#edgeWasAdded(org.apache.airavata.workflow.model.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.appcatalog.appinterface.DataType) WorkflowRuntimeException(org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)

Example 7 with WSPort

use of org.apache.airavata.workflow.model.graph.ws.WSPort 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 8 with WSPort

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

the class DifferedInputNode method edgeWasRemoved.

/**
 * Called whan an Edge was removed from the parameter port. Change the name
 * of the node.
 *
 * @see edu.indiana.extreme.xbaya.graph.impl.NodeImpl#edgeWasRemoved(edu.indiana.extreme.xbaya.graph.impl.EdgeImpl)
 */
@Override
protected void edgeWasRemoved(Edge removedEdge) {
    super.edgeWasRemoved(removedEdge);
    // TODO organize this.
    List<DataEdge> edges = getEdges();
    if (edges.size() == 0) {
        setParameterType(null);
        if (!isConfigured()) {
            // Reset
            setName(getComponent().getName());
            setDescription("");
            setDefaultValue(null);
            setMetadata(null);
        }
    } else {
        Edge edge = edges.get(0);
        Port toPort = edge.getToPort();
        WSPort toWsPort = (WSPort) toPort;
        DataType toType = toWsPort.getType();
        setParameterType(toType);
        if (!isConfigured()) {
            // Copy
            copyDefaultConfiguration(toWsPort);
        }
    }
}
Also used : WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) WSComponentPort(org.apache.airavata.workflow.model.component.ws.WSComponentPort) Port(org.apache.airavata.workflow.model.graph.Port) DataType(org.apache.airavata.model.application.io.DataType) Edge(org.apache.airavata.workflow.model.graph.Edge) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge)

Example 9 with WSPort

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

the class GraphImpl method fixParameterNodes.

// private void createID() {
// Date date = new Date();
// SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss_S");
// String time = format.format(date);
// 
// this.id = StringUtil.convertToJavaIdentifier(this.name) + "_" + time;
// }
/**
 * @throws GraphException
 */
public void fixParameterNodes() {
    // XXX fix the ports of parameter nodes for 2.6.3 or before.
    for (InputNode node : GraphUtil.getNodes(this, InputNode.class)) {
        DataPort oldPort = node.getOutputPort(0);
        if (oldPort instanceof WSPort) {
            node.getOutputPorts().remove(oldPort);
            this.ports.remove(oldPort);
            SystemDataPort newPort = new SystemDataPort();
            this.ports.add(newPort);
            newPort.setKind(Kind.DATA_OUT);
            newPort.setName(oldPort.getName());
            newPort.setGraph(this);
            newPort.setNode(node);
            newPort.createID();
            node.getOutputPorts().add(newPort);
            for (DataEdge edge : oldPort.getEdges()) {
                edge.setFromPort(newPort);
                newPort.getEdges().add(edge);
            }
        }
    }
    for (OutputNode node : GraphUtil.getNodes(this, OutputNode.class)) {
        DataPort oldPort = node.getInputPort(0);
        if (oldPort instanceof WSPort) {
            node.getInputPorts().remove(oldPort);
            this.ports.remove(oldPort);
            SystemDataPort newPort = new SystemDataPort();
            this.ports.add(newPort);
            newPort.setKind(Kind.DATA_IN);
            newPort.setName(oldPort.getName());
            newPort.setGraph(this);
            newPort.setNode(node);
            newPort.createID();
            node.getInputPorts().add(newPort);
            for (DataEdge edge : oldPort.getEdges()) {
                edge.setToPort(newPort);
                newPort.getEdges().add(edge);
            }
        }
    }
}
Also used : SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort) DataPort(org.apache.airavata.workflow.model.graph.DataPort) WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort) InputNode(org.apache.airavata.workflow.model.graph.system.InputNode) DataEdge(org.apache.airavata.workflow.model.graph.DataEdge) OutputNode(org.apache.airavata.workflow.model.graph.system.OutputNode) SystemDataPort(org.apache.airavata.workflow.model.graph.system.SystemDataPort)

Example 10 with WSPort

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

the class WSComponentPort method createPort.

/**
 * @return The port created.
 */
@Override
public WSPort createPort() {
    WSPort port = new WSPort();
    port.setName(this.name);
    // port.setTypeQName(this.type);
    port.setComponentPort(this);
    return port;
}
Also used : WSPort(org.apache.airavata.workflow.model.graph.ws.WSPort)

Aggregations

WSPort (org.apache.airavata.workflow.model.graph.ws.WSPort)17 DataPort (org.apache.airavata.workflow.model.graph.DataPort)12 DataEdge (org.apache.airavata.workflow.model.graph.DataEdge)11 Port (org.apache.airavata.workflow.model.graph.Port)7 WorkflowRuntimeException (org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException)6 DataType (org.apache.airavata.model.application.io.DataType)5 DataType (org.apache.airavata.model.appcatalog.appinterface.DataType)4 WSComponentPort (org.apache.airavata.workflow.model.component.ws.WSComponentPort)4 Edge (org.apache.airavata.workflow.model.graph.Edge)4 GraphException (org.apache.airavata.workflow.model.graph.GraphException)4 Node (org.apache.airavata.workflow.model.graph.Node)3 InputNode (org.apache.airavata.workflow.model.graph.system.InputNode)3 WSNode (org.apache.airavata.workflow.model.graph.ws.WSNode)3 DynamicNode (org.apache.airavata.workflow.model.graph.dynamic.DynamicNode)2 SubWorkflowNode (org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode)2 Point (java.awt.Point)1 URL (java.net.URL)1 HashSet (java.util.HashSet)1 ExpCatChildDataType (org.apache.airavata.registry.cpi.ExpCatChildDataType)1 RegistryException (org.apache.airavata.registry.cpi.RegistryException)1