Package de.danet.an.workflow.internalapi

Examples of de.danet.an.workflow.internalapi.ToolInvocationException


            return appl.invoke(tac, act, params);
        } catch (NoSuchObjectException e) {
            logger.warn
                ("NoSuchObjectException invoking " + appl + " on " + act
                 + " (mapped to ToolInvocationException): " + e.getMessage(),e);
            throw new ToolInvocationException (appl + ": " + e.getMessage());
        } catch (RemoteException e) {
            throw new EJBException (e);
        } catch (EJBException e) {
            // Handled like RemoteException
            throw e;
        } catch (RuntimeException e) {
            logger.warn
                ("RuntimeException invoking " + appl + " on " + act
                 + "(mapped to ToolInvocationException): " + e.getMessage(), e);
            // WLS seems to have problems with invoking setRollbackOnly twice
            if (!ctx.getRollbackOnly()) {
                ctx.setRollbackOnly();
            }
            throw new ToolInvocationException (appl + ": " + e.getMessage());
        }
    }
View Full Code Here


      params.put (pn, frag);
        } catch (SAXException e) {
      String m = "Cannot convert JDOM to W3C DOM: "
          + e.getMessage ();
      logger.error (m, e);
      throw new ToolInvocationException (m);
        } catch (TransformerConfigurationException e) {
      String m = "Cannot convert JDOM to W3C DOM: "
          + e.getMessage ();
      logger.error (m, e);
      throw new ToolInvocationException (m);
        }
    }
      }
  } else if (xmlParameterMode == XMLArgumentTypeProvider.XML_AS_JDOM) {
      for (Iterator i = params.keySet().iterator(); i.hasNext();) {
    String pn = (String)i.next();
    Object v = params.get (pn);
    if (v instanceof SAXEventBuffer) {
        try {
      SAXHandler sh = new SAXHandler ();
      convertWithTempRoot(sh, (SAXEventBuffer)v);
      Element temporaryRoot
          = sh.getDocument().getRootElement();
      params.put (pn, temporaryRoot.getChildren());
        } catch (SAXException e) {
      logger.error (e.getMessage(), e);
      throw new ToolInvocationException (e.getMessage());
        }
    }
      }
  }
  // invoke
  if (agent instanceof ContextRequester) {
      ((ContextRequester)agent).setToolAgentContext (agentContext);
  }
  if (logger.isDebugEnabled()) {
      logger.debug ("Invoking " + this.toString()
                    + " with " + formalParameters
                    + " and " + params);
  }
  try {
      agent.invoke(activity, formalParameters, params);
  } catch (CannotExecuteException e) {
      if (logger.isDebugEnabled()) {
          logger.debug ("Invocation resulted in: " + e.toString());
      }
      // try to find mapping
      if (e.getCause() != null && exceptionMappings != null) {
          for (Iterator i = exceptionMappings.iterator(); i.hasNext();) {
              ExceptionMapping m = (ExceptionMapping)i.next ();
              if (m.getJavaException().isInstance(e.getCause())) {
                  if (m.getProcessException() == null) {
                      break;
                  }
                  ResultProvider.ExceptionResult eres
                      = new ResultProvider.ExceptionResult
                            (m.getProcessException(), m.getSuspendActivity());
                        if (logger.isDebugEnabled()) {
                            logger.debug
                                ("Exception mapped to: " + eres.toString());
                        }
                  return new InvocationResult (eres);
              }
          }
      }
      throw new ToolInvocationException
        ("Cannot invoke tool, tool reports: " + e.getMessage(), e);
  }
  // maybe get result
  if (agent instanceof ResultProvider) {
      Object res = ((ResultProvider)agent).result ();
      if (res != null
    && !(res instanceof Map)
    && !(res instanceof ExceptionResult)) {
    throw new ToolInvocationException
        (toString() + " returns result that is neither"
         + " Map nor ExceptionResult");
      }
      if (logger.isDebugEnabled()) {
          logger.debug("Invocation result is: " + res);
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.internalapi.ToolInvocationException

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.