xmlBlaster 2.1.0 API

org.xmlBlaster.contrib.replication.impl
Class SpecificDB2

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

public class SpecificDB2
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
SpecificDB2()
          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.
 void cleanupSchema(java.lang.String schema, java.lang.String type, java.lang.String referencedSchema)
          Cleans up the specified schema for the specified type.
 java.lang.String createTableTrigger(SqlDescription infoDescription, TableToWatchInfo tableToWatch)
          Creates a string containing the trigger of the table to be watched.
protected  java.lang.String createVariableSqlPart(SqlDescription description, java.lang.String prefix, boolean containsLongs, boolean isInsert)
           
 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.
 void init(I_Info info)
           
 boolean removeTrigger(java.lang.String triggerName, java.lang.String tableName, boolean isSchemaTrigger)
          If the triggerName is null, then the own schema triggers are deleted.
protected  boolean sequenceExists(java.sql.Connection conn, java.lang.String sequenceName)
           
protected  boolean triggerExists(java.sql.Connection conn, java.lang.String triggerName)
           
 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, 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

SpecificDB2

public SpecificDB2()
Not doing anything.

Method Detail

sequenceExists

protected boolean sequenceExists(java.sql.Connection conn,
                                 java.lang.String sequenceName)
                          throws java.lang.Exception
Specified by:
sequenceExists in class SpecificDefault
Throws:
java.lang.Exception

triggerExists

protected boolean triggerExists(java.sql.Connection conn,
                                java.lang.String triggerName)
                         throws java.lang.Exception
Specified by:
triggerExists in class SpecificDefault
Throws:
java.lang.Exception

init

public void init(I_Info info)
          throws java.lang.Exception
Specified by:
init in interface I_ContribPlugin
Overrides:
init in class SpecificDefault
Throws:
java.lang.Exception
See Also:
I_ContribPlugin.init(I_Info)

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:
Exception. - Thrown if an exception occurs on the backend. Note that if an exception occurs you must cleanup the connection since it might become stale.
java.lang.Exception

createVariableSqlPart

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

createTableTrigger

public java.lang.String createTableTrigger(SqlDescription infoDescription,
                                           TableToWatchInfo tableToWatch)
Description copied from interface: I_DbSpecific
Creates a string containing the trigger of the table to be watched. .

Returns:

cleanupSchema

public void cleanupSchema(java.lang.String schema,
                          java.lang.String type,
                          java.lang.String referencedSchema)
Cleans up the specified schema for the specified type.

Parameters:
schema - can not be null.
type - can be null. If null all types are cleaned up, otherwise only the ones contained in the string will be cleaned up. For example "table alltriggers" will clean up both 'table' and 'trigger' types. The types must be specified in lowercase. Allowed types are synonym,trigger,package,procedure,function,view,table,sequence.
referencedSchema - is the schema which is referenced by the object. It only has an effect on triggers where the owner of the trigger would be the schema but the table on which the trigger resides it the referenced schema. If null, all schemas referenced are deleted.

getColumnStatement

public java.lang.StringBuffer getColumnStatement(SqlColumn colInfoDescription)
Helper method used to construct the CREATE TABLE statement part belonging to a single COLUMN. There is currently no way to distinguish the following:

Parameters:
colInfoDescription -
Returns:

removeTrigger

public boolean removeTrigger(java.lang.String triggerName,
                             java.lang.String tableName,
                             boolean isSchemaTrigger)
If the triggerName is null, then the own schema triggers are deleted. If at least one of the triggers has been removed, it returns true.

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)

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:
I_DbSpecific.triggerExists(java.sql.Connection, org.xmlBlaster.contrib.replication.TableToWatchInfo)

xmlBlaster 2.1.0 API

Copyright © 1999-2011 The xmlBlaster.org contributers.