JavaDoc


Publication

org.dbreplicator.replication
Class Publication

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.dbreplicator.replication.Publication
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, _PubImpl, _Publication, _Replicator

public class Publication
extends java.rmi.server.UnicastRemoteObject
implements _PubImpl, _Publication, _Replicator

The Publication class holds all the methods which are required for the physical creation of the publication(i.e system tables) and which are used at the time of synchronization at publisher's end. It implements three interfaces,

_PubImpl : It makes this class to implement all the remote methods which are called by the subscriber, at the time of subscribing, taking snapshot, synchronizing and for different tasks related to synchronization.

_Publication : It makes this class to implement all the methods which are called by the user, at the time of publishing, and for different tasks related to publishing.

_Replicator : It makes this class to implement all the methods which are called at the time of synchronization to get the publisher's information.

See Also:
Serialized Form

Field Summary
 int noOfPubTables
          number of tables included in publication
 
Fields inherited from interface org.dbreplicator.replication._Publication
publisher_wins, subscriber_wins, xmlAndShadow_entries
 
Constructor Summary
Publication()
           
Publication(ConnectionPool connectionPool0, java.lang.String pubName0, java.lang.String serverName0, ReplicationServer localServer0)
           
 
Method Summary
 void addTableToPublication(java.lang.String[] newTableList, java.lang.String[] filterClauses)
           
 void checkFilter(java.sql.Statement stmt, java.lang.String[] tableName0, java.lang.String[] filterClause0)
           
 void checkForLock(java.lang.String pubSubName)
           
 void checkTableNameIfNull(java.lang.String[] tableNames)
           
 void createSnapShot(java.lang.String subName, boolean isSchemaSupported, _FileUpload fileUpload, java.lang.String remoteMachineAddress)
          creates an XMl file for getting Snapshot on clients side.
 void createSnapShotAfterUpdateSub(java.lang.String address, int portNo, java.lang.String subName, java.util.ArrayList tablesForSnapShot, boolean isSchemaSupported, _FileUpload fileUpload, java.lang.String remoteMachineAddress)
          creates an XMl file for getting Snapshot on clients side.
 void createStructure(int clientVendorType0, java.lang.String subName, java.lang.String address, boolean isSchemaSupported, _FileUpload fileUpload, java.lang.String remoteMachineAddress)
          This method is responsible to assist to subscribe a subscription.
 java.lang.Object[] createXMLForClient(java.lang.String subName, java.lang.String clientServerName, boolean isSchemaSupported, _FileUpload fileUpload, java.lang.String remoteMachineAddress)
          Creates an XML file for synchronization purpose and send it to subscriber's socket.
 void dropSubscription(java.lang.String subName)
           
 void dropTableFromPublication(java.lang.String[] dropTableList)
           
 java.util.ArrayList dropTableListForSub(java.lang.String subName)
           
 java.lang.String getConflictResolver()
           
 ConnectionPool getConnectionPool()
           
 AbstractDataBaseHandler getDBDataTypeHandler()
           
 _FileUpload getFileUploader()
          getFileUploader
 java.lang.String getFilterClause(SchemaQualifiedName tableName)
           
 java.lang.String getPub_SubName()
           
 java.lang.Object[] getPublisherAddressAndPort()
           
 int getPubVendorName()
           
 RepTable getRepTable(java.lang.String tableName)
           
 java.lang.String getServerName()
           
 boolean isPublicationCyclic()
           
 void publish()
          This method is responsible for creating required system tables in publication database and shadow tables and triggers on tables to be published.
 void push(java.lang.String subName, java.lang.String remoteServerName, boolean isCreateTransactionLogFile, java.lang.String remoteMachineAddress)
          It handle the push replication operation in publication data source.
 void releaseLOCK()
           
 void saveSubscriptionData(java.lang.String subName)
          Inserts a row into bookmark table of server side to put a matching pair of publication name and subscription name.
 void saveSubscriptionNewData(java.lang.String subName)
          Inserts a row into bookmark table of server side to put a matching pair of publication name and subscription name.
 void setConflictResolver(java.lang.String conflictReolver0)
          Sets the conflict resolver for publication.
 void setCreateShadowTable(java.lang.String tableName0, boolean createShadowTable)
          This method come in use if tables in a publications are refering to each other and It is required to
 void setCyclic(boolean isCyclic)
           
 void setFilter(java.lang.String tableName0, java.lang.String filterClause0)
          Set the given filter clause for the given table
 void setFilter(java.lang.String tableName0, java.lang.String filterClause0, int paramCount0)
           
 void setIgnoredColumns(java.lang.String tableName, java.lang.String[] columnNamesToBeIgnored)
          This method sets the columns whose values are to be ignored while taking snapshot,synchronizing etc.
 void setPublicationTables(java.util.ArrayList repTables0)
          Set the replication tables for the publication
 void synchronize(java.lang.String subName, java.lang.String remoteServerName, boolean isCreateTransactionLogFile, java.lang.String remoteMachineAddress)
          merges the data between the client side and server side.
 void unpublish()
           
 void updateBookMarkLastSyncId(java.lang.String remote_Pub_Sub_Name, java.lang.Object[] lastId)
           
 void updatePublisherShadowAndBookmarkTableAfterPullOnSubscriber(java.lang.String remote_Pub_Sub_Name, java.lang.Object[] lastId)
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noOfPubTables

