ePOST API

rice.email
Class EmailService

java.lang.Object
  extended by java.util.Observable
      extended by rice.post.PostClient
          extended by rice.email.EmailService

public class EmailService
extends PostClient

This class serves as the entry point into the email service written on top of Post. The EmailService uses the observer pattern to notify other objects of newly received emails. The event generated will contain an Email object as its argument.

Version:
$Id: pretty.settings,v 1.1 2003/07/10 02:18:11 amislove Exp $
Author:
Alan Mislove

Field Summary
static java.lang.String INBOX_NAME
          the name of the Inbox's log
protected  Logger logger
           
 
Constructor Summary
EmailService(java.net.InetAddress localHost, Post post, java.security.KeyPair keyPair, boolean logRewrite)
          Constructor
 
Method Summary
 void addSubscription(java.lang.String sub, Continuation command)
          Adds a subscriptions to the log
 void expand(PostUserAddress[] list, SmtpManager manager, Continuation command)
          Method which expands the given list of PostUserAddresses by recursively checking for forwarding lists
 void getContentHashReferences(Continuation command)
          This method is periodically invoked by Post in order to get a list of all handles under which the application has live objects.
 java.net.InetAddress getLocalHost()
           
 void getLogs(Continuation command)
          This method is periodically invoked by Post in order to get a list of all mutable data which the application is interested in.
 Post getPost()
           
 void getRootFolder(Continuation command)
          Returns the Log for ePost's root folder.
 void getSubscriptions(Continuation command)
          Returns the list of subscriptions in the log
 void notificationReceived(NotificationMessage nm, Continuation command)
          This method is how the Post layer informs the EmailService layer that there is an incoming notification of new email.
 void removeSubscription(java.lang.String sub, Continuation command)
          Adds a subscriptions to the log
 void sendMessage(Email email, Continuation command)
          Sends the email to the recipient.
 void setInbox(Folder folder)
          Reset the inbox folder to be a different folder.
 
Methods inherited from class rice.post.PostClient
getAddress
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INBOX_NAME

public static final java.lang.String INBOX_NAME
the name of the Inbox's log

See Also:
Constant Field Values

logger

protected Logger logger
Constructor Detail

EmailService

public EmailService(java.net.InetAddress localHost,
                    Post post,
                    java.security.KeyPair keyPair,
                    boolean logRewrite)
Constructor

Parameters:
post - The Post service to use
keyPair - The keyPair of the local user
Method Detail

getPost

public Post getPost()
Returns:
the post object this serivce is using.

setInbox

public void setInbox(Folder folder)
Reset the inbox folder to be a different folder. This should be done only if you know what you're doing.

Parameters:
folder - The new inbox

getRootFolder

public void getRootFolder(Continuation command)
Returns the Log for ePost's root folder.

Parameters:
command - is the object notified of the result of the folder retrieval.

expand

public void expand(PostUserAddress[] list,
                   SmtpManager manager,
                   Continuation command)
Method which expands the given list of PostUserAddresses by recursively checking for forwarding lists

Parameters:
list - The list
command - The command to return the result to (a String[])

sendMessage

public void sendMessage(Email email,
                        Continuation command)
                 throws PostException
Sends the email to the recipient. The Email object has a notion of who its recipients are.

Parameters:
email - The email to send
command - is the object that will be notified of errors that occur during the send procedure, or Boolean(true) if it succeeds.
Throws:
PostException - DESCRIBE THE EXCEPTION

notificationReceived

public void notificationReceived(NotificationMessage nm,
                                 Continuation command)
This method is how the Post layer informs the EmailService layer that there is an incoming notification of new email.

Specified by:
notificationReceived in class PostClient
Parameters:
nm - The incoming notification.
command - THe command to return whether or not the notification should be accepted (Boolean true or false)

getContentHashReferences

public void getContentHashReferences(Continuation command)
This method is periodically invoked by Post in order to get a list of all handles under which the application has live objects. This used to implement the garbage collection service, thus, the application must ensure that all data which it is still interested in is returned. The applications should return a ContentHashReference[] containing all of the handles The application is still interested in to the provided continatuion.

Specified by:
getContentHashReferences in class PostClient

getLogs

public void getLogs(Continuation command)
This method is periodically invoked by Post in order to get a list of all mutable data which the application is interested in. The applications should return a Log[] containing all of the data The application is still interested in to the provided continatuion.

Specified by:
getLogs in class PostClient

getSubscriptions

public void getSubscriptions(Continuation command)
Returns the list of subscriptions in the log


addSubscription

public void addSubscription(java.lang.String sub,
                            Continuation command)
Adds a subscriptions to the log

Parameters:
sub - The subscription to add

removeSubscription

public void removeSubscription(java.lang.String sub,
                               Continuation command)
Adds a subscriptions to the log

Parameters:
sub - The subscription to add

getLocalHost

public java.net.InetAddress getLocalHost()
Returns:
the localHost

ePOST API

Copyright © 2001-2005 - Rice Pastry.