OpenNMS API 1.2.9

## org.opennms.netmgt.eventd.adaptors.udp
Class UdpEventReceiver

    java.lang.Object
      org.opennms.netmgt.eventd.adaptors.udp.UdpEventReceiver

All Implemented Interfaces:
  EventReceiver, Fiber, InitializableFiber, UdpEventReceiverMBean

public final class UdpEventReceiver
extends java.lang.Object
implements EventReceiver, UdpEventReceiverMBean

This class implements the User Datagram Protocol (UDP) event receiver. When the an agent sends an event via UDP/IP the receiver will process the event and then add the UUIDs to the internal list. If the event is successfully processed then an event-receipt is returned to the caller.

Author:
  Brian Weaver , Oculan Corporation

Field Summary
`private int` `m_dgPort` The UDP socket port binding.
`private java.net.DatagramSocket` `m_dgSock` The UDP socket for receipt and transmission of packets from agents.
`private java.util.List` `m_eventsIn` The list of incomming events.
`private java.util.List` `m_eventUuidsOut` The list of outgoing event-receipts by UUID.
`private java.util.List` `m_handlers` The list of registered event handlers.
`private java.lang.String` `m_logPrefix` The log prefix
`private UdpUuidSender` `m_output` The event receipt generator and sender thread.
`private UdpProcessor` `m_processor` The user datagram packet processor
`private UdpReceiver` `m_receiver` The UDP receiver thread.
`private int` `m_status` The Fiber's status.
`private static int` `UDP_PORT` The default User Datagram Port for the receipt and transmission of events.

Fields inherited from interface org.opennms.core.fiber.Fiber
`RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED`

Constructor Summary
`UdpEventReceiver()`
`UdpEventReceiver(int port)`

Method Summary
`void` `addEventHandler(EventHandler handler)` Adds a new event handler to receiver.
`void` `addEventHandler(java.lang.String name)`
`void` `destroy()` This method is used to stop a currently running `Fiber`.
`java.lang.String` `getName()` This method is used to return the name of the `Fiber`.
`java.lang.Integer` `getPort()`
`int` `getStatus()` This method is used to get the current status of the `Fiber`.
`void` `init()` This method is used to start the initilization process of the `Fiber`, which should eventually transition to a `RUNNING` status.
`void` `removeEventHandler(EventHandler handler)` Removes an event handler from the list of handler called when an event is received.
`void` `removeEventHandler(java.lang.String name)`
`void` `setLogPrefix(java.lang.String prefix)`
`void` `setPort(java.lang.Integer port)`
`void` `start()` This method is used to start the initilization process of the `Fiber`, which should eventually transition to a `RUNNING` status.
`void` `stop()` This method is used to stop a currently running `Fiber`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### UDP_PORT

    private static final int UDP_PORT

  The default User Datagram Port for the receipt and transmission of events.

  See Also:
    Constant Field Values

### m_receiver

    private UdpReceiver m_receiver

  The UDP receiver thread.

### m_processor

    private UdpProcessor m_processor

  The user datagram packet processor

### m_output

    private UdpUuidSender m_output

  The event receipt generator and sender thread.

### m_eventsIn

    private java.util.List m_eventsIn

  The list of incomming events.

### m_eventUuidsOut

    private java.util.List m_eventUuidsOut

  The list of outgoing event-receipts by UUID.

### m_handlers

    private java.util.List m_handlers

  The list of registered event handlers.

### m_status

    private volatile int m_status

  The Fiber's status.

### m_dgSock

    private java.net.DatagramSocket m_dgSock

  The UDP socket for receipt and transmission of packets from agents.

### m_dgPort

    private int m_dgPort

  The UDP socket port binding.

### m_logPrefix

    private java.lang.String m_logPrefix

  The log prefix

Constructor Detail

### UdpEventReceiver

    public UdpEventReceiver()

### UdpEventReceiver

    public UdpEventReceiver(int port)

Method Detail

### start

    public void start()

  Description copied from interface: `Fiber`
  This method is used to start the initilization process of the `Fiber`, which should eventually transition to a `RUNNING` status.

  Specified by:
    `start` in interface `Fiber`

### stop

    public void stop()

  Description copied from interface: `Fiber`
  This method is used to stop a currently running `Fiber`. Once invoked the `Fiber` should begin it's shutdown process. Depending on the implementation, this method may block until the `Fiber` terminates.

  Specified by:
    `stop` in interface `Fiber`

### getName

    public java.lang.String getName()

  Description copied from interface: `Fiber`
  This method is used to return the name of the `Fiber`. The name of the instance is defined by the implementor, but it should be realitively unique when possible.

  Specified by:
    `getName` in interface `Fiber`
  Returns:
    The name of the `Fiber`.

### getStatus

    public int getStatus()

  Description copied from interface: `Fiber`
  This method is used to get the current status of the `Fiber`. The status of the fiber should be one of the predefined constants of the `Fiber` interface, or from one of the derived interfaces.

  Specified by:
    `getStatus` in interface `Fiber`
  Returns:
    The current status of the `Fiber`.

### init

    public void init()

  Description copied from interface: `InitializableFiber`
  This method is used to start the initilization process of the `Fiber`, which should eventually transition to a `RUNNING` status.

  Specified by:
    `init` in interface `InitializableFiber`

### destroy

    public void destroy()

  Description copied from interface: `InitializableFiber`
  This method is used to stop a currently running `Fiber`. Once invoked the `Fiber` should begin it's shutdown process. Depending on the implementation, this method may block until the `Fiber` terminates.

  Specified by:
    `destroy` in interface `InitializableFiber`

### setPort

    public void setPort(java.lang.Integer port)

  Specified by:
    `setPort` in interface `UdpEventReceiverMBean`

### getPort

    public java.lang.Integer getPort()

  Specified by:
    `getPort` in interface `UdpEventReceiverMBean`

### addEventHandler

    public void addEventHandler(EventHandler handler)

  Adds a new event handler to receiver. When new events are received the decoded event is passed to the handler.

  Specified by:
    `addEventHandler` in interface `EventReceiver`
  Parameters:
    `handler` - A reference to an event handler

### removeEventHandler

    public void removeEventHandler(EventHandler handler)

  Removes an event handler from the list of handler called when an event is received. The handler is removed based upon the method `equals()` inherieted from the `Object` class.

  Specified by:
    `removeEventHandler` in interface `EventReceiver`
  Parameters:
    `handler` - A reference to the event handler.

### addEventHandler

    public void addEventHandler(java.lang.String name)
                         throws javax.management.MalformedObjectNameException,
                                javax.management.InstanceNotFoundException

  Specified by:
    `addEventHandler` in interface `UdpEventReceiverMBean`
  Throws:
    `javax.management.MalformedObjectNameException`
    `javax.management.InstanceNotFoundException`

### removeEventHandler

    public void removeEventHandler(java.lang.String name)
                            throws javax.management.MalformedObjectNameException,
                                   javax.management.InstanceNotFoundException

  Specified by:
    `removeEventHandler` in interface `UdpEventReceiverMBean`
  Throws:
    `javax.management.MalformedObjectNameException`
    `javax.management.InstanceNotFoundException`

### setLogPrefix

    public void setLogPrefix(java.lang.String prefix)

  Specified by:
    `setLogPrefix` in interface `UdpEventReceiverMBean`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.