Package de.danet.an.workflow.spis.aii

Examples of de.danet.an.workflow.spis.aii.CannotExecuteException


      activity.complete ();
  } catch (CannotCompleteException e) {
      logger.error
    (activity + " waiting for timer "
     + "but cannot be completed?!: " + e.getMessage (), e);
      throw new CannotExecuteException
    ("Receiving activity cannot be completed");
  } catch (InvalidDataException e) {
      logger.error
    ("Cannot set \"status\" out parameter of "
     + "wait tool. Propably wrong declaration. "
     + activity + " will be terminated.");
      throw new CannotExecuteException (e.getMessage ());
  }
    }
View Full Code Here


      }
      return templatesCache;
  } catch (TransformerConfigurationException e) {
      String msg = "Error creating TransformerHandler: " + e.getMessage();
      logger.error(msg, e);
      throw new CannotExecuteException (msg);
  } catch (SAXException e) {
      String msg = "Error creating TransformerHandler: " + e.getMessage();
      logger.error(msg, e);
      throw new CannotExecuteException (msg);
  }
    }
View Full Code Here

  try {
      result.set (invokeOperation(formPars, map));
  } catch (JaxenException je) {
      logger.error (je.getMessage());
      logger.debug (je.getMessage(), je);
      throw new CannotExecuteException (je.getMessage());
  } finally {
      if (logger.isDebugEnabled()) {
    logger.debug ("Finished invocation of " + activity.uniqueKey());
      }
  }
View Full Code Here

      }
      seb.pack();
  } catch (TransformerConfigurationException e) {
      String msg = "Error creating TransformerHandler: " + e.getMessage();
      logger.error(msg, e);
      throw new CannotExecuteException (msg);
  } catch (SAXException se) {
      String msg = "Error during transformation: " + se.getMessage();
      logger.error (msg, se);
      throw new CannotExecuteException (msg);
  }
  if (logger.isDebugEnabled()) {
      logTransformationResult (seb);
  }
 
  // assemble the result, do additional mapping
        Map resData = new HashMap ();
  Document jdomRes = null;
  for (int i = 0; i < formPars.length; i++) {
      if (logger.isDebugEnabled()) {
    logger.debug("formPars[i].id() = " + formPars[i].id());
    logger.debug("formPars[i].type() = " + formPars[i].type());
    logger.debug("formPars[i].mode() = " + formPars[i].mode());
      }
      if (formPars[i].mode() == FormalParameter.Mode.IN) {
    continue;
      }
      XPath path = (XPath)returnParamInfo.get(formPars[i].id());
      if (logger.isDebugEnabled()) {
    logger.debug("path = " + path);
      }
      if (path == null) {
    resData.put(formPars[i].id(), seb);
    continue;
      }
      // Handle path expression
      if (jdomRes == null) {
    try {
        SAXHandler hdlr = new SAXHandler ();
        seb.emit (hdlr);
        jdomRes = hdlr.getDocument();
    } catch (SAXException e) {
        String msg = "Problem converting SAX to JDOM: "
      + e.getMessage ();
        logger.error (msg, e);
        throw new CannotExecuteException (msg);
    }
      }
      if (formPars[i].type().equals(String.class)) {
    String value = path.stringValueOf(jdomRes);
    if (logger.isDebugEnabled()) {
        logger.debug("value = " + value);
    }
    resData.put(formPars[i].id(), value);
            } else if (formPars[i].type().equals(Date.class)) {
                String sval = path.stringValueOf(jdomRes);
                try {
                    Date value = XMLUtil.parseXsdDateTime(sval);
                    if (logger.isDebugEnabled()) {
                        logger.debug("value = " + value);
                    }
                    resData.put(formPars[i].id(), value);
                } catch (ParseException e) {
                    throw (CannotExecuteException)
                        (new CannotExecuteException
                         ("Problem parsing " + sval + " as xsd datetime: "
                          + e.getMessage())).initCause(e);
                }
            } else if (formPars[i].type().equals(Double.class)) {
                String sval = path.stringValueOf(jdomRes);
                try {
                    double value = XMLUtil.parseXsdDouble(sval);
                    if (logger.isDebugEnabled()) {
                        logger.debug("value = " + value);
                    }
                    resData.put(formPars[i].id(), new Double(value));
                } catch (NumberFormatException e) {
                    throw (CannotExecuteException)
                        (new CannotExecuteException
                         ("Problem parsing " + sval + " as xsd double: "
                          + e.getMessage())).initCause(e);
                }
            } else if (formPars[i].type().equals(Boolean.class)) {
                String sval = path.stringValueOf(jdomRes);
                try {
                    boolean value = XMLUtil.parseXsdBoolean(sval);
                    if (logger.isDebugEnabled()) {
                        logger.debug("value = " + value);
                    }
                    resData.put(formPars[i].id(), new Boolean(value));
                } catch (ParseException e) {
                    throw (CannotExecuteException)
                        (new CannotExecuteException
                         ("Problem parsing " + sval + " as xsd boolean: "
                          + e.getMessage())).initCause(e);
                }
      } else if ((formPars[i].type() instanceof Class)
           && Number.class.isAssignableFrom
View Full Code Here

      if (e.getException() != null) {
          cause = e.getException();
      }
            logger.error (cause.getMessage());
            logger.debug (cause.getMessage(), cause);
      throw new CannotExecuteException(e.getMessage(), cause);
  } catch (JellyException e) {
      // Unwrap JellyException to support sophisticated
      // exception handling
      Exception cause = e;
      if (e.getCause() != null && (e.getCause() instanceof Exception)) {
          cause = (Exception)e.getCause();
      }
            logger.error (cause.getMessage());
            logger.debug (cause.getMessage(), cause);
      throw new CannotExecuteException (e.getMessage(), cause);
  }
 
    }
