org.apache.james.mailboxmanager.mailbox
Interface Mailbox

All Known Implementing Classes:
TorqueMailbox

public interface Mailbox


Field Summary
static long ANONYMOUS_SESSION
           
 
Method Summary
 void addListener(MailboxListener listener)
          Implementations of Mailbox may interpret the fact that someone is listening and do some caching and even postpone persistence until everyone has removed itself.
 MessageResult appendMessage(javax.mail.internet.MimeMessage message, java.util.Date internalDate, MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
           
 java.util.Iterator expunge(MessageRange set, MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
           
 MessageResult getFirstUnseen(MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
           
 int getMessageCount(MailboxSession mailboxSession)
           
 java.util.Iterator getMessages(MessageRange set, MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
          TODO: consolidate search and getMessages into a single method
 java.lang.String getName()
          Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)
 javax.mail.Flags getPermanentFlags()
           
 long getUidNext(MailboxSession mailboxSession)
           
 long getUidValidity(MailboxSession mailboxSession)
           
 int getUnseenCount(MailboxSession mailboxSession)
           
 boolean isWriteable()
           
 long[] recent(boolean reset, MailboxSession mailboxSession)
           
 void removeListener(MailboxListener listener)
           
 java.util.Iterator search(SearchQuery searchQuery, MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
           
 java.util.Iterator setFlags(javax.mail.Flags flags, boolean value, boolean replace, MessageRange set, MessageResult.FetchGroup fetchGroup, MailboxSession mailboxSession)
          this is much more straight forward for IMAP instead of setting Flags of an array of lazy-loading MimeMessages.
 

Field Detail

ANONYMOUS_SESSION

static final long ANONYMOUS_SESSION
See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Example #mail.paul.lists.apache.james-dev (3rd level folder of user paul)

Returns:
Full folder name with namespace
Throws:
MailboxManagerException

getMessageCount

int getMessageCount(MailboxSession mailboxSession)
                    throws MailboxManagerException
Throws:
MailboxManagerException

isWriteable

boolean isWriteable()

search

java.util.Iterator search(SearchQuery searchQuery,
                          MessageResult.FetchGroup fetchGroup,
                          MailboxSession mailboxSession)
                          throws MailboxManagerException
Parameters:
fetchGroup - which fields to be returned in MessageResult
mailboxSession - TODO
Returns:
MessageResult with the fields defined by result
  • IMAP: msn or (msn and uid)
  • Javamail Folder: Message[]
Throws:
MailboxManagerException - if anything went wrong
UnsupportedCriteriaException - when any of the search parameters are not supported by this mailbox

getUidValidity

long getUidValidity(MailboxSession mailboxSession)
                    throws MailboxManagerException
Throws:
MailboxManagerException

getUidNext

long getUidNext(MailboxSession mailboxSession)
                throws MailboxManagerException
Parameters:
mailboxSession - TODO
Returns:
the uid that will be assigned to the next appended message
Throws:
MailboxManagerException

getPermanentFlags

javax.mail.Flags getPermanentFlags()
Returns:
Flags that can be stored

recent

long[] recent(boolean reset,
              MailboxSession mailboxSession)
              throws MailboxManagerException
Throws:
MailboxManagerException

getUnseenCount

int getUnseenCount(MailboxSession mailboxSession)
                   throws MailboxManagerException
Throws:
MailboxManagerException

getFirstUnseen

MessageResult getFirstUnseen(MessageResult.FetchGroup fetchGroup,
                             MailboxSession mailboxSession)
                             throws MailboxManagerException
Throws:
MailboxManagerException

expunge

java.util.Iterator expunge(MessageRange set,
                           MessageResult.FetchGroup fetchGroup,
                           MailboxSession mailboxSession)
                           throws MailboxManagerException
Parameters:
set -
  • IMAP, Javamail: not required, always expunge all
  • UIDPLUS: requires the possibility of defining a uid range
fetchGroup - which fields to be returned in MessageResult
mailboxSession - TODO
Returns:
MessageResult Iterator with the fields defined by result
  • IMAP, UIDPLUS: nothing required
  • Javamail Folder: requires the expunged Message[]
Throws:
MailboxManagerException - if anything went wrong

setFlags

java.util.Iterator setFlags(javax.mail.Flags flags,
                            boolean value,
                            boolean replace,
                            MessageRange set,
                            MessageResult.FetchGroup fetchGroup,
                            MailboxSession mailboxSession)
                            throws MailboxManagerException
this is much more straight forward for IMAP instead of setting Flags of an array of lazy-loading MimeMessages.
required by IMAP

Parameters:
flags - Flags to be set
value - true = set, false = unset
replace - replace all Flags with this flags, value has to be true
set - the range of messages
fetchGroup - fetch group for results
mailboxSession - TODO
Returns:
MessageResult Iterator containing messages whose flags have been updated, not null
Throws:
MailboxManagerException

appendMessage

MessageResult appendMessage(javax.mail.internet.MimeMessage message,
                            java.util.Date internalDate,
                            MessageResult.FetchGroup fetchGroup,
                            MailboxSession mailboxSession)
                            throws MailboxManagerException
Parameters:
internalDate -

IMAP defines this as the time when the message has arrived to this server (by smtp). Clients are also allowed to set the internalDate on apppend.

Is this Mail.getLastUpdates() for James delivery? Should we use MimeMessage.getReceivedDate()?

fetchGroup - which fields to be returned in MessageResult or null for minimal fetch group only
mailboxSession - TODO
Returns:
MessageResult with the fields defined by result
  • IMAP, Javamail Folder: nothing required
  • UIDPlusFolder: requires to return appended Message or uid
  • UIDPLUS: requires to return appended uid
Throws:
MailboxManagerException - if anything went wrong

getMessages

java.util.Iterator getMessages(MessageRange set,
                               MessageResult.FetchGroup fetchGroup,
                               MailboxSession mailboxSession)
                               throws MailboxManagerException
TODO: consolidate search and getMessages into a single method

Parameters:
set -
mailboxSession - TODO
Returns:
MessageResult with the fields defined by result
  • IMAP: a set of msn, uid, Flags, header lines, content, mime parts...
  • Javamail Folder: Message[]
Throws:
MailboxManagerException

addListener

void addListener(MailboxListener listener)
                 throws MailboxManagerException
Implementations of Mailbox may interpret the fact that someone is listening and do some caching and even postpone persistence until everyone has removed itself.

Parameters:
listener -
Throws:
MailboxManagerException

removeListener

void removeListener(MailboxListener listener)


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.