Package org.opennms.netmgt.snmp
Class SnmpWalker
- java.lang.Object
-
- org.opennms.netmgt.snmp.SnmpWalker
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
JoeSnmpWalker
,MockSnmpWalker
,Snmp4JWalker
public abstract class SnmpWalker extends java.lang.Object implements java.lang.AutoCloseable
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SnmpWalker.WalkerPduBuilder
-
Constructor Summary
Constructors Modifier Constructor Description protected
SnmpWalker(java.net.InetAddress address, java.lang.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 void
buildAndSendNextPdu()
abstract void
close()
protected abstract SnmpWalker.WalkerPduBuilder
createPduBuilder(int maxVarsPerPdu)
boolean
failed()
Returns the success or failure code for collection of the data.protected java.net.InetAddress
getAddress()
java.lang.String
getErrorMessage()
java.lang.Throwable
getErrorThrowable()
int
getMaxVarsPerPdu()
java.lang.String
getName()
protected void
handleAuthError(java.lang.String msg)
protected void
handleDone()
protected void
handleError(java.lang.String msg)
protected void
handleError(java.lang.String msg, java.lang.Throwable t)
protected void
handleFatalError(java.lang.Throwable e)
protected void
handleTimeout(java.lang.String msg)
protected boolean
processErrors(int errorStatus, int errorIndex)
protected void
processResponse(SnmpObjId receivedOid, SnmpValue val)
protected abstract void
sendNextPdu(SnmpWalker.WalkerPduBuilder pduBuilder)
void
setCallback(SnmpWalkCallback callback)
Sets an (optional) callback that will be triggered when the walk was successfully completed, or failed due to some error.void
start()
boolean
timedOut()
void
waitFor()
boolean
waitFor(long timeout)
-
-
-
Constructor Detail
-
SnmpWalker
protected SnmpWalker(java.net.InetAddress address, java.lang.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(java.lang.String msg)
-
handleError
protected void handleError(java.lang.String msg)
-
handleError
protected void handleError(java.lang.String msg, java.lang.Throwable t)
-
handleFatalError
protected void handleFatalError(java.lang.Throwable e)
-
handleTimeout
protected void handleTimeout(java.lang.String msg)
-
close
public abstract void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getName
public final java.lang.String getName()
-
waitFor
public void waitFor() throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
waitFor
public boolean waitFor(long timeout) throws java.lang.InterruptedException
- Throws:
java.lang.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 java.net.InetAddress getAddress()
-
getErrorMessage
public final java.lang.String getErrorMessage()
-
getErrorThrowable
public final java.lang.Throwable getErrorThrowable()
-
-