Package com.stimulus.archiva.exception

Examples of com.stimulus.archiva.exception.MessageExtractionException


 
  protected String extractMessage(Email message) throws MessageExtractionException
  {
 
    if (message == null)
      throw new MessageExtractionException("assertion failure: null message", logger);

    logger.debug("extracted message {" + message + "}");
 
    Hashtable<String,Part> att       = new Hashtable<String,Part>();
    Hashtable<String,String> inl     = new Hashtable<String,String>();
    Hashtable<String,String> imgs     = new Hashtable<String,String>();
    Hashtable<String,String> nonImgs   = new Hashtable<String,String>();
    Hashtable<String,String> ready     = new Hashtable<String,String>();
    ArrayList<String> mimeTypes     = new ArrayList<String>();
    String viewFileName;
    try {
      dumpPart((Part)message, att, inl, imgs, nonImgs, mimeTypes, message.getSubject());
      for (String attachFileName: att.keySet()) {
        Part p = (Part) att.get(attachFileName);
        writeAttachment(p, attachFileName);
        ready.put(attachFileName, attachFileName);
        if (!imgs.containsKey(attachFileName) && !nonImgs.containsKey(attachFileName))
          addAttachment(attachFileName, p.getContentType());
      }
     
      if (inl.containsKey("text/html")) {
        viewFileName = prepareHTMLMessage(baseURL, inl, imgs, nonImgs, ready, mimeTypes);
      } else if (inl.containsKey("text/plain")) {
        viewFileName = preparePlaintextMessage(inl, imgs, nonImgs, ready, mimeTypes);
      } else {
        logger.debug("unable to extract message since the content type is unsupported. returning empty message body.");
        return writeTempMessage("<html><head><META http-equiv=Content-Type content=\"text/html; charset="+serverEncoding+"\"></head><body></body></html>",".html");
      }
    } catch (Exception ex) {
      throw new MessageExtractionException(ex.getMessage(),ex, logger);
    }
    logger.debug("message successfully extracted {filename='" + fileName + "' " + message + "}");
    return viewFileName;
  }
View Full Code Here


 
  protected String extractMessage(Email message) throws MessageExtractionException
  {
 
    if (message == null)
      throw new MessageExtractionException("assertion failure: null message", logger);

    logger.debug("extracted message {" + message + "}");
 
    Hashtable<String,Part> att       = new Hashtable<String,Part>();
    Hashtable<String,String> inl     = new Hashtable<String,String>();
    Hashtable<String,String> imgs     = new Hashtable<String,String>();
    Hashtable<String,String> nonImgs   = new Hashtable<String,String>();
    Hashtable<String,String> ready     = new Hashtable<String,String>();
    ArrayList<String> mimeTypes     = new ArrayList<String>();
    String viewFileName;
    try {
      dumpPart(message, att, inl, imgs, nonImgs, mimeTypes, message.getSubject());
      for (String attachFileName: att.keySet()) {
        Part p = (Part) att.get(attachFileName);
        writeAttachment(p, attachFileName);
        ready.put(attachFileName, attachFileName);
        if (!imgs.containsKey(attachFileName) && !nonImgs.containsKey(attachFileName))
          addAttachment(attachFileName, p.getContentType());
      }
     
      if (inl.containsKey("text/html")) {
        viewFileName = prepareHTMLMessage(baseURL, inl, imgs, nonImgs, ready, mimeTypes);
      } else if (inl.containsKey("text/plain")) {
        viewFileName = preparePlaintextMessage(inl, imgs, nonImgs, ready, mimeTypes);
      } else {
        logger.debug("unable to extract message since the content type is unsupported. returning empty message body.");
        return writeTempMessage("<html><head><META http-equiv=Content-Type content=\"text/html; charset="+serverEncoding+"\"></head><body></body></html>",".html");
      }
    } catch (Exception ex) {
      throw new MessageExtractionException(ex.toString(), logger);
    }
    logger.debug("message successfully extracted {filename='" + fileName + "' " + message + "}");
    return viewFileName;
  }
