Examples of MessageStoreException


Examples of com.stimulus.archiva.exception.MessageStoreException

             in = new FileInputStream(source).getChannel();
             out = new FileOutputStream(dest).getChannel();
             in.transferTo( 0, in.size(), out);
           
        } catch (Exception e) {
            throw new MessageStoreException("failed to copy email {src='"+source+"=',dest='"+dest+"'",e,logger);
        } finally {
             if (in != null) try { in.close(); } catch (Exception e) {};
             if (out != null) try { out.close(); } catch (Exception e) {};
        }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

      logger.debug("backupMessage()");
      File noArchiveFile = getNoArchiveFile();
      logger.warn("copying email to no archive queue {dest='"+noArchiveFile.getAbsolutePath()+"'}");
      boolean renamed = file.renameTo(noArchiveFile);
      if (!renamed) {
        throw new MessageStoreException("failed to copy message to noarchive queue",logger);
      }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

      FileOutputStream fos = null;
      try {
        fos = new FileOutputStream(noArchiveFile);
        email.writeTo(fos);
      } catch (Exception e) {
        throw new MessageStoreException("failed to copy message to noarchive queue:"+e.getMessage(),e,logger);
      } finally {
        try { fos.close(); } catch (Exception e) {}
      }
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

     * Copy a message to a error directory if the message cannot be indexed
     * @param emailID The email ID
     */ 
    public void backupMessage(EmailID emailID) throws MessageStoreException {
        if (emailID==null || emailID.getVolume()==null || emailID.getUniqueID()==null)
            throw new MessageStoreException("assertion failure: null emailID, volume or uniqueId",logger);
        logger.debug("backupMessage() {"+emailID+"'");
        copyEmail(getExistingFile(emailID.getVolume(),emailID.getUniqueID(),messageFileExtension),getNoIndexFile(emailID));  
    }
View Full Code Here

Examples of com.volantis.mps.message.store.MessageStoreException

                    // Parse the XML to check for correct tags etc.
                    reader.parse(new InputSource(new StringReader(xml)));
                } catch (SAXException se) {
                    // Invalid XML
                    logger.error("xml-validation-failure", se);
                    throw new MessageStoreException(
                            localizer.format("xml-validation-failure"),
                            MessageStoreMessageEnumeration.NOT_ACCEPTABLE);
                }
            }

            // Store the xml to disk
            File file = null;
            do {
                // Generate or regenerate the ID.  It is possible that in the
                // intervening time another thread has used the id and written
                // a file!
                newID = generateValidID();
                file = createEntryFile(newID);
            } while (!file.createNewFile());

            // get the xml as a byte array using specified encoding in prolog
            // if available - we assume that the XML prolog provides the
            // definitive answer w.r.t. the XML encoding
            byte[] xmlBuffer = null;

            if (encoding != null) {
                xmlBuffer = xml.getBytes(encoding);
            } else {
                xmlBuffer = xml.getBytes();
            }

            FileOutputStream fos = null;
            try {
                fos = new FileOutputStream(file);
                fos.write(xmlBuffer, 0, xmlBuffer.length);
                fos.flush();
            } catch (IOException ioe) {
                if (file != null) {
                    // Tidy up in case writing failed
                    file.delete();
                }
                logger.error("xml-write-error", ioe);
                throw new MessageStoreException(
                        localizer.format("xml-write-error"),
                        MessageStoreMessageEnumeration.BAD_REQUEST);
            } finally {
                if (fos != null) {
                    try {
                        fos.close();
                    } catch(IOException ioe) {
                        // ignore
                    }
                }
            }

            synchronized (messageStoreIDs) {
                // Store the id/timestamp in the memory cache
                messageStoreIDs.put(newID, generateTimeStamp(file));
            }

        } catch (IOException ioe) {
            logger.error("xml-write-error", ioe);
            throw new MessageStoreException(
                    localizer.format("xml-write-error"),
                    MessageStoreMessageEnumeration.BAD_REQUEST);
        } catch (MessageStoreException mse) {
            logger.error("id-generation-error", mse);
            throw new MessageStoreException(
                    localizer.format("id-generation-error"),
                    MessageStoreMessageEnumeration.BAD_REQUEST);
        }

        return newID;
View Full Code Here

Examples of com.volantis.mps.message.store.MessageStoreException

        }

        // If the count has reached the limit there are no more IDs available
        if (count.compareTo(limit) == 0) {
            logger.error("id-limit-reached", new Object[] {limit});
            throw new MessageStoreException(
                    localizer.format("id-limit-reached", new Object[]{limit}),
                    MessageStoreMessageEnumeration.INTERNAL_SERVER_ERROR);
        }

        return newID;
View Full Code Here

Examples of com.volantis.mps.message.store.MessageStoreException

        File file = createEntryFile(id);

        // File not found
        if (!file.exists()) {
            logger.error("file-non-existant-for-id", id);
            throw new MessageStoreException(
                    localizer.format("file-non-existant-for-id"),
                    MessageStoreMessageEnumeration.NOT_FOUND);
        }

        try {
            FileInputStream fis = new FileInputStream(file);

            // Restore old timestamp
            if (oldTimestamp != null) {
                synchronized (messageStoreIDs) {
                    messageStoreIDs.put(id, oldTimestamp);
                }
            }

            processXML(request, response, fis);

        } catch (IOException ioe) {
            logger.error("xml-read-error", ioe);
            throw new MessageStoreException(
                    localizer.format("xml-read-error"),
                    MessageStoreMessageEnumeration.NOT_FOUND);
        } catch (MarinerContextException mce) {
            logger.error("device-processing-error", mce);
            throw new MessageStoreException(
                    localizer.format("device-processing-error"),
                    MessageStoreMessageEnumeration.NOT_FOUND);
        } catch (ServletException se) {
            logger.error("mcs-comms-error", se);
            throw new MessageStoreException(
                    localizer.format("mcs-comms-error"),
                    MessageStoreMessageEnumeration.NOT_FOUND);
        } catch (SAXException se) {
            logger.error("xml-parse-error", se);
            throw new MessageStoreException(
                    localizer.format("xml-parse-error"),
                    MessageStoreMessageEnumeration.NOT_FOUND);
        }
    }
View Full Code Here

Examples of org.jboss.soa.esb.services.persistence.MessageStoreException

            insert(uid, message, classification, "TRUE", conn);
    }
    catch (Exception e)
    {
      logger.error(e);
      throw new MessageStoreException(e);
    }
    finally
    {
      release(conn);
    }
View Full Code Here

Examples of org.jboss.soa.esb.services.persistence.MessageStoreException

        Connection conn=null;
    try {
      conn = mgr.getConnection();
      message =  select(uid, conn);
    } catch (Exception e) {
      throw new MessageStoreException(e);
    } finally {
      release(conn);
    }
    return message;
  }
View Full Code Here

Examples of org.jboss.soa.esb.services.persistence.MessageStoreException

        Connection conn=null;
        try {
            conn = mgr.getConnection();
            message =  select(uid, classification, conn);
        } catch (Exception e) {
            throw new MessageStoreException(e);
        } finally {
            release(conn);
        }
        return message;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.