Package org.apache.airavata.xbaya.graph

Examples of org.apache.airavata.xbaya.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

                    WSComponentPort componentPort = ((WSPort) fromDataPort).getComponentPort();
                    setDescription(componentPort.getDescription());
                    setMetadata(componentPort.getAppinfo());
                }
            } else {
                throw new GraphException("Cannot connect more than one output ports to the output parameter.");
            }
        }
    }
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

                }
            } 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 XBayaRuntimeException("edges.size(): " + edges.size());
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

            } else if (inputType2.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + index + " (" + inputType1 + ") of " + getID()
                        + " must be same as the type of input " + (index + size) + " (" + inputType2 + ").";
                throw new GraphException(message);
            }
            // input1 -> output
            if (outputType.equals(WSConstants.XSD_ANY_TYPE)) {
                outputPort.copyType(port);
            } else if (outputType.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + index + " (" + inputType1 + ") of " + getID()
                        + " must be same as the type of output " + index + " (" + outputType + ").";
                throw new GraphException(message);
            }

        } else if (port == inputPort2) {
            // input2 -> input1
            if (inputType1.equals(WSConstants.XSD_ANY_TYPE)) {
                inputPort1.copyType(port);
            } else if (inputType1.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + index + " (" + inputType1 + ") of " + getID()
                        + " must be same as the type of input " + (index + size) + " (" + inputType2 + ").";
                throw new GraphException(message);
            }
            // input2 -> output
            if (outputType.equals(WSConstants.XSD_ANY_TYPE)) {
                outputPort.copyType(port);
            } else if (outputType.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + (index + size) + " (" + inputType2 + ") of " + getID()
                        + " must be same as the type of output " + index + " (" + outputType + ").";
                throw new GraphException(message);
            }
        } else if (port == outputPort) {
            // output -> input1
            if (inputType1.equals(WSConstants.XSD_ANY_TYPE)) {
                inputPort1.copyType(port);
            } else if (inputType1.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + index + " (" + inputType1 + ") of " + getID()
                        + " must be same as the type of output " + index + " (" + outputType + ").";
                throw new GraphException(message);
            }
            // output -> input2
            if (inputType2.equals(WSConstants.XSD_ANY_TYPE)) {
                inputPort2.copyType(port);
            } else if (inputType2.equals(portType)) {
                // Do nothing.
            } else {
                String message = "The type of input " + (index + size) + " (" + inputType2 + ") of " + getID()
                        + " must be same as the type of input " + index + " (" + outputType + ").";
                throw new GraphException(message);
            }
        } else {
            throw new XBayaRuntimeException();
        }
    }
View Full Code Here

    protected void edgeWasAdded(Edge edge) throws GraphException {
        super.edgeWasAdded(edge);
        if (edge instanceof ControlEdge) {
            List<ControlEdge> edges = getEdges();
            if (edges.size() > 1) {
                throw new GraphException("Cannot connect more than one Control Ports to the Exit node.");
            }
        }
    }
View Full Code Here

            }
        }
        if (edgeSet.isEmpty()) {
            return sortedOrder;
        } else {
            throw new GraphException("Graph Topological sorting failed, Graph has at least one cycle");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.xbaya.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.