com.hs.mail.imap.mailbox
Interface MailboxManager

All Known Implementing Classes:
DefaultMailboxManager

public interface MailboxManager

Since:
Feb 2, 2010
Author:
WonChul Doh

Method Summary
 void addEventListener(EventListener listener)
           
 void addMessage(long ownerID, MailMessage message, String mailboxName)
          Appends a message to the user's INBOX.
 void addSubscription(long userID, long mailboxID, String mailboxName)
          Subscribe the user to the given mailbox.
 void appendMessage(long mailboxID, Date internalDate, javax.mail.Flags flags, File file)
          Appends a message to this mailbox.
 void copyMessage(long uid, long mailboxID)
          Copies a message to the given mailbox.
 Mailbox createMailbox(long ownerID, String mailboxName)
          Creates a new mailbox.
 void deleteMailbox(long ownerID, long mailboxID, boolean delete)
          Delete or empty a mailbox from store.
 void deleteMessage(long uid)
          Deletes the given message.
 void deleteSubscription(long userID, String mailboxName)
          Unsubscribes the user from the given mailbox.
 List<Long> expunge(long mailboxID)
          Gets the UIDs of messages which has /Deleted flag.
 List<Mailbox> getChildren(long userID, long ownerID, String mailboxName, boolean subscribed)
           
 EventDispatcher getEventDispatcher()
           
 javax.mail.Flags getFlags(long uid)
           
 Map<String,String> getHeader(long physMessageID)
          Gets the headers of the message.
 Map<String,String> getHeader(long physMessageID, String[] fields)
          Gets the headers of the message.
 Mailbox getMailbox(long ownerID, String mailboxName)
          Returns user's Mailbox with a given path
 List<Long> getMailboxIDList(String mailboxName)
           
 FetchData getMessageFetchData(long uid)
           
 List<Long> getMessageIDList(long mailboxID)
           
 boolean hasChildren(Mailbox mailbox)
          Does the mailbox have inferior child mailboxes?
 boolean isSubscribed(long userID, String mailboxName)
          Check if given mailbox is subscribed to user
 boolean mailboxExists(long ownerID, String mailboxName)
          Check if given mailbox exists.
 void removeEventListener(EventListener listener)
           
 void renameMailbox(Mailbox source, String targetName)
          Renames a mailbox.
 void resetRecent(long mailboxID)
           
 List<Long> search(UidToMsnMapper map, long mailboxID, SearchKey key)
          Searches for the messages matching the given query.
 void setFlags(long uid, javax.mail.Flags flags, boolean replace, boolean set)
          Sets flags on this message.
 

Method Detail

getEventDispatcher

EventDispatcher getEventDispatcher()

addEventListener

void addEventListener(EventListener listener)

removeEventListener

void removeEventListener(EventListener listener)

getMailbox

Mailbox getMailbox(long ownerID,
                   String mailboxName)
Returns user's Mailbox with a given path

Parameters:
ownerID - owner of the mailbox
mailboxName - path to the mailbox
Returns:
the mailbox as Mailbox

mailboxExists

boolean mailboxExists(long ownerID,
                      String mailboxName)
Check if given mailbox exists.

Parameters:
ownerID - owner of this mailbox
mailboxName - the name of mailbox for checking existence
Returns:
true when the mailbox exists, false otherwise

getChildren

List<Mailbox> getChildren(long userID,
                          long ownerID,
                          String mailboxName,
                          boolean subscribed)

getMailboxIDList

List<Long> getMailboxIDList(String mailboxName)

hasChildren

boolean hasChildren(Mailbox mailbox)
Does the mailbox have inferior child mailboxes?

Parameters:
mailbox - ID of the mailbox
Returns:
true when the mailbox has children, false otherwise

expunge

List<Long> expunge(long mailboxID)
Gets the UIDs of messages which has /Deleted flag.

Parameters:
mailboxID - ID of mailbox
Returns:
list of UIDs of messages which has /Deleted flag

search

List<Long> search(UidToMsnMapper map,
                  long mailboxID,
                  SearchKey key)
Searches for the messages matching the given query.

Parameters:
map - UID to MSN converting map
mailboxID - ID of mailbox to search
key - the search query
Returns:
list of UIDs of messages searched

createMailbox

Mailbox createMailbox(long ownerID,
                      String mailboxName)
Creates a new mailbox. Any intermediary mailboxes missing from the hierarchy will be created.

Parameters:
ownerID - owner of the mailbox
mailboxName - the name of mailbox to create
Returns:
Mailbox created

renameMailbox

void renameMailbox(Mailbox source,
                   String targetName)
Renames a mailbox.

Parameters:
source - original mailbox
targetName - new name for the mailbox

deleteMailbox

void deleteMailbox(long ownerID,
                   long mailboxID,
                   boolean delete)
Delete or empty a mailbox from store.

Parameters:
ownerID - ID of the user who owns the mailbox
mailboxID - ID of the mailbox
delete - true when delete, false when empty

isSubscribed

boolean isSubscribed(long userID,
                     String mailboxName)
Check if given mailbox is subscribed to user

Parameters:
userID - ID of user
mailboxID - ID of mailbox
Returns:
true if mailbox is subscribed, otherwise false

addSubscription

void addSubscription(long userID,
                     long mailboxID,
                     String mailboxName)
Subscribe the user to the given mailbox.

Parameters:
userID - ID of the user
mailboxID - ID of the mailbox to subscribe

deleteSubscription

void deleteSubscription(long userID,
                        String mailboxName)
Unsubscribes the user from the given mailbox.

Parameters:
mailboxID - ID of the mailbox to unsubscribe

getMessageFetchData

FetchData getMessageFetchData(long uid)

getFlags

javax.mail.Flags getFlags(long uid)

getMessageIDList

List<Long> getMessageIDList(long mailboxID)

addMessage

void addMessage(long ownerID,
                MailMessage message,
                String mailboxName)
Appends a message to the user's INBOX. This method is called by MDA.


appendMessage

void appendMessage(long mailboxID,
                   Date internalDate,
                   javax.mail.Flags flags,
                   File file)
                   throws IOException
Appends a message to this mailbox.

Parameters:
mailboxID - ID of mailbox to append a message
internalDate - the time of addition to be set
flags - optionally set these flags on created message, or null when no additional flags should be set
file - the file containing the mail contents
Throws:
IOException

deleteMessage

void deleteMessage(long uid)
Deletes the given message.

Parameters:
uid - ID of the message to delete

copyMessage

void copyMessage(long uid,
                 long mailboxID)
Copies a message to the given mailbox.

Parameters:
uid - ID of the message to copy
mailboxID - ID of mailbox where message will be copied

resetRecent

void resetRecent(long mailboxID)

setFlags

void setFlags(long uid,
              javax.mail.Flags flags,
              boolean replace,
              boolean set)
Sets flags on this message.

Parameters:
uid - ID of the message to set flags
flags - flags to be set
replace - true if to replace
set - true if to set, false to reset

getHeader

Map<String,String> getHeader(long physMessageID)
Gets the headers of the message.

Parameters:
physMessageID - ID of the physical message
Returns:
map containing header name and value entries

getHeader

Map<String,String> getHeader(long physMessageID,
                             String[] fields)
Gets the headers of the message.

Parameters:
physMessageID - ID of the physical message
fields - Array of fields to retrieve
Returns:
map containing header name and value entries


Copyright © 2011. All Rights Reserved.