|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.co.weft.alert.Watcher
uk.co.weft.alert.JDBCWatcher
An agent which watches for changes to a file and sends alerts based on those events. This class is primarily an example of how to use Watcher, although it is of course useful in its own right.
This agent knows about the following tokens which can be uses as either command-line parameters or configuration file properties:
These are in addition to the tokens known by Watcher, q.v.
In the alert context, this agent sets as tokens each of the fieldnames from the watch query, so that the values of these can be substituted into the template. Note that if the query returns fields with names identical to those of watcher tokens, those field values will over-ride the default values. For example, to send email to each email address returned by a query, you should ensure that the email address is returned in a field called mail_to_address.
| Field Summary | |
static java.lang.String |
DBDRIVERTOKEN
names of fields that I am interested in |
static java.lang.String |
DBPASSTOKEN
names of fields that I am interested in |
static java.lang.String |
DBURLTOKEN
names of fields that I am interested in |
static java.lang.String |
DBUSERTOKEN
names of fields that I am interested in |
protected java.lang.String |
driverName
the name of the JDBC driver class I use |
protected java.lang.String |
idField
the name of the field I use to uniquely identify a record |
protected java.lang.String |
mark
the query I run to mark that I've done something |
static java.lang.String |
MARKIDTOKEN
names of fields that I am interested in |
static java.lang.String |
MARKQUERYTOKEN
names of fields that I am interested in |
protected java.lang.String |
pass
the password I use |
protected java.lang.String |
url
the url of the database I watch |
protected java.lang.String |
user
the username I use |
protected java.lang.String |
watch
the query I run to see whether I've anything to do |
static java.lang.String |
WATCHQUERYTOKEN
names of fields that I am interested in |
| Fields inherited from class uk.co.weft.alert.Watcher |
alerter, alerts, configuration, debug, DEBUGTOKEN, ERRORTOKEN, INTERVALTOKEN, name, NAMETOKEN, recipient, resourceBundleName, sender, subject, SUBJECTTOKEN, template, TEMPLATETOKEN, thread, tooManyErrors, TOOMANYERRORS, whinges, winks |
| Constructor Summary | |
JDBCWatcher()
|
|
| Method Summary | |
protected java.util.Vector |
check()
perform a check to see whether the event I am watching for has occurred. |
void |
init(java.util.Map config)
initialise me with this configuration |
static void |
main(java.lang.String[] args)
Test harness only; you're not really expected to run watchers from the command line |
protected boolean |
mark(java.util.Map details)
mark the event indicated by details as having had it's alert sent |
| Methods inherited from class uk.co.weft.alert.Watcher |
coerceToUrl, getAlerts, getArgs, getName, getNextCheck, getResource, getResourceString, getState, getStringWithDefault, getWhinges, grs, grs, maybeCheck, reset, resetWhinges, run, sendAlert, start, stop, usage, whinge |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String DBURLTOKEN
public static final java.lang.String DBDRIVERTOKEN
public static final java.lang.String DBUSERTOKEN
public static final java.lang.String DBPASSTOKEN
public static final java.lang.String WATCHQUERYTOKEN
public static final java.lang.String MARKQUERYTOKEN
public static final java.lang.String MARKIDTOKEN
protected java.lang.String url
protected java.lang.String user
protected java.lang.String pass
protected java.lang.String watch
protected java.lang.String mark
protected java.lang.String idField
protected java.lang.String driverName
| Constructor Detail |
public JDBCWatcher()
| Method Detail |
public void init(java.util.Map config)
throws AlertingException
init in class WatcherAlertingException
protected java.util.Vector check()
throws java.lang.Exception
check in class Watcherjava.lang.Exception
protected boolean mark(java.util.Map details)
throws java.lang.Exception
mark in class Watcherdetails - details of the event seen
java.lang.Exception
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
|
jacquard 1.12.0 by The Web Engineering Factory and Toolworks | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||