xmlBlaster 2.2.0 contributions API

org.xmlBlaster.contrib.replication
Class TableToWatchInfo

java.lang.Object
  extended by org.xmlBlaster.contrib.replication.TableToWatchInfo

public class TableToWatchInfo
extends java.lang.Object

TableToWatchInfo is a place holder (as an ejb) for data which is stored in the ${replPrefix}tables table. It also offers facility to retrieve the data from info objects.

Author:
Michele Laghi

Field Summary
static java.lang.String ACTION_KEY
           
static java.lang.String ALL_TOKEN
           
static java.lang.String EMPTY
           
static java.lang.String KEY_SEP
           
static java.lang.String SCHEMA_PREFIX
           
static java.lang.String SEQUENCE_KEY
           
static java.lang.String STATUS_CREATING
           
static java.lang.String STATUS_OK
           
static java.lang.String STATUS_REMOVE
           
static java.lang.String TABLE_PREFIX
           
static java.lang.String TABLE_PREFIX_WITH_SEP
          this is used as the prefix for all tables to replicate
static java.lang.String TRIGGER_KEY
           
static java.lang.String VAL_SEP
           
 
Constructor Summary
TableToWatchInfo()
           
TableToWatchInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table)
           
 
Method Summary
 void assignFromInfoPair(java.lang.String key, java.lang.String value)
          Parses the data which is passed as a key/value pair.
static TableToWatchInfo get(java.sql.Connection conn, java.lang.String tableName, java.lang.String catalog, java.lang.String schema, java.lang.String table, TableToWatchInfo tableToWatch)
           
 java.lang.String getActions()
           
static TableToWatchInfo[] getAll(java.sql.Connection conn, java.lang.String confTableName)
          Gets the entire configuration information of the configuration table specified in the argument list.
 java.lang.String getCatalog()
           
 java.lang.String getConfigKey()
           
 java.lang.String getConfigValue()
           
 int getDebug()
           
 long getReplKey()
           
 java.lang.String getSchema()
           
static java.lang.String getSortedTablesToWatch(java.sql.Connection conn, I_Info info, java.util.List outputSequence)
           
 java.lang.String getStatus()
           
 java.lang.String getTable()
           
static TableToWatchInfo[] getTablesToWatch(java.sql.Connection conn, I_Info originalInfo)
          Gets an array containing all the tables to watch found in this configuration info object.
 java.lang.String getTrigger()
           
 boolean isReplicate()
           
 boolean isStatusOk(I_DbSpecific dbSpecific, java.sql.Connection conn)
          Checks if the status is OK.
 void removeFromDb(java.lang.String replicationPrefix, I_DbPool dbPool)
           
 void setActions(java.lang.String actions)
           
 void setCatalog(java.lang.String catalog)
           
 void setDebug(int debug)
           
 void setReplKey(long replKey)
           
 void setSchema(java.lang.String schema)
           
 void setStatus(java.lang.String status)
           
 void setTable(java.lang.String table)
           
 void setTrigger(java.lang.String trigger)
           
 void store(java.lang.String replPrefix, I_DbPool dbPool, java.sql.Connection conn)
          First checks if the entry exists already.
 void storeStatus(java.lang.String replicationPrefix, I_DbPool dbPool)
           
 java.lang.String toXml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_KEY

public static final java.lang.String ACTION_KEY
See Also:
Constant Field Values

TRIGGER_KEY

public static final java.lang.String TRIGGER_KEY
See Also:
Constant Field Values

SEQUENCE_KEY

public static final java.lang.String SEQUENCE_KEY
See Also:
Constant Field Values

STATUS_CREATING

public static final java.lang.String STATUS_CREATING
See Also:
Constant Field Values

STATUS_OK

public static final java.lang.String STATUS_OK
See Also:
Constant Field Values

STATUS_REMOVE

public static final java.lang.String STATUS_REMOVE
See Also:
Constant Field Values

TABLE_PREFIX

public static final java.lang.String TABLE_PREFIX
See Also:
Constant Field Values

SCHEMA_PREFIX

public static final java.lang.String SCHEMA_PREFIX
See Also:
Constant Field Values

KEY_SEP

public static final java.lang.String KEY_SEP
See Also:
Constant Field Values

VAL_SEP

public static final java.lang.String VAL_SEP
See Also:
Constant Field Values

EMPTY

public static final java.lang.String EMPTY
See Also:
Constant Field Values

ALL_TOKEN

public static final java.lang.String ALL_TOKEN
See Also:
Constant Field Values

TABLE_PREFIX_WITH_SEP

