Package org.opennms.netmgt.snmp
Class SnmpWalker
- java.lang.Object
-
- org.opennms.netmgt.snmp.SnmpWalker
-
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
JoeSnmpWalker,MockSnmpWalker,Snmp4JWalker
public abstract class SnmpWalker extends Object implements AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classSnmpWalker.WalkerPduBuilder
-
Constructor Summary
Constructors Modifier Constructor Description protectedSnmpWalker(InetAddress address, String name, int maxVarsPerPdu, int maxRepetitions, int maxRetries, CollectionTracker tracker)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidbuildAndSendNextPdu()abstract voidclose()protected abstract SnmpWalker.WalkerPduBuildercreatePduBuilder(int maxVarsPerPdu)booleanfailed()Returns the success or failure code for collection of the data.protected InetAddressgetAddress()StringgetErrorMessage()ThrowablegetErrorThrowable()intgetMaxVarsPerPdu()StringgetName()protected voidhandleAuthError(String msg)protected voidhandleDone()protected voidhandleError(String msg)protected voidhandleError(String msg, Throwable t)protected voidhandleFatalError(Throwable e)protected voidhandleTimeout(String msg)protected booleanprocessErrors(int errorStatus, int errorIndex)protected voidprocessResponse(SnmpObjId receivedOid, SnmpValue val)protected abstract voidsendNextPdu(SnmpWalker.WalkerPduBuilder pduBuilder)voidsetCallback(SnmpWalkCallback callback)Sets an (optional) callback that will be triggered when the walk was successfully completed, or failed due to some error.voidstart()booleantimedOut()voidwaitFor()booleanwaitFor(long timeout)
-
-
-
Constructor Detail
-
SnmpWalker
protected SnmpWalker(InetAddress address, String name, int maxVarsPerPdu, int maxRepetitions, int maxRetries, CollectionTracker tracker)
-
-
Method Detail
-
setCallback
public void setCallback(SnmpWalkCallback callback)
Sets an (optional) callback that will be triggered when the walk was successfully completed, or failed due to some error.- Parameters:
callback- the callback
-
createPduBuilder
protected abstract SnmpWalker.WalkerPduBuilder createPduBuilder(int maxVarsPerPdu)
-
start
public void start()
-
getMaxVarsPerPdu
public final int getMaxVarsPerPdu()
-
buildAndSendNextPdu
protected void buildAndSendNextPdu() throws SnmpException- Throws:
SnmpException
-
sendNextPdu
protected abstract void sendNextPdu(SnmpWalker.WalkerPduBuilder pduBuilder) throws SnmpException
- Throws:
SnmpException
-
handleDone
protected void handleDone()
-
failed
public boolean failed()
Returns the success or failure code for collection of the data.
-
timedOut
public boolean timedOut()
-
handleAuthError
protected void handleAuthError(String msg)
-
handleError
protected void handleError(String msg)
-
handleFatalError
protected void handleFatalError(Throwable e)
-
handleTimeout
protected void handleTimeout(String msg)
-
close
public abstract void close()
- Specified by:
closein interfaceAutoCloseable
-
getName
public final String getName()
-
waitFor
public void waitFor() throws InterruptedException- Throws:
InterruptedException
-
waitFor
public boolean waitFor(long timeout) throws InterruptedException- Throws:
InterruptedException
-
processErrors
protected boolean processErrors(int errorStatus, int errorIndex) throws SnmpException- Throws:
SnmpException
-
processResponse
protected void processResponse(SnmpObjId receivedOid, SnmpValue val) throws SnmpException
- Throws:
SnmpException
-
getAddress
protected final InetAddress getAddress()
-
getErrorMessage
public final String getErrorMessage()
-
getErrorThrowable
public final Throwable getErrorThrowable()
-
-