|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.dbreplicator.replication
Class ReplicationServer
java.lang.Objectjava.rmi.server.RemoteObject
java.rmi.server.RemoteServer
java.rmi.server.UnicastRemoteObject
org.dbreplicator.replication.ReplicationServer
- All Implemented Interfaces:
- java.io.Serializable, java.rmi.Remote, _ReplicationServer, _ReplicationServerImpl
public class ReplicationServer
- extends java.rmi.server.UnicastRemoteObject
- implements _ReplicationServer, _ReplicationServerImpl
- extends java.rmi.server.UnicastRemoteObject
This is the main class of DBRepliactor, any side whether publisher or subscriber has to get an instance of this class by the method getInstance and then connect to the required database by using the method setDataSource.
The Publisher can create a publication by executing the method:
createPublication (get an instance of Publication class),
and the Subscriber can create a subscription by executing the method:
createSubscription (get an instance of Subscription class).
After that the control is transferred to the publisher and subscriber. and they start communicating to each other. It also implements _ReplicationServerImpl interface. So it gives publication's object when needed remotely(At the time of subscribing, snapshot, synchronize).
- See Also:
- Serialized Form
| Field Summary | |
|---|---|
java.lang.String |
databaseName
|
java.lang.String |
dataBaseName
|
java.lang.String |
databaseServerName
|
java.lang.String |
dBPortNo
|
java.lang.String |
driver
|
java.lang.String |
password
|
java.lang.String |
portNo
|
ScheduleHandler |
scheduleHandler
Mapping of subscriptions |
java.lang.String |
URL
|
java.lang.String |
user
|
java.lang.String |
vendorName
|
| Method Summary | |
|---|---|
void |
addTableToPublication(java.lang.String pubName,
java.lang.String[] tableNames0,
java.lang.String[] filterClauses,
java.util.ArrayList pubRepTables,
Publication pub)
To add more tables to a Publication |
_Publication |
createPublication(java.lang.String pubName,
java.lang.String[] tableNames)
Checks the following : |
_Publication |
createPublication(java.lang.String pubName,
java.lang.String[] tableNames,
java.lang.String[] removeCycleTableNames)
createPublication |
_Publication |
createPublicationBK(java.lang.String pubName,
java.lang.String[] tableNames)
|
_Subscription |
createSubscription(java.lang.String subName,
java.lang.String pubName)
Checks whether a subscription with the same name already exists in Subscription Table. |
java.util.ArrayList |
dropTableFromPublication(java.lang.String pubName,
java.lang.String[] tableNames,
Publication pub,
java.util.ArrayList pubRepTables)
To drop tables from a Publication |
java.sql.Connection |
getConnection(java.lang.String pub_sub_Name)
|
java.sql.Connection |
getDefaultConnection()
|
static ReplicationServer |
getInstance(int port0,
java.lang.String url0)
This method is responsible for getting the Replication Server instance. |
_Publication |
getPublication(java.lang.String pubName)
This method is called to get the publication's object even after creating it. |
java.lang.String |
getRemoteAddress()
getRemoteAddress |
_PubImpl |
getRemotePublication(java.lang.String pubName)
Returns the publication object when called by the subscriber remotely. |
ScheduleHandler |
getScheduleHandler()
This method returns the scheduleHandler instance which is used during add,edit and remove Schedule methods in subscription class. |
java.lang.String |
getServerName()
|
_Subscription |
getSubscription(java.lang.String subName)
This method returns the subscription's object, It is implemented for the cases in which for some reason the subscription's object can not be gotten directly, As when the replication server is restarted. |
java.util.ArrayList |
getTablesInCycle()
|
void |
refershPublication(java.lang.String pubName)
|
void |
refershSubscription(java.lang.String subName)
|
void |
setDataSource(javax.sql.DataSource dataSource)
|
void |
setDataSource(javax.sql.DataSource dataSource,
java.lang.String username,
java.lang.String password)
|
void |
setDataSource(java.lang.String driver0,
java.lang.String url0,
java.lang.String user0,
java.lang.String password0)
It is responsible for getting the default connection with the database. |
void |
setDataSource(java.lang.String dataBaseName0,
java.lang.String user0,
java.lang.String password0,
java.lang.String dBPortNo0,
java.lang.String databaseServerName0,
java.lang.String vendorName0)
|
void |
shutdown()
|
| 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 |
|---|
scheduleHandler
public ScheduleHandler scheduleHandler
- Mapping of subscriptions
driver
public java.lang.String driver
URL
public java.lang.String URL
user
public java.lang.String user
password
public java.lang.String password
portNo
public java.lang.String portNo
databaseName
public java.lang.String databaseName
databaseServerName
public java.lang.String databaseServerName
dataBaseName
public java.lang.String dataBaseName
dBPortNo
public java.lang.String dBPortNo
vendorName
public java.lang.String vendorName
| Method Detail |
|---|
getInstance
public static ReplicationServer getInstance(int port0, java.lang.String url0) throws RepException
- This method is responsible for getting the Replication Server instance.
It starts a replication server at the specified port and m/c by starting
the rmi registry over the specified port and m/c and binding this object.
- Parameters:
port0- Port no where we want to start the replication server.url0- System's name or ipaddress where to start replication server.- Returns:
- rep instance of replication server
- Throws:
RepException- if port is busy or m/c name is passed as localhost
getPublication
public _Publication getPublication(java.lang.String pubName) throws java.rmi.RemoteException, RepException
- This method is called to get the publication's object even after
creating it. It is well implemented in the method getPriPublication.
- Specified by:
getPublicationin interface_ReplicationServer
- Parameters:
pubName- Name of the publication whose object is required.- Returns:
- pub Publication class' object.
- Throws:
java.rmi.RemoteExceptionRepException
getRemotePublication
public _PubImpl getRemotePublication(java.lang.String pubName) throws java.rmi.RemoteException, RepException
- Returns the publication object when called by the subscriber remotely.
- Specified by:
getRemotePublicationin interface_ReplicationServerImpl
- Parameters:
pubName-- Returns:
- Publication Object
- Throws:
java.rmi.RemoteExceptionRepException
setDataSource
public void setDataSource(java.lang.String driver0, java.lang.String url0, java.lang.String user0, java.lang.String password0) throws RepException
- It is responsible for getting the default connection with the database.
Default connection implies the connection of the replication server.
- Specified by:
setDataSourcein interface_ReplicationServer
- Parameters:
driver0- The driver name of the concerned databse.url0- The URL of the cocerned database.user0- The username for the concerned databse.password0- The password for the concerned databse.- Throws:
RepException- In case it can not get connection with the database.
setDataSource
public void setDataSource(javax.sql.DataSource dataSource) throws RepException
- Throws:
RepException
setDataSource
public void setDataSource(javax.sql.DataSource dataSource, java.lang.String username, java.lang.String password) throws RepException
- Throws:
RepException
setDataSource
public void setDataSource(java.lang.String dataBaseName0, java.lang.String user0, java.lang.String password0, java.lang.String dBPortNo0, java.lang.String databaseServerName0, java.lang.String vendorName0) throws RepException
- Specified by:
setDataSourcein interface_ReplicationServer
- Throws:
RepException
createPublication
public _Publication createPublication(java.lang.String pubName, java.lang.String[] tableNames) throws RepException
- Checks the following :
Publication alredy exists.
Specified Table(s) exists in database.
Each table must have primary key.
Sequence of tables specified ( Primary Table than Foreign Table )
Then, Create the instance of Publication, set the instance of RepTable [] to pub
Put it in Map
- Specified by:
createPublicationin interface_ReplicationServer
- Parameters:
pubName- Name of the PublicationtableNames- Names of the tables to be published.- Returns:
- pub1 Publication class' object.
- Throws:
RepException- In case of violation of above checked conditions.
createPublicationBK
public _Publication createPublicationBK(java.lang.String pubName, java.lang.String[] tableNames) throws RepException
- Throws:
RepException
getSubscription
public _Subscription getSubscription(java.lang.String subName) throws RepException
- This method returns the subscription's object, It is implemented for the
cases in which for some reason the subscription's object can not
be gotten directly, As when the replication server is restarted. This
method searches subscriptions and reptable tables and gathers the required
information to rebuild the subscription's object.
- Specified by:
getSubscriptionin interface_ReplicationServer
- Parameters:
subName- Subscription's name- Returns:
- sub Subscription class' object
- Throws:
RepException- If could not set up connection with the database.
createSubscription
public _Subscription createSubscription(java.lang.String subName, java.lang.String pubName) throws RepException
- Checks whether a subscription with the same name already exists
in Subscription Table. Creates the subscription's object,
then adds an entry in the subscription Map.
- Specified by:
createSubscriptionin interface_ReplicationServer
- Parameters:
subName- Name of the subscription.pubName- Name of the corresponding publication.- Returns:
- sub subscription class' object.
- Throws:
RepException- If the above check violates.
getConnection
public java.sql.Connection getConnection(java.lang.String pub_sub_Name) throws RepException
- Specified by:
getConnectionin interface_ReplicationServer
- Throws:
RepException
getDefaultConnection
public java.sql.Connection getDefaultConnection()
- Specified by:
getDefaultConnectionin interface_ReplicationServer
refershPublication
public void refershPublication(java.lang.String pubName)
refershSubscription
public void refershSubscription(java.lang.String subName)
getServerName
public java.lang.String getServerName() throws java.rmi.RemoteException
- Specified by:
getServerNamein interface_ReplicationServerImpl
- Throws:
java.rmi.RemoteException
getScheduleHandler
public ScheduleHandler getScheduleHandler()
- This method returns the scheduleHandler instance which is used during
add,edit and remove Schedule methods in subscription class.
- Returns:
- ScheduleHandler
addTableToPublication
public void addTableToPublication(java.lang.String pubName, java.lang.String[] tableNames0, java.lang.String[] filterClauses, java.util.ArrayList pubRepTables, Publication pub) throws RepException
- To add more tables to a Publication
Checks the following :
Publication exists or not.
Specified Table(s) exists in database.
Each table must have primary key.
Sequence of tables specified ( Primary Table than Foreign Table )
- Parameters:
pubName- Name of the PublicationtableNames0- Names of the tables to be published.filterClauses- Filters on the published tables.pubRepTables- ArrayList of tables already published.pub- publication object.- Throws:
RepException- In case of violation of above checked conditions.
dropTableFromPublication
public java.util.ArrayList dropTableFromPublication(java.lang.String pubName, java.lang.String[] tableNames, Publication pub, java.util.ArrayList pubRepTables) throws RepException
- To drop tables from a Publication
Checks the following :
Publication exists or not.
Specified Table(s) exists in database.
Each table must have primary key.
Sequence of tables specified ( Primary Table than Foreign Table )
- Parameters:
pubName- Name of the PublicationtableNames- Names of the tables to be published.- Returns:
- pub1 Publication class' object.
- Throws:
RepException- In case of violation of above checked conditions.
createPublication
public _Publication createPublication(java.lang.String pubName, java.lang.String[] tableNames, java.lang.String[] removeCycleTableNames) throws RepException
- createPublication
- Specified by:
createPublicationin interface_ReplicationServer
- Parameters:
pubName- StringtableNames- String[]removeCycleTableNames- String[]- Returns:
- _Publication
- Throws:
RepException
getTablesInCycle
public java.util.ArrayList getTablesInCycle()
- Specified by:
getTablesInCyclein interface_ReplicationServer
shutdown
public void shutdown() throws RepException
- Throws:
RepException
getRemoteAddress
public java.lang.String getRemoteAddress() throws RepException
- getRemoteAddress
- Specified by:
getRemoteAddressin interface_ReplicationServerImpl
- Returns:
- String
- Throws:
RepException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.rmi.server.RemoteObject

