com.google.appengine.api.mail.dev
Class LocalMailService
- java.lang.Object
-
- AbstractLocalRpcService
-
- com.google.appengine.api.mail.dev.LocalMailService
-
public final class LocalMailService extends AbstractLocalRpcService
Stub implementation of the Google App Engine mail api. This implementation logs messages using aLogger
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);
getSentMessages()
and clear the list viaclearSentMessages()
. By default, messages are logged atLevel.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. SeeLOG_MAIL_BODY_PROPERTY
andLOG_MAIL_LEVEL_PROPERTY
for more information.
-
-
Field Summary
Fields Modifier and Type Field and Description 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 theLevel
at which we log mail messages.static java.lang.String
PACKAGE
The package name for this service.
-
Constructor Summary
Constructors Constructor and Description LocalMailService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description 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()
-
-
-
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 eitherBoolean.TRUE
orBoolean.FALSE
.- See Also:
- Constant Field Values
-
LOG_MAIL_LEVEL_PROPERTY
public static final java.lang.String LOG_MAIL_LEVEL_PROPERTY
Init property that specifies theLevel
at which we log mail messages. Value must be a string representation of aLevel
(callingLevel.parse(String)
with the value as the arg should return a valid instance).- See Also:
- Constant Field Values
-
-
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()
-
-