xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.replication.impl
Class SpecificPostgres

java.lang.Object
  extended by org.xmlBlaster.contrib.replication.impl.SpecificDefault
      extended by org.xmlBlaster.contrib.replication.impl.SpecificPostgres
All Implemented Interfaces:
I_ContribPlugin, I_DbSpecific

public class SpecificPostgres
extends SpecificDefault


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xmlBlaster.contrib.replication.impl.SpecificDefault
SpecificDefault.Replacer
 
Field Summary
 
Fields inherited from class org.xmlBlaster.contrib.replication.impl.SpecificDefault
blockLoop, COMMIT_NO, COMMIT_YES, dbMetaHelper, dbPool, info, initialUpdater, isDbWriteable, replacer, replaceVariable, replPrefix, replVersion, ROLLBACK_NO, ROLLBACK_YES, transformer
 
Fields inherited from interface org.xmlBlaster.contrib.replication.I_DbSpecific
NEEDS_PUBLISHER_KEY, WIPEOUT_ALL, WIPEOUT_FUNCTIONS, WIPEOUT_INDEXES, WIPEOUT_NO_TABLES, WIPEOUT_ONLY_TABLES, WIPEOUT_PACKAGES, WIPEOUT_PROCEDURES, WIPEOUT_SEQUENCES, WIPEOUT_SYNONYMS, WIPEOUT_TABLES, WIPEOUT_TRIGGERS, WIPEOUT_VIEWS
 
Constructor Summary
SpecificPostgres()
          Not doing anything.
 
Method Summary
 void addSchemaToWatch(java.sql.Connection conn, java.lang.String catalog, java.lang.String schema)
          Adds a schema to be watched.
 java.lang.String createTableFunction(SqlDescription infoDescription, java.lang.String functionName)
          This method creates a function to be associated to a trigger to detect INSERT DELETE and UPDATE operations on a particular table.
private  java.lang.String createTableTrigger(SqlDescription infoDescription, java.lang.String triggerName, java.lang.String replFlags)
           
 java.lang.String createTableTrigger(SqlDescription infoDescription, TableToWatchInfo tableToWatch)
          This method creates a trigger to detect INSERT DELETE and UPDATE operations on a particular table.
protected  java.lang.String createVariableSqlPart(SqlDescription description, java.lang.String prefix)
           
 java.lang.StringBuffer getColumnStatement(SqlColumn colInfoDescription)
          Helper method used to construct the CREATE TABLE statement part belonging to a single COLUMN.
 java.lang.String getContentFromGuid(java.lang.String guid, java.lang.String catalog, java.lang.String schema, java.lang.String table, I_AttributeTransformer transformer)
          This is used for cases where it was not possible to retrieve the (new) content of an entry synchronously in the PL/SQL Code.
 boolean removeTrigger(java.lang.String triggerName, java.lang.String tableName, boolean isSchemaTrigger)
          removes the specified trigger from the specified table.
protected  boolean sequenceExists(java.sql.Connection conn, java.lang.String sequenceName)
          returns true if the sequence exists already.
protected  boolean triggerExists(java.sql.Connection conn, java.lang.String sequenceName)
          returns true if the trigger exists already.
 boolean triggerExists(java.sql.Connection conn, TableToWatchInfo tableToWatch)
          Checks wether a trigger really exists or not.
 int wipeoutSchema(java.lang.String catalog, java.lang.String schema, boolean[] objectsToWipeout)
          Cleans up the complete schema.
 
Methods inherited from class org.xmlBlaster.contrib.replication.impl.SpecificDefault
addTableToWatch, addTrigger, addTriggersIfNeeded, bootstrap, broadcastStatement, cancelUpdate, checkSequenceForCreation, checkTableForCreation, checkTriggerConsistency, checkTriggerForCreation, cleanup, clearCancelUpdate, forceTableChangeCheck, getContentFromClasspath, getCreateTableStatement, getName, getObjectName, getOwnSchema, getReplPrefix, getUsedPropertyKeys, incrementReplKey, init, initialCommand, initialCommandPre, initiateUpdate, isDatasourceReadonly, main, readNewTable, releaseIntoPool, releaseIntoPool, removeFromPool, removeFromPool, removeSchemaTriggers, removeTableToWatch, setAttributeTransformer, shutdown, toString, updateFromFile
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpecificPostgres

public SpecificPostgres()
Not doing anything.

Method Detail

getColumnStatement

public java.lang.StringBuffer getColumnStatement(SqlColumn colInfoDescription)
Helper method used to construct the CREATE TABLE statement part belonging to a single COLUMN.

