|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.beans.NotificationAdaptor
This class is an SNMP NotificationAdaptor for use with SnmpTrapReceiver.
It supports event generation per the JDK 1.1 event model.
To use in an application, simply instantiate an SnmpTrapReceiver, specify the port, and register instance of this to receive traps. The purpose of this adaptor is to convert a v2 trap pdu to v1 trap pdu. For example,
SnmpTrapReceiver receiver = new SnmpTrapReceiver(); receiver.setPort(162); NotificationAdaptor filter = new NotificationAdaptor(); receiver.addTrapListener(filter); TrapListener listener = new TrapListener() { public void receivedTrap(TrapEvent trap) { System.err.println("Got a trap from: "+trap.getRemoteHost()); } };
filter.addTrapListener(listener);
Supply the applet in the constructor if using applets and may need to use SAS.
Constructor Summary | |
NotificationAdaptor()
Default constructor. |
Method Summary | |
void |
addTrapListener(TrapListener l)
Add a listener for events from this target. |
protected TrapEvent |
convertTrap(TrapEvent trp)
Attempts to convert v2c notification pdu parameters to v1 trap pdu parameters. |
void |
receivedTrap(TrapEvent evt)
Fires the received trap event after applying this filter to the registered listeners. |
void |
removeTrapListener(TrapListener l)
Remove a listener for events from this target. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NotificationAdaptor()
Method Detail |
public void receivedTrap(TrapEvent evt)
receivedTrap
in interface TrapListener
public void addTrapListener(TrapListener l)
public void removeTrapListener(TrapListener l)
protected TrapEvent convertTrap(TrapEvent trp)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |