xmlBlaster 2.1.0 API

org.xmlBlaster.contrib.dbwatcher.detector
Interface I_ChangeDetector

All Known Implementing Classes:
MD5ChangeDetector, TimestampChangeDetector

public interface I_ChangeDetector

This interface hides the plugin which checks if the data has changed.

There are many ways to detect DB changes, we provide a plugin for MD5 and timestamp checking

  1. Changes are delivered by a MOM

    No DbWatcher is needed: This is the proper approach. As legacy systems have various channels which manipulate the DB directly it is no solution for older systems.
  2. Modify/Creation timestamp column

    A trigger adds the timestamp to each table
    -> This changes the DB schema
  3. Sequence of primary key

    Tables which contain a growing sequence of keys may use this to detect inserts
    -> Failes for 'update'
  4. Using a LogMiner

    -> Is database specific and consumes a lot of CPU/memory
  5. Audit tables (with trigger)

    Need to start database in audit mode -> How does it work in a portable way?
  6. Having a trigger for each table

    The trigger notifies a stored procedure
    -> This needs to change the DB -> What if foreign database? http://www.oracle.com/technology/oramag/oracle/03-jan/o13java.html
  7. Flashback queries

    -> What is this?
  8. Use ora_rowscan (since Oracle 10g, similar for MS-SQLServer)

    Example for Oracle (http://www.remote-dba.net/10g_26.htm):
    select scn_to_timestamp(ora_rowscn) FROM A where ora_rowscn IS NOT null;
    Allows to retrieve the rowchange timestamps
    SQLServer uses the column type rowVersion.
    -> Missing for Oracle 9 and other DBs, Oracle 10g and MSQLServer support it.
  9. Using a customized select with MD5

    Query everything and remember the last state with MD5. On change send the complete data again.

Author:
Marcel Ruff

Method Summary
 int checkAgain(java.util.Map attrMap)
          Check the observed data for changes.
 void init(I_Info info, I_ChangeListener changeListener, I_DataConverter dataConverter)
          Needs to be called after construction.
 void shutdown()
          Cleanup resources.
 

Method Detail

init

void init(I_Info info,
          I_ChangeListener changeListener,
          I_DataConverter dataConverter)
          throws java.lang.Exception
Needs to be called after construction.

Parameters:
info - The configuration
changeListener - The listener to notify if something has changed
dataConverter - If not null the data will be transformed immediately during change detection
Throws:
java.lang.Exception

checkAgain

int checkAgain(java.util.Map attrMap)
               throws java.lang.Exception
Check the observed data for changes.

Parameters:
attrMap - This map can be null. The event source can transport some specific information to help the changeDetector doing its work efficiently.
Returns:
> 0 if the observed data has changed. If supported by the plugin the the number of changed rows,
Throws:
java.lang.Exception - Can be of any type

shutdown

void shutdown()
              throws java.lang.Exception
Cleanup resources.

Throws:
java.lang.Exception - Can be of any type

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.