public int noOfPubTables
number of tables included in publication

Constructor Detail

Publication

public Publication()
            throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

Publication

public Publication(ConnectionPool connectionPool0,
                   java.lang.String pubName0,
                   java.lang.String serverName0,
                   ReplicationServer localServer0)
            throws java.rmi.RemoteException,
                   RepException
Throws:
java.rmi.RemoteException
RepException
Method Detail

setConflictResolver

public void setConflictResolver(java.lang.String conflictReolver0)
                         throws RepException
Sets the conflict resolver for publication. This can be one of:
  • publisher_wins
  • subscriber_wins

Specified by:
setConflictResolver in interface _Publication
Parameters:
conflictReolver0 - conflict resolver
Throws:
RepException

setPublicationTables

public void setPublicationTables(java.util.ArrayList repTables0)
Set the replication tables for the publication

Parameters:
repTables0 - list of tables

setCyclic

public void setCyclic(boolean isCyclic)

isPublicationCyclic

public boolean isPublicationCyclic()

getConflictResolver

public java.lang.String getConflictResolver()
                                     throws java.rmi.RemoteException
Specified by:
getConflictResolver in interface _PubImpl
Throws:
java.rmi.RemoteException

setFilter

public void setFilter(java.lang.String tableName0,
                      java.lang.String filterClause0)
               throws RepException
Set the given filter clause for the given table

A filter clause is simply the end of a where clause in an SQL statement. For example, to determine if your filterclause will work, insert it into this statement, where tablename is the table to which the filter is being applied:

select * from <tablename> where <filterclause>

As you can see, the filterclause can be almost anything, including subselects.

Specified by:
setFilter in interface _Publication
Parameters:
tableName0 - for which filter clause is to be added
filterClause0 - filter clause to be set
Throws:
RepException - if table does not exist or if filter clause is invalid

setFilter

public void setFilter(java.lang.String tableName0,
                      java.lang.String filterClause0,
                      int paramCount0)
               throws RepException
Specified by:
setFilter in interface _Publication
Throws:
RepException

setCreateShadowTable

public void setCreateShadowTable(java.lang.String tableName0,
                                 boolean createShadowTable)
                          throws RepException
This method come in use if tables in a publications are refering to each other and It is required to

Specified by:
setCreateShadowTable in interface _Publication
Parameters:
tableName0 - String
createShadowTable - boolean
Throws:
RepException

publish

public void publish()
             throws RepException
This method is responsible for creating required system tables in publication database and shadow tables and triggers on tables to be published. It is required for replication and saves data into system tables about the publication.

Specified by:
publish in interface _Publication
Throws:
RepException

createStructure

public void createStructure(int clientVendorType0,
                            java.lang.String subName,
                            java.lang.String address,
                            boolean isSchemaSupported,
                            _FileUpload fileUpload,
                            java.lang.String remoteMachineAddress)
                     throws java.rmi.RemoteException,
                            RepException
This method is responsible to assist to subscribe a subscription. This method creates a XML file to get all the tables involved in the publication and makes an entry in bookmark table of serverside to save the publication name with the subscription.

Specified by:
createStructure in interface _PubImpl
Parameters:
clientVendorType0 - client database type i.e. oracle or sql server
subName - Subscription Name
address - IP Address
isSchemaSupported - True/False (boolean)
fileUpload -
remoteMachineAddress - IP Address
Throws:
java.rmi.RemoteException
RepException

