|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dbreplicator.replication.DBHandler
Class AbstractDataBaseHandler
java.lang.Objectorg.dbreplicator.replication.DBHandler.AbstractDataBaseHandler
- Direct Known Subclasses:
- CloudScapeHandler, DaffodilDBHandler, DB2Handler, FireBirdDatabaseHandler, GeneralDataBaseHandler, MYSQLHandler, OracleHandler, PointBaseHandler, PostgreSQLHandler, SQLServerHandler, SybaseHandler
public abstract class AbstractDataBaseHandler
- extends java.lang.Object
In replicator because of the feature of multidatabase synchronization, It has become very much necessary to handle different databases deifferently. By identifying the database from Utility class a proper databasehandler is returned, And every handler extends this abstract class. So the abstract methods declared in it are defined accordingly in different handlers. This Class is solely defined for table creations and for appropriate column datatype sequence generation.
| Field Summary | |
|---|---|
static java.lang.String |
ignoredColumns_Table
|
static java.lang.String |
trackPrimaryKeyUpdation_Table
|
static java.lang.String |
trackReplicationTablesUpdation_Table
|
| Constructor Summary | |
|---|---|
AbstractDataBaseHandler()
|
|
| Method Summary | |
|---|---|
boolean |
checkSchema(java.lang.String schemaName)
|
void |
createClientSystemTables(java.lang.String subName)
|
void |
createRemoteSystemTables(java.lang.String pubName)
|
void |
createSchemas(java.lang.String pubName,
java.util.ArrayList schemas)
|
void |
CreateSequenceOnLogTable(java.lang.String pubSubName)
|
void |
CreateSequenceOnRepTable(java.lang.String pubSubName)
|
void |
CreateSequenceOnShadowTable(java.lang.String pubSubName)
|
abstract void |
createShadowTable(java.lang.String pubsubName,
java.lang.String tableName,
java.lang.String allColSequence,
java.lang.String[] primaryColumns)
Creates Shadow Table as per the database. |
abstract void |
createShadowTableTriggers(java.lang.String pubName,
java.lang.String tableName,
java.util.ArrayList colNameDataType,
java.lang.String[] primCols)
Creates ShadowTable triggers on different replication tables. |
void |
createSubscribedTablesTriggersAndShadowTables(java.lang.String subName,
java.lang.String[] pubTableQueries,
java.lang.String[] alterTableAddFKQueries,
java.util.HashMap primCols,
int pubVendorType,
java.util.ArrayList repTables)
This method create the main table, its corresponding shadow table and triggers in the database. |
void |
deleteRecordsFromSuperLogTable(java.sql.Statement subStatment)
|
void |
dropGenerators(java.sql.Connection con,
java.lang.String generatorName)
|
void |
dropPublisherSystemTables(java.sql.Connection con)
|
void |
dropSequences(java.sql.Connection con,
java.lang.String sequenceName)
|
void |
dropSubscriberSystemTables(java.sql.Connection con)
|
void |
dropTriggersAndShadowTable(java.sql.Connection connection,
java.lang.String table,
java.lang.String pubsubName)
|
void |
fireDropQuery(java.sql.Connection con,
java.lang.String query)
|
int |
getAppropriatePrecision(int columnSize,
java.lang.String datatypeName)
This method is implemented in child classes if precision exceed the maximum precision of the data type |
abstract int |
getAppropriateScale(int columnScale)
|
java.lang.String |
getBookMarkTableName()
|
java.util.ArrayList |
getColumnNamesAndDataTypes(java.lang.String columnSequence)
|
java.util.ArrayList |
getColumnNamesAndDataTypes1(java.lang.String columnSequence)
|
abstract AbstractColumnObject |
getColumnObject(TypeInfo typeInfo)
According to the sqlType, different column's for different databases are handled saperately. |
java.lang.String |
getIgnoredColumns_Table()
|
java.lang.String |
getLocalServerName()
|
java.lang.String |
getLogTableName()
|
java.lang.Object |
getMinValOfSyncIdTodeleteRecordsFromShadowTable(java.lang.String tableName,
java.sql.Statement stmt)
|
java.lang.String |
getPublicationTableName()
|
java.lang.String |
getRepTableName()
|
java.lang.String |
getScheduleTableName()
|
java.lang.String |
getShadowTableColumnDataTypeSequence(java.util.ArrayList nameTypeList,
java.lang.String[] primCols,
RepTable reptable)
Return the list of shadowtabls cols in a string. |
java.lang.String |
getShadowTableName(java.lang.String tableName)
|
java.lang.String |
getSubscriptionTableName()
|
java.lang.String |
getTableColumns(int VendorType,
java.lang.String columnName,
TypeInfo typeInfo,
int columnPrecision,
java.sql.ResultSet rs)
|
java.lang.String |
getTrackPrimayKeyUpdation_Table()
|
java.lang.String |
getTrackReplicationTablesUpdation_Table()
|
int |
getvendorName()
|
abstract boolean |
isDataTypeOptionalSizeSupported(TypeInfo typeInfo)
|
abstract boolean |
isForeignKeyException(java.sql.SQLException ex)
To get the foreign key error code to resolve the Synchronization problem when tables have parent - child relationship. |
abstract boolean |
isPrimaryKeyException(java.sql.SQLException ex)
|
abstract boolean |
isSchemaSupported()
This method is added for checking of schema.If schema exist in database then it return true else false.All the database support the schema except My SQL and Firebird. |
abstract java.sql.PreparedStatement |
makePrimaryPreperedStatement(java.sql.Connection pub_sub_Connection,
java.lang.String[] primaryColumns,
java.lang.String shadowTable,
java.lang.String local_pub_sub_name)
|
abstract java.sql.PreparedStatement |
makePrimaryPreperedStatementBackwardTraversing(java.lang.String[] primaryColumns,
long lastId,
java.lang.String local_pub_sub_name,
java.lang.String shadowTable)
|
void |
makeProvisionForLOBDataTypes(java.util.ArrayList list)
|
java.lang.String |
saveRepTableData(java.sql.Connection connection,
java.lang.String pubsubName,
RepTable repTable)
Save the RepTable data which is a system table. |
void |
setColumnPrecisionInTypeInfo(TypeInfo typeInfo,
java.sql.ResultSetMetaData rsmt,
int columnIndex)
|
void |
setDefaultSchema(java.sql.Connection connection)
It checks from the sqlType values whether the datatype is optional size supported or not. |
void |
setIgnoredColumns(java.sql.Connection connection,
java.lang.String pubsubName,
RepTable repTable)
|
void |
setLocalServerName(java.lang.String name0)
|
abstract void |
setTypeInfo(TypeInfo typeInfo,
java.sql.ResultSet rs)
This is a very important function which sets the parameter (instance of Class TypeInfo) with the corresponding typeName of the sqlType for different databases. |
java.lang.String |
updateDataType(java.lang.String dataType0)
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
ignoredColumns_Table
public static final java.lang.String ignoredColumns_Table
- See Also:
- Constant Field Values
trackReplicationTablesUpdation_Table
public static final java.lang.String trackReplicationTablesUpdation_Table
- See Also:
- Constant Field Values
trackPrimaryKeyUpdation_Table
public static final java.lang.String trackPrimaryKeyUpdation_Table
- See Also:
- Constant Field Values
| Constructor Detail |
|---|
AbstractDataBaseHandler
public AbstractDataBaseHandler()
| Method Detail |
|---|
CreateSequenceOnLogTable
public void CreateSequenceOnLogTable(java.lang.String pubSubName) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
CreateSequenceOnRepTable
public void CreateSequenceOnRepTable(java.lang.String pubSubName) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
CreateSequenceOnShadowTable
public void CreateSequenceOnShadowTable(java.lang.String pubSubName) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
setTypeInfo
public abstract void setTypeInfo(TypeInfo typeInfo, java.sql.ResultSet rs) throws RepException, java.sql.SQLException
- This is a very important function which sets the parameter (instance of
Class TypeInfo) with the corresponding typeName of the sqlType for different
databases. So that we can make corresponding queries.
- Parameters:
typeInfo-rs-- Throws:
RepExceptionjava.sql.SQLException
isSchemaSupported
public abstract boolean isSchemaSupported()
- This method is added for checking of schema.If schema exist in database
then it return true else false.All the database support the schema except
My SQL and Firebird.
- Returns:
- boolean
isDataTypeOptionalSizeSupported
public abstract boolean isDataTypeOptionalSizeSupported(TypeInfo typeInfo)
getColumnObject
public abstract AbstractColumnObject getColumnObject(TypeInfo typeInfo) throws RepException
- According to the sqlType, different column's for different databases are handled
saperately. It returns the object of AbstractColumnObject which is extended
by each type of column Object classes. This fundamental is used basically for
handeling Blob and Clob type of columns.
- Parameters:
typeInfo-- Throws:
RepException
createShadowTable
public abstract void createShadowTable(java.lang.String pubsubName, java.lang.String tableName, java.lang.String allColSequence, java.lang.String[] primaryColumns) throws RepException
- Creates Shadow Table as per the database.
- Parameters:
pubsubName-tableName-allColSequence-- Throws:
RepException
createShadowTableTriggers
public abstract void createShadowTableTriggers(java.lang.String pubName, java.lang.String tableName, java.util.ArrayList colNameDataType, java.lang.String[] primCols) throws RepException
- Creates ShadowTable triggers on different replication tables.
- Parameters:
pubName-tableName-colNameDataType-primCols-- Throws:
RepException
isPrimaryKeyException
public abstract boolean isPrimaryKeyException(java.sql.SQLException ex) throws java.sql.SQLException
- Throws:
java.sql.SQLException
setDefaultSchema
public void setDefaultSchema(java.sql.Connection connection) throws RepException
- It checks from the sqlType values whether the datatype is optional size
supported or not.
- Parameters:
connection- Connection- Throws:
RepException
getAppropriatePrecision
public int getAppropriatePrecision(int columnSize, java.lang.String datatypeName)
- This method is implemented in child classes if precision exceed the
maximum precision of the data type
- Parameters:
columnSize- int- Returns:
- int
- Throws:
RepException
createRemoteSystemTables
public void createRemoteSystemTables(java.lang.String pubName) throws RepException
- Throws:
RepException
getvendorName
public int getvendorName()
createClientSystemTables
public void createClientSystemTables(java.lang.String subName) throws RepException
- Throws:
RepException
createSubscribedTablesTriggersAndShadowTables
public void createSubscribedTablesTriggersAndShadowTables(java.lang.String subName, java.lang.String[] pubTableQueries, java.lang.String[] alterTableAddFKQueries, java.util.HashMap primCols, int pubVendorType, java.util.ArrayList repTables) throws RepException, java.sql.SQLException
- This method create the main table, its corresponding shadow table and
triggers in the database. If main table already created in the database,
then it get existing table query. If table structure is same then it
subscribe the table in database otherwise it thorw the exception table
already exist with different structure the database.
- Parameters:
subName- StringpubTableQueries- String[]primCols- HashMappubVendorType- int- Throws:
RepExceptionjava.sql.SQLException
getShadowTableColumnDataTypeSequence
public java.lang.String getShadowTableColumnDataTypeSequence(java.util.ArrayList nameTypeList, java.lang.String[] primCols, RepTable reptable)
- Return the list of shadowtabls cols in a string.
- Parameters:
nameTypeList- ArrayListprimCols- String[]- Returns:
- String
setLocalServerName
public void setLocalServerName(java.lang.String name0)
getLocalServerName
public java.lang.String getLocalServerName()
saveRepTableData
public java.lang.String saveRepTableData(java.sql.Connection connection, java.lang.String pubsubName, RepTable repTable) throws java.sql.SQLException, RepException
- Save the RepTable data which is a system table.
It store the Publication/Subscription Name,
its corresponding table with filter clause and conflict
resolver.
- Throws:
java.sql.SQLExceptionRepException
setIgnoredColumns
public void setIgnoredColumns(java.sql.Connection connection, java.lang.String pubsubName, RepTable repTable) throws RepException, java.sql.SQLException
- Throws:
RepExceptionjava.sql.SQLException
checkSchema
public boolean checkSchema(java.lang.String schemaName)
dropTriggersAndShadowTable
public void dropTriggersAndShadowTable(java.sql.Connection connection, java.lang.String table, java.lang.String pubsubName) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
fireDropQuery
public void fireDropQuery(java.sql.Connection con, java.lang.String query) throws java.sql.SQLException
- Throws:
java.sql.SQLException
updateDataType
public java.lang.String updateDataType(java.lang.String dataType0)
createSchemas
public void createSchemas(java.lang.String pubName, java.util.ArrayList schemas) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
dropSequences
public void dropSequences(java.sql.Connection con, java.lang.String sequenceName) throws java.sql.SQLException
- Throws:
java.sql.SQLException
makeProvisionForLOBDataTypes
public void makeProvisionForLOBDataTypes(java.util.ArrayList list)
getPublicationTableName
public java.lang.String getPublicationTableName()
getSubscriptionTableName
public java.lang.String getSubscriptionTableName()
getRepTableName
public java.lang.String getRepTableName()
getLogTableName
public java.lang.String getLogTableName()
getBookMarkTableName
public java.lang.String getBookMarkTableName()
getScheduleTableName
public java.lang.String getScheduleTableName()
setColumnPrecisionInTypeInfo
public void setColumnPrecisionInTypeInfo(TypeInfo typeInfo, java.sql.ResultSetMetaData rsmt, int columnIndex) throws java.sql.SQLException
- Throws:
java.sql.SQLException
getColumnNamesAndDataTypes1
public java.util.ArrayList getColumnNamesAndDataTypes1(java.lang.String columnSequence)
getTableColumns
public java.lang.String getTableColumns(int VendorType, java.lang.String columnName, TypeInfo typeInfo, int columnPrecision, java.sql.ResultSet rs) throws RepException, java.sql.SQLException
- Throws:
RepExceptionjava.sql.SQLException
getShadowTableName
public java.lang.String getShadowTableName(java.lang.String tableName)
getColumnNamesAndDataTypes
public java.util.ArrayList getColumnNamesAndDataTypes(java.lang.String columnSequence)
getAppropriateScale
public abstract int getAppropriateScale(int columnScale) throws RepException
- Throws:
RepException
dropPublisherSystemTables
public void dropPublisherSystemTables(java.sql.Connection con)
dropSubscriberSystemTables
public void dropSubscriberSystemTables(java.sql.Connection con)
deleteRecordsFromSuperLogTable
public void deleteRecordsFromSuperLogTable(java.sql.Statement subStatment) throws java.sql.SQLException
- Throws:
java.sql.SQLException
dropGenerators
public void dropGenerators(java.sql.Connection con, java.lang.String generatorName) throws java.sql.SQLException
- Throws:
java.sql.SQLException
isForeignKeyException
public abstract boolean isForeignKeyException(java.sql.SQLException ex) throws java.sql.SQLException
- To get the foreign key error code to resolve
the Synchronization problem when tables have
parent - child relationship.
- Returns:
- String
- Throws:
java.sql.SQLException
makePrimaryPreperedStatement
public abstract java.sql.PreparedStatement makePrimaryPreperedStatement(java.sql.Connection pub_sub_Connection, java.lang.String[] primaryColumns, java.lang.String shadowTable, java.lang.String local_pub_sub_name) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
getIgnoredColumns_Table
public java.lang.String getIgnoredColumns_Table()
getTrackReplicationTablesUpdation_Table
public java.lang.String getTrackReplicationTablesUpdation_Table()
getTrackPrimayKeyUpdation_Table
public java.lang.String getTrackPrimayKeyUpdation_Table()
getMinValOfSyncIdTodeleteRecordsFromShadowTable
public java.lang.Object getMinValOfSyncIdTodeleteRecordsFromShadowTable(java.lang.String tableName, java.sql.Statement stmt) throws java.sql.SQLException
- Throws:
java.sql.SQLException
makePrimaryPreperedStatementBackwardTraversing
public abstract java.sql.PreparedStatement makePrimaryPreperedStatementBackwardTraversing(java.lang.String[] primaryColumns, long lastId, java.lang.String local_pub_sub_name, java.lang.String shadowTable) throws java.sql.SQLException, RepException
- Throws:
java.sql.SQLExceptionRepException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dbreplicator.replication.DBHandler.AbstractDataBaseHandler

