com.continuent.tungsten.replicator.ddlscan
Class DDLScan

java.lang.Object
  extended by com.continuent.tungsten.replicator.ddlscan.DDLScan

public class DDLScan
extends java.lang.Object

Main DDLScan functionality is programmed here.

Version:
1.0
Author:
Linas Virbalas

Constructor Summary
DDLScan(java.lang.String url, java.lang.String dbName, java.lang.String user, java.lang.String pass)
          Creates a new DDLScan object from provided JDBC URL connection credentials and template file.
 
Method Summary
 void parseRenameDefinitions(java.lang.String definitionsFile)
          Tries to load rename definitions file.
 void parseTemplate(java.lang.String templateFile)
          Compiles the given Velocity template file.
 void prepare(java.lang.String additionalPath)
          Connect to the underlying database.
 void release()
          Disconnect from the THL database.
 void resetRenameDefinitions()
          Stop using rename definitions file for future scan(...) calls.
 java.lang.String scan(java.lang.String tablesToFind, java.util.Hashtable<java.lang.String,java.lang.String> templateOptions, java.io.Writer writer)
          Scans and extracts metadata from the database of requested tables.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DDLScan

public DDLScan(java.lang.String url,
               java.lang.String dbName,
               java.lang.String user,
               java.lang.String pass)
        throws ReplicatorException
Creates a new DDLScan object from provided JDBC URL connection credentials and template file.

Parameters:
url - JDBC URL connection string.
dbName - Database/schema to connect to.
Throws:
java.lang.Exception
ReplicatorException
Method Detail

prepare

public void prepare(java.lang.String additionalPath)
             throws ReplicatorException,
                    java.lang.InterruptedException,
                    java.sql.SQLException
Connect to the underlying database.

Throws:
ReplicatorException
java.lang.InterruptedException
java.sql.SQLException

parseTemplate

public void parseTemplate(java.lang.String templateFile)
                   throws ReplicatorException
Compiles the given Velocity template file.

Throws:
ReplicatorException

parseRenameDefinitions

public void parseRenameDefinitions(java.lang.String definitionsFile)
                            throws ReplicatorException,
                                   java.io.IOException
Tries to load rename definitions file. It will be used for all subsequent scan calls.

Throws:
ReplicatorException - On parsing or CSV format errors.
java.io.IOException - If file cannot be read.
See Also:
resetRenameDefinitions(), scan(String, Hashtable, Writer)

resetRenameDefinitions

public void resetRenameDefinitions()
Stop using rename definitions file for future scan(...) calls.

See Also:
parseRenameDefinitions(String), scan(String, Hashtable, Writer)

scan

public java.lang.String scan(java.lang.String tablesToFind,
                             java.util.Hashtable<java.lang.String,java.lang.String> templateOptions,
                             java.io.Writer writer)
                      throws ReplicatorException,
                             java.lang.InterruptedException,
                             java.sql.SQLException,
                             java.io.IOException
Scans and extracts metadata from the database of requested tables. Calls merge(...) against each found table.

Parameters:
tablesToFind - Regular expression enable list of tables to find or null for all tables.
templateOptions - Options (option->value) to pass to the template.
writer - Writer object to use for appending rendered template. Make sure to initialize it before and flush/close it after manually.
Returns:
Rendered template data.
Throws:
ReplicatorException
java.lang.InterruptedException
java.sql.SQLException
java.io.IOException

release

public void release()
Disconnect from the THL database.