com.adventnet.snmp.beans
Class SnmpRequestServer

java.lang.Object
  |
  +--com.adventnet.snmp.beans.SnmpServer
        |
        +--com.adventnet.snmp.beans.SnmpRequestServer
Direct Known Subclasses:
SnmpTasks

public class SnmpRequestServer
extends SnmpServer
implements RequestListener, SnmpClient, java.beans.VetoableChangeListener, CustomizerTemplate

This class is an SNMP Server bean for performing asynchronous SNMP requests on a list of variables. It supports event generation per the JDK 1.1 event model. It allows sending request events to it or invoking its asynchronous request methods and receiving response events, i.e. ResultEvent objects, from it when responses arrive or timeout.

See the requestServerDemo.java applet example in the applications directory.

To use in an application, instantiate the server, and register to receive results. For example, the following is a trivial listener that prints the return value.

    SnmpRequestServer server = new SnmpRequestServer();
    
    ResultListener listener = new ResultListener() {
        public void setResult(ResultEvent evt) {
            System.err.println("Response: "+evt.getValue());
        }
    };
    
server.addResultListener(listener);
Then use the asynchronous methods to make requests, or you can generate events, e.g.
       RequestEvent evt = 
           new RequestEvent(b1, getParameter("OID"), RequestEvent.GET);
       server.addRequest(evt);
  
The above is a somewhat simplified example for event generation.

To receive timeout events,use setSendTimeoutEvents(true). Otherwise if the request times out,then the timeout events will not be sent to the listener.

Normally, you would allow registration of RequestListener objects, and send events to all registered listeners. The advantage of generating events really lies in being able to write components that do not know at build time the request server they will send events to.

Major difference between this and SnmpRequestServer is the ability to use the RequestEvent objects to send requests to the SnmpRequestServer. The benefit of this feature is that event connections between sources of request events, and SnmpRequestServer instances can be more readily be defined, in bean builders for example. So a button that generates a request event can be flexibly connected to the appropriate SnmpRequestServer instance in a bean builder. The SnmpRequestServer provides a convenience object for many of the common operations you do with an SNMP agent.

For garbagecollection of the resources used, releaseResources() method should be invoked. Different SnmpRequestServer instances on the same JVM, will reuse the SnmpAPI, SnmpSession and MibOperations instance. So, for releasing these resources, releaseResources() method should be called on every SnmpRequestServer instance created and when this method is called on the final instance of SnmpRequestServer, these will be garbage collected.

Supply the applet in the constructor if using applets and may need to use SAS.

See Also:
RequestEvent, ResultEvent, Serialized Form

Field Summary
(package private)  java.util.Hashtable destinations
           
(package private)  int logID
           
(package private)  java.lang.String mibModules
           
(package private)  int[] prevoid
           
(package private)  java.util.Hashtable requests
           
 boolean serialize
          based on this flag the v3 tables ( USMUserTable and SnmpEngineTable ) will be serialized.
 
Fields inherited from class com.adventnet.snmp.beans.SnmpServer
api, applet, ASN1_ERROR_ERR, ASN1_ERROR_OID, attemptCompleteData, attemptPartialData, AUTH_NO_PRIV, AUTH_PRIV, authKey, authPassword, authProtocol, broadCast, clientID, community, contextID, contextName, count, debugon, DECRYPT_ERROR_ERR, DECRYPT_ERROR_OID, discoveryTimeSyncListener, enc, engineID, engineTable, error, errorCode, errorcodes, errorIndex, exceptionCode, exceptionCodes, finalize_called, group, group_oidList, isName, isNotSet, isSendPDUByGroup, listeners, localAddrs, localPort, logFlag, loggerImpl, logLevel, logType, matchServ, matchtable, MAX_NUM_ROWS, maxRepetitions, MD5_AUTH, mibOps, NO_AUTH, NO_AUTH_NO_PRIV, nonRepeaters, NOT_TIME_WINDOWS_ERR, NOT_TIME_WINDOWS_OID, nullsession_targets, oidList, options, pduErrorIndex, pollertargets, pollInterval, port, port_targets, principal, printStr, privKey, privPassword, privProtocol, propertylisteners, protocol, reqHandler, reqid, retries, secModel, securityLevel, sendTimeoutEvents, sentreqid, session, session_port_targets, session_targets, sessionName, SHA_AUTH, SNMPGET, SNMPGETBULK, SNMPGETNEXT, SNMPINFORM, SNMPREPORT, SNMPRESPONSE, SNMPSET, snmpStore, SNMPTRAP, SNMPV2TRAP, targetHost, targets, timeout, UKN_ENGINEID_ERR, UKN_ENGINEID_OID, UKN_USERNAMES_ERR, UKN_USERNAMES_OID, UNSUPP_SEC_LEVEL_ERR, UNSUPP_SEC_LEVEL_OID, userError, userErrorCode, usmTable, v3ErrorTable, validateUser, varbinds_per_request, varList, version, VERSION1, VERSION2C, VERSION3, writeCommunity, WRONG_DIGEST_ERR, WRONG_DIGEST_OID
 
Constructor Summary
SnmpRequestServer()
          Use this constructor for applications.
SnmpRequestServer(java.applet.Applet applet)
          Use this constructor for applets.
SnmpRequestServer(java.applet.Applet applet, int localPort, java.lang.String sessionName)
          Use this constructor for appletswhich will create a session with name and in specific localport..
SnmpRequestServer(int protocol, ProtocolOptions options)
          Use this constructor for applications which uses protocols other than UDP/IP.
SnmpRequestServer(int localPort, java.lang.String sessionName)
          Use this constructor for applications which will create a session with name and in specific localport.
SnmpRequestServer(java.lang.String[] localAddrs, java.lang.String sessionName)
          Use this constructor for applications in which the session needs to be bound to some local address.
 
Method Summary
 void addLogClient(com.adventnet.afp.log.LoggerProperties loggerProps)
          Adds the Log client for which the target has to redirect the log messages.
 void addLogClient(com.adventnet.utils.LogInterface client)
          Add the Log client for which the SnmpRequestServer has to redirect the log messages
 int addObjectID(java.lang.String s)
          Adds an ObjectID specified by string to the existing OID list.
 int addRequest(RequestEvent e)
          To add a request to the already existing requests.
 void addResultListener(ResultListener l)
          Adds a Listener to the list that is notified each time when a response arrives.
 int addSnmpOID(SnmpOID oid)
          Adds an SnmpOID to the existing list of OIDs.
 void addSnmpPropertyListener(SnmpPropertyListener l)
          Adds SnmpPropertyListener to the Listeners list.
 void addUserError(int errorCode, java.lang.String errorString)
          This method is used to add user defined error codes and the corresponding error string.
 void addV3HandShakeResultListener(V3HandShakeResultListener l)
          Adds a listener to receive the events when SnmpEngineID discovery and time Synchronization is performed by the method async_create_v3_tables.
 boolean authenticate(SnmpPDU pdu, java.lang.String community)
          This is the SnmpClient method implementation used to authenticate a PDU.
 boolean callback(SnmpSession session, SnmpPDU pdu, int requestID)
          This is the SnmpClient method implementation method that processes and forwards the result.The response returned by the RequestServer will be received by this method.
 void debugPrint(java.lang.String debugOutput)
          This is the SnmpClient method implementation that prints the standard error.
 void deSerializeUSM()
          This will deserialize the v3 tables like USMUserTable and SnmpEngineTable from serialized file if the serilaized file already exists
protected  void genEvent(SnmpPDU pdu)
          Generate the response event to the listeners
