|
The Web NMS servers, both BE and FE, comprises of functionally independent modules (also called as processes) which interact among each other and make up the complete server application. The 'Module Services' provides a way for all these modules to be centrally controlled and coordinated, to ensure smooth operation of the server application. You can extend the functionality of the Web NMS servers by plugging in your own module, following the contracts defined by the Module Services.
What do Module Services offer?
Provision to define modules that are individual processes in the Web NMS BE or FE server
Provides the life-cycle methods for the modules
Provision to start and stop the modules
For plugging in your own module into the Web NMS Server, follow the steps detailed below :
Step 1
Implement the com.adventnet.nms.util.RunProcessInterface
The com.adventnet.nms.util.RunProcessInterface
defines various methods through which the Web NMS servers
control the corresponding module. In effect, the implementation of com.adventnet.nms.util.RunProcessInterfacebecomes
the main class (or the entry point) for your module within the Web NMS
server.
Details about an example implementation for the RunProcessInterface are provided below.
Step 2
Make an entry in the NmsProcesses[BE/FE].conf file
Specify the fully qualified class name of your implementation of com.adventnet.nms.util.RunProcessInterface and the parameters to be passed to it in the NmsProcessesBE.conf or NmsProcessesFE.conf, to plug-in your module in the BE or FE server, respectively.
A typical entry made in the NmsProcessesBE.conf file is provided below for your reference.
#java com.adventnet.nms.tl1.NMSTAServer [TAS_PORT port] [APPLET_DIRECTORY applet_directory]
PROCESS com.adventnet.nms.tl1.NMSTAServer
ARGS TAS_PORT 5005 APPLET_DIRECTORY html
Here,
"com.adventnet.nms.tl1.NMSTAServer" is the fully qualified class name of the implementation of RunProcessInterface.
"[TAS_PORT port] [APPLET_DIRECTORY applet_directory]" are the parameters to be passed
"ARGS TAS_PORT 5005 APPLET_DIRECTORY html" - the values for the respective parameters are passed here.
Specifying the modules and their parameters
To plug-in your module in the Web NMS servers, you need to make an entry in the NmsProcessesBE.conf / NmsProcessesFE.conf present in the <Web NMS HOME>/conf directory. You can also specify parameters in the configuration file, which will be passed as arguments to your module when it is started by the Web NMS server.
In the configuration file, the fully qualified class name of your implementation of com.adventnet.nms.util.RunProcessInterface should be specified against the keyword PROCESS and the parameters for the module have to be specified against the keyword ARGS.
The following is a typical entry in the conf file. NmsProcess is the implementation of com.adventnet.nms.util.RunProcessInterface which belongs to the test package. This module will take two parameters, TIMEOUT and RETRIES, with values 5 and 2 respectively.
PROCESS test.NmsProcess
ARGS TIMEOUT 5 RETRIES 2
Controlling the order of starting up and shutting down the modules
The Web NMS server starts the various modules in the order (top to bottom) they are specified in the NmsProcesses[BE/FE].conf configuration file and shuts them down in the reverse order. In Web NMS, modules are normally specified in the order of linear dependency, that is, any module is functionally dependent only on modules that are specified before that in the conf file. This ordering is essential for making sure that the Web NMS server startup and shutdown operations happen smoothly.
The com.adventnet.nms.util.RunProcessInterface interface defines the life cycle methods for the modules through which the Web NMS servers control them.
public
void callMain (String[
] args)
This method is called by the Web NMS server to start the module that is
specified in the NmsProcesses[BE/FE].conf
file. This method is the entry point for the corresponding module within
the Web NMS server. The arguments to the module specified in the conf
file are passed to this method. You should provide the initialization
and start off your module from this method.
public
boolean isInitialized ()
This method is used by the Web NMS server to check if the module has started
properly and is ready to serve other modules and the clients. Only when
all the modules specified in the conf file are started properly do the
Web NMS servers accept connections from the clients. Once your module
is initialized, you should return true from this method.
public
void shutDown ()
This
method is called for the module when the Web NMS server is shut down.
You should free up all the resources used by your module (Threads, socket
connections, database resources, etc.) in this method and make sure this
method always returns.
Please refer to the javadoc of com.adventnet.nms.util.RunProcessInterface
for a complete description of the API.
Please refer to the example ProcessTest.java in <Web NMS Home>/default_impl/client_server_communication directory, which illustrates the implementation of the com.adventnet.nms.util.RunProcessInterface interface, which is started as a separate thread by specifying the entry in the conf file as explained above. Refer to the example implementation of RunProcessInterface in Communication Framework.
|