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

java.lang.Object
  extended by org.opennms.netmgt.eventd.adaptors.udp.UdpEventReceiver
All Implemented Interfaces:
Fiber, InitializableFiber, BaseOnmsMBean, EventReceiver, UdpEventReceiverMBean

public final class UdpEventReceiver
extends 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.

Version:
$Id: $
Author:
Brian Weaver , Oculan Corporation , Brian Weaver , Oculan Corporation

Field Summary
 
Fields inherited from interface org.opennms.core.fiber.Fiber
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED
 
Constructor Summary
UdpEventReceiver()
          Constructor for UdpEventReceiver.
UdpEventReceiver(int port, String ipAddress)
          Constructor for UdpEventReceiver.
 
Method Summary
 void addEventHandler(EventHandler handler)
          Adds a new event handler to receiver.
 void addEventHandler(String name)
          addEventHandler
 void destroy()
          destroy
 List<EventHandler> getEventHandlers()
          getEventHandlers
 String getIpAddress()
          getIpAddress
 String getName()
          getName
 Integer getPort()
          getPort
 int getStatus()
          getStatus
 String getStatusText()
          getStatusText
 void init()
          init
 void removeEventHandler(EventHandler handler)
          Removes an event handler from the list of handler called when an event is received.
 void removeEventHandler(String name)
          removeEventHandler
 void setEventHandlers(List<EventHandler> eventHandlers)
          setEventHandlers
 void setIpAddress(String ipAddress)
          setIpAddress
 void setLogPrefix(String prefix)
          setLogPrefix
 void setPort(Integer port)
          setPort
 void start()
          start
 String status()
          status
 void stop()
          stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UdpEventReceiver

public UdpEventReceiver()

Constructor for UdpEventReceiver.


UdpEventReceiver

public UdpEventReceiver(int port,
                        String ipAddress)

Constructor for UdpEventReceiver.

Parameters:
port - a int.
ipAddress - a String object.
Method Detail

start

public void start()

start

Specified by:
start in interface Fiber
Specified by:
start in interface BaseOnmsMBean

stop

public void stop()

stop

Specified by:
stop in interface Fiber
Specified by:
stop in interface BaseOnmsMBean

getName

public String getName()

getName

Specified by:
getName in interface Fiber
Returns:
a String object.

getStatus

public int getStatus()

getStatus

Specified by:
getStatus in interface Fiber
Specified by:
getStatus in interface BaseOnmsMBean
Returns:
a int.

getStatusText

public String getStatusText()

getStatusText

Specified by:
getStatusText in interface BaseOnmsMBean
Returns:
a String object.

status

public String status()

status

Specified by:
status in interface BaseOnmsMBean
Returns:
a String object.

init

public void init()

init

Specified by:
init in interface InitializableFiber
Specified by:
init in interface BaseOnmsMBean

destroy

public void destroy()

destroy

Specified by:
destroy in interface InitializableFiber
Specified by:
destroy in interface UdpEventReceiverMBean

getIpAddress

public String getIpAddress()

getIpAddress

Returns:
a String object.

setIpAddress

public void setIpAddress(String ipAddress)

setIpAddress

Parameters:
ipAddress - a String object.

setPort

public void setPort(Integer port)

setPort

Specified by:
setPort in interface UdpEventReceiverMBean
Parameters:
port - a Integer object.

getPort

public Integer getPort()

getPort

Specified by:
getPort in interface UdpEventReceiverMBean
Returns:
a Integer object.

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. 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. 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.

getEventHandlers

public List<EventHandler> getEventHandlers()

getEventHandlers

Returns:
a List object.

setEventHandlers

public void setEventHandlers(List<EventHandler> eventHandlers)

setEventHandlers

Parameters:
eventHandlers - a List object.

addEventHandler

public void addEventHandler(String name)
                     throws MalformedObjectNameException,
                            InstanceNotFoundException

addEventHandler

Specified by:
addEventHandler in interface UdpEventReceiverMBean
Parameters:
name - a String object.
Throws:
MalformedObjectNameException - if any.
InstanceNotFoundException - if any.

removeEventHandler

public void removeEventHandler(String name)
                        throws MalformedObjectNameException,
                               InstanceNotFoundException

removeEventHandler

Specified by:
removeEventHandler in interface UdpEventReceiverMBean
Parameters:
name - a String object.
Throws:
MalformedObjectNameException - if any.
InstanceNotFoundException - if any.

setLogPrefix

public void setLogPrefix(String prefix)

setLogPrefix

Specified by:
setLogPrefix in interface UdpEventReceiverMBean
Parameters:
prefix - a String object.


Copyright © 2011. All Rights Reserved.