protected  void genTimeoutEvent(SnmpPDU pdu)
          Generate the timeout events to the listeners
 boolean getAttemptPartial()
          Deprecated. SnmpRequestServer cannot get the partial data. It is specifically for SnmpTarget bean which does synchronous comm..
 java.lang.String getAuthPassword()
          To get the SNMP V3 AuthPassword
 int getAuthProtocol()
          To get the SNMP V3 AuthProtocol
 java.lang.String getCommunity()
          To get the SNMP target Community
 java.lang.String getContextID()
          To get the SNMP V3 contextID
 java.lang.String getContextName()
          To get the SNMP V3 Context name
 boolean getDebug()
          To check if Debug mode is enabled or not
 byte[] getEngineID()
          To get the SNMP V3 engineID value for v3
 int getErrorCode()
          To get the error code from the last request.
 java.lang.String getErrorResultString(SnmpPDU pdu)
          To get the error string associated with the response PDU
 java.lang.String getErrorString()
          To get the error string from the last request.
 int getMaxRepetitions()
          To get the SNMP target max repetitions value for a getbulk request.
 java.lang.String getMibModules()
          To get the MIBs (/white-space separated list of mib files)that is(/are) loaded in this applet/application
 MibOperations getMibOperations()
          To get the MibOperations object reference.
 int getNonRepeaters()
          To get the SNMP target non-repeaters value for a getbulk request.
 java.lang.String getObjectID()
          To get the first object ID from a list of ObjectIDs.
 java.lang.String getObjectID(int index)
          To get the object ID at the specified index
 java.lang.String[] getObjectIDList()
          To get the list of object IDs.
 java.lang.String getPrincipal()
          To get the SNMP V3 username
 java.lang.String getPrivPassword()
          To get the SNMP V3 PrivPassword
 int getRetries()
          To get the SNMP target retries value.
 java.lang.String getSecurityLevel()
          To get the SNMP V3 SecurityLevel
 int getSecurityModel()
          To get the SNMP V3 securityModel
 boolean getSendTimeoutEvents()
          To check if the target will send timeout events to registered listeners.
 SnmpOID getSnmpOID()
          To get the first SnmpOID from the list of object IDs.
 SnmpOID[] getSnmpOIDList()
          To get the list of object IDs as an array of SnmpOID instances
 int getSnmpVersion()
          To get the SNMP target SNMP Version.
 java.lang.String getTargetHost()
          To get the SNMP target hostname
 int getTargetPort()
          To get the SNMP target port number
 int getTimeout()
          To get the SNMP target timeout value in Seconds.
 int getUserErrorCode()
          Gets the user defined error code for the last request.
 java.lang.String getUserErrorString()
          This method is used to get the user defined error string to a specific error code.
 java.lang.String getWriteCommunity()
          To get the SNMP target write Community to be used for set requests
 boolean isBroadCastEnabled()
          Returns the current status as to whether broadcasting is enabled/disabled.
 boolean isSerialize()
          To check the status of Serialization of v3 tables (USMUserTable and SnmpEngineTable)
 void loadMibs(java.lang.String mibs)
          Loads the specified mib.
 void readFromDatabase()
          This will read the v3table like USmUserTable and SnmpEngineTable from Database after establishing connection
 void releaseResources()
          Though the resources will be cleaned up by the garbage collector, if the application is no more using the SnmpRequestServer bean instance, this method can be used to immediately release the resources.
 void removeLogClient()
          Removes the Log client that has been registered to redirect the log Messages for this instance.
 void removeResultListener(ResultListener l)
          Removes a listener for response events from the list of listeners.
 void removeSnmpPropertyListener(SnmpPropertyListener l)
          Removes the SnmpPropertyListener from the list.
 void removeV3HandShakeListener(V3HandShakeResultListener l)
          Removes the listener registered for getting events.
 int sendGetBulkRequestList()
          To send a GetBulk request to get a list of SNMP variable bindings from the agent using the Object Identifier list previously set in this SnmpRequestServer instance.
 int sendGetNextRequest()
          To send a getnext request for the SNMP variable identified by the first Object Identifier set in this SnmpRequestServer instance.
 int sendGetNextRequest(SnmpOID oid)
          To send a getnext request for the SNMP variable identified by specified Object Identifier.
 int sendGetNextRequestList()
          To send a getnext request for a list of SNMP variable bindings identified by the Object Identifier list previously set in this SnmpRequestServer instance.
 int sendGetNextRequestList(SnmpOID[] oids)
          To send a getnext request for a list of SNMP variables identified by the Object Identifier list stored in this SnmpRequestServer instance.
 int sendGetRequest()
          To send a get request for the the SNMP variable identified by the first Object Identifier stored in the SnmpRequestServer instance.
 int sendGetRequest(SnmpOID oid)
          To send a get request for the the SNMP variable identified by specified Object Identifier.
 int sendGetRequestList()
          To send a get request for the list of SNMP variable bindings identified by the Object Identifier list previously set in this SnmpRequestServer instance.
 int sendGetRequestList(SnmpOID[] oids)
          To send a get request for a list of SNMP variables identified by the Object Identifier list.
 int sendSetRequest(java.lang.String value)
          To send a set request with the value to be set for the ObjectID This method will fail if MIB with this variable is not loaded or this is not a leaf node in the MIB.
 int sendSetRequest(java.lang.String value, byte type)
          To send a set request with the value to be set and the type of the variable Throws DataException if no OID specified earlier or in case of errors.
 int sendSetRequestList(java.lang.String[] values)
          To set the list of SNMP variable bindings on the agent using the Object Identifier list previously set in this SnmpRequestServer instance.
 int sendSetRequestVariable(SnmpVar var)
          To send a set request to set the specified SnmpVar value for the OID that is set in the SnmpRequestServer instance.
 int sendSetRequestVariables(SnmpVar[] values)
          To send a set request to set the list of SNMP variable bindings on the agent, using the Object Identifier list previously set in this SnmpRequestServer instance.
