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

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


        // Create a copy to global variable.
        List<DataPort> outputPorts = endBlockNode.getOutputPorts();
        ArrayList<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        for (int i = 0; i < outputPorts.size(); i++) {
            DataPort outputPort = outputPorts.get(i);
            String variable = outputPort.getID() + OUTPUT_SUFFIX;
            int index = blockBlock ? i : i + outputPorts.size();
            DataPort inputPort = endBlockNode.getInputPort(index);
            Port fromPort = inputPort.getFromPort();
            GpelAssignCopyFrom from = createAssignCopyFrom(fromPort);
            GpelAssignCopyTo to = new GpelAssignCopyTo(this.bpelNS);
            to.setVariable(variable);
            GpelAssignCopy copy = new GpelAssignCopy(this.bpelNS, from, to);
            copies.add(copy);
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 (node.getOutputPorts().size() != 1) {
            throw new GraphException("Number of out ports in WS node " + node.getName() + "is invalid:"
                    + node.getOutputPorts().size());
        }
        DataPort outputPort = node.getOutputPort(0);

        WSComponent component = node.getComponent();
        String inputPartName = component.getInputPartName();
        String inputTypeName = component.getInputTypeName();

        XmlElement complexType = extensions.addElement(scuflNS, "complextype");
        complexType.addAttribute("optional", "false");
        complexType.addAttribute("unbounded", "false");
        complexType.addAttribute("typename", inputTypeName);

        String spliterName = inputPartName;
        complexType.addAttribute("name", spliterName);
        complexType.addAttribute("qname", inputName.toString());

        XmlElement element = complexType.addElement(scuflNS, "elements");
        for (DataPort port : inputPorts) {
            if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
                XmlElement baseType = element.addElement(scuflNS, "basetype");
                baseType.addAttribute("optional", "false");
                baseType.addAttribute("unbounded", "false");
                baseType.addAttribute("typename", port.getType().getLocalPart());
                baseType.addAttribute("name", port.getName());
                baseType.addAttribute("qname", inputTypeName + "&gt;" + port.getName());

            }
            // all the sources are written here
            // the links from input nodes to the spiters are done here
            // links from the from node output splitter to the this service's
            // inputsplitter is done here

            if (port.getFromNode() instanceof InputNode) {
                XmlElement source = builder.newFragment(scuflNS, "source");
                source.addAttribute("name", port.getFromNode().getID());
                if (!sourceExist(port.getFromNode().getID())) {
                    this.sources.put(port.getFromNode().getID(), source);
                }
                XmlElement link = builder.newFragment(scuflNS, "link");
                link.addAttribute("source", port.getFromNode().getID());
                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
                this.links.add(link);

            } else if (port.getFromNode() instanceof WSNode) {
                XmlElement link = builder.newFragment(scuflNS, "link");
                if (port.getFromNode().getOutputPorts().size() != 1) {
                    throw new GraphException("Number of out ports in from WS node " + port.getFromNode().getName()
                            + "is invalid:" + node.getOutputPorts().size());
                }
                link.addAttribute("source", getValidName((WSNode) port.getFromNode()) + "OutputMessagePartXML:"
                        + port.getFromNode().getOutputPort(0).getName());
                link.addAttribute("sink", getValidName(node) + "InputMessagePartXML:" + port.getName());
                this.links.add(link);
            } else {
                throw new GraphException("Unhandled from node type:" + port.getFromNode() + " for node"
                        + node.getName());
            }
        }

        // link from the spliter to the service

        XmlElement link = builder.newFragment(scuflNS, "link");
        link.addAttribute("source", getValidName(node) + "InputMessagePartXML:output");
        link.addAttribute("sink", getValidName(node) + ":" + spliterName);
        this.links.add(link);

        // link from service out to the ouput spliter

        link = builder.newFragment(scuflNS, "link");
        link.addAttribute("source", getValidName(node) + ":" + node.getComponent().getOutputPartName());
        link.addAttribute("sink", getValidName(node) + "OutputMessagePartXML:input");
        this.links.add(link);

        // /outspiltor
        XmlElement outProcessor = scufl.addElement(scuflNS, "processor");
        outProcessor.addAttribute("name", getValidName(node) + "OutputMessagePartXML");
        XmlElement outLocal = outProcessor.addElement(scuflNS, "local");
        outLocal.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLOutputSplitter");
        XmlElement outExtensions = outLocal.addElement(scuflNS, "extensions");
        XmlElement outComplextype = outExtensions.addElement(scuflNS, "complextype");
        outComplextype.addAttribute("optional", "false");
        outComplextype.addAttribute("unbounded", "false");
        outComplextype.addAttribute("typename", component.getOutputTypeName());
        outComplextype.addAttribute("name", component.getOutputPartName());
        QName outputName = getOutputElementName(node);
        if (null == outputName) {
            throw new GraphException("No Valid output type found for WS Node" + node.getName());
        }
        outComplextype.addAttribute("qname", outputName.toString());
        XmlElement elements = outComplextype.addElement(scuflNS, "elements");
        XmlElement outBaseType = elements.addElement(scuflNS, "basetype");
        outBaseType.addAttribute("optional", "false");
        outBaseType.addAttribute("unbounded", "false");

        outBaseType.addAttribute("typename", outputPort.getType().getLocalPart());
        String Z = component.getOutputPort(0).getName();
        outBaseType.addAttribute("name", Z);

        outBaseType.addAttribute("qname", component.getOutputTypeName() + "&gt;" + Z);

        List<DataPort> outputPorts = node.getOutputPorts();
        for (DataPort port : outputPorts) {
            List<Node> toNodes = port.getToNodes();
            for (Node toNode : toNodes) {
                if (toNode instanceof OutputNode) {
                    if ("http://www.w3.org/2001/XMLSchema".equals(port.getType().getNamespaceURI())) {
                        XmlElement sink = builder.newFragment(scuflNS, "sink");
                        sink.addAttribute("name", toNode.getID());
                        sinks.add(sink);
                        link = builder.newFragment(scuflNS, "link");
                        link.addAttribute("source", getValidName(node) + "OutputMessagePartXML:" + outputPort.getName());
                        link.addAttribute("sink", toNode.getID());
                        this.links.add(link);
                    }
                }
            }
View Full Code Here

            if (graphPiece instanceof DynamicNode) {
                if (this.draggedPort.getKind() == Kind.DATA_OUT && draggedPort instanceof DataPort) {
                    this.panel.setCursor(SwingUtil.CROSSHAIR_CURSOR);
                    DynamicNode dynamicNode = (DynamicNode) graphPiece;
                    dynamicNode.getComponent();
                    DataPort freePort = dynamicNode.getFreeInPort();
                    try {
                        freePort.copyType((DataPort) draggedPort);
                    } catch (GraphException e) {
                        engine.getGUI().getErrorWindow().error(e);
                        return;
                    }
                    // selectInputPort(freePort);
View Full Code Here

            Port fromPort = inPort.getFromPort();
            Node fromNode = inPort.getFromNode();
            if (fromNode instanceof WSNode) {
                WSNode fromWsNode = (WSNode) fromNode;
                if (null != fromPort && fromPort instanceof DataPort) {
                    DataPort fromDataPort = (DataPort) fromPort;
                    WsdlDefinitions wsdl = engine.getGUI().getWorkflow().getWSDLs().get(fromWsNode.getWSDLID());
                    Iterator<XmlNamespace> itr = wsdl.xml().namespaces().iterator();
                    try {
                        XmlElement schema = wsdl.getTypes().element("schema").clone();
                        // do not change the following ordering of setting
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.