xmlBlaster 1.2 API

org.xmlBlaster.contrib.replication
Class NdbPrePostStatement

java.lang.Object
  extended byorg.xmlBlaster.contrib.replication.NdbPrePostStatement
All Implemented Interfaces:
I_ContribPlugin, I_PrePostStatement, ReplicationConstants

public class NdbPrePostStatement
extends java.lang.Object
implements I_PrePostStatement

NdbPrePostStatement

Author:
Michele Laghi

Field Summary
private  java.lang.String comChannel
           
private static java.util.logging.Logger log
           
 
Fields inherited from interface org.xmlBlaster.contrib.replication.ReplicationConstants
ACTION_ATTR, ALREADY_PROCESSED_ATTR, ALTER_ACTION, CATALOG_ATTR, CONTRIB_PERSISTENT_MAP, CREATE_ACTION, DB_ID_ATTR, DELETE_ACTION, DROP_ACTION, DUMP_ACTION, DUMP_FILENAME, DUMP_POSTFIX, END_OF_TRANSITION, EXCEPTION_ATTR, EXTRA_REPL_KEY_ATTR, GUID_ATTR, INITIAL_DATA_END, INITIAL_DATA_END_TO_REMOTE, INITIAL_DATA_ID, INITIAL_FILES_LOCATION, INSERT_ACTION, MASTER_ATTR, MAX_ENTRIES_ATTR, OLD_CONTENT_ATTR, REPL_KEY_ATTR, REPL_MANAGER_REGISTER, REPL_MANAGER_SESSION, REPL_MANAGER_TOPIC, REPL_MANAGER_UNREGISTER, REPL_PREFIX_DEFAULT, REPL_PREFIX_KEY, REPL_REQUEST_CANCEL_UPDATE, REPL_REQUEST_RECREATE_TRIGGERS, REPL_REQUEST_UPDATE, REPL_VERSION, REPLICATION_CMD, SCHEMA_ATTR, SLAVE_NAME, SQL_TOPIC_ATTR, STATEMENT_ACTION, STATEMENT_ATTR, STATEMENT_ID_ATTR, STATEMENT_PRIO_ATTR, SUPPORTED_VERSIONS, TABLE_NAME_ATTR, TRANSACTION_ATTR, UPDATE_ACTION, VERSION_ATTR, VERSION_TOKEN
 
Constructor Summary
NdbPrePostStatement()
           
 
Method Summary
 java.util.Set getUsedPropertyKeys()
          Gets all property keys which may be used by this object.
 void init(I_Info info)
           
 void postStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow)
          Reads the COM_MESSAGEID, COM_CHANNEL and COM_TXTL columns of C_INS and writes with these values an entry in the C_IN_TEXTS
 boolean preStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow)
          Transforms the column of C_OUTS.COM_CHANNEL to be C_INS.COM_CHANNEL='20'.
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static java.util.logging.Logger log

comChannel

private java.lang.String comChannel
Constructor Detail

NdbPrePostStatement

public NdbPrePostStatement()
Method Detail

preStatement

public boolean preStatement(java.lang.String operation,
                            java.sql.Connection conn,
                            SqlInfo info,
                            SqlDescription tableDescription,
                            SqlRow currentRow)
                     throws java.lang.Exception
Transforms the column of C_OUTS.COM_CHANNEL to be C_INS.COM_CHANNEL='20'. Since in the DEE this value is null and the NDB needs to know from whom it comes.

Specified by:
preStatement in interface I_PrePostStatement
Parameters:
operation - is the operation to be invoked for the statement. It can be one of the ReplicationConstants defined actions INSERT, UPDATE or DELETE.
conn - The Database connection object. The implementor is not responsible for cleaning up the resource, this is done by the invoker. All operations of all rows contained in the sqlInfo object are executed in the same transaction.
tableDescription - the description (metadata) of the table from which the current table is coming from, if the row would contain entries (columns) coming from more than one table, then null is passed. The ReplicationWriter never passes null, since all data coming from one row come from the same table.
currentRow - The row which currently will be processed.
Returns:
true if the statement has to be executed, false otherwise (then the statement is not executed). If it returns false, then the postStatement is not executed either.
Throws:
java.lang.Exception - thrown if something went wrong in the implementation. If it is thrown, then the operation is not performed and a rollback of the entire transaction is done.

postStatement

public void postStatement(java.lang.String operation,
                          java.sql.Connection conn,
                          SqlInfo info,
                          SqlDescription tableDescription,
                          SqlRow currentRow)
                   throws java.lang.Exception
Reads the COM_MESSAGEID, COM_CHANNEL and COM_TXTL columns of C_INS and writes with these values an entry in the C_IN_TEXTS

Specified by:
postStatement in interface I_PrePostStatement
Parameters:
operation - is the operation to be invoked for the statement. It can be one of the ReplicationConstants defined actions INSERT, UPDATE or DELETE.
conn - The Database connection object. The implementor is not responsible for cleaning up the resource, this is done by the invoker. All operations of all rows contained in the sqlInfo object are executed in the same transaction.
tableDescription - the description (metadata) of the table from which the current table is coming from, if the row would contain entries (columns) coming from more than one table, then null is passed. The ReplicationWriter never passes null, since all data coming from one row come from the same table.
currentRow - The row which currently has been processed.
Throws:
java.lang.Exception - thrown if something went wrong in the implementation. If it is thrown, then a rollback of the entire transaction is done.

getUsedPropertyKeys

public java.util.Set getUsedPropertyKeys()
Description copied from interface: I_ContribPlugin
Gets all property keys which may be used by this object.

Specified by:
getUsedPropertyKeys in interface I_ContribPlugin
Returns:

init

public void init(I_Info info)
          throws java.lang.Exception
Specified by:
init in interface I_ContribPlugin
Throws:
java.lang.Exception

shutdown

public void shutdown()
              throws java.lang.Exception
Specified by:
shutdown in interface I_ContribPlugin
Throws:
java.lang.Exception
See Also:
I_Plugin

xmlBlaster 1.2 API

Copyright © 1999-2006 The xmlBlaster.org contributers.