ePOST API

rice.email.proxy.mailbox.postbox
Class PostMailbox

java.lang.Object
  extended by rice.email.proxy.mailbox.postbox.PostMailbox
All Implemented Interfaces:
Mailbox

public class PostMailbox
extends java.lang.Object
implements Mailbox

This class serves as the main "glue" code between foedus and the POST-based email implementation.


Field Summary
protected  EmailService email
           
static java.lang.String HIERARCHY_DELIMITER
           
protected  PostFolder root
           
 
Constructor Summary
PostMailbox(EmailService email, Folder root, Environment env)
          Constructs a PostMailbox given an emailservice to run off of.
 
Method Summary
 void createFolder(java.lang.String name)
          Creates a folder with the given name.
 void deleteFolder(java.lang.String name)
          Deletes the folder associated with the given name.
 MailFolder getFolder(java.lang.String name)
          Fetches a given folder name.
 java.lang.String getHierarchyDelimiter()
          Returns the hierarchy delimiter used by this mailbox
 MailFolder getRootFolder()
          Returns the root folder of the user's mailbox.
protected  MailFolder[] listFolders()
          Lists all folders
 MailFolder[] listFolders(java.lang.String pattern)
          Lists all folders which match the provided pattern
 java.lang.String[] listSubscriptions(java.lang.String pattern)
           
 void put(MovingMessage msg)
          Adds the given message to this folder
 void renameFolder(java.lang.String old_name, java.lang.String new_name)
          Renames the given folder to the new name.
 void subscribe(java.lang.String fullName)
           
 void unsubscribe(java.lang.String fullName)
           
protected  void walk(PostFolder folder, java.util.Vector result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

email

protected EmailService email

root

protected PostFolder root

HIERARCHY_DELIMITER

public static java.lang.String HIERARCHY_DELIMITER
Constructor Detail

PostMailbox

public PostMailbox(EmailService email,
                   Folder root,
                   Environment env)
            throws MailboxException
Constructs a PostMailbox given an emailservice to run off of.

Parameters:
email - The email service on the local pastry node.
Throws:
MailboxException
Method Detail

getHierarchyDelimiter

public java.lang.String getHierarchyDelimiter()
Returns the hierarchy delimiter used by this mailbox

Specified by:
getHierarchyDelimiter in interface Mailbox
Returns:
The hierarchy delimiter

getRootFolder

public MailFolder getRootFolder()
                         throws MailboxException
Returns the root folder of the user's mailbox. Note that this method blocks while fetching the folder.

Returns:
The root folder.
Throws:
MailboxException - If an error occurs.

put

public void put(MovingMessage msg)
         throws MailboxException
Adds the given message to this folder

Specified by:
put in interface Mailbox
Parameters:
msg - The message to add
Throws:
MailboxException

createFolder

public void createFolder(java.lang.String name)
                  throws MailboxException
Creates a folder with the given name. If the name contains the heirarchy character, it is interpreted as a hierchy and any necessary folders are created, too.

Specified by:
createFolder in interface Mailbox
Parameters:
folder - The name to create
Throws:
MailboxException

getFolder

public MailFolder getFolder(java.lang.String name)
                     throws MailboxException
Fetches a given folder name. This name can represent a hierarhy, if it contains the hierarhy delimiting character.

Specified by:
getFolder in interface Mailbox
Parameters:
name - The name of the folder
Returns:
The specificed MailFolder.
Throws:
MailboxException

listFolders

protected MailFolder[] listFolders()
                            throws MailboxException
Lists all folders

Returns:
All available folders
Throws:
MailboxException

listFolders

public MailFolder[] listFolders(java.lang.String pattern)
                         throws MailboxException
Lists all folders which match the provided pattern

Specified by:
listFolders in interface Mailbox
Parameters:
pattern - The pattern to match against
Returns:
The folders which match
Throws:
MailboxException

renameFolder

public void renameFolder(java.lang.String old_name,
                         java.lang.String new_name)
                  throws MailboxException
Renames the given folder to the new name. If the new name represents a hierarchy, any necessary folders are automatically created.

Specified by:
renameFolder in interface Mailbox
Parameters:
old_name - The current name
new_name - The new name
Throws:
MailboxException

deleteFolder

public void deleteFolder(java.lang.String name)
                  throws MailboxException
Deletes the folder associated with the given name. If the folder has child folders, a MailboxException is thrown.

Specified by:
deleteFolder in interface Mailbox
Parameters:
name - The name of the folder to delete
Throws:
MailboxException

walk

protected void walk(PostFolder folder,
                    java.util.Vector result)
             throws MailboxException
Throws:
MailboxException

subscribe

public void subscribe(java.lang.String fullName)
               throws MailboxException
Specified by:
subscribe in interface Mailbox
Throws:
MailboxException

unsubscribe

public void unsubscribe(java.lang.String fullName)
                 throws MailboxException
Specified by:
unsubscribe in interface Mailbox
Throws:
MailboxException

listSubscriptions

public java.lang.String[] listSubscriptions(java.lang.String pattern)
                                     throws MailboxException
Specified by:
listSubscriptions in interface Mailbox
Throws:
MailboxException

ePOST API

Copyright © 2001-2005 - Rice Pastry.