org.apache.log4j.ext
Interface SnmpTrapSenderFacade

All Known Implementing Classes:
JoeSNMPTrapSender, NetSnmpCommandLineTrapSender

public interface SnmpTrapSenderFacade

Title: SnmpTrapSenderFacade
Description: A simplified interface to an underlying SNMP API.

The intent of this class is both to limit the available interface, and allow the underlying SNMP library to be changed, as desired.

Version:
1.0.2 changes ---
2002-10-15: mwm : changed the sysUpTime value to a long, to cope with the SysUpTimeResolver mechanism.
2003-05-24: mwm : changed the method signature of the SnmpTrapSenderFacade interface to use the Appender as a single parameter object -- this makes the method more flexible against changes to the set of parameters or interest in the future.
Author:
Mark Masterson (m.masterson@computer.org)
http://www.m2technologies.net/

Method Summary
 void addTrapMessageVariable(java.lang.String applicationTrapOIDValue, java.lang.String value)
          Adds a new Varbind to the SNMP PDU.
 void initialize(SNMPTrapAppender appender)
          This method is called to set the values of all of the class fields used as parameters to the underlying SNMP API.
 void sendTrap()
          Sends the PDU defined by the variables of the fields of this class.
 

Method Detail

initialize

public void initialize(SNMPTrapAppender appender)
This method is called to set the values of all of the class fields used as parameters to the underlying SNMP API. This method must be called prior to calling either of the other methods in this class.

Parameters:
appender - - An instance of the SNMPTrapAppender class. All of the values needed to configure the trap sender will be extracted from the Appender, via its getter methods.

sendTrap

public void sendTrap()
Sends the PDU defined by the variables of the fields of this class. This method should always be called last by an application, after having called the initialization() method once, and the addTrapMessageVariable() method one or more times.


addTrapMessageVariable

public void addTrapMessageVariable(java.lang.String applicationTrapOIDValue,
                                   java.lang.String value)
Adds a new Varbind to the SNMP PDU. The Varbind is made of the value of the application trap OID (applicationTrapOID) parameter, as the key, and the value paramater to this method as the value. A PDU has a collection of Varbind variables -- repeated calls to this method will add to that collection successively.

Parameters:
applicationTrapOIDValue - - formatted as an OID E.g. "1.3.6.1.2.1.1.2.0.0.0.0" -- this OID would point to the standard sysObjectID of the "systemName" node of the standard "system" MIB.
This is the default value, if none is provided.
If you want(need) to use custom OIDs (such as ones from the "private.enterprises" node -- "1.3.6.1.4.1.x.x.x..."), you always need to provide the fully qualified OID as the parameter for this variable.

value - - the text to append to the Varbind that will be added to the SNMP PDU.