|
xmlBlaster 2.2.0 contributions API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.contrib.dbwatcher.detector.TimestampChangeDetector
public class TimestampChangeDetector
Check the database and compare the change timestamp of a table to the previous one.
The nature of this plugin is based on a timestamp comparison, as such it does not detect DELETE changes of database rows, as this will not create a new timestamp. All other commands (CREATE, INSERT, UPDATE) will touch the timestamp and are therefor detected. Additionally a DROP is detected.
DB statement | Reported change | Comment |
---|---|---|
CREATE | CREATE | - |
INSERT | UPDATE | SQL INSERT statement are reported as UPDATE |
UPDATE | UPDATE | - |
DELETE | - | Is not detected |
DROP | DROP | see mom.eraseOnDrop configuration |
Note that the previous timestamp value is hold in RAM only, after plugin restart it is lost and a complete set of data is send again.
Field Summary | |
---|---|
protected java.lang.String |
changeCommand
|
protected java.lang.String |
changeDetectStatement
|
protected I_ChangeListener |
changeListener
|
protected I_DataConverter |
dataConverter
|
protected I_DbPool |
dbPool
|
protected java.lang.String |
groupColName
|
protected boolean |
ignoreExistingDataOnStartup
|
protected I_Info |
info
|
protected java.lang.String |
newTimestamp
|
protected java.lang.String |
oldTimestamp
|
protected boolean |
poolOwner
|
protected java.lang.String |
queryMeatStatement
|
protected boolean |
tableExists
|
protected int |
timestampColNum
|
protected java.lang.String |
tmpOldTimestamp
|
protected boolean |
useGroupCol
|
Constructor Summary | |
---|---|
TimestampChangeDetector()
|
Method Summary | |
---|---|
void |
activateDetection()
|
int |
checkAgain(java.util.Map attrMap)
Check the observed data for changes. |
java.lang.String |
get(java.lang.String key)
Enforced by I_ReplaceVariable |
java.lang.String |
getChangeCommand()
|
java.lang.String |
getChangeDetectStatement()
|
java.lang.String |
getGroupColName()
|
java.lang.String |
getNewTimestamp()
|
java.lang.String |
getOldTimestamp()
|
java.lang.String |
getQueryMeatStatement()
|
int |
getTimestampColNum()
|
void |
init(I_Info info,
I_ChangeListener changeListener,
I_DataConverter dataConverter)
Needs to be called after construction. |
boolean |
isIgnoreDetection()
|
boolean |
isIgnoreExistingDataOnStartup()
|
boolean |
isPoolOwner()
|
boolean |
isTableExists()
|
boolean |
isUseGroupCol()
|
static java.lang.String |
modifyMinStrIfDate(java.lang.String in,
long time)
|
java.lang.String |
modifyMinStrIfDateWithPersistence(java.lang.String in,
long time)
Modifies a string if it contains the special token '${currentDate}'. |
void |
setChangeCommand(java.lang.String changeCommand)
|
void |
setChangeDetectStatement(java.lang.String changeDetectStatement)
|
void |
setGroupColName(java.lang.String groupColName)
|
void |
setOldTimestamp(java.lang.String oldTimestamp)
|
void |
setPoolOwner(boolean poolOwner)
|
void |
setQueryMeatStatement(java.lang.String queryMeatStatement)
|
void |
setTimestampColNum(int timestampColNum)
|
void |
setUseGroupCol(boolean useGroupCol)
|
void |
shutdown()
Cleanup resources. |
void |
stopDetection()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected I_Info info
protected I_ChangeListener changeListener
protected I_DataConverter dataConverter
protected I_DbPool dbPool
protected boolean poolOwner
protected java.lang.String changeDetectStatement
protected int timestampColNum
protected java.lang.String groupColName
protected boolean useGroupCol
protected boolean tableExists
protected boolean ignoreExistingDataOnStartup
protected java.lang.String changeCommand
protected java.lang.String oldTimestamp
protected java.lang.String tmpOldTimestamp
protected java.lang.String newTimestamp
protected java.lang.String queryMeatStatement
Constructor Detail |
---|
public TimestampChangeDetector()
Method Detail |
---|
public java.lang.String modifyMinStrIfDateWithPersistence(java.lang.String in, long time) throws java.lang.Exception
in
-
java.lang.Exception
public static java.lang.String modifyMinStrIfDate(java.lang.String in, long time) throws java.lang.Exception
java.lang.Exception
public void init(I_Info info, I_ChangeListener changeListener, I_DataConverter dataConverter) throws java.lang.Exception
I_ChangeDetector
init
in interface I_ChangeDetector
info
- changeListener
- dataConverter
-
java.lang.Exception
I_ChangeDetector.init(org.xmlBlaster.contrib.I_Info, org.xmlBlaster.contrib.dbwatcher.I_ChangeListener, org.xmlBlaster.contrib.dbwatcher.convert.I_DataConverter)
public int checkAgain(java.util.Map attrMap) throws java.lang.Exception
checkAgain
in interface I_ChangeDetector
attrMap
- Currently "oldTimestamp" can be passed to force a specific scan
java.lang.Exception
- Can be of any typeI_ChangeDetector.checkAgain(java.util.Map)
public void shutdown() throws java.lang.Exception
I_ChangeDetector
shutdown
in interface I_ChangeDetector
java.lang.Exception
- Can be of any typeI_ChangeDetector.shutdown()
public java.lang.String getChangeCommand()
getChangeCommand
in interface TimestampChangeDetectorMBean
public java.lang.String getChangeDetectStatement()
getChangeDetectStatement
in interface TimestampChangeDetectorMBean
public java.lang.String getGroupColName()
getGroupColName
in interface TimestampChangeDetectorMBean
public java.lang.String getNewTimestamp()
getNewTimestamp
in interface TimestampChangeDetectorMBean
public java.lang.String getOldTimestamp()
getOldTimestamp
in interface TimestampChangeDetectorMBean
public java.lang.String getQueryMeatStatement()
getQueryMeatStatement
in interface TimestampChangeDetectorMBean
public int getTimestampColNum()
getTimestampColNum
in interface TimestampChangeDetectorMBean
public boolean isIgnoreExistingDataOnStartup()
isIgnoreExistingDataOnStartup
in interface TimestampChangeDetectorMBean
public boolean isPoolOwner()
isPoolOwner
in interface TimestampChangeDetectorMBean
public boolean isTableExists()
isTableExists
in interface TimestampChangeDetectorMBean
public boolean isUseGroupCol()
isUseGroupCol
in interface TimestampChangeDetectorMBean
public void setChangeCommand(java.lang.String changeCommand)
setChangeCommand
in interface TimestampChangeDetectorMBean
public void setChangeDetectStatement(java.lang.String changeDetectStatement)
setChangeDetectStatement
in interface TimestampChangeDetectorMBean
public void setGroupColName(java.lang.String groupColName)
setGroupColName
in interface TimestampChangeDetectorMBean
public void setOldTimestamp(java.lang.String oldTimestamp)
setOldTimestamp
in interface TimestampChangeDetectorMBean
public void setPoolOwner(boolean poolOwner)
setPoolOwner
in interface TimestampChangeDetectorMBean
public void setQueryMeatStatement(java.lang.String queryMeatStatement)
setQueryMeatStatement
in interface TimestampChangeDetectorMBean
public void setTimestampColNum(int timestampColNum)
setTimestampColNum
in interface TimestampChangeDetectorMBean
public void setUseGroupCol(boolean useGroupCol)
setUseGroupCol
in interface TimestampChangeDetectorMBean
public void stopDetection()
stopDetection
in interface TimestampChangeDetectorMBean
public void activateDetection()
activateDetection
in interface TimestampChangeDetectorMBean
public boolean isIgnoreDetection()
isIgnoreDetection
in interface TimestampChangeDetectorMBean
public java.lang.String get(java.lang.String key)
get
in interface org.xmlBlaster.util.I_ReplaceVariable
|
xmlBlaster 2.2.0 contributions API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |