Examples of MessageStoreException


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 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);

        String uniqueId = emailID.getUniqueID();
        Volume volume = emailID.getVolume();
       
        logger.debug("copyEmailToNoIndexQueue() {"+emailID+"'");
        FileChannel in = null, out = null;
        String messageFileName = getMessageFileName(emailID);
        String indexErrorFileName = getIndexErrorFileName(emailID);
        try {         
             in = new FileInputStream(messageFileName).getChannel();
             out = new FileOutputStream(indexErrorFileName).getChannel();
             in.transferTo( 0, in.size(), out);
           
        } catch (Exception e) {
            throw new MessageStoreException("failed to copy suspect message to noindex queue {src='"+messageFileName+"=',dest='"+indexErrorFileName+"'",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

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

       String messageFileName = getMessageFileName(emailID);
       InputStream is = new BufferedInputStream(new FileInputStream(messageFileName));
       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

Examples of com.stimulus.archiva.exception.MessageStoreException

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

       OutputStream os = new BufferedOutputStream(new FileOutputStream(messageFileName));
       Cipher ecipher = null;
       if (encrypt) {
           try {
               ecipher = Cipher.getInstance(key.getAlgorithm());
               ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
         } catch (Exception e) {
               throw new MessageStoreException("failed to initialize cipher. cause:",e,logger);
           }
           os = new CipherOutputStream(os,ecipher);
       }


View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

             key = SecretKeyFactory.getInstance(algorithm).generateSecret(keySpec);
          
             paramSpec = new PBEParameterSpec(salt, iterationCount);

         } catch (java.security.NoSuchAlgorithmException e)  {
             throw new MessageStoreException("failed to locate desired encryption algorithm {algorithm='"+algorithm+"'",logger);
         } catch (Exception e) {
             throw new MessageStoreException(e.toString(),e,logger);
         }
   }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

     */ 
  
    protected String getMessageFileName(EmailID emailID) throws MessageStoreException
    {
        if (emailID==null || emailID.getVolume()==null || emailID.getUniqueID()==null)
            throw new MessageStoreException("assertion failure: null emailID, volume or uniqueId",logger);

        String filename = emailID.getVolume().getPath() + File.separatorChar + emailID.getUniqueID().substring(0, 8) + File.separatorChar + emailID.getUniqueID() + messageFileExtension;
        logger.debug("getMessageFileName() {return='" + filename + "'}");
        return filename;
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

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

Examples of com.stimulus.archiva.exception.MessageStoreException

     */ 
 
    protected String getMessageFileDirectory(EmailID emailID) throws MessageStoreException
    {
        if (emailID==null || emailID.getVolume()==null || emailID.getUniqueID()==null)
            throw new MessageStoreException("assertion failure: null emailID, volume or uniqueId",logger);

        String dirname = emailID.getVolume().getPath() + File.separatorChar + emailID.getUniqueID().substring(0, 8);
        logger.debug("getMessageFileDirectory() {return='" + dirname + "'}");
        return dirname;
    }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

     */ 

    public String createMessageStoreDir(Volume volume) throws MessageStoreException {

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

       logger.debug("createMessageDir() {" + 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

Examples of com.stimulus.archiva.exception.MessageStoreException

     */ 

    protected String createMessageDir(EmailID emailID) throws MessageStoreException
    {
        if (emailID==null)
            throw new MessageStoreException("assertion failure: null emailID",logger);

      String messageDir = getMessageFileDirectory(emailID);
        logger.debug("createMessageDir() {messageDir='" + messageDir + "'}");
        File todayDir = new File(messageDir);
        if(!todayDir.exists())
        {
            logger.info("message sub-directory does not exist {messageDir='" + messageDir + "'}");
            boolean makedir = todayDir.mkdir();
            if(makedir)
                logger.info("created message sub-directory {messageDir='" + messageDir + "'}");
            else
                throw new MessageStoreException("failed to create message sub=directory {messageDir='" + messageDir + "'}",logger);
        } else
        {
            logger.debug("message directory exists {messageDir='" + messageDir + "'}");
        }
        return messageDir;
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

    public void insertMessage(EmailID emailId, InputStream in, boolean compress, boolean encrypt) throws MessageStoreException
    {
        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 + ",compress='" + compress + "',encrypt='"+encrypt+"'}");
      
       if (!config.isDefaultPassPhraseModified())
           throw new MessageStoreException("failed to archive message. encryption password is not set. {"+emailId+"}",logger);

       OutputStream out = null;
       createMessageStoreDir(emailId.getVolume());
       createMessageDir(emailId);
       String messageFileName = getMessageFileName(emailId);
        try
        {

            out = getRawMessageOutputStream(messageFileName,compress,encrypt);
            byte[] buf = new byte[1024];
            int numRead = 0;
            while ((numRead = in.read(buf)) >= 0) {
                out.write(buf, 0, numRead);
            }
        } catch(IOException e)
        {
           throw new MessageStoreException("failed to store message to file {file='" + messageFileName + "'}", e, logger);
        } finally {
            try
              {

                if (in !=null)
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.