com.continuent.tungsten.replicator.extractor
Class DummyExtractor

java.lang.Object
  extended by com.continuent.tungsten.replicator.extractor.DummyExtractor
All Implemented Interfaces:
RawExtractor, ReplicatorPlugin

public class DummyExtractor
extends java.lang.Object
implements RawExtractor

This class defines a DummyExtractor

Version:
1.0
Author:
Teemu Ollakka

Constructor Summary
DummyExtractor()
           
 
Method Summary
 void configure(PluginContext context)
          Complete plug-in configuration.
 DBMSEvent extract()
          Extract the next available DBMSEvent from the database log.
 DBMSEvent extract(java.lang.String trxId)
          Extract starting after the event ID provided as an argument.
 java.lang.String getCurrentResourceEventId()
          Returns the last event ID committed in the database from which we are extracting.
 int getNFrags()
          Number of fragments per transaction.
 java.lang.Integer getNTrx()
          Get number of DBMSEvents that will be generated by dummy extractor.
 void prepare(PluginContext context)
          Prepare plug-in for use.
 void release(PluginContext context)
          Release all resources used by plug-in.
 void setLastEventId(java.lang.String eventId)
          Set the value of the last event ID we have processed.
 void setNFrags(int frags)
           
 void setNTrx(java.lang.Integer i)
          Set number of DBMSEvents that will be generated by dummy extractor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyExtractor

public DummyExtractor()
Method Detail

setNTrx

public void setNTrx(java.lang.Integer i)
Set number of DBMSEvents that will be generated by dummy extractor.

Parameters:
i -

getNTrx

public java.lang.Integer getNTrx()
Get number of DBMSEvents that will be generated by dummy extractor.

Returns:
number of transactions

getNFrags

public int getNFrags()
Number of fragments per transaction.


setNFrags

public void setNFrags(int frags)

extract

public DBMSEvent extract()
                  throws java.lang.InterruptedException
Extract the next available DBMSEvent from the database log.

Specified by:
extract in interface RawExtractor
Returns:
next DBMSEvent found in the logs
Throws:
java.lang.InterruptedException
See Also:
RawExtractor.extract()

extract

public DBMSEvent extract(java.lang.String trxId)
Extract starting after the event ID provided as an argument. This is equivalent to invoking setLastEventId() followed by extract().

Specified by:
extract in interface RawExtractor
Parameters:
trxId - Event ID at which to begin extracting
Returns:
DBMSEvent corresponding to the id
See Also:
RawExtractor.extract(java.lang.String)

configure

public void configure(PluginContext context)
Complete plug-in configuration. This is called after setters are invoked at the time that the replicator goes through configuration.

Specified by:
configure in interface ReplicatorPlugin
See Also:
ReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)

prepare

public void prepare(PluginContext context)
Prepare plug-in for use. This method is assumed to allocate all required resources. It is called before the plug-in performs any operations.

Specified by:
prepare in interface ReplicatorPlugin
See Also:
ReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)

release

public void release(PluginContext context)
Release all resources used by plug-in. This is called before the plug-in is deallocated.

Specified by:
release in interface ReplicatorPlugin
See Also:
ReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)

setLastEventId

public void setLastEventId(java.lang.String eventId)
                    throws ReplicatorException
Set the value of the last event ID we have processed. The extractor is responsible for returning the next event ID in sequence after this one the next time extract() is called.

Specified by:
setLastEventId in interface RawExtractor
Parameters:
eventId - Event ID at which to begin extracting
Throws:
ReplicatorException
See Also:
RawExtractor.setLastEventId(java.lang.String)

getCurrentResourceEventId

public java.lang.String getCurrentResourceEventId()
                                           throws ReplicatorException,
                                                  java.lang.InterruptedException
Returns the last event ID committed in the database from which we are extracting. It is used to help synchronize state between the database and the transaction history log. Values returned from this call must correspond with the last extracted DBMSEvent.eventId as follows:
  1. If the returned value is greater than DBMSEvent.eventId, the database has more recent updates
  2. If the returned value is equal to DBMSEvent.eventId, all events have been extracted
It should not be possible to receive a value that is less than the last extracted DBMSEvent.eventId as this implies that the extractor is somehow ahead of the state of the database, which would be inconsistent.

Specified by:
getCurrentResourceEventId in interface RawExtractor
Returns:
A current event ID that can be compared with event IDs in DBMSEvent
Throws:
ReplicatorException
java.lang.InterruptedException
See Also:
RawExtractor.getCurrentResourceEventId()