(package private)  int sendSNMPRequest(SnmpPDU pdu)
          This sends the SNMP request.
 void sendTrap(SnmpOID enterprise, java.lang.String agenthost, int genericType, int specificType, long uptime, SnmpVar[] values)
          To send a SNMP trap, with parameters specified and variable bindings using object ids from the Object Identifier list previously set in this SnmpRequestServer instance, and the values specified.
 void sendTrap(java.lang.String enterprise, java.lang.String agenthost, int genericType, int specificType, long uptime, java.lang.String[] values)
          To send a SNMP trap, with parameters specified and variable bindings using object ids from the Object Identifier list previously set in this SnmpRequestServer instance, and the values specified.
 void setAttemptPartial(boolean b)
          Deprecated. SnmpRequestServer cannot get partial data by enabling the flag. It is specific for SnmpTarget bean which does synchronous comm..
 void setAuthPassword(java.lang.String password)
          To set the SNMP V3 AuthPassword
 void setAuthProtocol(int protocol)
          To set the SNMP V3 AuthProtocol
 void setBroadCastEnable(boolean broadcast)
          Calling this method with a "true" value will indicate that the request is to be sent as a broadcast request.
 void setCommunity(java.lang.String s)
          To set the SNMP target Community
 void setContextID(java.lang.String ctxtID)
          To set the SNMP V3 contextID
 void setContextName(java.lang.String cName)
          To set the SNMP V3 Context name
 void setDebug(boolean debug)
          To enable or disable the Debug mode.
 void setEngineID(byte[] engID)
          To set the SNMP V3 engineID value for v3
 void setMaxRepetitions(int i)
          To set the SNMP target max repetitions value for a getbulk request.
 void setMibModules(java.lang.String mibs)
          To load the MIB in this applet/application.
 void setNonRepeaters(int i)
          To set the SNMP target non-repeaters value for a getbulk request.
 void setObjectID(int index, java.lang.String s)
          Sets the object ID value specified the string at the given index
 void setObjectID(java.lang.String s)
          Sets the object ID value specified by the string
 void setObjectIDList(java.lang.String[] s)
          Sets the list of object IDs specified by the string array
 void setParams(java.lang.String host, java.lang.String port, java.lang.String community, java.lang.String mib, java.lang.String oid)
          To set Multiple parameters like TargetHost,Port,Community,MibModule and OID.
 void setParams(java.lang.String host, java.lang.String port, java.lang.String community, java.lang.String mib, java.lang.String[] oidlist)
          To set Multiple parameters like TargetHost,Port,Community,MibModule and OIDList.
 void setPrincipal(java.lang.String uName)
          To set the SNMP V3 username
 void setPrivPassword(java.lang.String password)
          To set the SNMP V3 PrivPassword
 void setRetries(int i)
          To Set the SNMP target retries value.
 void setSecurityLevel(byte sLevel)
          To set the SNMP V3 SecurityLevel.The value will be 0 ,1 or 3.
 void setSecurityModel(int securityModel)
          To set the SNMP V3 SecurityModel
 void setSendTimeoutEvents(boolean b)
          To set the boolean state of whether this target will send timeout events to registered listeners or not
 void setSnmpOID(SnmpOID oid)
          Sets the SnmpOID.
 void setSnmpOIDList(SnmpOID[] list)
          To set the list of object IDs given as an array of SnmpOIDs
 void setSnmpVersion(int i)
          To set the SNMP target SNMP Version.
 void setTargetHost(java.lang.String s)
          To set the SNMP target hostname
 void setTargetPort(int i)
          To set the SNMP target port number
 void setTimeout(int i)
          To Set the SNMP target timeout value in Seconds.
 void setWriteCommunity(java.lang.String s)
          To set the SNMP target write Community to be used for set requests
