Package org.apache.airavata.xbaya.graph

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


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


  public static void validateConnection(Edge edge) throws GraphException {
    Port fromPort = edge.getFromPort();
    Port toPort = edge.getToPort();
    if (edge instanceof ControlEdge) {
      if (!(fromPort instanceof ControlPort && toPort instanceof ControlPort)) {
        throw new GraphException(ErrorMessages.UNEXPECTED_ERROR);
      }
    } else if (edge instanceof DataEdge) {
      if (fromPort instanceof EPRPort) {
        // TODO
        return;
      }
      if (!(fromPort instanceof DataPort || fromPort instanceof EPRPort)
          || !(toPort instanceof DataPort)) {
        throw new GraphException(ErrorMessages.UNEXPECTED_ERROR);
      }

      DataPort fromDataPort = (DataPort) fromPort;
      DataPort toDataPort = (DataPort) toPort;

      QName fromType = fromDataPort.getType();
      QName toType = toDataPort.getType();

      if (toDataPort.getEdges().size() > 1) {
        throw new GraphException(
            ErrorMessages.MORE_THAN_ONE_CONNECTIONS);
      }

      // if connection came from the CEP register component it should be
      // ok
      if (fromPort.getNode() instanceof WSNode) {
        if ("registerStream".equals(((WSNode) fromPort.getNode())
            .getOperationName())) {
          return;
        }
      }

      if (!(fromType == null
          || fromType.equals(WSConstants.XSD_ANY_TYPE)
          || fromType.equals(new QName(WSConstants.XSD_NS_URI,
              "anyType"))
          || toType == null
          || toType.equals(WSConstants.XSD_ANY_TYPE)
          || toType.equals(new QName(WSConstants.XSD_NS_URI,
              "anyType")) || fromType.equals(toType)) && (fromType == null
          || fromType.equals(WSConstants.LEAD_ANY_TYPE)
          || fromType.equals(new QName(WSConstants.LEAD_NS_URI,
              "anyType"))
          || toType == null
          || toType.equals(WSConstants.LEAD_ANY_TYPE)
          || toType.equals(new QName(WSConstants.LEAD_NS_URI,
              "anyType")) || fromType.equals(toType))) {
        throw new GraphException(
            "Cannot connect ports with different types:"
                + " \nfrom=\t" + fromType + " \nto=\t" + toType
                + "");
      }
    }
View Full Code Here

        if (!(newType == null || newType.equals(WSConstants.XSD_ANY_TYPE) || type == null
                || type.equals(WSConstants.XSD_ANY_TYPE) || newType.equals(type))) {
            String message = "The type (" + newType + ")  must be same as the type  " + " (" + type + ") of " + getID()
                    + ".";
            throw new GraphException(message);
        }
    }
View Full Code Here

    public static WSGraph createGraph(String graphString) throws GraphException {
        XmlElement graphElement;
        try {
            graphElement = XMLUtil.stringToXmlElement(graphString);
        } catch (RuntimeException e) {
            throw new GraphException(ErrorMessages.XML_ERROR, e);
        }
        return createGraph(graphElement);
    }
View Full Code Here

        try {
            WSGraph graph = createWSGraph();
            graph.parse(graphElement);
            return graph;
        } catch (RuntimeException e) {
            throw new GraphException(ErrorMessages.XML_ERROR, e);
        }
    }
View Full Code Here

            } else if (BPELScriptType.GPEL == type) {
                GpelConstants.GPEL_NS = XmlInfosetBuilder.newInstance().newNamespace(GPEL, GPELNS);
                this.bpelNS = XmlInfosetBuilder.newInstance().newNamespace(GPEL, GPELNS);
                this.process = new GpelProcess(bpelNS, bpelTargetNamespace);
            } else {
                throw new GraphException("Unknown BPEL type " + type);
            }

            // Target namespace of the workflow WSDL
            this.targetNamespace = this.process.xml().declareNamespace(this.workflowWSDL.getTargetNamespace());

            // Types namespace of the workflow WSDL
            this.typesNamespace = this.process.xml().declareNamespace(this.workflowWSDL.getTypesNamespace());

            // xsd
            XMLUtil.declareNamespaceIfNecessary(WSConstants.XSD_NS.getPrefix(), WSConstants.XSD_NS.getName(), false,
                    this.process.xml());

            this.process.setActivity(createMainSequence());

            // comment
            addComment();

            // Validate
            this.process.xmlValidate();

            logger.info(this.process.xmlStringPretty());
        } catch (RuntimeException e) {
            throw new GraphException(e);
        }
    }
View Full Code Here

        addBlock(this.remainNodes, sequence);

        addFinalReply(sequence);

        if (this.remainNodes.size() > 0) {
            throw new GraphException("Some node(s) are not connected.");
        }

        return sequence;
    }
View Full Code Here

            addExit((ExitNode) node, sequence);
        } else if (node instanceof ResourceNode) {
            // nothing
        } else {

            throw new GraphException(node.getClass().getName() + " is not supported.");
        }
    }
View Full Code Here

                from.setVariable(fromNode.getID() + INPUT_SUFFIX);
            }
        } else if (fromNode instanceof InstanceNode) {
            // no op
        } else {
            throw new GraphException("Unexpected node," + fromNode.getClass().getName() + " is connected");
        }
        return from;
    }
View Full Code Here

    private void getSpecialBlock(Node node, int depth, Set<Node> block, Class startClass, Class 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)) {
                block.add(nextNode);
                if (depth == 0) {
                    // Stop the recursion here.
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.