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

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


    private <S extends Node, E extends Node> E findEndNode(Node node, int depth, Class<S> startClass, Class<E> endClass)
            throws GraphException {
        List<Node> nextNodes = GraphUtil.getNextNodes(node);
        for (Node nextNode : nextNodes) {
            if (nextNode instanceof OutputNode) {
                throw new GraphException("Nodes after " + startClass.getName()
                        + " cannot be connected to the output without going through " + endClass.getName() + ".");
            } else if (endClass.isInstance(nextNode)) {
                if (depth == 0) {
                    // Stop the recursion here.
                    return (E) nextNode; // This cast is OK.
                } else {
                    return findEndNode(nextNode, depth - 1, startClass, endClass);
                }
            } else if (startClass.isInstance(nextNode)) {
                // handle embedded forEach
                return findEndNode(nextNode, depth + 1, startClass, endClass);
            } else {
                return findEndNode(nextNode, depth, startClass, endClass);
            }
        }
        throw new GraphException("Cannot find matching  " + endClass.getName() + " for " + startClass.getName() + ".");
    }
View Full Code Here


        //
        // Condition
        //
        String booleanExpression = ifNode.getXPath();
        if (booleanExpression == null) {
            throw new GraphException("XPath cannot be null");
        }
        // replace $1, $2,... with actual value.
        List<? extends Port> inputPorts = ifNode.getInputPorts();
        ArrayList<GpelAssignCopy> copies = new ArrayList<GpelAssignCopy>();
        for (int i = 0; i < inputPorts.size(); i++) {
View Full Code Here

            Node toNode = toPort.getNode();
            Port fromPort = edge.getFromPort();
            Node fromNode = fromPort.getNode();

            if (!(toNode instanceof ResourceNode && fromNode instanceof ResourceNode)) {
                throw new GraphException("Cannot connect Resource Node to other type of nodes");
            }
        }
    }
View Full Code Here

    protected void indexToPointer() throws GraphException {
        for (String portID : this.inputPortIDs) {
            PortImpl port = this.graph.getPort(portID);
            if (port == null) {
                throw new GraphException("Port, " + portID + ", does not exist.");
            }
            port.setKind(PortImpl.Kind.DATA_IN);
            port.setNode(this);
            this.inputPorts.add((DataPort) port);
        }

        for (String portID : this.outputPortIDs) {
            PortImpl port = this.graph.getPort(portID);
            if (port == null) {
                throw new GraphException("Port, " + portID + ", does not exist.");
            }
            port.setKind(PortImpl.Kind.DATA_OUT);
            port.setNode(this);
            this.outputPorts.add((DataPort) port);
        }

        if (this.controlInPortID != null) {
            PortImpl port = this.graph.getPort(this.controlInPortID);
            if (port == null) {
                throw new GraphException("Port, " + this.controlInPortID + ", does not exist.");
            }
            port.setKind(PortImpl.Kind.CONTROL_IN);
            port.setNode(this);
            this.controlInPort = (ControlPort) port;
        }

        for (String portID : this.controlOutPortIDs) {
            PortImpl port = this.graph.getPort(portID);
            if (port == null) {
                throw new GraphException("Port, " + portID + ", does not exist.");
            }
            port.setKind(PortImpl.Kind.CONTROL_OUT);
            port.setNode(this);
            this.controlOutPorts.add((ControlPort) port);
        }

        if (this.eprPortID != null) {
            PortImpl port = this.graph.getPort(this.eprPortID);
            if (port == null) {
                throw new GraphException("Port, " + this.eprPortID + ", does not exist.");
            }
            port.setKind(PortImpl.Kind.EPR);
            port.setNode(this);
            this.eprPort = port;
        }
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

            WsdlMessage inputMessage = createInputMessage();
            WsdlMessage outputMessage = createOutputMessage();
            createPortType(inputMessage, outputMessage);
            addComment();
        } catch (RuntimeException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here

                // The first edge.
                this.type = toType;
            } else if (edges.size() > 1) {
                // Not the first edge.
                if (!toType.equals(WSConstants.XSD_ANY_TYPE) && !this.type.equals(toType)) {
                    throw new GraphException("Cannot connect ports with different types.");
                }

            } else {
                // Should not happen.
                throw new WorkflowRuntimeException("edges.size(): " + edges.size());
View Full Code Here

                }
            } else if (edges.size() > 1) {
                // Not the first edge.
                QName 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());
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.