(package private)  void updateMibs()
           
 void vetoableChange(java.beans.PropertyChangeEvent e)
          This method is called when a vetoableChange event is fired from the propertySetting bean.
 
Methods inherited from class com.adventnet.snmp.beans.SnmpServer
assignLogger, async_create_v3_tables, create_v3_tables, finalize, genEvent, getCharacterEncoding, getCompleteResponse, getGROUPSNMPResponse, getHostAddress, getIgnoreSpecificControlCodes, getLocalAddresses, getMibPath, getOverwriteCMI, getPacketBufferSize, getPdu, getSecLevelForTimeSync, getSecurityProvider, getSecurityTable, getSerializedMibFileName, getSimpleDateFormat, getSnmpEngineID, getSnmpEngineTable, getSNMPResponse, getSNMPResponse, getSNMPResponse, getTimeoutInMilliSec, getTimeToWait, getUSMTable, getV3ConfigTable, initJdbcParams, initSecurityProvider, initSnmpStore, isBroadcastFeatureEnable, isLoadFromCompiledMibs, isLoadFromSerializedMibs, isLoadMibsFromDatabase, isOverwriteCMI, isOverwriteMibsInDatabase, isReadDesc, isSendPDUByGroup, isSerializeMibs, isSetAutoInformResponse, isSupportedSecurityModel, isV3DatabaseFlag, isValidateUser, logErrorMessage, logInfoMessage, manage_v3_tables, managing_v3_tables, sendSNMPRequest, sendSNMPRequest, setAutoInformResponse, setBroadcastFeatureEnable, setCharacterEncoding, setErrorMessage, setIgnoreSpecificControlCodes, setLoadFromCompiledMibs, setLoadFromSerializedMibs, setLoadMibsFromDatabase, setMibOperations, setMibPath, setOverwriteCMI, setOverwriteMibsInDatabase, setPacketBufferSize, setPduParams, setReadDesc, setReceiveBufferSize, setSecLevelForTimeSync, setSendPDUByGroup, setSerializedMibFileName, setSerializeMibs, setSimpleDateFormat, setSnmpEngineID, setTimeoutInMilliSec, setTimeToWait, setV3ConfigTable, setV3DatabaseFlag, updateEntry, validateUser
 
Methods inherited from class java.lang.Object
, clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logID

int logID

mibModules

java.lang.String mibModules

prevoid

int[] prevoid

requests

java.util.Hashtable requests

serialize

public boolean serialize
based on this flag the v3 tables ( USMUserTable and SnmpEngineTable ) will be serialized.

destinations

java.util.Hashtable destinations
Constructor Detail

SnmpRequestServer

public SnmpRequestServer()
Use this constructor for applications. Use for applets only if you want to prevent the use of SAS. MIB loading from applets may fail from this SnmpRequestServer instance if you use this constructor. This matters only for the first SnmpRequestServer instance, and subsequent instances will use the same SNMP mechanisms for the same port.

SnmpRequestServer

public SnmpRequestServer(int localPort,
                         java.lang.String sessionName)
Use this constructor for applications which will create a session with name and in specific localport. Use for applets only if you want to prevent use of SAS. MIB loading from applets may fail from this SnmpRequestServer instance if you use this constructor. This matters only for the first SnmpRequestServer instance, and subsequent instances will use the same SNMP mechanisms for the same port.

SnmpRequestServer

public SnmpRequestServer(int protocol,
                         ProtocolOptions options)
