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

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


    public void removePort(Port port) throws GraphException {
        if (port == null) {
            throw new IllegalArgumentException("null");
        }
        if (!this.ports.contains(port)) {
            throw new GraphException("The graph doesn't contain the port that is being removed.");
        }

        // copy it so that we can remove edge without worrying about the
        // iteration issue.
        ArrayList<Edge> edgesToBeRemoved = new ArrayList<Edge>(port.getEdges());
View Full Code Here


            return null;
        }

        if (!this.ports.contains(fromPort) || !this.ports.contains(toPort)) {
            // The specified port doesn't belong to the graph.
            throw new GraphException("The graph doesn't contain the specified port.");
        }

        PortImpl fromPortImpl = (PortImpl) fromPort;
        PortImpl toPortImpl = (PortImpl) toPort;
        NodeImpl fromNode = fromPortImpl.getNode();
View Full Code Here

     * @throws GraphException
     * @see org.apache.airavata.workflow.model.graph.Graph#removeEdge(org.apache.airavata.workflow.model.graph.Edge)
     */
    public void removeEdge(Edge edge) throws GraphException {
        if (!this.edges.contains(edge)) {
            throw new GraphException("The graph doesn't contain the specified edge.");
        }
        EdgeImpl edgeImpl = (EdgeImpl) edge;

        PortImpl fromPort = edgeImpl.getFromPort();
        PortImpl toPort = edgeImpl.getToPort();
View Full Code Here

     */
    public void importGraph(Graph graph) throws GraphException {

        // Does not support other implementations.
        if (!(graph instanceof GraphImpl)) {
            throw new GraphException("Cannot import this graph implementation");
        }

        GraphImpl graphImpl = (GraphImpl) graph;

        for (NodeImpl node : graphImpl.getNodes()) {
View Full Code Here

        this();
        try {
            XmlElement workflowElement = XMLUtil.stringToXmlElement(workflowString);
            parse(workflowElement);
        } catch (RuntimeException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here

                XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS);
                GpelConstants.GPEL_NS = gpelNS;
                this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString));
            } catch (RuntimeException e) {
                String error = "Failed to parse the BPEL document.";
                throw new GraphException(error, e);
            }
        }

        XmlElement workflowWSDLElement = workflowElement.element(WORKFLOW_WSDL_TAG);
        if (workflowWSDLElement != null) {
            try {
                String wsdlText = workflowWSDLElement.requiredText();
                this.workflowWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlText));
            } catch (RuntimeException e) {
                String error = "Failed to parse the workflow WSDL.";
                throw new GraphException(error, e);
            }
        }
    }
View Full Code Here

        this();
        try {
            XmlElement workflowElement = XMLUtil.stringToXmlElement(workflowString);
            parse(workflowElement);
        } catch (RuntimeException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here

        this();
        try {
            XmlElement workflowElement = XMLUtil.loadXML(workflowFilePath.toURL().openStream());
            parse(workflowElement);
        } catch (RuntimeException e) {
            throw new GraphException(e);
        } catch (IOException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here

                XmlNamespace gpelNS = XmlInfosetBuilder.newInstance().newNamespace(BPELScript.GPEL, BPELScript.GPELNS);
                GpelConstants.GPEL_NS = gpelNS;
                this.gpelProcess = new GpelProcess(XMLUtil.stringToXmlElement(bpelString));
            } catch (RuntimeException e) {
                String error = "Failed to parse the BPEL document.";
                throw new GraphException(error, e);
            }
        }

        XmlElement workflowWSDLElement = workflowElement.element(WORKFLOW_WSDL_TAG);
        if (workflowWSDLElement != null) {
            try {
                String wsdlText = workflowWSDLElement.requiredText();
                this.workflowWSDL = new WsdlDefinitions(XMLUtil.stringToXmlElement(wsdlText));
            } catch (RuntimeException e) {
                String error = "Failed to parse the workflow WSDL.";
                throw new GraphException(error, e);
            }
        }
    }
View Full Code Here

        local.addChild(0, "org.embl.ebi.escience.scuflworkers.java.XMLInputSplitter");
        XmlElement extensions = local.addElement(scuflNS, "extensions");

        QName inputName = getInputElementName(node);
        if (null == inputName) {
            throw new GraphException("No Valid input type found for WS Node" + node.getName());
        }
        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");
View Full Code Here

TOP

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

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.