org.xmlBlaster.contrib.dbwatcher.plugin
Class DbWatcherPlugin
java.lang.Object
org.xmlBlaster.contrib.GlobalInfo
org.xmlBlaster.contrib.dbwatcher.plugin.DbWatcherPlugin
- All Implemented Interfaces:
- I_Info, I_Plugin
public class DbWatcherPlugin
- extends GlobalInfo
DbWatcherPlugin is a plugin wrapper if you want to run DbWatcher inside xmlBlaster.
DbWatcher checks a database for changes and publishes these to the MoM
This plugin needs to be registered in xmlBlasterPlugins.xml
to be available on xmlBlaster server startup.
<plugin id='DbWatcherPlugin.TEST_TS' className='org.xmlBlaster.contrib.dbwatcher.plugin.DbWatcherPlugin'>
<attribute id='jdbc.drivers'>oracle.jdbc.driver.OracleDriver</attribute>
<attribute id='db.url'>${db.url}</attribute>
<attribute id='db.user'>${db.user}</attribute>
<attribute id='db.password'>${db.password}</attribute>
<attribute id='db.queryMeatStatement'>SELECT * FROM TEST_TS WHERE TO_CHAR(ts, 'YYYY-MM-DD HH24:MI:SSXFF') > '${oldTimestamp}' ORDER BY ICAO_ID</attribute>
<attribute id='mom.topicName'>db.change.event.${groupColValue}</attribute>
<attribute id='mom.loginName'>dbWatcher/3</attribute>
<attribute id='mom.password'>secret</attribute>
<attribute id='mom.alertSubscribeKey'><key oid=''/></attribute>
<attribute id='mom.alertSubscribeQos'><qos/></attribute>
<attribute id='changeDetector.class'>org.xmlBlaster.contrib.dbwatcher.detector.TimestampChangeDetector</attribute>
<attribute id='alertScheduler.pollInterval'>10000</attribute>
<attribute id='changeDetector.groupColName'>ICAO_ID</attribute>
<attribute id='changeDetector.detectStatement'>SELECT MAX(TO_CHAR(ts, 'YYYY-MM-DD HH24:MI:SSXFF')) FROM TEST_TS</attribute>
<attribute id='converter.class'>org.xmlBlaster.contrib.dbwatcher.convert.ResultSetToXmlConverter</attribute>
<attribute id='converter.addMeta'>true</attribute>
<attribute id='transformer.class'></attribute>
<action do='LOAD' onStartupRunlevel='9' sequence='6' onFail='resource.configuration.pluginFailed'/>
<action do='STOP' onShutdownRunlevel='6' sequence='5'/>
</plugin>
This plugin uses java.util.logging and redirects the logging to xmlBlasters default
logging framework. You can switch this off by setting the attribute xmlBlaster/jdk14loggingCapture to false.
- Author:
- Marcel Ruff
Constructor Summary |
DbWatcherPlugin()
Default constructor, you need to call init() thereafter. |
Methods inherited from class org.xmlBlaster.contrib.GlobalInfo |
dump, get, getBoolean, getGlobal, getInt, getKeys, getLong, getObject, getObjectKeys, getOriginalGlobal, getRaw, getStrippedString, getType, getVersion, init, loadPlugin, put, putObject, putRaw, replaceAllEntries, setStrippedHostname |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static java.util.logging.Logger log
dbWatcher
private DbWatcher dbWatcher
DbWatcherPlugin
public DbWatcherPlugin()
- Default constructor, you need to call init() thereafter.
doInit
protected void doInit(Global global_,
PluginInfo pluginInfo)
throws XmlBlasterException
- Specified by:
doInit
in class GlobalInfo
- Parameters:
global_
- The global passed by the RunLevelManager, this is not the object owned by the plugin. It is the original global.
- Throws:
XmlBlasterException
- See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)
shutdown
public void shutdown()
throws XmlBlasterException
- Description copied from interface:
I_Plugin
- Cleans up the resource.
- Specified by:
shutdown
in interface I_Plugin
- Overrides:
shutdown
in class GlobalInfo
- Throws:
XmlBlasterException
- if an exception occurs. The exception is
handled by the RunLevelManager depending on how the plugin has been
configured with the action:
<action do='STOP' onShutdownRunlevel='2' sequence='5'
onFail='resource.configuration.pluginFailed'>
If onFail is defined to something, the RunLevelManager will stop.- See Also:
I_Plugin.shutdown()
Copyright © 1999-2014 The xmlBlaster.org contributers.