stella.log
Class OffLimitMailer

java.lang.Object
  extended by util.PropertyContainer
      extended by util.PropertyResources
          extended by util.PropertyBundles
              extended by util.Mailer
                  extended by stella.log.OffLimitMailer
All Implemented Interfaces:
Cloneable, Initializable, LocalizedSupplying, PropertySupplying, ResourceSupplying

public class OffLimitMailer
extends Mailer

This class sends a mail to the administrator if certain values are really out-of-bounds.


Nested Class Summary
 
Nested classes/interfaces inherited from class util.Mailer
Mailer.Google
 
Nested classes/interfaces inherited from class util.PropertyResources
PropertyResources.URLResource
 
Field Summary
private  Map<String,Double> avalert
          Average alerts.
private static String DEFAVERAGELIMITS
          The list of column names to value-pairs denoting average limits.
private static String DEFAVORDER
          Default order in the average output.
private static String DEFAVTELLIMITS
           
private static boolean DEFDEBUG
          The default debuggin mode.
private static String DEFDONELIST
          The fields to query from the env table.
private static String DEFDONENAMES
          How the returned columns are named.
private static String DEFDONEWHERE
          Additional constraints for the done table query.
private static String DEFENVLIST
          Properties for the offlimit alarm.
static String DEFFROM
          The default from address.
private static String DEFJOINTLIST
          The fields to query from the env table.
private static String DEFJOINTNAMES
          How the returned columns are named.
private static String DEFJOINTWHERE
          Additional constraints for the joint table query.
private static String DEFMINMAXORDER
          Default order in the average output.
private static String DEFMINMAXTELS
          The list of column names to value-pairs denoting min/max limits.
private static String DEFOBSLIST
           
private static String DEFPASSWORD
          Default password name.
private static String DEFSIGMALIMITS
          The list of column names to single value denoting max deviations.
private static String DEFSIGMAORDER
          Default order in the average output.
private static String DEFSMTPHOST
          The default smtphost.
private static int DEFSMTPPORT
          The default port.
private static String DEFTELESCOPE
          The telescope query.
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_AVERAGELIMITS
          The list of column names to value-pairs denoting average limits.
static String KEY_AVORDER
          How we order the list of average offenders in the mail.
static String KEY_AVTELLIMITS
          The list of column names to value-pairs denoting average limits.
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_FROM
          Address of the sender, with or without domain.
static String KEY_MINMAXORDER
          How we order the list of minmaxerage offenders in the mail.
static String KEY_MINMAXTELS
          The list of column names to value-pairs denoting min/max limits.
static String KEY_SIGMALIMITS
          The list of column names to single value denoting max deviations.
static String KEY_SIGMAORDER
          How we order the list of average offenders in the mail.
static String KEY_SPANLIMITS
          The list of column names to single value denoting max spans.
static String KEY_TO
          Address list of the recipients, to-type.
private  Map<String,Double> mmalert
          Min/max alerts.
private  Map<String,Double> sigalert
          Sigma alerts.
 
Fields inherited from class util.Mailer
KEY_PASSWORD, KEY_SMTPHOST, KEY_SMTPPORT, KEY_USERNAME, KEY_USESSL, STELLAMAINTENANCE, STELLAROBOTIC
 
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.ResourceSupplying
KEY_URLRESOURCES, KEY_URLUSECONFIG, KEY_URLUSECURRENT, KEY_URLUSEHOME
 
Fields inherited from interface util.PropertySupplying
CONFIG, KEY_CLASS
 
Constructor Summary
OffLimitMailer(Map<String,String> prop)
          Constructs a new mail-finalizer with the distinct properties.
 
Method Summary
private static void addToMapping(Map<String,Double> target, String tel, Map<String,Double> off)
          We add a mapping for a specific telescope to the average offender mapping by augmenting the search key by the telescope name as a colon-separated pre-key.
 boolean gather(Date now)
          Gathers the db-data.
 void init()
          On init, we try to parse the from field.
static void main(String[] arg)
          Does an alert report for the current day.
private  boolean sendWarning(Date now)
          Sends mail reports.
 
Methods inherited from class util.Mailer
close, createStellaRoboticMailer, getAddresses, getStellaMaintenance, getStellaRobotic, prepareMail, sendMail, sendMail, threadMail
 
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.ResourceSupplying
getResource, getResourceAsStream, getResources
 
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
 

Field Detail

KEY_FROM

public static final String KEY_FROM
Address of the sender, with or without domain. Follow RFC822 syntax.

See Also:
Constant Field Values

KEY_TO

public static final String KEY_TO
Address list of the recipients, to-type. With or without domain.

See Also:
Constant Field Values

KEY_CC

public static final String KEY_CC
Address list of the recipients, cc-type. With or without domain.

See Also:
Constant Field Values

KEY_BCC

public static final String KEY_BCC
Address list of the recipients, bcc-type. With or without domain.

See Also:
Constant Field Values

KEY_DEBUG

public static final String KEY_DEBUG
If true, mail-delivery is blocked for debugging mode.

See Also:
Constant Field Values

KEY_AVORDER

public static final String KEY_AVORDER
How we order the list of average offenders in the mail.

See Also:
Constant Field Values

KEY_MINMAXORDER

public static final String KEY_MINMAXORDER
How we order the list of minmaxerage offenders in the mail.

See Also:
Constant Field Values

KEY_SIGMAORDER

public static final String KEY_SIGMAORDER
How we order the list of average offenders in the mail.

See Also:
Constant Field Values

KEY_AVTELLIMITS

public static final String KEY_AVTELLIMITS
The list of column names to value-pairs denoting average limits.

See Also:
Constant Field Values

KEY_AVERAGELIMITS

public static final String KEY_AVERAGELIMITS
The list of column names to value-pairs denoting average limits.

See Also:
Constant Field Values

KEY_MINMAXTELS

public static final String KEY_MINMAXTELS
The list of column names to value-pairs denoting min/max limits.

See Also:
Constant Field Values

KEY_SIGMALIMITS

public static final String KEY_SIGMALIMITS
The list of column names to single value denoting max deviations.

See Also:
Constant Field Values

KEY_SPANLIMITS

public static final String KEY_SPANLIMITS
The list of column names to single value denoting max spans.

See Also:
Constant Field Values

DEFFROM

public static final String DEFFROM
The default from address.

See Also:
Constant Field Values

DEFSMTPHOST

private static final String DEFSMTPHOST
The default smtphost.

See Also:
Constant Field Values

DEFSMTPPORT

private static final int DEFSMTPPORT
The default port.

See Also:
Constant Field Values

DEFUSESSL

private static final boolean DEFUSESSL
Default we use ssl.

See Also:
Constant Field Values

DEFUSERNAME

private static final String DEFUSERNAME
Default user name.

See Also:
Constant Field Values

DEFPASSWORD

private static final String DEFPASSWORD
Default password name.

See Also:
Constant Field Values

DEFTO

private static final String DEFTO
The default to address.

See Also:
Constant Field Values

DEFDEBUG

private static final boolean DEFDEBUG
The default debuggin mode.

See Also:
Constant Field Values

DEFENVLIST

private static final String DEFENVLIST
Properties for the offlimit alarm.

See Also:
Constant Field Values

DEFOBSLIST

private static final String DEFOBSLIST
See Also:
Constant Field Values

DEFDONELIST

private static final String DEFDONELIST
The fields to query from the env table. May include expressions.

See Also:
Constant Field Values

DEFDONENAMES

private static final String DEFDONENAMES
How the returned columns are named. Can be null.

See Also:
Constant Field Values

DEFDONEWHERE

private static final String DEFDONEWHERE
Additional constraints for the done table query.

See Also:
Constant Field Values

DEFJOINTLIST

private static final String DEFJOINTLIST
The fields to query from the env table. May include expressions.

See Also:
Constant Field Values

DEFJOINTNAMES

private static final String DEFJOINTNAMES
How the returned columns are named. Can be null.

See Also:
Constant Field Values

DEFJOINTWHERE

private static final String DEFJOINTWHERE
Additional constraints for the joint table query.

See Also:
Constant Field Values

DEFTELESCOPE

private static final String DEFTELESCOPE
The telescope query.

See Also:
Constant Field Values

DEFAVERAGELIMITS

private static final String DEFAVERAGELIMITS
The list of column names to value-pairs denoting average limits.

See Also:
Constant Field Values

DEFAVTELLIMITS

private static final String DEFAVTELLIMITS
See Also:
Constant Field Values

DEFMINMAXTELS

private static final String DEFMINMAXTELS
The list of column names to value-pairs denoting min/max limits.

See Also:
Constant Field Values

DEFSIGMALIMITS

private static final String DEFSIGMALIMITS
The list of column names to single value denoting max deviations.

See Also:
Constant Field Values

DEFAVORDER

private static final String DEFAVORDER
Default order in the average output.

See Also:
Constant Field Values

DEFMINMAXORDER

private static final String DEFMINMAXORDER
Default order in the average output.

See Also:
Constant Field Values

DEFSIGMAORDER

private static final String DEFSIGMAORDER
Default order in the average output.

See Also:
Constant Field Values

from

private javax.mail.Address from
The from-address may not change.


avalert

private Map<String,Double> avalert
Average alerts.


mmalert

private Map<String,Double> mmalert
Min/max alerts.


sigalert

private Map<String,Double> sigalert
Sigma alerts.

Constructor Detail

OffLimitMailer

public OffLimitMailer(Map<String,String> prop)
Constructs a new mail-finalizer with the distinct properties. Make sure that the #KEY_FOLLOWUP, the KEY_TO and the Mailer.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

init

public void init()
On init, we try to parse the from field. If that fails, we throw an IllegalArgumentException. We do not check, if a to-field exists, this is checked during error finalizing.

Specified by:
init in interface Initializable
Overrides:
init in class Mailer

gather

public boolean gather(Date now)
Gathers the db-data.


addToMapping

private static final void addToMapping(Map<String,Double> target,
                                       String tel,
                                       Map<String,Double> off)
We add a mapping for a specific telescope to the average offender mapping by augmenting the search key by the telescope name as a colon-separated pre-key.


sendWarning

private boolean sendWarning(Date now)
Sends mail reports.


main

public static void main(String[] arg)
Does an alert report for the current day.