Package org.snmp4j.util
Class TreeUtils
java.lang.Object
org.snmp4j.util.AbstractSnmpUtility
org.snmp4j.util.TreeUtils
-
Field Summary
Fields inherited from class org.snmp4j.util.AbstractSnmpUtility
pduFactory, session -
Constructor Summary
ConstructorsConstructorDescriptionTreeUtils(Session snmpSession, PDUFactory pduFactory) Creates aTreeUtilsinstance. -
Method Summary
Modifier and TypeMethodDescriptionintGets the maximum number of the variable bindings perTreeEventreturned by this instance.getSubtree(Target target, OID rootOID) Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target synchronously.voidgetSubtree(Target target, OID rootOID, Object userObject, TreeListener listener) Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.booleanReturn the ignore lexicographic order errors flage value.voidsetIgnoreLexicographicOrder(boolean ignoreLexicographicOrder) Set the ignore lexicographic order errors flage value.voidsetMaxRepetitions(int maxRepetitions) Sets the maximum number of the variable bindings perTreeEventreturned by this instance.Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.voidwalk(Target target, OID[] rootOIDs, Object userObject, TreeListener listener) Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.
-
Constructor Details
-
TreeUtils
Creates aTreeUtilsinstance. The created instance is thread safe as long as the suppliedSessionandPDUFactoryare thread safe.- Parameters:
snmpSession- a SNMPSessioninstance.pduFactory- aPDUFactoryinstance that creates the PDU that are used by this instance to retrieve MIB tree data using GETBULK/GETNEXT operations.
-
-
Method Details
-
getSubtree
Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target synchronously.- Parameters:
target- aTargetthat 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).- Returns:
- a possibly empty List of
TreeEventinstances where each instance carries zero or more values (or an error condition) in depth-first-order.
-
walk
Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.- Parameters:
target- aTargetthat 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.- Returns:
- a possibly empty List of
TreeEventinstances where each instance carries zero orrootOIDs.lengthvalues. - Since:
- 2.1
-
getSubtree
Gets a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.- Parameters:
target- aTargetthat 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 suppliedTreeListener.listener- theTreeListenerthat processes theTreeEvents generated by this method. Each event object may carry zero or more object instances from the sub-tree in depth-first-order.
-
walk
Walks a subtree with GETNEXT (SNMPv1) or GETBULK (SNMP2c, SNMPv3) operations from the specified target asynchronously.- Parameters:
target- aTargetthat 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 suppliedTreeListener.listener- theTreeListenerthat processes theTreeEvents 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 eachTreeEventcontains the variable bindings of each iteration.- Since:
- 2.1
-
setMaxRepetitions
public void setMaxRepetitions(int maxRepetitions) Sets the maximum number of the variable bindings perTreeEventreturned by this instance.- Parameters:
maxRepetitions- the maximum repetitions used for GETBULK requests. For SNMPv1 this values has no effect (it is then implicitly one).
-
setIgnoreLexicographicOrder
public void setIgnoreLexicographicOrder(boolean ignoreLexicographicOrder) Set the ignore lexicographic order errors flage value.- Parameters:
ignoreLexicographicOrder-trueto ignore lexicographic order errors,falseotherwise (default).- Since:
- 1.10.1
-
getMaxRepetitions
public int getMaxRepetitions()Gets the maximum number of the variable bindings perTreeEventreturned by this instance.- Returns:
- the maximum repetitions used for GETBULK requests. For SNMPv1 this values has no effect (it is then implicitly one).
-
isIgnoreLexicographicOrder
public boolean isIgnoreLexicographicOrder()Return the ignore lexicographic order errors flage value.- Returns:
trueif lexicographic order errors are ignored,falseotherwise (default).- Since:
- 1.10.1
-