xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.dbwatcher.plugin
Class DbWatcherPlugin

java.lang.Object
  extended by org.xmlBlaster.contrib.GlobalInfo
      extended by org.xmlBlaster.contrib.dbwatcher.plugin.DbWatcherPlugin
All Implemented Interfaces:
I_Info, org.xmlBlaster.util.plugin.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

Field Summary
 
Fields inherited from class org.xmlBlaster.contrib.GlobalInfo
global, LOWER_CASE, ORIGINAL_ENGINE_GLOBAL, pluginInfo, UNTOUCHED, UPPER_CASE
 
Fields inherited from interface org.xmlBlaster.contrib.I_Info
ID, JMX_PREFIX
 
Constructor Summary
DbWatcherPlugin()
          Default constructor, you need to call init() thereafter.
 
Method Summary
protected  void doInit(org.xmlBlaster.util.Global global_, org.xmlBlaster.util.plugin.PluginInfo pluginInfo)
           
 void shutdown()
          Cleans up the resource.
 
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
 

Constructor Detail

DbWatcherPlugin

public DbWatcherPlugin()
Default constructor, you need to call init() thereafter.

Method Detail

doInit

protected void doInit(org.xmlBlaster.util.Global global_,
                      org.xmlBlaster.util.plugin.PluginInfo pluginInfo)
               throws org.xmlBlaster.util.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:
org.xmlBlaster.util.XmlBlasterException
See Also:
I_Plugin.init(org.xmlBlaster.util.Global, org.xmlBlaster.util.plugin.PluginInfo)

shutdown

public void shutdown()
              throws org.xmlBlaster.util.XmlBlasterException
Description copied from interface: org.xmlBlaster.util.plugin.I_Plugin
Cleans up the resource.

Specified by:
shutdown in interface org.xmlBlaster.util.plugin.I_Plugin
Overrides:
shutdown in class GlobalInfo
Throws:
org.xmlBlaster.util.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()

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.