getPublisherAddressAndPort

public java.lang.Object[] getPublisherAddressAndPort()
                                              throws java.rmi.RemoteException,
                                                     RepException
Specified by:
getPublisherAddressAndPort in interface _PubImpl
Throws:
java.rmi.RemoteException
RepException

saveSubscriptionData

public void saveSubscriptionData(java.lang.String subName)
                          throws java.rmi.RemoteException
Inserts a row into bookmark table of server side to put a matching pair of publication name and subscription name.

Specified by:
saveSubscriptionData in interface _PubImpl
Parameters:
subName - sub name
Throws:
RepException
java.rmi.RemoteException

createSnapShot

public void createSnapShot(java.lang.String subName,
                           boolean isSchemaSupported,
                           _FileUpload fileUpload,
                           java.lang.String remoteMachineAddress)
                    throws java.sql.SQLException,
                           java.rmi.RemoteException,
                           RepException
creates an XMl file for getting Snapshot on clients side. Do entry in the server side bookmark table. Deletes all records from the server side log table.

Specified by:
createSnapShot in interface _PubImpl
Parameters:
subName - String
isSchemaSupported - True/False (boolean)
fileUpload -
remoteMachineAddress - IP Address
Throws:
java.sql.SQLException
java.rmi.RemoteException
RepException

createXMLForClient

public java.lang.Object[] createXMLForClient(java.lang.String subName,
                                             java.lang.String clientServerName,
                                             boolean isSchemaSupported,
                                             _FileUpload fileUpload,
                                             java.lang.String remoteMachineAddress)
                                      throws java.rmi.RemoteException,
                                             RepException
Creates an XML file for synchronization purpose and send it to subscriber's socket. Creates a server socket and send's it's information to the subscriber, so that subscriber can transfer file over it.

Specified by:
createXMLForClient in interface _PubImpl
Parameters:
subName - String
clientServerName - String
isSchemaSupported - boolean
fileUpload -
remoteMachineAddress - String
Returns:
Object[]
Throws:
java.rmi.RemoteException
RepException

synchronize

public void synchronize(java.lang.String subName,
                        java.lang.String remoteServerName,
                        boolean isCreateTransactionLogFile,
                        java.lang.String remoteMachineAddress)
                 throws java.rmi.RemoteException,
                        RepException
merges the data between the client side and server side.

Specified by:
synchronize in interface _PubImpl
Parameters:
subName -
remoteServerName -
Throws:
java.rmi.RemoteException
RepException

push

public void push(java.lang.String subName,
                 java.lang.String remoteServerName,
                 boolean isCreateTransactionLogFile,
                 java.lang.String remoteMachineAddress)
          throws java.rmi.RemoteException,
                 RepException
It handle the push replication operation in publication data source.

Specified by:
push in interface _PubImpl
Parameters:
subName - String
remoteServerName - String
Throws:
java.rmi.RemoteException
RepException

getServerName

public java.lang.String getServerName()
                               throws java.rmi.RemoteException
Specified by:
getServerName in interface _PubImpl
Throws:
java.rmi.RemoteException

getFilterClause

public java.lang.String getFilterClause(SchemaQualifiedName tableName)
                                 throws java.rmi.RemoteException
Specified by:
getFilterClause in interface _PubImpl
Throws:
java.rmi.RemoteException

getDBDataTypeHandler

public AbstractDataBaseHandler getDBDataTypeHandler()
Specified by:
getDBDataTypeHandler in interface _Replicator

getPub_SubName

public java.lang.String getPub_SubName()
Specified by:
getPub_SubName in interface _Replicator

getRepTable

public RepTable getRepTable(java.lang.String tableName)
                     throws RepException
Specified by:
getRepTable in interface _Replicator
Throws:
RepException

unpublish

public void unpublish()
               throws RepException
Specified by:
unpublish in interface _Publication
Throws:
RepException

dropSubscription

public void dropSubscription(java.lang.String subName)
                      throws java.rmi.RemoteException,
                             RepException
Specified by:
dropSubscription in interface _PubImpl
Throws:
java.rmi.RemoteException
RepException

checkForLock

public void checkForLock(java.lang.String pubSubName)
                  throws RepException,
                         java.rmi.RemoteException
Specified by:
checkForLock in interface _PubImpl
Throws:
RepException
java.rmi.RemoteException

