com.continuent.tungsten.replicator.filter
Class CDCMetadataFilter

java.lang.Object
  extended by com.continuent.tungsten.replicator.filter.CDCMetadataFilter
All Implemented Interfaces:
Filter, ReplicatorPlugin

public class CDCMetadataFilter
extends java.lang.Object
implements Filter

Filter which for each row change transaction adds a change data capture row to a corresponding change table.

Change table structure:
original columns ..., CDC_OP_TYPE, CDC_TIMESTAMP, CDC_SEQUENCE_NUMBER

Filter automatically generates a CDC_SEQUENCE_NUMBER primary key value for the change table. However, for this to work correctly, caller must ensure there are no parallel applies to the same change table (normally it isn't a problem).

Version:
1.0
Author:
Stephane Giron

Constructor Summary
CDCMetadataFilter()
           
 
Method Summary
 void configure(PluginContext context)
          Complete plug-in configuration.
 ReplDBMSEvent filter(ReplDBMSEvent event)
          Filter the event.
 void prepare(PluginContext context)
          Prepare plug-in for use.
 void release(PluginContext context)
          Release all resources used by plug-in.
 void setCdcColumnsAtFront(boolean atFront)
          If true, CDC columns are expected to be at the front of original columns.
 void setSchemaNameSuffix(java.lang.String schemaNameSuffix)
          Sets the schemaNameSuffix value.
 void setSequenceBeginning(long sequenceBeginning)
          Which CDC sequence number to begin with, if CDC sequence number cannot be determined (eg.
 void setTableNameSuffix(java.lang.String tableNameSuffix)
          Sets the tableNameSuffix value.
 void setToSingleSchema(java.lang.String toSingleSchema)
          It is possibly to have all CDC tables in a single schema.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CDCMetadataFilter

public CDCMetadataFilter()
Method Detail

setSchemaNameSuffix

public void setSchemaNameSuffix(java.lang.String schemaNameSuffix)
Sets the schemaNameSuffix value. Can be left empty, if change tables are in the same schema as origin tables.

Parameters:
schemaNameSuffix - The schemaNameSuffix to set.

setTableNameSuffix

public void setTableNameSuffix(java.lang.String tableNameSuffix)
Sets the tableNameSuffix value. Eg. if tabe name is FOO and suffix is set to _CD, then change rows will be saved in table FOO_CD.

Parameters:
tableNameSuffix - The tableNameSuffix to set.

setToSingleSchema

public void setToSingleSchema(java.lang.String toSingleSchema)
It is possibly to have all CDC tables in a single schema.

Parameters:
toSingleSchema - Schema where all change tables are expected to be.

setSequenceBeginning

public void setSequenceBeginning(long sequenceBeginning)
Which CDC sequence number to begin with, if CDC sequence number cannot be determined (eg. no CDC data yet exists).

Parameters:
sequenceBeginning - CDC sequence number.

setCdcColumnsAtFront

public void setCdcColumnsAtFront(boolean atFront)
If true, CDC columns are expected to be at the front of original columns. If false - at the end.


filter

public ReplDBMSEvent filter(ReplDBMSEvent event)
                     throws ReplicatorException
Filter the event. Filters may transform the event or return null if the event should be discarded. Filters must be prepared to be interrupted, which mechanism is used to cancel processing.

Specified by:
filter in interface Filter
Parameters:
event - An event to be filtered
Returns:
Filtered ReplDBMSEvent or null
Throws:
ReplicatorException - Thrown if there is a processing error
See Also:
Filter.filter(com.continuent.tungsten.replicator.event.ReplDBMSEvent)

configure

public void configure(PluginContext context)
               throws ReplicatorException
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
Throws:
ReplicatorException - Thrown if configuration is incomplete or fails
See Also:
ReplicatorPlugin.configure(com.continuent.tungsten.replicator.plugin.PluginContext)

prepare

public void prepare(PluginContext context)
             throws ReplicatorException
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
Throws:
ReplicatorException - Thrown if resource allocation fails
See Also:
ReplicatorPlugin.prepare(com.continuent.tungsten.replicator.plugin.PluginContext)

release

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

Specified by:
release in interface ReplicatorPlugin
Throws:
ReplicatorException - Thrown if resource deallocation fails
See Also:
ReplicatorPlugin.release(com.continuent.tungsten.replicator.plugin.PluginContext)