|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.management.snmp.agent.SnmpTrapReceiver
public class SnmpTrapReceiver
This MBean allows you to receive traps of subagents.
This trap receiver listen on a dedicated port and forward traps to some classes.
To enable trap receiving you must start the receiver.
Constructor Summary | |
---|---|
SnmpTrapReceiver(SnmpEngine engine,
int port,
InetAddress address)
Instantiate a SnmpTrapForwarder that will forward
received traps according to its configuration. |
|
SnmpTrapReceiver(SnmpEngineParameters parameters,
SnmpEngineFactory factory,
int port,
InetAddress address)
Instantiate a SnmpTrapForwarder that will forward
received traps according to its configuration. |
Method Summary | |
---|---|
protected TaskServer |
createCallbackTaskServer()
Return the TaskServer that will be used to invoke callbacks. |
protected Thread |
createDispatcherThread(Runnable dispatcher)
Creates a new Thread to listen for incoming traps. |
protected TaskServer |
createPacketTaskServer()
Return the TaskServer that will be used to handle incoming Trap/Inform PDUs. |
void |
receiveAsGeneric(boolean val)
Call this method in order to be called by receivedTrap
(if true). |
protected void |
receivedTrap(SnmpTrap trap)
You must implement this method in order to handle received traps in a generic way. |
protected void |
receivedV1Trap(SnmpPduTrap trap)
You must implement this method in order to handle received SNMP V1 traps. |
protected void |
receivedV2Trap(SnmpPduRequest trap)
You must implement this method in order to handle received SNMP V2 traps. |
protected void |
receivedV3Trap(SnmpScopedPduRequest trap)
You must implement this method in order to handle received SNMP V3 traps. |
void |
start()
Start listening for traps. |
void |
stop()
Stop listening for traps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SnmpTrapReceiver(SnmpEngine engine, int port, InetAddress address) throws IllegalArgumentException
SnmpTrapForwarder
that will forward
received traps according to its configuration.
engine
- The SNMP engine to use.port
- The port the forwarder is listening to.address
- The Ip address the dispatcher will listen for.
events on. If null, the dispatcher will listen on localhost.
IllegalArgumentException
public SnmpTrapReceiver(SnmpEngineParameters parameters, SnmpEngineFactory factory, int port, InetAddress address) throws IllegalArgumentException
SnmpTrapForwarder
that will forward
received traps according to its configuration.
It instantiates an SnmpEngine.
WARNING : The SnmpEngineId is computed as follow:
SnmpEngineId
time based.
parameters
- The engine parameters to use.factory
- The factory to use in order to create the engine.port
- The port the forwarder is listening to.address
- The Ip address the dispatcher will listen for.
IllegalArgumentException
- If one of the
specified configuration file doesn't exist.Method Detail |
---|
public void receiveAsGeneric(boolean val)
receivedTrap
(if true). By default the methods receivedV1Trap
or
receivedV2Trap
or receivedV3Trap
are
called when the receiver receives a trap (false).
val
- True, receive as generic. False, receive a different
call for each kind of trap (SNMP V1, V2 or V3).public void start() throws SocketException
SocketException
public void stop() throws SocketException
SocketException
protected TaskServer createPacketTaskServer()
The default implementation of this method is to return a
new started DaemonTaskServer
.
This method is called from this object constructor.
protected TaskServer createCallbackTaskServer()
null
, which means that callbacks will be directly
invoked from the thread of the packetTaskServer.
This method is called from this object constructor.
TaskServer
protected Thread createDispatcherThread(Runnable dispatcher)
The thread returned by this method must be runnable. The default implementation of this method is:
return new Thread(dispatcher);
This method is called each time this object is started.
dispatcher
- The dispatcher that will listen for incoming
traps in the new thread.protected void receivedTrap(SnmpTrap trap)
trap
- The received trap pdu.protected void receivedV1Trap(SnmpPduTrap trap)
trap
- The received trap pdu.protected void receivedV2Trap(SnmpPduRequest trap)
trap
- The received trap pdu.protected void receivedV3Trap(SnmpScopedPduRequest trap)
trap
- The received trap pdu.
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |