WebNMS 5 API Specification

com.adventnet.management
Interface ManagementServices


public interface ManagementServices

This is an interface which supports generic protocol-neutral Management transactions for user client applications. It offers the ManagementServices like Request response, Event notification and request Polling to the user client applications.

Applications should use the method ManagementServicesAPI.getInstance(String[] ,int ) or ManagementServicesAPI.getInstance(Applet,int) to create a ManagementServices implementation instance. This is a singleton instance for a JVM. Click Here For Details

Transactions Supported For User Client Applications : This supports the following types of transactions with the user client applications.

a) Request Response (Synchronous ) : Sending a request and receiving the response synchronously.
b) Request Response (Asynchronous) : Sending a request and receiving the response asynchronously.
c) Polling Request : Registering a request to be sent periodically and receiving the responses.
d) Event Notifications : : Registering a request for receiving event notifications .


Method Summary
 boolean checkResponse(int reqid)
          To check if response has been received for the given request id.
 int[] checkResponses()
          To return request id of all the responses received.
 java.lang.String establishSession(Property prop)
          Used to establish a session with the device agent.
 boolean isRunning()
          Determines If the ManagementServices is running or stopped .
 ManagementServerResultEvent receive(int reqid)
          Gets the result for send() as ManagementServerResultEvent for the given reqid returned for send().
 void registerClient(Property property)
          Registers a Property request with the ManagementServices for Polling.
 void registerClient(Property[] propertyArr)
          Registers an array of Property requests with the ManagementServices for Polling.
 java.lang.String registerForNotification(Property prop)
          Registers a Property request with the ManagementServices for receiving Event notifications.
The user client application object should implement MSEventListener interface for receiving notifications.
 void reRegisterClient(Property property)
          Unregisters and registers a Property request with the ManagementServices for Polling.
 void reRegisterClient(Property[] propertyArr)
          Unregisters and registers a Property request with the ManagementServices for Polling.
 void restart()
          This will restart the ManagementServices if they have been stopped using stop().
 int send(Property prop)
          Asynchronous type of Request Response Transaction .
 void sendAction(Property prop)
          A unacknowledged type of Request Response Transaction .
 void setDebug(boolean debug)
          This is used to enable the debug mode in Management Services.
 void stop()
          This will temporarily shutdown the ManagementServices.
 ManagementServerResultEvent syncSend(Property prop)
          Synchronous type of Request Response Transaction .
 void terminateSession(Property prop)
          Used to terminate an established device session .
 void terminateSession(java.lang.String sessionId)
          This is used to terminate the session using the sessionId returned during establish.
 void unregisterClient(Property property)
          Unregisters a Property request with the ManagementServices from Polling.
 void unregisterClient(Property[] propertyArr)
          Unregisters an array of Property requests with the ManagementServices from Polling.
 void unregisterForNotification(Property prop)
          Unregisters a Property request with the ManagementServices from receiving events.
 void unregisterForNotification(java.lang.String eventId)
          Unregisters a Property request with the ManagementServices from receiving events.
 

Method Detail

restart

public void restart()
             throws java.lang.Exception
This will restart the ManagementServices if they have been stopped using stop(). It will restart the Polling and Event notification operation.

stop

public void stop()
This will temporarily shutdown the ManagementServices. It will stop Polling and Event notification Operations. It can be restarted using restart()

registerClient

public void registerClient(Property property)
                    throws java.lang.Exception
Registers a Property request with the ManagementServices for Polling. The user client application may get the responses either through ProtocolListener interface or using Property.setMethodDetail(String, int, String[], Object[]) Details
Parameters:
Property - - Property to register.

registerClient

public void registerClient(Property[] propertyArr)
                    throws java.lang.Exception
Registers an array of Property requests with the ManagementServices for Polling. The user client application may get the responses either through ProtocolListener interface or using Property.setMethodDetail(String, int, String[], Object[]) Details
Parameters:
Property[] - - Property array to register.

unregisterClient

public void unregisterClient(Property property)
Unregisters a Property request with the ManagementServices from Polling. The Property should be the same instance as used for register.
Parameters:
Property - - Property to unregister.

