|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.jaw.snmp.manager.SnmpTrapAgent
The SnmpTrapAgent
class implements an SNMP trap dispatcher.
Listener objects can be registered in an SnmpTrapAgent
.
The SnmpTrapAgent
listens for any incoming trap: each time
it receives a trap, it inform all the listeners.
By default the dispatcher listens to the UDP port 162.
The SnmpTrapAgent
class implements Runnable
:
it is expected to be used as a Thread
object.
An SnmpTrapAgent
object maintains two lists of
listener objects:
SnmpTrapListener
interface will be activated each time an SNMP V1 trap
is received.
SnmpV2TrapListener
interface will be activated each time an SNMP V2 trap
is received.
SnmpTrapListener
,
SnmpV2TrapListener
Constructor Summary | |
SnmpTrapAgent()
Initializes an SnmpTrapAgent which listens on the port 162. |
|
SnmpTrapAgent(int portNumber)
Initializes an SnmpTrapAgent which listens on the specified port. |
Method Summary | |
void |
addTrapListener(SnmpTrapListener handler)
Adds a V1 trap listener to this SnmpTrapAgent . |
void |
addV2TrapListener(SnmpV2TrapListener handler)
Add a V2 trap listener to this SnmpTrapAgent . |
boolean |
containsTrapReceiver(SnmpTrapListener handler)
Returns true if the specified object is listening to V1 traps. |
boolean |
containsV2TrapReceiver(SnmpV2TrapListener handler)
Returns true if the specified object is listening to V2 traps. |
SnmpPduFactoryIf |
getPduFactory()
Gets the PDU factory associated to this SnmpTrapAgent . |
java.util.Enumeration |
getTrapListeners()
Gets all of the V1 trap listeners. |
java.util.Enumeration |
getV2TrapListeners()
Gets all of the V2 trap listeners. |
void |
removeTrapListener(SnmpTrapListener handler)
Removes a V1 trap listener. |
void |
removeV2TrapListener(SnmpV2TrapListener handler)
Removes a V2 trap listener. |
void |
run()
Dispatching loop. |
void |
setPduFactory(SnmpPduFactoryIf factory)
Sets the PDU factory associated to this SnmpTrapAgent . |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SnmpTrapAgent() throws java.net.SocketException, SnmpStatusException
SnmpTrapAgent
which listens on the port 162.
This constructor invokes
SnmpMain.initializeSNMP.initializeSNMP
failed.public SnmpTrapAgent(int portNumber) throws java.net.SocketException, SnmpStatusException
SnmpTrapAgent
which listens on the specified port.
This constructor invokes
SnmpMain.initializeSNMP.portNumber
- The port number.initializeSNMP
failed.Method Detail |
public void run()
This method is normally called by Thread.start
.
public void addTrapListener(SnmpTrapListener handler)
SnmpTrapAgent
.handler
- The listener to add.public void addV2TrapListener(SnmpV2TrapListener handler)
SnmpTrapAgent
.handler
- The listener to add.public boolean containsTrapReceiver(SnmpTrapListener handler)
handler
- A listener.public boolean containsV2TrapReceiver(SnmpV2TrapListener handler)
handler
- A listener.public void removeTrapListener(SnmpTrapListener handler)
handler
- The listener to be removed.public void removeV2TrapListener(SnmpV2TrapListener handler)
handler
- The listener to be removed.public java.util.Enumeration getTrapListeners()
SnmpTrapListener
objects.public java.util.Enumeration getV2TrapListeners()
SnmpV2TrapListener
objects.public SnmpPduFactoryIf getPduFactory()
SnmpTrapAgent
.public void setPduFactory(SnmpPduFactoryIf factory)
SnmpTrapAgent
.factory
- The PDU factory (if null, the default factory is set).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |