Package org.apache.airavata.workflow.model.graph

Examples of org.apache.airavata.workflow.model.graph.DataPort


        super.edgeWasAdded(edge);

        // TODO organize this.
        if (edge instanceof DataEdge) {
            DataEdge dataEdge = (DataEdge) edge;
            DataPort toPort = dataEdge.getToPort();
            QName toType = toPort.getType();

            List<DataEdge> edges = getEdges();
            if (edges.size() == 1) {
                // The first edge.
                setParameterType(toType);
View Full Code Here


        return exitNode;
    }

    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();
View Full Code Here

        // Have to be very careful to remove the node.
        // The extended for loop cannot be used to remove the elements.

        // Remove edges connected to input ports.
        for (Iterator<DataPort> portItr = nodeImpl.getInputPorts().iterator(); portItr.hasNext();) {
            DataPort port = portItr.next();
            for (Iterator<DataEdge> edgeItr = port.getEdges().iterator(); edgeItr.hasNext();) {
                DataEdge edge = edgeItr.next();
                // Remove the edge from from-port.
                DataPort fromPort = edge.getFromPort();
                fromPort.removeEdge(edge);
                // remove the edge from this port. This is necessary so that
                // type update works properly.
                edgeItr.remove();

                // Remove the edge from the graph.
                this.edges.remove(edge);
                fromPort.getNode().edgeWasRemoved(edge);
            }
            // Remove the port from the node.
            portItr.remove();
            // Remove the port from the graph.
            this.ports.remove(port);
        }

        // Remove edges connected to output ports.
        for (Iterator<DataPort> portItr = nodeImpl.getOutputPorts().iterator(); portItr.hasNext();) {
            DataPort port = portItr.next();
            for (Iterator<DataEdge> edgeItr = port.getEdges().iterator(); edgeItr.hasNext();) {
                DataEdge edge = edgeItr.next();
                DataPort toPort = edge.getToPort();
                toPort.removeEdge(edge);
                edgeItr.remove();
                this.edges.remove(edge);
                toPort.getNode().edgeWasRemoved(edge);
            }
            portItr.remove();
            this.ports.remove(port);
        }

        for (Iterator<ControlPort> portItr = nodeImpl.getControlOutPorts().iterator(); portItr.hasNext();) {
            PortImpl port = portItr.next();
            for (Iterator<? extends EdgeImpl> edgeItr = port.getEdges().iterator(); edgeItr.hasNext();) {
                EdgeImpl edge = edgeItr.next();
                PortImpl toPort = edge.getToPort();
                toPort.removeEdge(edge);
                edgeItr.remove();
                this.edges.remove(edge);
                toPort.getNode().edgeWasRemoved(edge);
            }
            portItr.remove();
            this.ports.remove(port);
        }

        PortImpl controlInPort = nodeImpl.getControlInPort();
        if (controlInPort != null) {
            for (Iterator<? extends EdgeImpl> edgeItr = controlInPort.getEdges().iterator(); edgeItr.hasNext();) {
                EdgeImpl edge = edgeItr.next();
                PortImpl fromPort = edge.getFromPort();
                fromPort.removeEdge(edge);
                edgeItr.remove();
                this.edges.remove(edge);
                fromPort.getNode().edgeWasRemoved(edge);
            }
            this.ports.remove(controlInPort);
        }

        PortImpl eprPort = nodeImpl.getEPRPort();
        if (eprPort != null) {
            for (Iterator<? extends EdgeImpl> edgeItr = eprPort.getEdges().iterator(); edgeItr.hasNext();) {
                EdgeImpl edge = edgeItr.next();
                PortImpl toPort = edge.getToPort();
                toPort.removeEdge(edge);
                edgeItr.remove();
                this.edges.remove(edge);
                toPort.getNode().edgeWasRemoved(edge);
            }
            this.ports.remove(eprPort);
        }

        this.nodes.remove(node);
View Full Code Here

     * @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);
                }
            }
        }
View Full Code Here

      if (!(fromPort instanceof DataPort || fromPort instanceof EPRPort)
          || !(toPort instanceof DataPort)) {
        throw new GraphException(MessageConstants.UNEXPECTED_ERROR);
      }

      DataPort fromDataPort = (DataPort) fromPort;
      DataPort toDataPort = (DataPort) toPort;

      QName fromType = fromDataPort.getType();
      QName toType = toDataPort.getType();

      if (toDataPort.getEdges().size() > 1) {
        throw new GraphException(
            MessageConstants.MORE_THAN_ONE_CONNECTIONS);
      }

      // if connection came from the CEP register component it should be
View Full Code Here

  public static void propagateTypes(Graph graph) throws GraphException {
    List<WSPort> wsPorts = getPorts(graph, WSPort.class);
    for (WSPort wsPort : wsPorts) {
      List<DataEdge> edges = wsPort.getEdges();
      for (DataEdge edge : edges) {
        DataPort fromPort = edge.getFromPort();

        DataPort toPort = edge.getToPort();
        if (fromPort == wsPort) {
          toPort.copyType(wsPort);
        } else if (toPort == wsPort) {
          fromPort.copyType(wsPort);
        } else {
          throw new WorkflowRuntimeException();
        }
View Full Code Here

     * Adds additional input port.
     */
    public void addInputPort() {
        ForEachComponent component = getComponent();
        ComponentDataPort input = component.getInputPort();
        DataPort port = input.createPort();
        addInputPort(port);
    }
View Full Code Here

    }

    public DataPort addInputPortAndReturn() {
        ForEachComponent component = getComponent();
        ComponentDataPort input = component.getInputPort();
        DataPort port = input.createPort();
        addInputPort(port);
        return port;
    }
View Full Code Here


    public void removeInputPort() throws GraphException {
        List<DataPort> inputPorts = getInputPorts();
        // Remove the last one.
        DataPort inputPort = inputPorts.get(inputPorts.size() - 1);
        removeInputPort(inputPort);
    }
View Full Code Here

     * Adds additional output port.
     */
    public void addOutputPort() {
        ForEachComponent component = getComponent();
        ComponentDataPort outputPort = component.getOutputPort();
        DataPort port = outputPort.createPort();
        addOutputPort(port);
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.graph.DataPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.