Package com.tailf.ncs.snmp.snmp4j
Class NotificationReceiver
Object
com.tailf.ncs.snmp.snmp4j.NotificationReceiver
This class mediated the use of Snmp4j
for receiving and mapping of incoming snmp notifications.
As such it sets up the notification receiving capabilities according to the ncs configuration.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Returns the set of snmp peer ip addresses for registered managed devices.static NotificationReceiver
Factory method to get a NotificationReceiver instance.static NotificationReceiver
getNotificationReceiver
(String host, int port) Factory method to get a NotificationReceiver instance.Get a copy of the registered chain of NotificationHandlerInstances An NotificationHandlerInstance is an NotificationHandler together with its registered opaque object.boolean
Check it the NotificationReceiver is enabled This flag is controlled by the NCS configurationboolean
Check it the NotificationReceiver has startedvoid
register
(NotificationHandler responder, Object opaque) This method is used to register handler callback classes to the notification receiver.void
register
(ArrayList<NotifHandlerInstance> handlerChain) This register method takes an ArrayList of NotificationHandlerInstances and registers these.void
start()
This method is called to start subscription on notificationsvoid
stop()
This method is called to stop subscription on notifications
-
Method Details
-
getKnownIPAddresses
Returns the set of snmp peer ip addresses for registered managed devices.- Returns:
- set of ConfValue where the values are either of type ConfIPv4 or ConfIPv6
-
register
This method is used to register handler callback classes to the notification receiver. There can be many handlers registered on the notification receiver in which case they are chained in a sequence corresponding to the order in which they where registered. An received notification will be processed by the handlers in order but the process chain stopped if the previous handler returned a suspend return value. It is possible to register a opaque object that is passed to the handler when it is called. This way information for the handler can be stored and maintained.- Parameters:
responder
- - handler class to process notificationsopaque
- - object to pass to the handler at execution- Throws:
NcsException
-
register
This register method takes an ArrayList of NotificationHandlerInstances and registers these. Any old registration will be swept away. This method is useful when it is of interest to change the default filter handling of the NotificationReceiver.- Parameters:
handlerChain
-- Throws:
NcsException
-
getRegisteredNotificationHandlers
Get a copy of the registered chain of NotificationHandlerInstances An NotificationHandlerInstance is an NotificationHandler together with its registered opaque object.- Returns:
- ArrayList of NotificationHandlerInstances
-
start
This method is called to start subscription on notifications- Throws:
IOException
-
stop
This method is called to stop subscription on notifications- Throws:
IOException
-
isStarted
public boolean isStarted()Check it the NotificationReceiver has started- Returns:
- true if started
-
isEnabled
public boolean isEnabled()Check it the NotificationReceiver is enabled This flag is controlled by the NCS configuration- Returns:
- true if enabled
-
getNotificationReceiver
public static NotificationReceiver getNotificationReceiver(String host, int port) throws NcsException Factory method to get a NotificationReceiver instance. The NotificationReceiver is a singleton i.e. there an only be one instance of this class- Parameters:
host
- hostname for the NCS serverport
- port number for the NCS server- Returns:
- NotificationReceiver
- Throws:
NcsException
-
getNotificationReceiver
Factory method to get a NotificationReceiver instance. The NotificationReceiver is a singleton i.e. there an only be one instance of this class- Throws:
NcsException
-
destroyNotificationReceiver
public static void destroyNotificationReceiver()
-