Class LocalMailService
java.lang.Object
com.google.appengine.tools.development.AbstractLocalRpcService
com.google.appengine.api.mail.dev.LocalMailService
- All Implemented Interfaces:
LocalRpcService
@AutoService(LocalRpcService.class)
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) proxy.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.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.appengine.tools.development.LocalRpcService
LocalRpcService.Status -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the list of sent messages.Returns the maximum size of an encoded API request in bytes, ornullfor the default size.Returns the package for the service, for example, "datastore_v3".List<com.google.appengine.api.mail.MailServicePb.MailMessage> voidinit(LocalServiceContext context, Map<String, String> properties) Initializes the service with a set of configuration properties.com.google.apphosting.base.protos.api.ApiBasePb.VoidProtosend(LocalRpcService.Status status, com.google.appengine.api.mail.MailServicePb.MailMessage msg) com.google.apphosting.base.protos.api.ApiBasePb.VoidProtosendToAdmins(LocalRpcService.Status status, com.google.appengine.api.mail.MailServicePb.MailMessage msg) voidstart()Puts a new service into "serving" mode.voidstop()Stops the service, releasing all of its resources.Methods inherited from class com.google.appengine.tools.development.AbstractLocalRpcService
getDefaultDeadline, getMaximumDeadline
-
Field Details
-
PACKAGE
The package name for this service.- See Also:
-
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.TRUEorBoolean.FALSE.- See Also:
-
LOG_MAIL_LEVEL_PROPERTY
Init property that specifies theLevelat 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:
-
-
Constructor Details
-
LocalMailService
public LocalMailService()
-
-
Method Details
-
getPackage
Description copied from interface:LocalRpcServiceReturns the package for the service, for example, "datastore_v3".- Returns:
- a not
nullpackage name.
-
init
Description copied from interface:LocalRpcServiceInitializes the service with a set of configuration properties. Must be called before a service isstarted.- Specified by:
initin interfaceLocalRpcService- Overrides:
initin classAbstractLocalRpcService- Parameters:
context- A context object for the applicationproperties- A read-onlyMapof properties.
-
start
public void start()Description copied from interface:LocalRpcServicePuts a new service into "serving" mode. Aside from setting properties, the service is not functional until after having been started.- Specified by:
startin interfaceLocalRpcService- Overrides:
startin classAbstractLocalRpcService
-
stop
public void stop()Description copied from interface:LocalRpcServiceStops the service, releasing all of its resources.- Specified by:
stopin interfaceLocalRpcService- Overrides:
stopin classAbstractLocalRpcService
-
send
public com.google.apphosting.base.protos.api.ApiBasePb.VoidProto send(LocalRpcService.Status status, com.google.appengine.api.mail.MailServicePb.MailMessage msg) -
sendToAdmins
public com.google.apphosting.base.protos.api.ApiBasePb.VoidProto sendToAdmins(LocalRpcService.Status status, com.google.appengine.api.mail.MailServicePb.MailMessage msg) -
getSentMessages
- Returns:
- A list of all messages that have been sent.
-
clearSentMessages
public void clearSentMessages()Clear the list of sent messages. -
getMaxApiRequestSize
Description copied from interface:LocalRpcServiceReturns the maximum size of an encoded API request in bytes, ornullfor the default size.- Specified by:
getMaxApiRequestSizein interfaceLocalRpcService- Overrides:
getMaxApiRequestSizein classAbstractLocalRpcService
-