com.google.appengine.api.mail.dev
Class LocalMailService

java.lang.Object
  extended by AbstractLocalRpcService
      extended by com.google.appengine.api.mail.dev.LocalMailService

@ServiceProvider(value=)
public final class LocalMailService
extends AbstractLocalRpcService

Stub implementation of the Google App Engine mail api. This implementation logs messages using a Logger associated with this class and keeps messages that were sent in memory. If you want to access the list of sent messages you can get ahold of the registered LocalMailService instance as follows:

 ApiProxyLocal proxy = (ApiProxyLocal) ApiProxy.getDelegate();
 LocalMailService mailService =
     (LocalMailService)delegate.getService(LocalMailService.PACKAGE);
 
You can then access the list via getSentMessages() and clear the list via clearSentMessages(). By default, messages are logged at Level.INFO and the body of the message is excluded. The log level and whether or not the body of the message is logged can be configured. See LOG_MAIL_BODY_PROPERTY and LOG_MAIL_LEVEL_PROPERTY for more information.


Field Summary
static java.lang.String LOG_MAIL_BODY_PROPERTY
          Init property that determines whether or not we log the body of the email.
static java.lang.String LOG_MAIL_LEVEL_PROPERTY
          Init property that specifies the Level at which we log mail messages.
static java.lang.String PACKAGE
          The package name for this service.
 
Constructor Summary
LocalMailService()
           
 
Method Summary
 void clearSentMessages()
          Clear the list of sent messages.
 java.lang.Integer getMaxApiRequestSize()
           
 java.lang.String getPackage()
           
 java.util.List<MailServicePb.MailMessage> getSentMessages()
           
 void init(LocalServiceContext context, java.util.Map<java.lang.String,java.lang.String> properties)
           
 ApiBasePb.VoidProto send(Status status, MailServicePb.MailMessage msg)
           
 ApiBasePb.VoidProto sendToAdmins(Status status, MailServicePb.MailMessage msg)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PACKAGE

public static final java.lang.String PACKAGE
The package name for this service.

See Also:
Constant Field Values

LOG_MAIL_BODY_PROPERTY

public static final java.lang.String LOG_MAIL_BODY_PROPERTY
Init property that determines whether or not we log the body of the email. Value must be a string representation of either Boolean.TRUE or Boolean.FALSE.

See Also:
Constant Field Values

LOG_MAIL_LEVEL_PROPERTY

public static final java.lang.String LOG_MAIL_LEVEL_PROPERTY
Init property that specifies the Level at which we log mail messages. Value must be a string representation of a Level (calling Level.parse(String) with the value as the arg should return a valid instance).

See Also:
Constant Field Values
Constructor Detail

LocalMailService

public LocalMailService()
Method Detail

getPackage

public java.lang.String getPackage()

init

public void init(LocalServiceContext context,
                 java.util.Map<java.lang.String,java.lang.String> properties)

start

public void start()

stop

public void stop()

send

public ApiBasePb.VoidProto send(Status status,
                                MailServicePb.MailMessage msg)

sendToAdmins

public ApiBasePb.VoidProto sendToAdmins(Status status,
                                        MailServicePb.MailMessage msg)

getSentMessages

public java.util.List<MailServicePb.MailMessage> getSentMessages()
Returns:
A list of all messages that have been sent.

clearSentMessages

public void clearSentMessages()
Clear the list of sent messages.


getMaxApiRequestSize

public java.lang.Integer getMaxApiRequestSize()