Package org.apache.airavata.workflow.model.exceptions

Examples of org.apache.airavata.workflow.model.exceptions.WorkflowException


          }
        }
      }

      if (((String) outputVal).length() == 0) {
        throw new WorkflowException("Empty Output Generated");
      }
      outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
    } else {
      Invoker fromInvoker = invokerMap.get(fromNode);
      try {
View Full Code Here


     */
    public void setup() throws WorkflowException {

        if (this.gfacURL == null) {
            String message = "The location of the Generic Factory is not specified.";
            throw new WorkflowException(message);
        }

        if (this.portTypeQName == null) {
            String message = "Error in finding the service name";
            throw new WorkflowException(message);
        }

        try {

            URI uri = new URI(this.gfacURL);

            /*
             * Substring to remove GfacService
             */
            String gfacPath = uri.getPath();
            if (gfacPath != null && gfacPath.contains("/")) {
                gfacPath = gfacPath.substring(0, gfacPath.lastIndexOf('/') + 1) + portTypeQName.getLocalPart();
            }
            URI getWsdlURI = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), gfacPath
                    + "/getWSDL", uri.getQuery(), uri.getFragment());

            logger.info("getWSDL service:" + getWsdlURI.toString());

            WsdlDefinitions concreteWSDL = WsdlResolver.getInstance().loadWsdl(getWsdlURI);

            this.invoker = InvokerFactory.createInvoker(this.portTypeQName, concreteWSDL, null, this.messageBoxURL,
                    null, true);
            this.invoker.setup();
        } catch (WorkflowException xe) {
            throw xe;
        } catch (Exception e) {
            throw new WorkflowException(e.getMessage(), e);
        }

    }
View Full Code Here

            } catch (ExecutionException e) {
                // The service-failed notification should have been sent
                // already.
                logger.error(e.getMessage(), e);
                String message = "Error in invoking a service: " + this.serviceInformation;
                throw new WorkflowException(message, e);
            }
        } catch (RuntimeException e) {
            logger.error(e.getMessage(), e);
            String message = "Error in invoking a service: " + this.serviceInformation;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        } catch (Error e) {
            logger.error(e.getMessage(), e);
            String message = "Unexpected error: " + this.serviceInformation;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        }

        boolean success = super.invoke();
        if (!success) {
            try {
View Full Code Here

                String message = "Error in a service: ";
                // An implementation of WSIFMessage,
                // WSIFMessageElement, implements toString(), which
                // serialize the message XML.
                message += faultMessage.toString();
                throw new WorkflowException(message);
            }
        } catch (InterruptedException e) {
            logger.error(e.getMessage(), e);
        } catch (ExecutionException e) {
            // The service-failed notification should have been sent already.
            logger.error(e.getMessage(), e);
            String message = "Error in invoking a service: " + this.serviceInformation;
            throw new WorkflowException(message, e);
        } catch (RuntimeException e) {
            logger.error(e.getMessage(), e);
            String message = "Error while waiting for a service to finish: " + this.serviceInformation;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        } catch (Error e) {
            logger.error(e.getMessage(), e);
            String message = "Unexpected error: " + this.serviceInformation;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        }
    }
View Full Code Here

            throw e;
        } catch (RuntimeException e) {
            logger.error(e.getMessage(), e);
            String message = "Error while waiting for a output: " + name;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        } catch (Error e) {
            logger.error(e.getMessage(), e);
            String message = "Unexpected error: " + this.serviceInformation;
            this.notifier.invocationFailed(message, e);
            throw new WorkflowException(message, e);
        }
    }
View Full Code Here

      if (this.config.isActOnProvenance()) {
        try {
          this.getConfig().getConfiguration().getJcrComponentRegistry().getRegistry()
              .saveWorkflowExecutionStatus(this.config.getTopic(), ExecutionStatus.STARTED);
        } catch (RegistryException e) {
          throw new WorkflowException(e);
        }
      }
      ArrayList<Node> inputNodes = this.getInputNodesDynamically();
      Object[] values = new Object[inputNodes.size()];
      String[] keywords = new String[inputNodes.size()];
      for (int i = 0; i < inputNodes.size(); ++i) {
        Node node = inputNodes.get(i);
        NodeController.getGUI(node).setBodyColor(NodeState.FINISHED.color);
        notifyViaInteractor(WorkflowExecutionMessage.NODE_STATE_CHANGED, null);
        keywords[i] = ((InputNode) node).getName();
        values[i] = ((InputNode) node).getDefaultValue();
      }
      this.config.getNotifier().workflowStarted(values, keywords);
      while (this.getWorkflow().getExecutionState() != WorkflowExecutionState.STOPPED) {
        if (getRemainNodesDynamically() == 0) {
          notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
          // if (this.config.getMode() ==
          // WorkflowInterpreterConfiguration.GUI_MODE) {
          // this.notifyPause();
          // } else {
          // this.getWorkflow().setExecutionState(
          // WorkflowExecutionState.STOPPED);
          // }
        }
        // ok we have paused sleep
        while (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED) {
          try {
            Thread.sleep(400);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
        // get task list and execute them
        ArrayList<Node> readyNodes = this.getReadyNodesDynamically();
        for (Node node : readyNodes) {
          if (node.isBreak()) {
            this.notifyPause();
            break;
          }
          if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.PAUSED
              || this.getWorkflow().getExecutionState() == WorkflowExecutionState.STOPPED) {
            break;
            // stop executing and sleep in the outer loop cause we
            // want
            // recalculate the execution stack
          }

          boolean nodeOutputLoadedFromProvenance = false;
          if (this.config.isActOnProvenance()) {
            nodeOutputLoadedFromProvenance = readProvenance(node);
            if (!nodeOutputLoadedFromProvenance) {
              executeDynamically(node);
            }
          } else {
            executeDynamically(node);
          }
          if (this.getWorkflow().getExecutionState() == WorkflowExecutionState.STEP) {
            this.getWorkflow().setExecutionState(WorkflowExecutionState.PAUSED);
            break;
          }
        }
        // TODO commented this for foreach, fix this.
        sendOutputsDynamically();
        // Dry run sleep a lil bit to release load
        if (readyNodes.size() == 0) {
          // when there are no ready nodes and no running nodes
          // and there are failed nodes then workflow is stuck because
          // of failure
          // so we should pause the execution
          if (InterpreterUtil.getRunningNodeCountDynamically(this.getGraph()) == 0
              && InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) != 0) {
            this.getWorkflow().setExecutionState(WorkflowExecutionState.PAUSED);
          }

          try {
            Thread.sleep(400);
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
        }
      }

      if (InterpreterUtil.getFailedNodeCountDynamically(this.getGraph()) == 0) {
        if (this.config.isActOnProvenance()) {
          try {
            try {
              this.getConfig().getConfiguration().getJcrComponentRegistry().getRegistry()
                  .saveWorkflowExecutionStatus(this.config.getTopic(), ExecutionStatus.FINISHED);
            } catch (Exception e) {
              throw new WorkflowException(e);
            }
          } catch (Exception e) {
            throw new WorkflowException(e);
          }
          // System.out.println(this.config.getConfiguration().getJcrComponentRegistry().getRegistry().getWorkflowStatus(this.topic));
        }
      } else {
        if (this.config.isActOnProvenance()) {
          try {
            this.getConfig().getConfiguration().getJcrComponentRegistry().getRegistry()
                .saveWorkflowExecutionStatus(this.config.getTopic(), ExecutionStatus.FAILED);
          } catch (RegistryException e) {
            throw new WorkflowException(e);
          }
        }
      }
      this.config.getNotifier().workflowTerminated();
      // if (this.config.getMode() ==
View Full Code Here

    try {
      WorkflowInterpreter subworkflowInterpreter = (WorkflowInterpreter) getInputViaInteractor(
          WorkflowExecutionMessage.INPUT_WORKFLOWINTERPRETER_FOR_WORKFLOW, subWorkflow);
      subworkflowInterpreter.scheduleDynamically();
    } catch (Exception e) {
      throw new WorkflowException(e);
    }
    // if (this.config.getMode() ==
    // WorkflowInterpreterConfiguration.GUI_MODE) {
    // new WorkflowInterpreter(getConfig(), this.topic, subWorkflow, true,
    // false, new GUIWorkflowInterpreterInteractorImpl(engine,
View Full Code Here

          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // wsNode.getID(), null);
          // }
        } catch (URISyntaxException e) {
          throw new WorkflowException(e);
        }

        leadCtxHeader.setServiceId(node.getID());
        try {
          leadCtxHeader.setWorkflowId(new URI(this.getWorkflow().getName()));
View Full Code Here

          // .getBrokerURL(), this.config.getTopic(), true,
          // this.getConfig().getConfiguration().getMessageBoxURL()),
          // foreachWSNode.getID(), null);
          // }
        } catch (URISyntaxException e) {
          throw new WorkflowException(e);
        }
        invoker = new WorkflowInvokerWrapperForGFacInvoker(portTypeQName, gfacURLString, this.getConfig().getConfiguration().getMessageBoxURL()
            .toString(), leadCtxHeader, this.config.getNotifier().createServiceNotificationSender(foreachWSNode.getID()));
      } else {
        invoker = new GenericInvoker(portTypeQName, wsdlLocation, foreachWSNode.getID(), this.getConfig().getConfiguration().getMessageBoxURL()
View Full Code Here

          inputValues.add(inputValue);
        }

      }
    } catch (ArrayIndexOutOfBoundsException e) {
      throw new WorkflowException("Wrong number of Inputs to For EachNode");
    }
    return inputValues;
  }
View Full Code Here

TOP

Related Classes of org.apache.airavata.workflow.model.exceptions.WorkflowException

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.