public static final java.lang.String TABLE_PREFIX_WITH_SEP
this is used as the prefix for all tables to replicate

See Also:
Constant Field Values
Constructor Detail

TableToWatchInfo

public TableToWatchInfo()

TableToWatchInfo

public TableToWatchInfo(java.lang.String catalog,
                        java.lang.String schema,
                        java.lang.String table)
Method Detail

getSortedTablesToWatch

public static java.lang.String getSortedTablesToWatch(java.sql.Connection conn,
                                                      I_Info info,
                                                      java.util.List outputSequence)
                                               throws java.lang.Exception
Throws:
java.lang.Exception

getTablesToWatch

public static TableToWatchInfo[] getTablesToWatch(java.sql.Connection conn,
                                                  I_Info originalInfo)
                                           throws java.lang.Exception
Gets an array containing all the tables to watch found in this configuration info object.

Parameters:
info -
Returns:
Throws:
java.lang.Exception

getConfigKey

public java.lang.String getConfigKey()

getConfigValue

public java.lang.String getConfigValue()

assignFromInfoPair

public void assignFromInfoPair(java.lang.String key,
                               java.lang.String value)
                        throws java.lang.Exception
Parses the data which is passed as a key/value pair.

Parameters:
key -
value -
Throws:
java.lang.Exception

getCatalog

public java.lang.String getCatalog()
Returns:
Returns the catalog.

setCatalog

public void setCatalog(java.lang.String catalog)
Parameters:
catalog - The catalog to set.

isReplicate

public boolean isReplicate()
Returns:
Returns the replicate.

setActions

public void setActions(java.lang.String actions)
Parameters:
replicate - The replicate to set.

getReplKey

public long getReplKey()
Returns:
Returns the replKey.

setReplKey

public void setReplKey(long replKey)
Parameters:
replKey - The replKey to set.

getSchema

public java.lang.String getSchema()
Returns:
Returns the schema.

setSchema

public void setSchema(java.lang.String schema)
Parameters:
schema - The schema to set.

getStatus

public java.lang.String getStatus()
Returns:
Returns the status.

setStatus

public void setStatus(java.lang.String status)
Parameters:
status - The status to set.

getTable

public java.lang.String getTable()
Returns:
Returns the table.

setTable

public void setTable(java.lang.String table)
Parameters:
table - The table to set.

getTrigger

public java.lang.String getTrigger()
Returns:
Returns the trigger.

setTrigger

public void setTrigger(java.lang.String trigger)
Parameters:
trigger - The trigger to set.

store

public void store(java.lang.String replPrefix,
                  I_DbPool dbPool,
                  java.sql.Connection conn)
           throws java.lang.Exception
First checks if the entry exists already. If it exists, it is first removed, otherwise it is just added.

Parameters:
replPrefix -
dbPool -
conn -
Throws:
java.lang.Exception

get

public static TableToWatchInfo get(java.sql.Connection conn,
                                   java.lang.String tableName,
                                   java.lang.String catalog,
                                   java.lang.String schema,
                                   java.lang.String table,
                                   TableToWatchInfo tableToWatch)
                            throws java.lang.Exception
Parameters:
conn -
tableName - The name of the table from which to retrieve the information
catalog -
schema -
table -
tableToWatch - can be null. If it is not null, it will be changed appropriately and returned.
Returns:
Throws:
java.lang.Exception

getAll

public static TableToWatchInfo[] getAll(java.sql.Connection conn,
                                        java.lang.String confTableName)
Gets the entire configuration information of the configuration table specified in the argument list. Never throws exception nor returns null.

Parameters:
conn -
tableName -
Returns:

getActions

public java.lang.String getActions()

toXml

public java.lang.String toXml()

getDebug

public int getDebug()

setDebug

public void setDebug(int debug)

storeStatus

public void storeStatus(java.lang.String replicationPrefix,
                        I_DbPool dbPool)
                 throws java.lang.Exception
Throws:
java.lang.Exception

removeFromDb

public void removeFromDb(java.lang.String replicationPrefix,
                         I_DbPool dbPool)
                  throws java.lang.Exception
Throws:
java.lang.Exception

isStatusOk

public boolean isStatusOk(I_DbSpecific dbSpecific,
                          java.sql.Connection conn)
Checks if the status is OK. To return true the status flag in the tables table must be OK, the trigger must exist and no exception shall be thrown by requesting the existence of the trigger.

Parameters:
dbSpecific -
conn -
Returns:

xmlBlaster 2.2.0 contributions API

Copyright © 1999-2014 The xmlBlaster.org contributers.