Parameters:
colInfoDescription -
Returns:

createVariableSqlPart

protected java.lang.String createVariableSqlPart(SqlDescription description,
                                                 java.lang.String prefix)
Parameters:
col -
prefix - can be 'old' or 'new'
Returns:

createTableFunction

public java.lang.String createTableFunction(SqlDescription infoDescription,
                                            java.lang.String functionName)
This method creates a function to be associated to a trigger to detect INSERT DELETE and UPDATE operations on a particular table.

Parameters:
infoDescription - the info object containing the necessary information for the table.
Returns:
a String containing the sql update. It can be executed.

createTableTrigger

public java.lang.String createTableTrigger(SqlDescription infoDescription,
                                           TableToWatchInfo tableToWatch)
This method creates a trigger to detect INSERT DELETE and UPDATE operations on a particular table.

Parameters:
infoDescription - the info object containing the necessary information for the table.
Returns:
a String containing the sql update. It can be executed.

createTableTrigger

private java.lang.String createTableTrigger(SqlDescription infoDescription,
                                            java.lang.String triggerName,
                                            java.lang.String replFlags)

addSchemaToWatch

public void addSchemaToWatch(java.sql.Connection conn,
                             java.lang.String catalog,
                             java.lang.String schema)
                      throws java.lang.Exception
Adds a schema to be watched. By Oracle it would add triggers to the schema.

Parameters:
catalog -
schema -
Throws:
java.lang.Exception

removeTrigger

public boolean removeTrigger(java.lang.String triggerName,
                             java.lang.String tableName,
                             boolean isSchemaTrigger)
Description copied from interface: I_DbSpecific
removes the specified trigger from the specified table.

isSchemaTrigger - true if the trigger to be removed is a schema trigger.
Returns:
true if the trigger has been removed, false otherwise.

wipeoutSchema

public int wipeoutSchema(java.lang.String catalog,
                         java.lang.String schema,
                         boolean[] objectsToWipeout)
                  throws java.lang.Exception
Description copied from interface: I_DbSpecific
Cleans up the complete schema. It cleans tables, sequences, views, functions, procedures, triggers and indexes.

objectsToWipeout - a boolean[] array containing 9 elements telling wether the specified objects of a certain type have to be wiped out or not. For the relationship between position and meaning see the static variables. If you pass null here all object types are wiped out.
Returns:
the number of entries removed.
Throws:
java.lang.Exception

getContentFromGuid

public java.lang.String getContentFromGuid(java.lang.String guid,
                                           java.lang.String catalog,
                                           java.lang.String schema,
                                           java.lang.String table,
                                           I_AttributeTransformer transformer)
                                    throws java.lang.Exception
Description copied from interface: I_DbSpecific
This is used for cases where it was not possible to retrieve the (new) content of an entry synchronously in the PL/SQL Code.

Parameters:
guid - the unique Id identifying this entry. This is needed. Can not be null
catalog - can be null
schema - can be null
table - must be defined (can not be null).
transformer - An optional plugin
Returns:
the String containing the serialized entry.
Throws:
java.lang.Exception
See Also:
org.xmlBlaster.contrib.replication.I_DbSpecific#getContentFromGuid(java.lang.String, java.lang.String, java.lang.String, java.lang.String)

sequenceExists

protected boolean sequenceExists(java.sql.Connection conn,
                                 java.lang.String sequenceName)
                          throws java.lang.Exception
returns true if the sequence exists already.

Specified by:
sequenceExists in class SpecificDefault
Throws:
java.lang.Exception

triggerExists

protected boolean triggerExists(java.sql.Connection conn,
                                java.lang.String sequenceName)
                         throws java.lang.Exception
returns true if the trigger exists already.

Specified by:
triggerExists in class SpecificDefault
Throws:
java.lang.Exception

triggerExists

public boolean triggerExists(java.sql.Connection conn,
                             TableToWatchInfo tableToWatch)
                      throws java.lang.Exception
Description copied from interface: I_DbSpecific
Checks wether a trigger really exists or not. This method is normally implemented by the vendor specific implementation. It is used to detect inconsistencies.

tableToWatch - The object containing the table to be checked for trigger
Returns:
true if the trigger really exists, false otherwise.
Throws:
java.lang.Exception - If an exception occurs in the backend.
See Also:
org.xmlBlaster.contrib.replication.I_DbSpecific#triggerExists(org.xmlBlaster.contrib.replication.TableToWatchInfo)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.