"WEBNMS_5 API Docs"

com.adventnet.nms.startnms
Class MainSocketServerBE

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by com.adventnet.nms.startnms.MainSocketServerBE
All Implemented Interfaces:
MainSocketAPI, ShutDownObserver, java.io.Serializable, java.lang.Runnable, java.rmi.Remote

public class MainSocketServerBE
extends java.rmi.server.UnicastRemoteObject
implements MainSocketAPI, java.lang.Runnable, ShutDownObserver

This is the server class for the Common Socket or Common RMI API for the BE-FE server communication. All the modules of the Web NMS viz., Topology Database, Maps, Events, Alerts and Poll use the common socket for their client and server communication. Users can plug in their own client and server module in the Web NMS and use this API for their client and server module communication. Note : This class should be used only in the BE or FE server JVM.

See Also:
Serialized Form

Field Summary
 int nmsSocketPortBE
          The port used by the common socket server to which FE Server connects.
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
MainSocketServerBE()
           
MainSocketServerBE(int port)
          Constructor to initialize the Common Socket server object.
MainSocketServerBE(int port, boolean anyPort)
          Constructor to initialize the Common Socket server object.
MainSocketServerBE(java.lang.String proto)
          The constructor to use when the server has to be accessible via RMI from the client.
 
Method Summary
 void createSessions(MainSocketSessionBE session)
           
 int getLocalPort()
          This method will return the port in which the ServerSocket is listening for this instance of MainSocketServerBE.
static int getSequenceId()
           
 void instantiateMainSocketSessionBE(SocketConnectionBE clientSocket)
          This method gets invoked from MainSocketClientFE, if only singleJVM variable is true.
 void registerForResponses(SocketServerConnectionBE servClient)
          The modules which want to use the common socket connection should implement the SocketServerConnectionBE interface and use this method to register themselves.
 void run()
          This method waits indefinitely for a new connection from FE
 void shutDown()
          Gets called whenever Web NMS Server shuts down.
 MainSessionRemoteInterface start()
          This method is invoked by the client to get the remote reference of the Common Session object.
 MainSessionRemoteInterface start(java.lang.String timeAtWhichClientConnects)
           
 MainSessionRemoteInterface start(java.lang.String moduleID, java.lang.String timeAtWhichClientConnects)
           
 
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
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

nmsSocketPortBE

public int nmsSocketPortBE
The port used by the common socket server to which FE Server connects. This port number has to be given when NmsMainFE starts in separate JVM so that FE Server can read this file and connect to this port.

Constructor Detail

MainSocketServerBE

public MainSocketServerBE(int port)
                   throws java.rmi.RemoteException
Constructor to initialize the Common Socket server object. The argument used specifies the port to be used by the Web NMS common socket server.

Throws:
java.rmi.RemoteException

MainSocketServerBE

public MainSocketServerBE(int port,
                          boolean anyPort)
                   throws java.rmi.RemoteException
Constructor to initialize the Common Socket server object. The argument used specifies the port to be used by the Web NMS common socket server. The second argument specifies whether '0' can be used as port number while creating the ServerSocket.

Throws:
java.rmi.RemoteException

MainSocketServerBE

public MainSocketServerBE()
                   throws java.rmi.RemoteException
Throws:
java.rmi.RemoteException

MainSocketServerBE

public MainSocketServerBE(java.lang.String proto)
                   throws java.rmi.RemoteException
The constructor to use when the server has to be accessible via RMI from the client.

Throws:
java.rmi.RemoteException
Method Detail

instantiateMainSocketSessionBE

public void instantiateMainSocketSessionBE(SocketConnectionBE clientSocket)
                                    throws java.rmi.RemoteException
This method gets invoked from MainSocketClientFE, if only singleJVM variable is true.

Throws:
java.rmi.RemoteException

run

public void run()
This method waits indefinitely for a new connection from FE

Specified by:
run in interface java.lang.Runnable

createSessions

public void createSessions(MainSocketSessionBE session)

getLocalPort

public int getLocalPort()
This method will return the port in which the ServerSocket is listening for this instance of MainSocketServerBE. This will be useful, when the socket is bound to any available port instead of any specific port.


registerForResponses

public void registerForResponses(SocketServerConnectionBE servClient)
The modules which want to use the common socket connection should implement the SocketServerConnectionBE interface and use this method to register themselves. Whenever the client connects to the server, the init() method of the SocketServerConnectionBE is invoked so that the modules can open a separate session and register with the MainSocketSessionBE to process client's requests.


start

public MainSessionRemoteInterface start()
                                 throws java.rmi.RemoteException
This method is invoked by the client to get the remote reference of the Common Session object. Whenever the client connects to the server, the init() method of the SocketServerConnectionBE is invoked so that the modules can open a separate session and register with the MainSocketSessionBE to process client's requests.

Specified by:
start in interface MainSocketAPI
Throws:
java.rmi.RemoteException

start

public MainSessionRemoteInterface start(java.lang.String timeAtWhichClientConnects)
                                 throws java.rmi.RemoteException
Specified by:
start in interface MainSocketAPI
Throws:
java.rmi.RemoteException

start

public MainSessionRemoteInterface start(java.lang.String moduleID,
                                        java.lang.String timeAtWhichClientConnects)
                                 throws java.rmi.RemoteException
Specified by:
start in interface MainSocketAPI
Throws:
java.rmi.RemoteException

shutDown

public void shutDown()
Description copied from interface: ShutDownObserver
Gets called whenever Web NMS Server shuts down. All registered Observers will be notified even before calling shutDown method of all modules

Specified by:
shutDown in interface ShutDownObserver

getSequenceId

public static int getSequenceId()

"WEBNMS_5 API Docs"

Copyright © 2011 ZOHO Corp., All Rights Reserved.