|
Communication between the Central Server and Distributed Mediation Servers can be operated in one-way or two-way modes, these modes are explained in Communication Mechanism. One-way communication mode is initiated and maintained only by the Distributed Mediation Servers and so, the communication is established and persists only for the time the data is transferred to the Central Server. On the other hand, two-way communication mode is maintained by both the Central and Distributed Mediation Server and so, the communication is persistent.
Communication customization is controlled by two interfaces namely,
SPPCommInitIfc
and SPPRegionalCommIfc
. These interfaces have to be implemented at the Central Server
and Distributed Regional Server respectively. The CommunicationInfo.xml
present in the conf directory
of the respective servers decides what kind of communication will exist
between the Central Server and the Distributed Mediation Servers.
SPPCommInitIfc
interface is implemented for establishing the communication link. The
methods provided by this interface are init(), open() and shutdown().
A CommunicationException
is thrown if there are any errors.
The init()
method is invoked before the communication is established.
This method can be used to perform any pre-initialization actions. The
argument to this method is a Properties object containing the MainProps
and UserProps values obtained from CommunicationInfo.xml
configuration file.
|
public void init(Properties args) throws CommunicationException; |
The open()
method is invoked to create an instance of the communication
session object. This method is very important as this method instantiates
the actual implementation for read and write.
At the Central Server, the open() method waits infinitely to listen for any Distributed Mediation Server to connect. When a Distributed Mediation Server connection is established , the instance of SPPRegionalCommIfc interface implementation is returned.
At the Distributed Mediation Server, the open method checks whether the connection is successful and returns the instance of SPPRegionalCommIfc interface implementation.
The argument to this method is a Properties object containing the MainProps and UserProps values obtained from CommunicationInfo.xml configuration file.
|
public SPPRegionalCommIfc open(Properties params) throws CommunicationException; |
The shutdown()
method is invoked to close the communication.
|
public void shutdown() throws CommunicationException; |
SPPRegionalCommIfc interface implements the protocol specific logic for data transfer. The methods provided by this interface are initialize(), write(), read() and shutdown(). A communication exception is thrown if there are any errors.
The initialize()
method is invoked to perform initialization of protocol to
be used for data transfer. The argument to this method is a Properties
object containing the values necessary for establishing the communication
session. This method returns true
if the initialization is successful, else returns
false.
|
public boolean initialize(Properties args) throws CommunicationException; |
The write()
method is invoked whenever data is to be sent to the counterpart
server. The write interval present in CommunicationInfo.xml
determines the time interval at which this method is invoked. The argument
to this method is a DataObject that contains the data that is to be sent
to the counterpart server. This method throws CommunicationException if
the write operation is not successful.
|
public DataObject write(DataObject dataObject) throws CommunicationException; |
The read()
method is invoked whenever data is to be read from the counterpart
server. The read interval present in CommunicationInfo.xml
determines the time interval at which this method is invoked. This
method returns the DataObject received from the counterpart server.
|
public DataObject read() throws CommunicationException; |
The shutdown()
method is invoked to close the communication and release
the resources.
|
public void shutdown() throws CommunicationException; |
|