Use this constructor for applications which uses protocols other than UDP/IP.

SnmpRequestServer

public SnmpRequestServer(java.applet.Applet applet,
                         int localPort,
                         java.lang.String sessionName)
Use this constructor for appletswhich will create a session with name and in specific localport.. Applets will try and use SAS, and if unsuccessful will use local sockets.

SnmpRequestServer

public SnmpRequestServer(java.applet.Applet applet)
Use this constructor for applets. Applets will try and use SAS, and if unsuccessful will use local sockets.

SnmpRequestServer

public SnmpRequestServer(java.lang.String[] localAddrs,
                         java.lang.String sessionName)
Use this constructor for applications in which the session needs to be bound to some local address. Usually, the session will be shared across different instances of this class. If seperate session needs to be used, then specify unique sessionNames for the instances created.
Parameters:
localAddrs - The local addresses to which the session needs to be bound.
sessionName - Specify unique sessionNames for the instances which need to use different SnmpSession instances to send data.
Method Detail

loadMibs

public void loadMibs(java.lang.String mibs)
              throws MibException,
                     java.io.IOException,
                     java.io.FileNotFoundException
Loads the specified mib. If first SnmpRequestServer has been opened with applet parameter, then URLs will be used. MIB loading applies across all beans in this package, i.e. MIBs can be loaded in any of the bean instances, and will be available to all beans in this package, across the VM. The files can be seperated by a space, tab, new line, carriage return and pipe symbol.
for example, server.loadMibs("../mibs/RFC1213-MIB ../mibs/IF-MIB");
MIBs can also be loaded from string URLs.

In case of loading the files from space seperated directories, the whole String should be given within the double quotes.
for example, if the MIB file is present in the directory 'Program Files',
server.loadMibs("\"../../mibs/Program Files/RFC1213-MIB\"")

Overrides:
loadMibs in class SnmpServer
Throws:
MibException - is thrown while parser error ocurs.
java.io.IOException - is thrown while upon IO error occurs.
java.io.FileNotFoundException - is thrown if the file is not found.

addResultListener

public void addResultListener(ResultListener l)
Adds a Listener to the list that is notified each time when a response arrives. The Listeners will receive Result Events from any or all SNMP requests. Targeting responses to specific listeners, requires using RequestEvent and the setDestination method while creating the request.
Parameters:
l - an instance of ResultListener.
See Also:
ResultEvent, ResultListener

removeResultListener

public void removeResultListener(ResultListener l)
Removes a listener for response events from the list of listeners.
Parameters:
l - ResultListener to be removed.
See Also:
ResultListener

addSnmpPropertyListener

public void addSnmpPropertyListener(SnmpPropertyListener l)
Adds SnmpPropertyListener to the Listeners list. Whenever the value of target parameters like HostName, targetPort gets changed,SnmpPropertyChangeEvent will be sent to all the registered listeners in this list.
Parameters:
l - an instance of SnmpPropertyListener to be added.
See Also:
SnmpPropertyChangeEvent, SnmpPropertyListener

removeSnmpPropertyListener

public void removeSnmpPropertyListener(SnmpPropertyListener l)
Removes the SnmpPropertyListener from the list.
Parameters:
l - SnmpPropertyListener to be removed.
See Also:
SnmpPropertyListener

addV3HandShakeResultListener

public void addV3HandShakeResultListener(V3HandShakeResultListener l)
Adds a listener to receive the events when SnmpEngineID discovery and time Synchronization is performed by the method async_create_v3_tables.
Parameters:
l - the V3HandShakeResultListener to be registered for getting events.
See Also:
V3HandShakeResultListener, V3HandShakeResultEvent

removeV3HandShakeListener

public void removeV3HandShakeListener(V3HandShakeResultListener l)
Removes the listener registered for getting events.
Parameters:
l - the V3HandShakeResultListener to be removed.
See Also:
V3HandShakeResultListener

readFromDatabase

public void readFromDatabase()
                      throws java.sql.SQLException
This will read the v3table like USmUserTable and SnmpEngineTable from Database after establishing connection
Throws:
java.sql.SQLException - incase of any error during reading from database.

deSerializeUSM

public void deSerializeUSM()
This will deserialize the v3 tables like USMUserTable and SnmpEngineTable from serialized file if the serilaized file already exists

authenticate

public boolean authenticate(SnmpPDU pdu,
                            java.lang.String community)
This is the SnmpClient method implementation used to authenticate a PDU. Always returns true. Needs to be implemented for callbacks.
Specified by:
authenticate in interface SnmpClient

callback

public boolean callback(SnmpSession session,
                        SnmpPDU pdu,
                        int requestID)
This is the SnmpClient method implementation method that processes and forwards the result.The response returned by the RequestServer will be received by this method. The following ErrorCodes can be set: REQ_TIMEDOUT, SNMP error's defined in ErrorMessages
Specified by:
callback in interface SnmpClient
See Also:
ErrorMessages, getErrorCode(), getErrorString()

debugPrint

public void debugPrint(java.lang.String debugOutput)
This is the SnmpClient method implementation that prints the standard error.
Specified by:
debugPrint in interface SnmpClient

genTimeoutEvent

protected void genTimeoutEvent(SnmpPDU pdu)
Generate the timeout events to the listeners
Overrides:
genTimeoutEvent in class SnmpServer

genEvent

protected void genEvent(SnmpPDU pdu)
Generate the response event to the listeners
Overrides:
genEvent in class SnmpServer

addObjectID

public int addObjectID(java.lang.String s)
Adds an ObjectID specified by string to the existing OID list.
Parameters:
s - the OID to be added
Returns:
the index of the entry added for later reference.

addSnmpOID

public int addSnmpOID(SnmpOID oid)
Adds an SnmpOID to the existing list of OIDs.
Parameters:
oid - SnmpOID to be added.
Returns:
the index of the entry added for later reference.

getObjectID

public java.lang.String getObjectID(int index)
To get the object ID at the specified index
Parameters:
index - the index of the oid in the oidlist array
Returns:
an ObjectID as a string in the format iso.org.dod.internet.. if mibs loaded or as a string in the format .1.3.6.1.. if mibs is not loaded.

getObjectID

public java.lang.String getObjectID()
To get the first object ID from a list of ObjectIDs.
Returns:
the ObjectID as a string

setObjectID

public void setObjectID(java.lang.String s)
Sets the object ID value specified by the string
Parameters:
s - the oid to be set

setObjectID

public void setObjectID(int index,
                        java.lang.String s)
Sets the object ID value specified the string at the given index
Parameters:
index - index in the oidlist where the oid has to be set.
s - the oid that has to be set.

getObjectIDList

public java.lang.String[] getObjectIDList()
To get the list of object IDs.
Returns:
the list of OIDs as a String array.

setObjectIDList

public void setObjectIDList(java.lang.String[] s)
Sets the list of object IDs specified by the string array
Parameters:
s[] - an array of ObjectIDs.

getSnmpOID

public SnmpOID getSnmpOID()
To get the first SnmpOID from the list of object IDs.
Returns:
the ObjectID as an SnmpOID.

setSnmpOID

public void setSnmpOID(SnmpOID oid)
Sets the SnmpOID.
Parameters:
oid - SnmpOID to be set.

getSnmpOIDList

public SnmpOID[] getSnmpOIDList()
To get the list of object IDs as an array of SnmpOID instances
Returns:
an array of SnmpOIDs.

setSnmpOIDList

public void setSnmpOIDList(SnmpOID[] list)
To set the list of object IDs given as an array of SnmpOIDs
Parameters:
list[] - an array of SnmpOIDs

getTargetHost

public java.lang.String getTargetHost()
To get the SNMP target hostname
Specified by:
getTargetHost in interface CustomizerTemplate
Returns:
the hostname as a String

setTargetHost

public void setTargetHost(java.lang.String s)
To set the SNMP target hostname
Specified by:
setTargetHost in interface CustomizerTemplate
Parameters:
s - target hostname as a String

getTargetPort

public int getTargetPort()
To get the SNMP target port number
Specified by:
getTargetPort in interface CustomizerTemplate
Returns:
the target port.

setTargetPort

public void setTargetPort(int i)
To set the SNMP target port number
Specified by: