uk.co.westhawk.snmp.event
Class TrapReceivedSupport
java.lang.Object
|
+--uk.co.westhawk.snmp.event.TrapReceivedSupport
- public class TrapReceivedSupport
- extends java.lang.Object
This is a utility class that can be used by classes that support trap
listener functionality.
You can use an instance of this class as a member field
of your class and delegate various work to it.
- Version:
- $Revision: 1.3 $ $Date: 2002/10/10 15:13:56 $
- Author:
- Birgit Arkesteijn
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
version_id
public static final java.lang.String version_id
TrapReceivedSupport
public TrapReceivedSupport(java.lang.Object src)
- The constructor.
- Parameters:
src
- The source of the trap events when they are fired.
empty
public void empty()
- Removes all the listeners.
getListenerCount
public int getListenerCount()
- Returns the number of listeners.
- Returns:
- The number of listeners.
addTrapListener
public void addTrapListener(TrapListener listener)
- Adds the specified trap listener to receive traps.
removeTrapListener
public void removeTrapListener(TrapListener listener)
- Removes the specified trap listener.
fireTrapReceived
public boolean fireTrapReceived(int version,
java.lang.String hostAddress,
byte[] message)
- Fires an undecoded trap event.
The event is fired to all listeners, unless one of them consumes it.
This behaviour is different from the decoded trap event.
The idea is that for undecoded traps it is very unlikely that more
than one party (usually SnmpContext objects) is interested.
- Parameters:
version
- The SNMP version of the traphostAddress
- The IP address of the host where the trap came frommessage
- The trap in bytes- Returns:
- Whether or not the event has been consumed.
- See Also:
fireTrapReceived(Pdu)
fireTrapReceived
public void fireTrapReceived(Pdu pdu)
- Fires a decoded trap event.
The event is fired to all listeners, whether they consume it or not.
This behaviour is different from the undecoded trap event.
- Parameters:
pdu
- The decoded trap pdu.- See Also:
fireTrapReceived(int, String, byte [])