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

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


    }

    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


        try {
            String componentString = componentElement.requiredText();
            WSComponent wsdlComponent = WSComponentFactory.createComponent(componentString);
            setComponent(wsdlComponent);
        } catch (ComponentException e) {
            throw new GraphException(MessageConstants.COMPONENT_FORMAT_ERROR, e);
        }
    }
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 void removeNode(Node node) throws GraphException {
        if (node == null) {
            throw new IllegalArgumentException("null");
        }
        if (!this.nodes.contains(node)) {
            throw new GraphException("The graph doesn't contain the node that is being removed.");
        }

        NodeImpl nodeImpl = (NodeImpl) node;

        // Have to be very careful to remove the node.
View Full Code Here

    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

  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(MessageConstants.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(MessageConstants.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(
            MessageConstants.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

  public static WSGraph createGraph(String graphString) throws GraphException {
    XmlElement graphElement;
    try {
      graphElement = XMLUtil.stringToXmlElement(graphString);
    } catch (RuntimeException e) {
      throw new GraphException(MessageConstants.XML_ERROR, e);
    }
    return createGraph(graphElement);
  }
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.