View Full Code Here

 
  protected String extractMessage(Email message) throws MessageExtractionException
  {
 
    if (message == null)
      throw new MessageExtractionException("assertion failure: null message", logger);

    logger.debug("extracted message {" + message + "}");
 
    Hashtable<String,Part> att       = new Hashtable<String,Part>();
    Hashtable<String,String> inl     = new Hashtable<String,String>();
    Hashtable<String,String> imgs     = new Hashtable<String,String>();
    Hashtable<String,String> nonImgs   = new Hashtable<String,String>();
    Hashtable<String,String> ready     = new Hashtable<String,String>();
    ArrayList<String> mimeTypes     = new ArrayList<String>();
    String viewFileName;
    try {
      dumpPart((Part)message.getUnderlyingMessage(), att, inl, imgs, nonImgs, mimeTypes, message.getSubject());
      for (String attachFileName: att.keySet()) {
        Part p = (Part) att.get(attachFileName);
        writeAttachment(p, attachFileName);
        ready.put(attachFileName, attachFileName);
        if (!imgs.containsKey(attachFileName) && !nonImgs.containsKey(attachFileName))
          addAttachment(attachFileName, p.getContentType());
      }
     
      if (inl.containsKey("text/html")) {
        viewFileName = prepareHTMLMessage(baseURL, inl, imgs, nonImgs, ready, mimeTypes);
      } else if (inl.containsKey("text/plain")) {
        viewFileName = preparePlaintextMessage(inl, imgs, nonImgs, ready, mimeTypes);
      } else {
        logger.debug("unable to extract message since the content type is unsupported. returning empty message body.");
        return writeTempMessage("<html><head><META http-equiv=Content-Type content=\"text/html; charset="+serverEncoding+"\"></head><body></body></html>",".html");
      }
    } catch (Exception ex) {
      throw new MessageExtractionException(ex.getMessage(),ex, logger);
    }
    logger.debug("message successfully extracted {filename='" + fileName + "' " + message + "}");
    return viewFileName;
  }
View Full Code Here

 
  protected String extractMessage(Email message) throws MessageExtractionException
  {
 
    if (message == null)
      throw new MessageExtractionException("assertion failure: null message", logger);

    logger.debug("extracted message {" + message + "}");
 
    Hashtable<String,Part> att       = new Hashtable<String,Part>();
    Hashtable<String,String> inl     = new Hashtable<String,String>();
    Hashtable<String,String> imgs     = new Hashtable<String,String>();
    Hashtable<String,String> nonImgs   = new Hashtable<String,String>();
    Hashtable<String,String> ready     = new Hashtable<String,String>();
    ArrayList<String> mimeTypes     = new ArrayList<String>();
    String viewFileName;
    try {
      dumpPart(message, att, inl, imgs, nonImgs, mimeTypes, message.getSubject());
      for (String attachFileName: att.keySet()) {
        Part p = (Part) att.get(attachFileName);
        writeAttachment(p, attachFileName);
        ready.put(attachFileName, attachFileName);
        //if (!imgs.containsKey(attachFileName) && !nonImgs.containsKey(attachFileName))
          addAttachment(attachFileName, p);
      }
     
      if (inl.containsKey("text/html")) {
        viewFileName = prepareHTMLMessage(baseURL, inl, imgs, nonImgs, ready, mimeTypes);
      } else if (inl.containsKey("text/plain")) {
        viewFileName = preparePlaintextMessage(inl, imgs, nonImgs, ready, mimeTypes);
      } else {
        logger.debug("unable to extract message since the content type is unsupported. returning empty message body.");
        return writeTempMessage("<html><head><META http-equiv=Content-Type content=\"text/html; charset="+serverEncoding+"\"></head><body></body></html>",".html");
      }
    } catch (Exception ex) {
      throw new MessageExtractionException(ex.getMessage(),ex, logger);
    }
    logger.debug("message successfully extracted {filename='" + fileName + "' " + message + "}");
    return viewFileName;
  }
View Full Code Here

TOP

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

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.