|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dbreplicator.replication
Class Subscription
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
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
- extends java.rmi.server.UnicastRemoteObject
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.RemoteExceptionRepException
| Method Detail |
|---|
resetRemoteServer
public void resetRemoteServer()
- Specified by:
resetRemoteServerin 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:
setRemoteServerUrlin 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:
setRemoteServerPortNoin interface_Subscription
- Parameters:
remotePort0-
getRemoteServerUrl
public java.lang.String getRemoteServerUrl()
- Specified by:
getRemoteServerUrlin interface_Subscription
getRemoteServerPortNo
public int getRemoteServerPortNo()
- Specified by:
getRemoteServerPortNoin 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:
subscribein 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:
getSnapShotin 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:
synchronizein 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:
pushin 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:
pullin 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:
getRepTablein 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:
getServerNamein interface_SubImpl
- Throws:
java.rmi.RemoteException
getDBDataTypeHandler
public AbstractDataBaseHandler getDBDataTypeHandler()
- Specified by:
getDBDataTypeHandlerin interface_Replicator
getPub_SubName
public java.lang.String getPub_SubName()
- Specified by:
getPub_SubNamein 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:
unsubscribein interface_Subscription
- Throws:
RepExceptionjava.rmi.RemoteException
getRepTables
public java.util.ArrayList getRepTables()
- Specified by:
getRepTablesin 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:
addSchedulein interface_Subscription
- Parameters:
scheduleName- StringsubscriptionName- StringscheduleType0- StringpublicationServerName- StringpublicationPortNo- StringrecurrenceType- StringreplicationType- StringstartDateTime- TimestampscheduleCounter- 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:
removeSchedulein interface_Subscription
- Parameters:
scheduleName0- StringsubName0- 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:
editSchedulein interface_Subscription
- Parameters:
scheduleName0- StringsubName0- StringnewPubServerName- StringnewPubPortNo- String- Throws:
RepException
updateSubscription
public void updateSubscription() throws RepException
- Specified by:
updateSubscriptionin 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:
getSnapShotAfterUpdatingSubscriberin interface_Subscription
- Throws:
RepException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.rmi.server.RemoteObject

