Package com.stimulus.archiva.exception

Examples of com.stimulus.archiva.exception.MessageStoreException


    * @return The file location message not processed
    */ 
   
    protected File getNoIndexFile(EmailID emailID) throws MessageStoreException {
        if (emailID==null || emailID.getUniqueID()==null)
            throw new MessageStoreException("assertion failure: null emailID or uniqueId",logger);
        String filename = Config.getNoIndexPath() + File.separatorChar + emailID.getUniqueID() + messageFileExtension;
        logger.debug("getNoIndexFileName() {return='" + filename + "'}");
        return new File(filename);
    }
View Full Code Here


     */ 

    public static String createMessageStoreDir(Volume volume) throws MessageStoreException {

       if (volume==null)
           throw new MessageStoreException("assertion failure: null volume",logger);

       logger.debug("createMessageStoreDir() {" + volume + "}");

       File storeDir = new File(volume.getPath());
       if(!storeDir.exists())
       {
           logger.info("message store directory does not exist {"+volume+"}");
           boolean success = storeDir.mkdir();
           if(!success)
               throw new MessageStoreException("failed to create message store directory {" + volume + "}", logger);
           logger.info("created message store directory {" + volume + "}");
       }
       return volume.getPath();
    }
View Full Code Here

             logger.debug("message sub-directory does not exist {dir='" + directory + "'}");
             boolean makedir = todayDir.mkdir();
             if(makedir)
                 logger.debug("created message sub-directory {dir='" + directory + "'}");
             else
                 throw new MessageStoreException("failed to create directory {dir='" + directory + "'}",logger);
         } else
         {
             logger.debug("directory exists {dir='" + directory + "'}");
         }
    }
View Full Code Here

    {
   
        Config config = Config.getConfig();
       
       if (emailId==null || emailId.getVolume()==null || emailId.getUniqueID()==null)
           throw new MessageStoreException("assertion failure: null emailID, volume or uniqueId",logger);

       if(emailId.getUniqueID() == null)
            throw new MessageStoreException("insert message was found to have a null message id.", logger);

       logger.debug("insertMessage {"+emailId + "}");
      
       if (!config.isDefaultPassPhraseModified())
           throw new MessageStoreException("failed to archive message. encryption password is not set. {"+emailId+"}",logger);

       File messageFile = getNewFile(emailId.getVolume(),emailId.getUniqueID(),messageFileExtension);
      
      
       if (messageFile.exists()) {
         logger.debug("no need to archive. message already exists in the store. {"+emailId+"}");
         return false;
       }
       try {
         email.setHeader("X-MailArchiva-Archive-Date", DateUtil.convertDatetoString(new Date()));
       } catch (MessagingException me) {
         logger.error("failed to set archive date");
       }
      
       try {
         writeEmail(email, messageFile);
       } catch (Exception e) {
         throw new MessageStoreException("failed to write message to store {"+emailId+"}",e,logger);
       }
       return true;
    }
View Full Code Here

     */ 
   
    public Email retrieveMessage(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("retrieveMessage() {"+emailID+"'}");
    
    
        Email message = null;
        try {
         
           File messageFile = getExistingFile(emailID.getVolume(),emailID.getUniqueID(),messageFileExtension);
           logger.debug("returning input stream {filename='" + messageFile + "'}");
           
           message = new Email(emailID,getRawMessageInputStream(messageFile, true, true));
       
             saveEmailChanges(message);

            logger.debug("retrieved message {"+message+"}");
        } catch (java.io.FileNotFoundException fnfe) {
          throw new MessageStoreException("The message is currently not accessible on the storage device.",fnfe,logger);
        } catch(Exception e) {
            throw new MessageStoreException("Retrieved message does not appear to be well formed.", e, logger);
        }
        return message;

    }
View Full Code Here

     * Copy a message to a error directory if the message cannot be indexed
     * @param emailID The email ID
     */ 
    public void copyEmailToNoIndexQueue(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("copyEmailToNoIndexQueue() {"+emailID+"'");
        copyEmail(getExistingFile(emailID.getVolume(),emailID.getUniqueID(),messageFileExtension),getNoIndexFile(emailID));  
    }
View Full Code Here

             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+"'",logger);
        } finally {
             if (in != null) try { in.close(); } catch (Exception e) {};
             if (out != null) try { out.close(); } catch (Exception e) {};
        }
    }
View Full Code Here

      logger.warn("copying email to no archive queue {dest='"+noArchiveFile.getAbsolutePath()+"'}");
     
      try {
          writeEmail(email, noArchiveFile);
        } catch (Exception e) {
          throw new MessageStoreException("failed to write message to store {"+email+"}",logger);
        }
      
    }
View Full Code Here

     * @param decrypt Should decrypt message
     * @return An inputstream containing the message
     */ 
   public InputStream getRawMessageInputStream(File messageFile, boolean decompress, boolean decryptthrows IOException,MessageStoreException {
       if (messageFile==null )
           throw new MessageStoreException("assertion failure: null messageFileName",logger);

       InputStream is = new BufferedInputStream(new FileInputStream(messageFile));
       Cipher dcipher = null;
       if(decrypt) {
           try {
             
               dcipher = Cipher.getInstance(key.getAlgorithm());
               dcipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
         } catch (Exception e) {
               throw new MessageStoreException("failed to initialize cipher. cause:",e,logger);
           }
           is = new CipherInputStream(is,dcipher);
       }

       if(decompress)
View Full Code Here

     * @return An outputstream directed to the message
     */ 
  
   public OutputStream getRawMessageOutputStream(File messageFile,boolean compress, boolean encrypt) throws IOException,MessageStoreException {
       if (messageFile==null)
           throw new MessageStoreException("assertion failure: null messageFileName",logger);

       OutputStream os = new BufferedOutputStream(new FileOutputStream(messageFile));
       Cipher ecipher = null;
       if (encrypt) {
           try {
               ecipher = Cipher.getInstance(key.getAlgorithm());
               ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
           } catch (Exception e) {
                logger.fatal("Please ensure you have the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files installed.");
                logger.fatal("Visit http://java.sun.com2/javase/downloads/index.jsp to download them.");
                throw new MessageStoreException("failed to initalize cipher. Cause:",e,logger);
           }
           os = new CipherOutputStream(os,ecipher);
       }


View Full Code Here

TOP

Related Classes of com.stimulus.archiva.exception.MessageStoreException

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.