1 17 18 package org.apache.james.imapserver.store; 19 20 import org.apache.avalon.framework.logger.AbstractLogEnabled; 21 22 import javax.mail.internet.MimeMessage ; 23 import javax.mail.MessagingException ; 24 import java.util.Date ; 25 26 33 public class SimpleImapMessage 34 extends AbstractLogEnabled implements ImapMessage 35 { 36 private MimeMessage mimeMessage; 37 private MessageFlags flags; 38 private Date internalDate; 39 private long uid; 40 private SimpleMessageAttributes attributes; 41 42 SimpleImapMessage( MimeMessage mimeMessage, MessageFlags flags, 43 Date internalDate, long uid ) 44 { 45 this.mimeMessage = mimeMessage; 46 this.flags = flags; 47 this.internalDate = internalDate; 48 this.uid = uid; 49 } 50 51 public MimeMessage getMimeMessage() { 52 return mimeMessage; 53 } 54 55 public MessageFlags getFlags() { 56 return flags; 57 } 58 59 public Date getInternalDate() { 60 return internalDate; 61 } 62 63 public long getUid() { 64 return uid; 65 } 66 67 public ImapMessageAttributes getAttributes() throws MailboxException 68 { 69 if ( attributes == null ) { 70 attributes = new SimpleMessageAttributes(); 71 setupLogger( attributes ); 72 try { 73 attributes.setAttributesFor( mimeMessage ); 74 } 75 catch ( MessagingException e ) { 76 throw new MailboxException( "Could not parse mime message." ); 77 } 78 } 79 return attributes; 80 } 81 } 82 | Popular Tags |