Package org.apache.airavata.xbaya.graph

Examples of org.apache.airavata.xbaya.graph.GraphException


        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 + ">" + 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


        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
        QName inputName = null;
        if (iterator.hasNext()) {
            inputName = iterator.next().getElement();
        } else {
            throw new GraphException("No input part found for WS Node" + node.getName());
        }
        return inputName;
    }
View Full Code Here

        Iterator<WsdlMessagePart> iterator = wsdlMessage.parts().iterator();
        QName inputName = null;
        if (iterator.hasNext()) {
            inputName = iterator.next().getElement();
        } else {
            throw new GraphException("No output part found for WS Node" + node.getName());
        }
        return inputName;
    }
View Full Code Here

        XmlElement arbitrarywsdl = processor.addElement(scuflNS, "arbitrarywsdl");
        XmlElement wsdl = arbitrarywsdl.addElement(scuflNS, "wsdl");

        String epr = getEPR(node);
        if (null == epr) {
            throw new GraphException("EPR not found for the WS-node:" + builder.serializeToString(node));
        }
        wsdl.addChild(epr + "?wsdl");

        XmlElement operation = arbitrarywsdl.addElement(scuflNS, "operation");
        operation.addChild(node.getOperationName());
View Full Code Here

            return false;
        }
        for (Port port : node.getInputPorts()) {
            Collection<Node> fromNodes = port.getFromNodes();
            if (fromNodes.isEmpty()) {
                throw new GraphException("There is a port that is not connected to any.");
            } else {
                for (Node fromNode : fromNodes) {
                    if (this.notYetInvokedNodes.contains(fromNode)) {
                        // There is a node that should be executed before this
                        // node.
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

                }
            } 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

             * check if there is already more than instance node connecting to destination node
             */
            if (!(toNode instanceof InstanceNode)) {
                for (Node node : toNode.getControlInPort().getFromNodes()) {
                    if ((node instanceof InstanceNode) && this != node) {
                        throw new GraphException("Cannot connect more than one instance node to another node.");
                    }
                }
            }
        }
    }
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 {
        this.fromPort = this.graph.getPort(this.fromPortID);
        if (this.fromPort == null) {
            throw new GraphException("Cannot find a port with the ID, " + this.fromPortID + ".");
        }
        this.toPort = this.graph.getPort(this.toPortID);
        if (this.toPort == null) {
            throw new GraphException("Cannot find a port with the ID, " + this.toPortID + ".");
        }

        // Has to do the above first because they are used in the edgeWasAdded
        // method.
        this.fromPort.addEdge(this);
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.