Examples of MessageStoreException


Examples of com.stimulus.archiva.exception.MessageStoreException

               Cipher cipher = Cipher.getInstance(key.getAlgorithm());
               cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
               byte[] outputBytes = cipher.doFinal(password.getBytes("UTF-8"));
               return Base64.encodeToString(outputBytes,false);
          } catch (java.security.NoSuchAlgorithmException e)  {
              throw new MessageStoreException("failed to locate desired encryption algorithm {algorithm='"+Config.getConfig().getPBEAlgorithm()+"'",logger);
          } catch (Exception e) {
              throw new MessageStoreException(e.toString(),e,logger);
          }
   }
View Full Code Here

Examples of com.stimulus.archiva.exception.MessageStoreException

            cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
            byte[] base64DecodedData = Base64.decodeFast(password);
            byte[] outputBytes = cipher.doFinal(base64DecodedData);
            return new String(outputBytes);
       } catch (java.security.NoSuchAlgorithmException e)  {
           throw new MessageStoreException("failed to locate desired encryption algorithm {algorithm='"+Config.getConfig().getPBEAlgorithm()+"'",logger);
       } catch (Exception e) {
           throw new MessageStoreException(e.toString(),e,logger);
      
     }
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());
       String messageDirectory = createMessageDir(emailId);
       String messageFileName = getMessageFileName(emailId);
       File messageFile = null;
        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

Examples of com.stimulus.archiva.exception.MessageStoreException

     */ 
   
    public Email retrieveMessage(EmailID emailID, boolean decompress, boolean decrypt, boolean headersOnly) 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("retrieveMessage() {"+emailID+",retrieveHeadersOnly='" + headersOnly + "', decompress='" + decompress + "',decrypt='"+decrypt+"'");
      
        String messageFileName = getMessageFileName(emailID);
        InputStream is = null;
        try {

            is = getRawMessageInputStream(emailID, decompress, decrypt);
        }   catch(FileNotFoundException fnfe)
        {
            throw new MessageStoreException("message file not found {filename='" + messageFileName + "'}", fnfe, logger);
        } catch(IOException io)
        {
            try
            {
                if (is!=null)
                    is.close();
            }
            catch(Exception e) { }
            throw new MessageStoreException("failed to retrieve message {filename='" + messageFileName + "'}", io, logger);
        }

        Email message = null;
        try {
            message = new Email(is, headersOnly, emailID);
        } catch(MessagingException me)
        {
            try
            {
                is.close();
            }
            catch(Exception e) { }
            throw new MessageStoreException("failed to decode message {filename='" + messageFileName + "'}", me, logger);
        } finally
        {
            if(is != null)
                try
                {
                    is.close();
                }
                catch(IOException ioe)
                {
                    throw new MessageStoreException("error closing message {file '" + messageFileName + "'}", ioe, logger);
                }

        }

        try
        {
            logger.debug("retrieved message {filename='" + messageFileName + "'," + message+"}");
        }
        catch(Exception e)
        {
            throw new MessageStoreException("retrieved message does not appear to be well formed.", e, logger);
        }
        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.