|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.contrib.replication.SqlPrePostStatement
public class SqlPrePostStatement
SqlPrePostStatement allows the replication to execute a stored procedure before and / or after the operation on the replica (it is invoked as an optional plugin by the ReplicationWriter).
Field Summary | |
---|---|
private static java.util.logging.Logger |
log
|
private java.util.Map |
sqlDeletePost
|
private java.util.Map |
sqlDeletePre
|
private java.util.Map |
sqlInsertPost
|
private java.util.Map |
sqlInsertPre
|
private java.util.Map |
sqlUpdatePost
|
private java.util.Map |
sqlUpdatePre
|
Fields inherited from interface org.xmlBlaster.contrib.ContribConstants |
---|
FILE_DATE, FILENAME_ATTR, FILENAME_ATTR_OLD_FASHION, SUBDIR_ATTR, TIMESTAMP_ATTR, TOPIC_NAME |
Constructor Summary | |
---|---|
SqlPrePostStatement()
|
Method Summary | |
---|---|
private boolean |
executeSqlCodeIfNeeded(java.sql.Connection conn,
java.util.Map map,
java.lang.String completeTableName)
|
private java.util.Map |
getCodeMap(java.lang.String prefix,
I_Info info,
DbMetaHelper dbMetaHelper)
Gets a map of all codes having as key the complete table name and as value the callable statement to invoke (already correct for jdbc callableStatement invocation). |
java.util.Set |
getUsedPropertyKeys()
Gets all property keys which may be used by this object. |
void |
init(I_Info info)
Properties used are: dbWriter.sqlPrePostStatement.sql.pre.insert.${SCHEMA}.${TABLE} dbWriter.sqlPrePostStatement.sql.pre.update.${SCHEMA}.${TABLE} dbWriter.sqlPrePostStatement.sql.pre.delete.${SCHEMA}.${TABLE} dbWriter.sqlPrePostStatement.sql.post.insert.${SCHEMA}.${TABLE} dbWriter.sqlPrePostStatement.sql.post.update.${SCHEMA}.${TABLE} dbWriter.sqlPrePostStatement.sql.post.delete.${SCHEMA}.${TABLE} |
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). |
void |
shutdown()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static java.util.logging.Logger log
private java.util.Map sqlInsertPre
private java.util.Map sqlUpdatePre
private java.util.Map sqlDeletePre
private java.util.Map sqlInsertPost
private java.util.Map sqlUpdatePost
private java.util.Map sqlDeletePost
Constructor Detail |
---|
public SqlPrePostStatement()
Method Detail |
---|
private final boolean executeSqlCodeIfNeeded(java.sql.Connection conn, java.util.Map map, java.lang.String completeTableName)
public boolean preStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow) throws java.lang.Exception
I_PrePostStatement
preStatement
in interface I_PrePostStatement
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.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.
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.public void postStatement(java.lang.String operation, java.sql.Connection conn, SqlInfo info, SqlDescription tableDescription, SqlRow currentRow) throws java.lang.Exception
I_PrePostStatement
postStatement
in interface I_PrePostStatement
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.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.
java.lang.Exception
- thrown if something went wrong in the implementation. If it is thrown, then a rollback of
the entire transaction is done.public java.util.Set getUsedPropertyKeys()
I_ContribPlugin
getUsedPropertyKeys
in interface I_ContribPlugin
private java.util.Map getCodeMap(java.lang.String prefix, I_Info info, DbMetaHelper dbMetaHelper)
prefix
- info
- dbMetaHelper
-
public void init(I_Info info) throws java.lang.Exception
init
in interface I_ContribPlugin
java.lang.Exception
public void shutdown() throws java.lang.Exception
shutdown
in interface I_ContribPlugin
java.lang.Exception
I_Plugin
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |