Package wt.jmx.core.mbeans
Class Emailer
java.lang.Object
javax.management.StandardMBean
wt.jmx.core.StandardMBean
wt.jmx.core.SelfAwareMBean
wt.jmx.core.mbeans.Emailer
- All Implemented Interfaces:
DynamicMBean,MBeanRegistration,BaseObjectNamed,EmailerMBean,SelfEmailingMBean
This MBean acts as an e-mailing utility service for other MBeans and provides
centralized configuration of MBean e-mailing.
Supported API: true
Extendable: false
Supported API: true
Extendable: false
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceEmailer will call destroy() method on any EmailContentProvider that implements this method.static classConvenience implementation of EmailContentProvider interface for use when the e-mail is to consist of a single, simple body part.static interfaceWrapper interface for e-mail content which allows just-in-time determination of content, i.e.static final classSimple implementation of EmailContentProvider which returns a predesignated Multipart object.static final classSpecialization of EmailBodyProvider for text whose type and contents are known at time of construction. -
Method Summary
Modifier and TypeMethodDescriptionvoidemailTextFile(File file, String addressesOrEmailList, String subject, long maxLines, long maxChars) E-mail last portion of text file
Supported API: truevoidemailZipOfFiles(URL baseURL, URL[] urls, String addressesOrEmailList, String subject) E-mail zip of files.static EmailergetInstance(StandardMBean mbeanContext, boolean throwExceptionOnNoInstance) Return the Emailer associated by MBeanLoader with 'mbeanContext' or the Emailer started and still not stopped within this classloader.voidsendEmail(jakarta.mail.internet.InternetAddress[] recipients, String subject, Emailer.EmailContentProvider contents) Send e-mail to array of e-mail addresses
Supported API: truevoidsendEmail(jakarta.mail.internet.InternetAddress[] recipients, String subject, Emailer.EmailContentProvider contents, String fromAddress) Send e-mail to array of e-mail addresses
Supported API: truevoidsendEmail(String toEmailAddresses, String subject, Emailer.EmailContentProvider contents) Send e-mail to a list of e-mail addresses
Supported API: truevoidsendEmailToAddressesOrList(String addressesOrEmailList, String subject, Emailer.EmailContentProvider contents) Send e-mail to an e-mail address or list
Supported API: truevoidsendEmailToList(String toEmailListName, String subject, Emailer.EmailContentProvider contents) Send e-mail to e-mail list
Supported API: trueMethods inherited from class wt.jmx.core.SelfAwareMBean
deregister, destroy, getBaseObjectName, getObjectName, getObjectNameOnPreRegister, getOwnerMBean, getSelfAwareMBean, init, isInited, isRegistered, isStarted, onDestroy, onInit, postDeregister, postRegister, preDeregister, preRegister, register, register, register, resetObjectName, setOwnerMBean, start, stopMethods inherited from class wt.jmx.core.StandardMBean
cacheMBeanInfo, cacheMBeanInfoInInstance, createMBeanInfo, emailThisMBean, getAttributes, getCachedInstanceMBeanInfo, getCachedMBeanInfo, getDescription, getDescription, getDescription, getDescription, getImpact, getMBeanInfo, getParameterName, setAttributesMethods inherited from class javax.management.StandardMBean
getAttribute, getClassName, getConstructors, getDescription, getDescription, getDescription, getImplementation, getImplementationClass, getMBeanInterface, getParameterName, invoke, setAttribute, setImplementationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface wt.jmx.core.mbeans.SelfEmailingMBean
emailThisMBean
-
Method Details
-
getInstance
Return the Emailer associated by MBeanLoader with 'mbeanContext' or the Emailer started and still not stopped within this classloader.
Supported API: true- Parameters:
mbeanContext- MBean to use as a lookup context for the given MBean (currently ignored unless SelfAwareMBean)throwExceptionOnNoInstance- Whether a NullPointerException should be thrown when no started instance is available
-
sendEmailToAddressesOrList
public void sendEmailToAddressesOrList(String addressesOrEmailList, String subject, Emailer.EmailContentProvider contents) throws IllegalArgumentException Send e-mail to an e-mail address or list
Supported API: true- Parameters:
addressesOrEmailList- List of e-mail addresses or name of e-mail list to send e-mail tosubject- Subject of e-mailcontents- Contents of e-mail- Throws:
IllegalArgumentException
-
sendEmail
public void sendEmail(String toEmailAddresses, String subject, Emailer.EmailContentProvider contents) throws IllegalArgumentException Send e-mail to a list of e-mail addresses
Supported API: true- Parameters:
toEmailAddresses- List of e-mail addresses to send e-mail tosubject- Subject of e-mailcontents- Contents of e-mail- Throws:
IllegalArgumentException
-
sendEmailToList
public void sendEmailToList(String toEmailListName, String subject, Emailer.EmailContentProvider contents) throws IllegalArgumentException Send e-mail to e-mail list
Supported API: true- Parameters:
toEmailListName- E-mail list to send e-mail tosubject- Subject of e-mailcontents- Contents of e-mail- Throws:
IllegalArgumentException
-
sendEmail
public void sendEmail(jakarta.mail.internet.InternetAddress[] recipients, String subject, Emailer.EmailContentProvider contents) throws IllegalArgumentException Send e-mail to array of e-mail addresses
Supported API: true- Parameters:
recipients- Array of e-mail addresses to send e-mail tosubject- Subject of e-mailcontents- Contents of e-mail- Throws:
IllegalArgumentException
-
sendEmail
public void sendEmail(jakarta.mail.internet.InternetAddress[] recipients, String subject, Emailer.EmailContentProvider contents, String fromAddress) throws IllegalArgumentException Send e-mail to array of e-mail addresses
Supported API: true- Parameters:
recipients- Array of e-mail addresses to send e-mail tosubject- Subject of e-mailcontents- Contents of e-mailfromAddress- From address for this e-mail; will use FromAddress attribute if this is null/unspecified- Throws:
IllegalArgumentException- if recipients is null, empty, or unacceptable to jakarta.mail
-
emailZipOfFiles
public void emailZipOfFiles(URL baseURL, URL[] urls, String addressesOrEmailList, String subject) throws IOException E-mail zip of files.
Supported API: true- Parameters:
baseURL- Base URL which jar entry names are formed relative to, must be parent URL to all other URLs specifiedurls- URLs of filesaddressesOrEmailList- List of e-mail addresses or name of e-mail list to send e-mail tosubject- Subject to give e-mail- Throws:
IOException
-
emailTextFile
public void emailTextFile(File file, String addressesOrEmailList, String subject, long maxLines, long maxChars) throws IOException E-mail last portion of text file
Supported API: true- Parameters:
file- File to e-mailaddressesOrEmailList- List of e-mail addresses or name of e-mail list to send e-mail tosubject- Subject to give e-mailmaxLines- Maximum number of lines to include; non-positive numbers imply no limitmaxChars- Maximum number of characters to include; non-positive numbers imply no limit- Throws:
IOException
-