unregisterClient

public void unregisterClient(Property[] propertyArr)
Unregisters an array of Property requests with the ManagementServices from Polling. The Property(s) should be the same instance as used for register.
Parameters:
Property[] - - Property array to unregister.

reRegisterClient

public void reRegisterClient(Property property)
                      throws java.lang.Exception
Unregisters and registers a Property request with the ManagementServices for Polling. Used to refresh Polling. The Property should be the same instance as used for register.
Parameters:
Property - - Property request to reregister.

reRegisterClient

public void reRegisterClient(Property[] propertyArr)
                      throws java.lang.Exception
Unregisters and registers a Property request with the ManagementServices for Polling. Used to refresh Polling. The Property(s) should be the same instance as used for register.
Parameters:
Property[] - - Property array to reregister.

syncSend

public ManagementServerResultEvent syncSend(Property prop)
Synchronous type of Request Response Transaction .
It sends the request based on the Property , blocks until response is received , and returns the response . a)Details
Returns:
ManagementServerResultEvent ,the generic response .

send

public int send(Property prop)
Asynchronous type of Request Response Transaction .

It sends the request based on the Property and returns a requuestId used to identify the transaction.
The user client application may get the responses either through ProtocolListener interface or using Property.setMethodDetail(String, int, String[], Object[]) The requestId can be used to receive the response from the same thread context using in receive(int) .


checkResponse

public boolean checkResponse(int reqid)
To check if response has been received for the given request id. returns true if response is available and the response can then be got from receive() method. else returns false.
This is used by applications which are designed to receive only from the same Thread context.
Parameters:
reqid - - integer representing the request id.
Returns:
true or false.

checkResponses

public int[] checkResponses()
To return request id of all the responses received. Generally used in apllications using receive() to receive responses.
This is used by applications which are designed to receive only from the same Thread context.
Returns:
array of int representing request id.

receive

public ManagementServerResultEvent receive(int reqid)
Gets the result for send() as ManagementServerResultEvent for the given reqid returned for send().
This is used by applications which are designed to receive only from the same Thread context. Details
Parameters:
reqid - - integer representing the request id.
Returns:
ManagementServerResultEvent object.

sendAction

public void sendAction(Property prop)
A unacknowledged type of Request Response Transaction .

It sends the request based on the Property and returns.
It is used to invoke an action in the Protocol Provider which may be specific to the protocol.

Returns:
nothing.

registerForNotification

public java.lang.String registerForNotification(Property prop)
Registers a Property request with the ManagementServices for receiving Event notifications.
The user client application object should implement MSEventListener interface for receiving notifications.

unregisterForNotification

public void unregisterForNotification(Property prop)
Unregisters a Property request with the ManagementServices from receiving events.
Parameters:
Property - - Property request to unregister. The Property should be the same instance as used for register.

unregisterForNotification

public void unregisterForNotification(java.lang.String eventId)
Unregisters a Property request with the ManagementServices from receiving events.
Parameters:
eventId - returned in register .

establishSession

public java.lang.String establishSession(Property prop)
Used to establish a session with the device agent. This is relevant only for connection oriented protocols .
The user client application should implement DeviceConnectionListener if it needs to be notified of connection loss.
Parameters:
Property - - Property request for establishing a session.

terminateSession

public void terminateSession(Property prop)
Used to terminate an established device session .
Parameters:
Property - - Property request for terminating a session. The Property should be the same instance as used for establish.

terminateSession

public void terminateSession(java.lang.String sessionId)
This is used to terminate the session using the sessionId returned during establish.
Parameters:
sessionId - - sessionId returned in establishSession.

isRunning

public boolean isRunning()
Determines If the ManagementServices is running or stopped .
Returns:
TRUE - If MS is running , FALSE - If MS is not running

setDebug

public void setDebug(boolean debug)
This is used to enable the debug mode in Management Services. Enables the debug mode in all the Protocol Providers of Management Services.
Parameters:
debug - - boolean representing the debug mode as true/false.
Returns:
Nothing.

WebNMS 5 API Specification