Class NotificationReceiver

Object
com.tailf.ncs.snmp.snmp4j.NotificationReceiver

public class NotificationReceiver extends Object
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 Details

    • getKnownIPAddresses

      public HashMap<InetAddress,ConfKey> 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

      public void register(NotificationHandler responder, Object opaque) throws NcsException
      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 notifications
      opaque - - object to pass to the handler at execution
      Throws:
      NcsException
    • register

      public void register(ArrayList<NotifHandlerInstance> handlerChain) throws NcsException
      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

      public ArrayList<NotifHandlerInstance> 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

      public void start() throws IOException
      This method is called to start subscription on notifications
      Throws:
      IOException
    • stop

      public void stop() throws IOException
      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 server
      port - port number for the NCS server
      Returns:
      NotificationReceiver
      Throws:
      NcsException
    • getNotificationReceiver

      public static NotificationReceiver getNotificationReceiver() 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
      Throws:
      NcsException
    • destroyNotificationReceiver

      public static void destroyNotificationReceiver()