xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.dbwriter.info
Interface I_PrePostStatement

All Superinterfaces:
ContribConstants, I_ContribPlugin, ReplicationConstants
All Known Implementing Classes:
SqlPrePostStatement

public interface I_PrePostStatement
extends I_ContribPlugin, ReplicationConstants

I_PrePostStatement is an interface which is invoked just before a statement is invoked for a row and just after.

Author:
Michele Laghi

Field Summary
 
Fields inherited from interface org.xmlBlaster.contrib.replication.ReplicationConstants
ABSOLUTE_COUNT, ACTION_ATTR, ALREADY_PROCESSED_ATTR, ALTER_ACTION, CATALOG_ATTR, CONTRIB_PERSISTENT_MAP, CREATE_ACTION, DB_ID_ATTR, DELETE_ACTION, DROP_ACTION, DUMP_ACTION, DUMP_CONTENT_ATTR, 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_DUMP_AS_XML, INITIAL_FILES_LOCATION, INITIAL_UPDATE_COLLECT, INITIAL_UPDATE_ONLY_REGISTER, INITIAL_UPDATE_START_BATCH, INITIAL_XML_CMD, INSERT_ACTION, KEEP_TRANSACTION_OPEN, MASTER_ATTR, MAX_ENTRIES_ATTR, MESSAGE_SEQ, NUM_OF_TRANSACTIONS, OLD_CONTENT_ATTR, PURPOSE_REPLICATION, REPL_KEY_ATTR, REPL_MANAGER_SESSION, REPL_MANAGER_TOPIC, REPL_PREFIX_DEFAULT, REPL_PREFIX_GROUP_KEY, REPL_PREFIX_KEY, REPL_REQUEST_CANCEL_UPDATE, REPL_REQUEST_RECREATE_TRIGGERS, REPL_REQUEST_UPDATE, REPL_VERSION, REPLICATION_CMD, REPLICATION_FORCE_SENDING, REPLICATION_MAX_ENTRIES_DEFAULT, REPLICATION_MAX_ENTRIES_KEY, REPLICATION_SEND_UNCHANGED_UPDATES, REPLICATION_VERSION, REQUEST_BROADCAST_SQL_TOPIC, REQUEST_CANCEL_UPDATE_TOPIC, REQUEST_INITIAL_DATA_TOPIC, REQUEST_RECREATE_TRIGGERS, RESPONSE_INITIAL_DATA_TOPIC, SCHEMA_ATTR, SIMPLE_MESSAGE, SLAVE_NAME, SQL_TOPIC_ATTR, STATEMENT_ACTION, STATEMENT_ATTR, STATEMENT_ID_ATTR, STATEMENT_PRIO_ATTR, SUPPORTED_VERSIONS, TABLE_NAME_ATTR, TRANSACTION_ATTR, TRANSACTION_SEQ, UPDATE_ACTION, VERSION_ATTR, VERSION_TOKEN
 
Fields inherited from interface org.xmlBlaster.contrib.ContribConstants
FILE_DATE, FILENAME_ATTR, FILENAME_ATTR_OLD_FASHION, SUBDIR_ATTR, TIMESTAMP_ATTR, TOPIC_NAME
 
Method Summary
 void postStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow)
          This method is invoked in the ReplicationWriter just after an INSERT, UPDATE, DELETE, CREATE, ALTER, DROP is invoked on the specified entry (the row).
 boolean preStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow)
          This method is invoked in the ReplicationWriter just before an INSERT, UPDATE or DELETE and CREATE, ALTER, DROP is invoked on the specified entry (the row).
 
Methods inherited from interface org.xmlBlaster.contrib.I_ContribPlugin
getUsedPropertyKeys, init, shutdown
 

Method Detail

preStatement

boolean preStatement(java.lang.String operation,
                     java.sql.Connection conn,
                     SqlInfo info,
                     SqlDescription tableDescription,
                     SqlRow currentRow)
                     throws java.lang.Exception
This method is invoked in the ReplicationWriter just before an INSERT, UPDATE or DELETE and CREATE, ALTER, DROP is invoked on the specified entry (the row). The user can manipulate the row, the sqlInfo or can perform some operations on the database. Note that the row has its state which is already modified when it comes to catalog, schema and table done by the mappers, but the row modification has not been done yet.

Parameters:
operation - is the operation to be invoked for the statement. It can be one of the ReplicationConstants defined actions INSERT, UPDATE DELETE, CREATE, ALTER or DROP.
conn - The Database connection object. The implementor is not responsible for cleaning up the resource, this is done by the invoker.
sqlInfo - The object of the whole unmodified message coming from the source.
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 could also pass null if the operation is a CREATE and the table does not exist yet in the replica database. As this is created out of the metadata information of the destination, the catalog-, schema-, table- and column names are already the ones after any mapping modification.
currentRow - The row which currently will be processed. It can be null if the operation is a CREATE, ALTER or DROP. The columns specified in this row are already modified according to the mapping.
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

void postStatement(java.lang.String operation,
                   java.sql.Connection conn,
                   SqlInfo info,
                   SqlDescription tableDescription,
                   SqlRow currentRow)
                   throws java.lang.Exception
This method is invoked in the ReplicationWriter just after an INSERT, UPDATE, DELETE, CREATE, ALTER, DROP is invoked on the specified entry (the row). The user can manipulate the row, the sqlInfo or can perform some operations on the database. Note that the row has its state which is after any modification done by the mappers, i.e. its content corresponds to what the writer will write, not necessarly whatt the watcher has sent. This method is only invoked if preStatement returned true.

Parameters:
operation - is the operation to be invoked for the statement. It can be one of the ReplicationConstants defined actions INSERT, UPDATE or DELETE, CREATE, ALTER or DROP.
conn - The Database connection object. The implementor is not responsible for cleaning up the resource, this is done by the invoker.
sqlInfo - The object of the whole unmodified message coming from the source.
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 could also pass null if the operation is a CREATE and the table does not exist yet in the replica database. As this is created out of the metadata information of the destination, the catalog-, schema-, table- and column names are already the ones after any mapping modification.
currentRow - The row which currently will be processed. It can be null if the operation is a CREATE, ALTER or DROP. The columns specified in this row are already modified according to the mapping.
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.

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.