|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.eventd.adaptors.udp.UdpEventReceiver
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.
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 |
private static final int UDP_PORT
private UdpReceiver m_receiver
private UdpProcessor m_processor
private UdpUuidSender m_output
private java.util.List m_eventsIn
private java.util.List m_eventUuidsOut
private java.util.List m_handlers
private volatile int m_status
private java.net.DatagramSocket m_dgSock
private int m_dgPort
private java.lang.String m_logPrefix
Constructor Detail |
public UdpEventReceiver()
public UdpEventReceiver(int port)
Method Detail |
public void start()
Fiber
Fiber
, which should eventually transition to a
RUNNING
status.
start
in interface Fiber
public void stop()
Fiber
Fiber
.
Once invoked the Fiber
should begin it's shutdown process.
Depending on the implementation, this method may block until the
Fiber
terminates.
stop
in interface Fiber
public java.lang.String getName()
Fiber
Fiber
. The
name of the instance is defined by the implementor, but it should be
realitively unique when possible.
getName
in interface Fiber
Fiber
.public int getStatus()
Fiber
Fiber
.
The status of the fiber should be one of the predefined constants of the
Fiber
interface, or from one of the derived interfaces.
getStatus
in interface Fiber
Fiber
.public void init()
InitializableFiber
Fiber
, which should eventually transition to a
RUNNING
status.
init
in interface InitializableFiber
public void destroy()
InitializableFiber
Fiber
.
Once invoked the Fiber
should begin it's shutdown process.
Depending on the implementation, this method may block until the
Fiber
terminates.
destroy
in interface InitializableFiber
public void setPort(java.lang.Integer port)
setPort
in interface UdpEventReceiverMBean
public java.lang.Integer getPort()
getPort
in interface UdpEventReceiverMBean
public void addEventHandler(EventHandler handler)
addEventHandler
in interface EventReceiver
handler
- A reference to an event handlerpublic void removeEventHandler(EventHandler handler)
equals()
inherieted from the Object
class.
removeEventHandler
in interface EventReceiver
handler
- A reference to the event handler.public void addEventHandler(java.lang.String name) throws javax.management.MalformedObjectNameException, javax.management.InstanceNotFoundException
addEventHandler
in interface UdpEventReceiverMBean
javax.management.MalformedObjectNameException
javax.management.InstanceNotFoundException
public void removeEventHandler(java.lang.String name) throws javax.management.MalformedObjectNameException, javax.management.InstanceNotFoundException
removeEventHandler
in interface UdpEventReceiverMBean
javax.management.MalformedObjectNameException
javax.management.InstanceNotFoundException
public void setLogPrefix(java.lang.String prefix)
setLogPrefix
in interface UdpEventReceiverMBean
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |