JavaDoc


Subscription

org.dbreplicator.replication
Class Subscription

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.Subscription
All Implemented Interfaces:
java.io.Serializable, java.rmi.Remote, _Replicator, _SubImpl, _Subscription

public class Subscription
extends java.rmi.server.UnicastRemoteObject
implements _SubImpl, _Subscription, _Replicator

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

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

_SubImpl : It makes this class to implement the method getServerName which is called remotely by the publisher to get the local server name at the time of synchronization.

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

See Also:
Serialized Form

Field Summary
 AbstractDataBaseHandler dbHandler
           
 java.lang.String subName
           
 
Fields inherited from interface org.dbreplicator.replication._Subscription
xmlAndShadow_entries
 
Constructor Summary
Subscription()
           
Subscription(ConnectionPool connectionPool0, java.lang.String subName0, java.lang.String serverName0, ReplicationServer localServer0)
           
 
Method Summary
 void addSchedule(java.lang.String scheduleName, java.lang.String subscriptionName, java.lang.String scheduleType0, java.lang.String publicationServerName, java.lang.String publicationPortNo, java.lang.String recurrenceType, java.lang.String replicationType, java.sql.Timestamp startDateTime, int scheduleCounter)
          Add a schedule entry to the replication tables, which will be looked at when the replication instance is started, and obeyed according to its specification
 void editSchedule(java.lang.String scheduleName0, java.lang.String subName0, java.lang.String newPubServerName, java.lang.String newPubPortNo)
          Edit an existing schedule entry
 ConnectionPool getConnectionPool()
           
 AbstractDataBaseHandler getDBDataTypeHandler()
           
 java.lang.String getPub_SubName()
           
 int getRemoteServerPortNo()
           
 java.lang.String getRemoteServerUrl()
           
 RepTable getRepTable(java.lang.String tableName)
          Return the instance of RepTable corresponding to table name passed
 java.util.ArrayList getRepTables()
           
 java.lang.String getServerName()
           
 void getSnapShot()
          remove all the records from subscribed tables at subscriber and update the subscriber side with the latest records from the publisher.
 void getSnapShotAfterUpdatingSubscriber()
          Get a snapshot of newly added tables or tables on which no replication operation was done
 void pull()
          In Pull Replication records are downloaded from the publisher database.
 void push()
          In Push Replication records are uploaded to the publisher database.
 void removeSchedule(java.lang.String scheduleName0, java.lang.String subName0)
          Remove a schedule entry from the schedule table
 void resetRemoteServer()
           
 void setAlterTableAddFKStatements(java.util.ArrayList alterTableAddFKQueries0)
           
 void setFilterClause(java.lang.String tableName, java.lang.String filterClause)
           
 void setPublicatonName(java.lang.String pubName0)
           
 void setRemoteServerPortNo(int remotePort0)
          This method is called at the time of creating the subscriber.
 void setRemoteServerUrl(java.lang.String remoteUrl0)
          This method is called at the time of creating the subscriber.
 void setSubscriptionTables(java.util.ArrayList tableNames0)
          This method is called after parsing to set the repTables with the structures same as written on XML file.
 void subscribe()
          This method is responsible for the physical creation of the subscriber.
 void synchronize()
          Takes changed records from publisher, transfers them to subscriber and applies them, then takes changed records from subscriber and applies them back to the publisher.
 void unsubscribe()
          This method removes the subscribed tables from the publication server's bookmark table, then drops all replication related tables in the subscribed database
 void updateSubscription()
           
 
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

subName

public java.lang.String subName

dbHandler

public AbstractDataBaseHandler dbHandler
Constructor Detail

Subscription

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

Subscription

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

resetRemoteServer

public void resetRemoteServer()
Specified by:
resetRemoteServer in interface _Subscription

setSubscriptionTables

public void setSubscriptionTables(java.util.ArrayList tableNames0)
This method is called after parsing to set the repTables with the structures same as written on XML file.

Parameters:
tableNames0 -

setAlterTableAddFKStatements

public void setAlterTableAddFKStatements(java.util.ArrayList alterTableAddFKQueries0)

setRemoteServerUrl

public void setRemoteServerUrl(java.lang.String remoteUrl0)
                        throws RepException
This method is called at the time of creating the subscriber. This method sets the url(i p address.) of the publsher's m/c for the subscriber, i.e on which m/c the publisher exists. And on which m/c the subscriber will look for this publisher.

Specified by:
setRemoteServerUrl in interface _Subscription
Parameters:
remoteUrl0 -
Throws:
RepException

setRemoteServerPortNo

public void setRemoteServerPortNo(int remotePort0)
This method is called at the time of creating the subscriber. This method sets the port no. of the publsher for the subscriber, i.e on which port the publisher is running. And on which port the subscriber will look for the replication server of the publisher.

Specified by:
setRemoteServerPortNo in interface _Subscription
Parameters:
remotePort0 -

getRemoteServerUrl

public java.lang.String getRemoteServerUrl()
Specified by:
getRemoteServerUrl in interface _Subscription

getRemoteServerPortNo

public int getRemoteServerPortNo()
Specified by:
getRemoteServerPortNo in interface _Subscription

getConnectionPool

public ConnectionPool getConnectionPool()

setPublicatonName

public void setPublicatonName(java.lang.String pubName0)

subscribe

public void subscribe()
               throws RepException
This method is responsible for the physical creation of the subscriber. This method creates replication system tables for the subscription at the subscriber's end. For getting the publication's replication tables' structures, it looks up the remote replication server, gets the object of the publication's class and then calls remote methods which create the XML file on the publisher's end. This file holds the queries needed to create the same structures on the client/subscriber system. Then this file is transferred over the client socket, parsed and replication tables are generated according to its specifications. Then the proper triggers are created, and subscription data is saved.

Specified by:
subscribe in interface _Subscription
Throws:
RepException

getSnapShot

public void getSnapShot()
                 throws RepException
remove all the records from subscribed tables at subscriber and update the subscriber side with the latest records from the publisher.

Specified by:
getSnapShot in interface _Subscription
Throws:
RepException

synchronize

public void synchronize()
                 throws RepException
Takes changed records from publisher, transfers them to subscriber and applies them, then takes changed records from subscriber and applies them back to the publisher. This is the main function called for merge replication, and does everything according to the rules set forth in the conflict resolution algorithm chosen for this publication.

Specified by:
synchronize in interface _Subscription
Throws:
RepException

push

public void push()
          throws RepException
In Push Replication records are uploaded to the publisher database. Subscriber create a XML file of records which are considered for synchronization and writes it on client synchronization socket. The Publisher reads the zip file of client records, parses it and performs the included operations on the published tables in accordance with the conflict resolution algorithm chosen for this publication.

Specified by:
push in interface _Subscription
Throws:
RepException

pull

public void pull()
          throws RepException
In Pull Replication records are downloaded from the publisher database. Subscriber create a XML file of records which are considered for synchronization and writes it on client synchronization socket. The Subscriber then reads the zip file of records, parses it and performs the included operations on the subscribed tables in accordance with the conflict resolution algorithm chosen for this publication.

Specified by:
pull in interface _Subscription
Throws:
RepException

getRepTable

public RepTable getRepTable(java.lang.String tableName)
                     throws RepException
Return the instance of RepTable corresponding to table name passed

Specified by:
getRepTable in interface _Replicator
Parameters:
tableName - String
Returns:
RepTable
Throws:
RepException

setFilterClause

public void setFilterClause(java.lang.String tableName,
                            java.lang.String filterClause)

getServerName

public java.lang.String getServerName()
                               throws java.rmi.RemoteException
Specified by:
getServerName in interface _SubImpl
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

unsubscribe

public void unsubscribe()
                 throws RepException
This method removes the subscribed tables from the publication server's bookmark table, then drops all replication related tables in the subscribed database

Specified by:
unsubscribe in interface _Subscription
Throws:
RepException
java.rmi.RemoteException

getRepTables

public java.util.ArrayList getRepTables()
Specified by:
getRepTables in interface _Subscription

addSchedule

public void addSchedule(java.lang.String scheduleName,
                        java.lang.String subscriptionName,
                        java.lang.String scheduleType0,
                        java.lang.String publicationServerName,
                        java.lang.String publicationPortNo,
                        java.lang.String recurrenceType,
                        java.lang.String replicationType,
                        java.sql.Timestamp startDateTime,
                        int scheduleCounter)
                 throws RepException
Add a schedule entry to the replication tables, which will be looked at when the replication instance is started, and obeyed according to its specification

Specified by:
addSchedule in interface _Subscription
Parameters:
scheduleName - String
subscriptionName - String
scheduleType0 - String
publicationServerName - String
publicationPortNo - String
recurrenceType - String
replicationType - String
startDateTime - Timestamp
scheduleCounter - int
Throws:
RepException

removeSchedule

public void removeSchedule(java.lang.String scheduleName0,
                           java.lang.String subName0)
                    throws RepException
Remove a schedule entry from the schedule table

Specified by:
removeSchedule in interface _Subscription
Parameters:
scheduleName0 - String
subName0 - String
Throws:
RepException

editSchedule

public void editSchedule(java.lang.String scheduleName0,
                         java.lang.String subName0,
                         java.lang.String newPubServerName,
                         java.lang.String newPubPortNo)
                  throws RepException
Edit an existing schedule entry

Specified by:
editSchedule in interface _Subscription
Parameters:
scheduleName0 - String
subName0 - String
newPubServerName - String
newPubPortNo - String
Throws:
RepException

updateSubscription

public void updateSubscription()
                        throws RepException
Specified by:
updateSubscription in interface _Subscription
Throws:
RepException

getSnapShotAfterUpdatingSubscriber

public void getSnapShotAfterUpdatingSubscriber()
                                        throws RepException
Get a snapshot of newly added tables or tables on which no replication operation was done

Specified by:
getSnapShotAfterUpdatingSubscriber in interface _Subscription
Throws:
RepException



Powered by Drupal - Theme by Danger4k