|
Web NMS provides various modules like Fault, Performance etc. You can write your module and plug it in into Web NMS. The data from this module is called the user data, and can be transferred between the Central Server and the DMS using the communication framework provided by Web NMS.
Whenever user data is to be transferred between the Central Server and the Distributed Mediation Servers, the existing communication framework needs to be utilized. To transfer data of type other than XML, you need to customize the communication layer itself. To avoid this, DataObject data type can be used to send user data. The user data can be of any data type but has to be in serialized form.
Steps to Customize User-Specific Data Transfer
To send data as Data Object, the data must extend the DataObject
class. The dataType
field needs to be set as 0 to indicate that a Data Object is to be transferred.
The userProps field can be used to set any user-specific information such
as, security information for the data. The following are the steps to
transfer user data between the two servers using the existing communication
framework.
Step
1: Implement the ModuleListener
interface to create a listener for the new module.
Make sure the data to be transferred in the form of either XML or Custom
Object is serializable. The methods
that need to be implemented are as follows
int getModuleID() - Use this method to get the module ID with which it has been registered to the communication framework.
setRequest(DataObject dataObject) - Use this method to manipulate the data received from the communication framework.
shutDown() - Use this method to close the connection and release resources held.
Step 2: Register the ModuleListener to the communication framework to receive notifications for data using the following:
Central Server -- SPPNOCHandler.getInstance().registerForNotification(int
notificationType,ModuleListener listener) throws
Exception
Example:
|
... SPPNOCHandler.getInstance().registerForNotification(DataTransferID.POLLED_DATA, this); ... |
Distributed Mediation Server -- NOCServerCommAPI.getInstance().registerForNotification(int
notificationType,ModuleListener listener) throws Exception
Example:
|
... NOCServerCommAPI.getInstance().registerForNotification(DataTransferID.POLLED_DATA, this); ... |
Step 3: Construct the DataObject with all the relevant data and send it through the respective communication framework.
In the case of Central Server, use SPPNOCHandler.getInstance().sendDataToPeer()
method to transfer the DataObject to the Distributed Mediation Server.
Example:
|
... SPPNOCHandler.getInstance().sendDataToPeer(regionID, dataObj, DataTransferID.POLLED_DATA); ... |
In the case of Distributed Mediation
Server, use NOCServerCommAPI.getInstance().sendData()
method to transfer the DataObject to the Central Server.
Example
|
... NOCServerCommAPI.getInstance().registerForNotification(DataTransferID.POLLED_DATA, this); ... |
Step 4: For plugging the new Module Listener into the distributed setup,
Write a RunProcessInterface and this implementation should wait until all the Web NMS modules are started. For details on how to implement the RPI, please refer to Module Services. This ensures initialization of communication module.
Central Server -- NmsWrapperUtil.isServerInitialized()
Distributed Mediation Server -- RMEServerUtil.getIsModuleInitialized()
Instantiate or register your ModuleListener.
|
|
Note: Default RunProcessInterface implementations available are:
|
|