com.continuent.tungsten.replicator.thl
Class CatalogManager

java.lang.Object
  extended by com.continuent.tungsten.replicator.thl.CatalogManager

public class CatalogManager
extends java.lang.Object

Encapsulates management of catalog tables used by THL.

Version:
1.0
Author:
Robert Hodges

Constructor Summary
CatalogManager(ReplicatorRuntime runtime)
          Creates a new Catalog manager.
 
Method Summary
 void close(PluginContext context)
          Close database connection.
 void connect(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String metadataSchema, java.lang.String vendor)
          Set DBMS connection information.
 ReplDBMSHeader getMinLastEvent()
          Return the minimum last applied event as stored in the CommitSeqnoTable.
 void prepareSchema(PluginContext context)
          Prepare catalog schema schema.
 void updateCommitSeqnoTable(THLEvent event)
          Updates the trep_commit_seqno table with latest event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogManager

public CatalogManager(ReplicatorRuntime runtime)
               throws ReplicatorException
Creates a new Catalog manager.

Parameters:
runtime - runtime
Throws:
ReplicatorException
Method Detail

connect

public void connect(java.lang.String url,
                    java.lang.String user,
                    java.lang.String password,
                    java.lang.String metadataSchema,
                    java.lang.String vendor)
             throws ReplicatorException
Set DBMS connection information. Connections will be allocated as needed.

Parameters:
url - Database url
user - Database user name
password - Database user password
metadataSchema - Name of replication service schema
vendor - Used when it's impossible to distinguish correct DBMS vendor from URL only. This is especially the case with Greenplum, when URL is the same as for PostgreSQL. Thus values: "postgresql" for PostgreSQL, "greenplum" for Greenplum, null for MySQL.
Throws:
ReplicatorException

prepareSchema

public void prepareSchema(PluginContext context)
                   throws ReplicatorException
Prepare catalog schema schema.

Parameters:
context - Replicator plugin context
Throws:
ReplicatorException - thrown on failure

updateCommitSeqnoTable

public void updateCommitSeqnoTable(THLEvent event)
                            throws java.sql.SQLException
Updates the trep_commit_seqno table with latest event.

Throws:
java.sql.SQLException

close

public void close(PluginContext context)
Close database connection.


getMinLastEvent

public ReplDBMSHeader getMinLastEvent()
                               throws ReplicatorException
Return the minimum last applied event as stored in the CommitSeqnoTable.

Returns:
the last applied event, or null if nothing was found
Throws:
ReplicatorException