releaseLOCK

public void releaseLOCK()
                 throws java.rmi.RemoteException
Specified by:
releaseLOCK in interface _PubImpl
Throws:
java.rmi.RemoteException

getPubVendorName

public int getPubVendorName()
                     throws RepException
Specified by:
getPubVendorName in interface _PubImpl
Throws:
RepException

updateBookMarkLastSyncId

public void updateBookMarkLastSyncId(java.lang.String remote_Pub_Sub_Name,
                                     java.lang.Object[] lastId)
                              throws java.rmi.RemoteException,
                                     java.sql.SQLException,
                                     RepException
Specified by:
updateBookMarkLastSyncId in interface _PubImpl
Throws:
java.rmi.RemoteException
java.sql.SQLException
RepException

addTableToPublication

public void addTableToPublication(java.lang.String[] newTableList,
                                  java.lang.String[] filterClauses)
                           throws RepException
Specified by:
addTableToPublication in interface _Publication
Throws:
RepException

saveSubscriptionNewData

public void saveSubscriptionNewData(java.lang.String subName)
                             throws java.rmi.RemoteException
Inserts a row into bookmark table of server side to put a matching pair of publication name and subscription name.

Specified by:
saveSubscriptionNewData in interface _PubImpl
Parameters:
subName - sub name
Throws:
RepException
java.rmi.RemoteException

dropTableFromPublication

public void dropTableFromPublication(java.lang.String[] dropTableList)
                              throws RepException
Specified by:
dropTableFromPublication in interface _Publication
Throws:
RepException

getConnectionPool

public ConnectionPool getConnectionPool()

checkFilter

public void checkFilter(java.sql.Statement stmt,
                        java.lang.String[] tableName0,
                        java.lang.String[] filterClause0)
                 throws RepException
Throws:
RepException

checkTableNameIfNull

public void checkTableNameIfNull(java.lang.String[] tableNames)
                          throws RepException
Throws:
RepException

createSnapShotAfterUpdateSub

public void createSnapShotAfterUpdateSub(java.lang.String address,
                                         int portNo,
                                         java.lang.String subName,
                                         java.util.ArrayList tablesForSnapShot,
                                         boolean isSchemaSupported,
                                         _FileUpload fileUpload,
                                         java.lang.String remoteMachineAddress)
                                  throws java.sql.SQLException,
                                         java.rmi.RemoteException,
                                         RepException
creates an XMl file for getting Snapshot on clients side. Do entry in the server side bookmark table. Deletes all records from the server side log table.

Specified by:
createSnapShotAfterUpdateSub in interface _PubImpl
Parameters:
address -
portNo -
subName -
Throws:
java.sql.SQLException
java.rmi.RemoteException
RepException

dropTableListForSub

public java.util.ArrayList dropTableListForSub(java.lang.String subName)
                                        throws RepException,
                                               java.sql.SQLException,
                                               java.rmi.RemoteException
Specified by:
dropTableListForSub in interface _PubImpl
Throws:
RepException
java.sql.SQLException
java.rmi.RemoteException

updatePublisherShadowAndBookmarkTableAfterPullOnSubscriber

public void updatePublisherShadowAndBookmarkTableAfterPullOnSubscriber(java.lang.String remote_Pub_Sub_Name,
                                                                       java.lang.Object[] lastId)
                                                                throws java.rmi.RemoteException,
                                                                       java.sql.SQLException,
                                                                       RepException
Specified by:
updatePublisherShadowAndBookmarkTableAfterPullOnSubscriber in interface _PubImpl
Throws:
java.rmi.RemoteException
java.sql.SQLException
RepException

setIgnoredColumns

public void setIgnoredColumns(java.lang.String tableName,
                              java.lang.String[] columnNamesToBeIgnored)
                       throws RepException
Description copied from interface: _Publication
This method sets the columns whose values are to be ignored while taking snapshot,synchronizing etc.

Specified by:
setIgnoredColumns in interface _Publication
Parameters:
tableName - String
Throws:
RepException

getFileUploader

public _FileUpload getFileUploader()
                            throws RepException,
                                   java.sql.SQLException,
                                   java.rmi.RemoteException
getFileUploader

Specified by:
getFileUploader in interface _PubImpl
Returns:
ArrayList
Throws:
RepException
java.sql.SQLException
java.rmi.RemoteException



Powered by Drupal - Theme by Danger4k