public class TreeUtils extends AbstractSnmpUtility
Modifier and Type | Class and Description |
---|---|
(package private) class |
TreeUtils.InternalTreeListener |
(package private) class |
TreeUtils.TreeRequest |
Modifier and Type | Field and Description |
---|---|
private boolean |
ignoreLexicographicOrder |
private static LogAdapter |
logger |
private int |
maxRepetitions |
pduFactory, session
Constructor and Description |
---|
TreeUtils(Session snmpSession,
PDUFactory pduFactory)
Creates a
TreeUtils instance. |
Modifier and Type | Method and Description |
---|---|
int |
getMaxRepetitions()
Gets the maximum number of the variable bindings per
TreeEvent
returned by this instance. |
java.util.List<TreeEvent> |
getSubtree(Target target,
OID rootOID)
Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations
from the specified target synchronously.
|
void |
getSubtree(Target target,
OID rootOID,
java.lang.Object userObject,
TreeListener listener)
Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations
from the specified target asynchronously.
|
boolean |
isIgnoreLexicographicOrder()
Return the ignore lexicographic order errors flage value.
|
void |
setIgnoreLexicographicOrder(boolean ignoreLexicographicOrder)
Set the ignore lexicographic order errors flage value.
|
void |
setMaxRepetitions(int maxRepetitions)
Sets the maximum number of the variable bindings per
TreeEvent
returned by this instance. |
java.util.List<TreeEvent> |
walk(Target target,
OID[] rootOIDs)
Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations
from the specified target asynchronously.
|
void |
walk(Target target,
OID[] rootOIDs,
java.lang.Object userObject,
TreeListener listener)
Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations
from the specified target asynchronously.
|
private static final LogAdapter logger
private int maxRepetitions
private boolean ignoreLexicographicOrder
public TreeUtils(Session snmpSession, PDUFactory pduFactory)
TreeUtils
instance. The created instance is thread
safe as long as the supplied Session
and
PDUFactory
are thread safe.snmpSession
- a SNMP Session
instance.pduFactory
- a PDUFactory
instance that creates the PDU that are used
by this instance to retrieve MIB tree data using GETBULK/GETNEXT
operations.public java.util.List<TreeEvent> getSubtree(Target target, OID rootOID)
target
- a Target
that specifies the target command responder
including its network transport address.rootOID
- the OID that specifies the root of the sub-tree to retrieve
(not included).TreeEvent
instances where each
instance carries zero or more values (or an error condition)
in depth-first-order.public java.util.List<TreeEvent> walk(Target target, OID[] rootOIDs)
target
- a Target
that specifies the target command responder
including its network transport address.rootOIDs
- the OIDs which specify the subtrees to walk. Each OID defines a sub-tree
that is walked. The walk ends if (a) an SNMP error occurs, (b) all
returned variable bindings for an iteration contain an exception value
(i.e., Null.endOfMibView
) or for each rootOIDs element, the returned
VariableBinding's OID has not the same prefix, (c) a VariableBinding out of
lexicographic order is returned.TreeEvent
instances where each
instance carries zero or rootOIDs.length
values.public void getSubtree(Target target, OID rootOID, java.lang.Object userObject, TreeListener listener)
target
- a Target
that specifies the target command responder
including its network transport address.rootOID
- the OID that specifies the root of the sub-tree to retrieve
(not included).userObject
- an optional user object that will be transparently handed over to the
supplied TreeListener
.listener
- the TreeListener
that processes the TreeEvent
s
generated by this method. Each event object may carry zero or more
object instances from the sub-tree in depth-first-order.public void walk(Target target, OID[] rootOIDs, java.lang.Object userObject, TreeListener listener)
target
- a Target
that specifies the target command responder
including its network transport address.rootOIDs
- the OIDs which specify the subtrees to walk. Each OID defines a sub-tree
that is walked. The walk ends if (a) an SNMP error occurs, (b) all
returned variable bindings for an iteration contain an exception value
(i.e., Null.endOfMibView
) or for each rootOIDs element, the returned
VariableBinding's OID has not the same prefix, (c) a VariableBinding out of
lexicographic order is returned.userObject
- an optional user object that will be transparently handed over to the
supplied TreeListener
.listener
- the TreeListener
that processes the TreeEvent
s
generated by this method. Each event object may carry zero or more
object instances from the sub-tree in depth-first-order if rootOIDs
has a single element. If it has more than one element, then each
TreeEvent
contains the variable bindings of each iteration.public void setMaxRepetitions(int maxRepetitions)
TreeEvent
returned by this instance.maxRepetitions
- the maximum repetitions used for GETBULK requests. For SNMPv1 this
values has no effect (it is then implicitly one).public void setIgnoreLexicographicOrder(boolean ignoreLexicographicOrder)
ignoreLexicographicOrder
- true
to ignore lexicographic order errors,
false
otherwise (default).public int getMaxRepetitions()
TreeEvent
returned by this instance.public boolean isIgnoreLexicographicOrder()
true
if lexicographic order errors are ignored,
false
otherwise (default).