|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectutil.PropertyContainer
util.PropertyResources
util.PropertyBundles
stella.AbstractErrorFinalizer
stella.error.MailFinalizer
public class MailFinalizer
Handles error-notification by e-mail. The properties of the finalizer define
whether it may be used for local or remote mail reporting, according to the
error-event follow-ups ErrorEvent.MAIL_LOCAL and
ErrorEvent.MAIL_HOME. Note that the type of error handled is defined
in the KEY_FOLLOWUP property, in principle there is no difference
in mailing to a local or remote person, except that the KEY_TO
fields should differ.
The message sent back has the error event class name in its subject and
the entire message in its body part. The sent date of the mail is set to
the construction time of the error event.
This class relies on the mailin API provided by Sun. Ensure that the required extension, at time of writing mail.jar and activation.jar are in the CLASSPATH.
| Nested Class Summary | |
|---|---|
static class |
MailFinalizer.Test
A class to test mail sending after an error. |
| Nested classes/interfaces inherited from class util.PropertyResources |
|---|
PropertyResources.URLResource |
| Field Summary | |
|---|---|
private static boolean |
DEFDEBUG
The default debuggin mode. |
private static String |
DEFFROM
The default from address. |
private static String |
DEFPASSWORD
Default password name. |
private static String |
DEFSMTPHOST
The default smtphost. |
private static int |
DEFSMTPPORT
The default port. |
private static String |
DEFTO
The default to address. |
private static String |
DEFUSERNAME
Default user name. |
private static boolean |
DEFUSESSL
Default we use ssl. |
private javax.mail.Address |
from
The from-address may not change. |
static String |
KEY_BCC
Address list of the recipients, bcc-type. |
static String |
KEY_CC
Address list of the recipients, cc-type. |
static String |
KEY_DEBUG
If true, mail-delivery is blocked for debugging mode. |
static String |
KEY_FOLLOWUP
One of the two follow-ups a mail finalizer can handle. |
static String |
KEY_FROM
Address of the sender, with or without domain. |
static String |
KEY_TELESCOPE
The issuing telescope. |
static String |
KEY_TO
Address list of the recipients, to-type. |
private Mailer |
mail
The mail-session object used for transporting mails. |
| Fields inherited from class util.PropertyBundles |
|---|
KEY_LOCALECOUNTRY, KEY_LOCALELANGUAGE, KEY_RESOURCEBUNDLES |
| Fields inherited from class util.PropertyResources |
|---|
KEY_NOINITONCREATE, localurl, locate, POSTFIX_DIR, POSTFIX_EXT, POSTFIX_FILE, POSTFIX_LIST, POSTFIX_URL, urlset |
| Fields inherited from class util.PropertyContainer |
|---|
KEY_LISTSEPARATOR, KEY_MAPKEYVALUECHAR, KEY_MAPSEPARATOR |
| Fields inherited from interface util.PropertySupplying |
|---|
CONFIG, KEY_CLASS |
| Fields inherited from interface util.ResourceSupplying |
|---|
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME |
| Constructor Summary | |
|---|---|
MailFinalizer(Map<String,String> prop)
Constructs a new mail-finalizer with the distinct properties. |
|
| Method Summary | |
|---|---|
boolean |
finalizeError(TargetDefinition ignore,
ErrorEvent occur,
CommandLaunching[] servers,
Sequencing dummy,
ParameterClustering set)
Handles a send-mail error follow-up. |
String |
getFollowUp()
Returns the follow-up this finalizer deals with. |
void |
init()
On init, we try to parse the from field. |
boolean |
isFinalizing()
This error finalizer is threadless, so it's finalizeError(stella.TargetDefinition, stella.ErrorEvent, stella.CommandLaunching[], stella.Sequencing, stella.ParameterClustering)
method is blocking. |
| Methods inherited from class stella.AbstractErrorFinalizer |
|---|
createErrorFinalizer, isAborting, setMonitor, wake |
| Methods inherited from class util.PropertyBundles |
|---|
clone, getLocalized, getLocalized, getLocalizedString, getLocalizedString, loadResource |
| Methods inherited from class util.PropertyResources |
|---|
createFrom, createFrom, createFrom, getApplet, getAsResources, getLocalClassLoader, getPropertiesToKey, getPropertiesToKey, getResource, getResourceAsStream, getResourceFromKey, getResources, keyCreate, keyCreate, reload, setApplet |
| Methods inherited from class util.PropertyContainer |
|---|
augment, augment, augment, defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsEnums, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, isNew, parseObject, reload, removeProperty, rescanned, setObject, setProperties, setProperty, stringProperties, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface util.PropertySupplying |
|---|
defaultBoolean, defaultChar, defaultDouble, defaultFloat, defaultInt, defaultLong, defaultObject, defaultObject, defaultProperties, defaultProperty, getAsBoolean, getAsChar, getAsDouble, getAsFloat, getAsInt, getAsList, getAsLong, getAsMap, getAsObject, getAsObject, getProperties, getProperty, has, parseObject, removeProperty, setObject, setProperty, stringProperties |
| Methods inherited from interface util.ResourceSupplying |
|---|
getResource, getResourceAsStream, getResources |
| Field Detail |
|---|
public static final String KEY_TELESCOPE
public static final String KEY_FROM
public static final String KEY_TO
public static final String KEY_CC
public static final String KEY_BCC
public static final String KEY_DEBUG
public static final String KEY_FOLLOWUP
private static final String DEFFROM
private static final String DEFSMTPHOST
private static final int DEFSMTPPORT
private static final boolean DEFUSESSL
private static final String DEFUSERNAME
private static final String DEFPASSWORD
private static final String DEFTO
private static final boolean DEFDEBUG
private Mailer mail
private javax.mail.Address from
| Constructor Detail |
|---|
public MailFinalizer(Map<String,String> prop)
KEY_FOLLOWUP, the KEY_TO and the
#KEY_SMTPHOST are present. The latter key's value is directly
copied to the JavaMail required property mail.smtp.kost.For efficiency, the mail session is initialized at finalizer construction, while the actual mail-transportation is done on error finalizing.
We use my properties to construct the Mailer instance to use.
| Method Detail |
|---|
public void init()
init in interface Initializableinit in class PropertyResourcespublic String getFollowUp()
public boolean finalizeError(TargetDefinition ignore,
ErrorEvent occur,
CommandLaunching[] servers,
Sequencing dummy,
ParameterClustering set)
KEY_TO, KEY_CC, and KEY_BCC
keys, the mail subject is the class name of the error and the mail body
the human-readable part of the error. The mail date is set to the error-
occurence date. If the mail was sent correctly,
true is returned.
public boolean isFinalizing()
finalizeError(stella.TargetDefinition, stella.ErrorEvent, stella.CommandLaunching[], stella.Sequencing, stella.ParameterClustering)
method is blocking. This method always returns false.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||