xmlBlaster 2.2.0 API

org.xmlBlaster.contrib.replication.impl
Class SpecificOracle

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

public class SpecificOracle
extends SpecificDefault


Nested Class Summary
 
Nested classes/interfaces inherited from class org.xmlBlaster.contrib.replication.impl.SpecificDefault
SpecificDefault.Replacer
 
Field Summary
private  boolean createDropAlterDetection
           
private  boolean debug
           
private  java.lang.String debugFunction
           
private static java.util.logging.Logger log
           
private  java.lang.String ownSchema
           
private  boolean useOid
           
private  boolean wipeoutExIfConnected
           
private  boolean wipeoutFunctions
           
private  boolean wipeoutIndexes
           
private  boolean wipeoutPackages
           
private  boolean wipeoutProcedures
           
private  boolean wipeoutSequences
           
private  boolean wipeoutSynonyms
           
private  boolean wipeoutTables
           
private  boolean wipeoutTriggers
           
private  boolean wipeoutViews
           
 
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
SpecificOracle()
          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.
private  boolean checkIfContainsLongs(SqlDescription description)
           
private  void checkSchemaConnections(java.sql.Connection conn, java.lang.String schema)
          Gets the number of connected users belonging to this schema.
private  int cleanupOp(java.sql.Connection conn, java.util.ArrayList names, java.lang.String schema, java.lang.String prefix, java.lang.String postfix)
           
 void cleanupSchema(java.lang.String schema, java.lang.String type, java.lang.String referencedSchema)
          Cleans up the specified schema for the specified type.
private  boolean cleanupType(java.lang.String schema, java.lang.String objName, java.lang.String sql, java.lang.String postfix)
           
 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, boolean useOid)
           
 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.
 java.lang.String getOwnSchema()
           
 void init(I_Info info)
           
private  int invokeListStatement(java.sql.Connection conn, java.util.List names, java.lang.String sql)
           
static void main(java.lang.String[] args)
           
 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)
          returns true if the sequence exists already.
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.
private  int wipeoutSchemaSingleSweep(java.lang.String catalog, java.lang.String schema, boolean[] objectsToWipeout)
           
 
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, getReplPrefix, getUsedPropertyKeys, incrementReplKey, initialCommand, initialCommandPre, initiateUpdate, isDatasourceReadonly, 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
 

Field Detail

log

private static java.util.logging.Logger log

ownSchema

private java.lang.String ownSchema

debug

private boolean debug

debugFunction

private java.lang.String debugFunction

wipeoutTriggers

private boolean wipeoutTriggers

wipeoutSequences

private boolean wipeoutSequences

wipeoutFunctions

private boolean wipeoutFunctions

wipeoutPackages

private boolean wipeoutPackages

wipeoutProcedures

private boolean wipeoutProcedures

wipeoutViews

private boolean wipeoutViews

wipeoutTables

private boolean wipeoutTables

wipeoutSynonyms

private boolean wipeoutSynonyms

wipeoutIndexes

private boolean wipeoutIndexes

wipeoutExIfConnected

private boolean wipeoutExIfConnected

createDropAlterDetection

private boolean createDropAlterDetection

useOid

private boolean useOid
Constructor Detail

SpecificOracle

public SpecificOracle()
Not doing anything.

Method Detail

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

checkIfContainsLongs

private boolean checkIfContainsLongs(SqlDescription description)
Parameters:
description -
Returns:

createVariableSqlPart

protected java.lang.String createVariableSqlPart(SqlDescription description,
                                                 java.lang.String prefix,
                                                 boolean containsLongs,
                                                 boolean isInsert,
                                                 boolean useOid)
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:

cleanupType

private final boolean cleanupType(java.lang.String schema,
                                  java.lang.String objName,
                                  java.lang.String sql,
                                  java.lang.String postfix)

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:

main

public static void main(java.lang.String[] args)

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.

cleanupOp

private int cleanupOp(java.sql.Connection conn,
                      java.util.ArrayList names,
                      java.lang.String schema,
                      java.lang.String prefix,
                      java.lang.String postfix)
               throws java.lang.Exception
Throws:
java.lang.Exception

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

invokeListStatement

private int invokeListStatement(java.sql.Connection conn,
                                java.util.List names,
                                java.lang.String sql)
                         throws java.sql.SQLException
Parameters:
conn -
st -
rs -
Returns:
Throws:
java.sql.SQLException

checkSchemaConnections

private void checkSchemaConnections(java.sql.Connection conn,
                                    java.lang.String schema)
                             throws java.lang.Exception
Gets the number of connected users belonging to this schema.

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

wipeoutSchemaSingleSweep

private int wipeoutSchemaSingleSweep(java.lang.String catalog,
                                     java.lang.String schema,
                                     boolean[] objectsToWipeout)
                              throws java.lang.Exception
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 triggerName)
                         throws java.lang.Exception
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:
I_DbSpecific.triggerExists(java.sql.Connection, org.xmlBlaster.contrib.replication.TableToWatchInfo)

getOwnSchema

public java.lang.String getOwnSchema()
Overrides:
getOwnSchema in class SpecificDefault

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.