View Full Code Here

    public void invoke(Activity activity, FormalParameter[] formalParameters,
            Map actualParameters) throws RemoteException,
            CannotExecuteException {
        int len = formalParameters.length;
        if (len < 3) {
            throw new CannotExecuteException("Too few arguments. "
                    + "At least JndiName, HomeClass, and Method are required!");
        }
       
        String jndiName
            = (String) actualParameters.get(formalParameters[0].id());
        String homeClassName
            = (String) actualParameters.get(formalParameters[1].id());
        String methodName
            = (String) actualParameters.get(formalParameters[2].id());
       
        int numArgs = len - 3;
        String returnParam = null;
        if (len > 3) {
            FormalParameter.Mode lastParamMode
                = formalParameters[len - 1].mode();
            if ((lastParamMode == FormalParameter.Mode.OUT)
                    || (lastParamMode == FormalParameter.Mode.INOUT)) {
                returnParam = formalParameters[len - 1].id();
               
                numArgs --;
            }
        }
       
        Object[] args = new Object[numArgs];
        Class[] sig = new Class[numArgs];
       
        parseArguments(formalParameters, actualParameters, numArgs, args, sig);

        Class homeClass;
        try {
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            homeClass = cl.loadClass(homeClassName);
        } catch (ClassNotFoundException e) {
            throw new CannotExecuteException("cannot load HomeClass '"
                    + homeClassName + "'");
        }

        if (logger.isDebugEnabled()) {
            String str = getDebugMethodCall(formalParameters, jndiName,
                    homeClassName, methodName, numArgs, args, sig);
           
            logger.debug(str);
        }
       
        Object callResult;
        try {
            callResult = callEJB(jndiName, homeClass, methodName, sig, args);
        } catch (NamingException e) {
            throw new CannotExecuteException(e.getMessage(), e);
        } catch (IllegalArgumentException e) {
            throw new CannotExecuteException(e.getMessage(), e);
        } catch (IllegalAccessException e) {
            throw new CannotExecuteException(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new CannotExecuteException(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            throw new CannotExecuteException(e.getMessage(), e);
        }
       
        if (returnParam != null) {
            Map resData = new HashMap ();
           
View Full Code Here

                } else if (args[i] instanceof org.jdom.Element) {
                    sig[i] = org.jdom.Element.class;
                } else {
                    String msg = "Got argument of XML type, but cannot"
                      + " recognize value's class: " + args[i].getClass();
                    throw new CannotExecuteException (msg);
                }
            } else {
                sig[i] = (Class) type;
            }
        }
View Full Code Here

     */
    public void invoke(Activity activity, FormalParameter[] formalParameters,
                       Map actualParameters) throws RemoteException,
            CannotExecuteException {
        if (applicationName == null) {
            throw new CannotExecuteException("Application name not configured");
        }
        if (formalParameters.length > 0
            && formalParameters[0].id().equals("key")
            && actualParameters.get("key") instanceof String) {
            applicationDirectory().registerInstance
View Full Code Here

      auk = activity.uniqueKey();
      result.set (sendMail(formPars, map));
  } catch (InvalidDataException e) {
      logger.error (e.getMessage());
      logger.debug (e.getMessage(), e);
      throw new CannotExecuteException (e.getMessage(), e);
  } catch (NoSuchProviderException e) {
      logger.error (e.getMessage());
      logger.debug (e.getMessage(), e);
      throw new CannotExecuteException (e.getMessage(), e);
  } catch (NamingException e) {
      logger.error (e.getMessage(), e);
      throw new CannotExecuteException (e.getMessage(), e);
  } catch (AddressException e) {
      logger.error (e.getMessage(), e);
      throw new CannotExecuteException (e.getMessage(), e);
  } catch (MessagingException e) {
      logger.error (e.getMessage());
      logger.debug (e.getMessage(), e);
      throw new CannotExecuteException (e.getMessage(), e);
  } finally {
      if (logger.isDebugEnabled()) {
    logger.debug ("Finished invocation of " + auk);
      }
  }
View Full Code Here

  String urlPN = formPars[paramIdx++].id();

  HttpClient client = new HttpClient ();
  String url = (String)actPars.get (urlPN);
  if (url == null || url.length() == 0) {
      throw new CannotExecuteException
    ("Second parameter must be valid url.");
  }
  String methodParm = (String)actPars.get (methodPN);
  HttpMethod method = null;
  if (methodParm.equals ("GET")) {
      method = new GetMethod (url);
  } else if (methodParm.equals ("POST")) {
      method = new PostMethod (url);
  } else {
      throw new CannotExecuteException
    ("First parameter must be \"GET\" or \"POST\", is \""
     + methodParm + "\"");
  }
  HostConfiguration hc = method.getHostConfiguration();
  if (hc != null && proxyHost != null) {
      if (nonProxyHostsPattern == null
    || !nonProxyHostsPattern.matcher(hc.getHost()).matches ()) {
    if (logger.isDebugEnabled()) {
        logger.debug ("Using proxy to access " + url);
    }
    hc.setProxy(proxyHost, proxyPort);
      } else {
    if (logger.isDebugEnabled()) {
        logger.debug ("Accessing " + url + " directly");
    }
      }   
  }
  if (authenticate) {
      client.getState().setCredentials
    (realm, hc.getHost (),
     new UsernamePasswordCredentials (username, password));
  }
  int statusCode = -1;
  try {
      for (int attempts = 0; attempts < 3; attempts += 1) {
    try {
        statusCode = client.executeMethod (method);
        break;
    } catch (HttpRecoverableException e) {
        logger.info ("Recoverable exception accessing \""
         + url + "\": " + e.getMessage ());
    }
      }
  } catch (IOException e) {
      logger.warn ("Problem accessing \"" + url
       + "\" (abandoning): " + e.getMessage ());
      result.set (new ExceptionResult ("CannotAccessException"));
      return;
  }
  if (statusCode == -1) {
      result.set (new ExceptionResult
      ("RetryCountExceededException"));
      return;
  }
  Map res = new HashMap ();
  result.set(res);
  res.put (statusPN, new Integer (statusCode));

  InputStream in = null;
  try {
      in = method.getResponseBodyAsStream();
  } catch (IOException e) {
      String msg = "Cannot get response body as stream: "
    + e.getMessage ();
      logger.error (msg, e);
      throw new CannotExecuteException (msg);
  }
  if (in == null) {
      res.put (resultPN, null);
      return;
  }

  Parser parser = new Parser ();
  SAXEventBufferImpl sb = new SAXEventBufferImpl ();
  parser.setContentHandler(sb);
  try {
      parser.parse(new InputSource (in));
  } catch (IOException e) {
      throw new CannotExecuteException
    ("Cannot parse response body: " + e.getMessage ());
  } catch (SAXException e) {
      throw new CannotExecuteException
    ("Cannot parse response body: " + e.getMessage ());
  }
  sb.pack ();
  res.put (resultPN, sb);
    }
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.spis.aii.CannotExecuteException

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.