Package org.snmp4j.model.snmp.api
Class CommitStatus
java.lang.Object
org.snmp4j.model.snmp.api.CommitStatus
- All Implemented Interfaces:
SnmpCommitResult
The
CommitStatus
represents the status of a SNMP commit operation.
It has two lists, the first contains all the successfully committed changes and the second
holds any failed change sets.- Version:
- 1.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsConstructorDescriptionCommitStatus
(SnmpErrorStatus snmpErrorStatus, int errorIndex, List<SnmpValuesChangeSet> committedChanges, List<SnmpValuesChangeSet> failedChanges) Create a SNMP commit result based on an error status and index as well as a list of succeeded (committed) changes and failed changes. -
Method Summary
Modifier and TypeMethodDescriptionint
Gets the error index of the SNMP error (if > 0) that points to theVariableBinding
inSnmpCommitResult.getFailedChanges()
that caused the error.boolean
Returnstrue
if the commit operation succeeded.toString()
-
Constructor Details
-
CommitStatus
public CommitStatus(SnmpErrorStatus snmpErrorStatus, int errorIndex, List<SnmpValuesChangeSet> committedChanges, List<SnmpValuesChangeSet> failedChanges) Create a SNMP commit result based on an error status and index as well as a list of succeeded (committed) changes and failed changes.- Parameters:
snmpErrorStatus
- the SNMP error status that caused the first failure as defined bySnmpErrorStatus
.errorIndex
- the index of the value that failed. Counting starts from the first change set's first element (=1) until the last changes set's last value.committedChanges
- the (possibly empty) list of successfully committed changes.failedChanges
- the (possibly empty) list of uncommitted changes or changes that caused an error.
-
-
Method Details
-
isSuccess
public boolean isSuccess()Description copied from interface:SnmpCommitResult
Returnstrue
if the commit operation succeeded.- Specified by:
isSuccess
in interfaceSnmpCommitResult
- Returns:
true
if the commit operation succeeded,false
if a timeout, IO exception, or SNMP error occurred.
-
getErrorStatus
- Specified by:
getErrorStatus
in interfaceSnmpCommitResult
-
getFailedChanges
- Specified by:
getFailedChanges
in interfaceSnmpCommitResult
-
getCommittedChanges
- Specified by:
getCommittedChanges
in interfaceSnmpCommitResult
-
getErrorIndex
public int getErrorIndex()Description copied from interface:SnmpCommitResult
Gets the error index of the SNMP error (if > 0) that points to theVariableBinding
inSnmpCommitResult.getFailedChanges()
that caused the error.- Specified by:
getErrorIndex
in interfaceSnmpCommitResult
- Returns:
- 0 if no specific variable binding caused an error or a value > 0 that points to the n-th variable binding
in
SnmpCommitResult.getFailedChanges()
that caused the error.
-
toString
-