java.lang.Object
org.snmp4j.agent.request.SnmpRequest.SnmpSubRequest
- All Implemented Interfaces:
EventListener,RequestStatusListener,SnmpSubRequest<SnmpRequest.SnmpSubRequest>,SubRequest<SnmpRequest.SnmpSubRequest>
- Enclosing class:
SnmpRequest
public class SnmpRequest.SnmpSubRequest
extends Object
implements SnmpSubRequest<SnmpRequest.SnmpSubRequest>, RequestStatusListener
The SnmpSubRequest represents a single variable binding request of a SNMP PDU.
- Version:
- 3.0
- Author:
- Frank Fock
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSnmpSubRequest(SnmpSubRequest<?> predecessor, int index) protectedSnmpSubRequest(org.snmp4j.smi.VariableBinding subrequest, int index) -
Method Summary
Modifier and TypeMethodDescriptionvoidMarks the sub-request as completed.final intGets the error status for this sub-request.intgetIndex()Returns the index of this subrequest in the request.protected MOScopegetNextScope(org.snmp4j.smi.OID previousOID) getQuery()Gets the query previously associated with this sub-request.Gets the request this sub-request belongs to.getScope()Gets the scope for this subrequest.Gets the status object associated with this sub-request.ManagedObject<? super SnmpRequest.SnmpSubRequest>Gets theManagedObjectthat is responsible for processing this sub-request.Gets the undo value object associated with this sub-request.Gets the user object that has previously associated with this sub-request.org.snmp4j.smi.VariableBindingReturns the variable binding associated with the sub-request.booleanhasError()Indicates whether this (sub-)request has an error.booleanChecks whether the sub-request has been completed and needs no further processing.Returns an iterator on the repetitions of this sub-request.voidvoidsetErrorStatus(int errorStatus) Sets the error status for this sub-request.voidsetLookupEvent(MOServerLookupEvent lookupEvent) voidSets the query associated with this subrequest.voidsetStatus(RequestStatus status) voidsetTargetMO(ManagedObject<? super SnmpRequest.SnmpSubRequest> managedObject) Sets theManagedObjectthat is determined as the target object of this sub-request by the agent framework.voidsetUndoValue(Object undoInformation) Associates an undo value object with this sub-request.voidsetUserObject(Object userObject) Sets the user object.toString()voidUpdates the next repetition's scope and reset any previously set query tonull.
-
Constructor Details
-
SnmpSubRequest
protected SnmpSubRequest(org.snmp4j.smi.VariableBinding subrequest, int index) -
SnmpSubRequest
-
-
Method Details
-
getNextScope
-
getRequest
Description copied from interface:SubRequestGets the request this sub-request belongs to.- Specified by:
getRequestin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a Request instance.
-
getStatus
Description copied from interface:SubRequestGets the status object associated with this sub-request.- Specified by:
getStatusin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a RequestStatus instance.
-
getVariableBinding
public org.snmp4j.smi.VariableBinding getVariableBinding()Description copied from interface:SubRequestReturns the variable binding associated with the sub-request. In order to process a sub-request this variable binding needs to be modified (if not an error condition prevents that).- Specified by:
getVariableBindingin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- the
VariableBindingthat holds the sub-request result or operation parameter (in case of a SET request).
-
setStatus
- Specified by:
setStatusin interfaceSnmpSubRequest<SnmpRequest.SnmpSubRequest>
-
getUndoValue
Description copied from interface:SubRequestGets the undo value object associated with this sub-request.- Specified by:
getUndoValuein interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- an Object that has previously been associated with this request by
calling
SubRequest.setUndoValue(java.lang.Object).
-
setUndoValue
Description copied from interface:SubRequestAssociates an undo value object with this sub-request. The undo value is internally used by the SNMP4J-Agent API and should therefore not be altered externally. One exception to this rule is an implementation of theManagedObjectinterface that does not extend any other API class.- Specified by:
setUndoValuein interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Parameters:
undoInformation- an object that represents/contains all necessary information to undo this sub-request.
-
requestStatusChanged
- Specified by:
requestStatusChangedin interfaceRequestStatusListener
-
getScope
Description copied from interface:SubRequestGets the scope for this subrequest. The scope is solely defined by this sub-request and possible request processing that has already excluded managed objects from the scope of this sub-request.- Specified by:
getScopein interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a
MOScopeinstance.
-
completed
public void completed()Description copied from interface:SubRequestMarks the sub-request as completed. This is a shortcut for callingSubRequest.getStatus()and thenRequestStatus.setPhaseComplete(boolean)totrue.- Specified by:
completedin interfaceSubRequest<SnmpRequest.SnmpSubRequest>
-
hasError
public boolean hasError()Description copied from interface:SubRequestIndicates whether this (sub-)request has an error.- Specified by:
hasErrorin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
trueif this request (and thus also this sub-request) has an error status greater than zero.
-
isComplete
public boolean isComplete()Description copied from interface:SubRequestChecks whether the sub-request has been completed and needs no further processing.- Specified by:
isCompletein interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
trueif the sub-request has been finished and should not be processed any more.
-
setTargetMO
Description copied from interface:SubRequestSets theManagedObjectthat is determined as the target object of this sub-request by the agent framework. For SET requests the target managed object is locked and referenced here to make sure that all locks are released when a request is answered. In addition, SET requests are processed in multiple phases and referencing the target managed objects increases performance.- Specified by:
setTargetMOin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Parameters:
managedObject- theManagedObjectresponsible for processing this sub- request.
-
getTargetMO
Description copied from interface:SubRequestGets theManagedObjectthat is responsible for processing this sub-request.- Specified by:
getTargetMOin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
ManagedObjectinstance.
-
getLookupEvent
- Specified by:
getLookupEventin interfaceSnmpSubRequest<SnmpRequest.SnmpSubRequest>
-
setLookupEvent
- Specified by:
setLookupEventin interfaceSnmpSubRequest<SnmpRequest.SnmpSubRequest>
-
getSnmpRequest
- Specified by:
getSnmpRequestin interfaceSnmpSubRequest<SnmpRequest.SnmpSubRequest>
-
setErrorStatus
public void setErrorStatus(int errorStatus) Description copied from interface:SubRequestSets the error status for this sub-request. Calling this method is a shortcut for.SubRequest.getStatus().setErrorStatus(int errorStatus)- Specified by:
setErrorStatusin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Parameters:
errorStatus- a SNMPv2/v3 error status.
-
getIndex
public int getIndex()Description copied from interface:SubRequestReturns the index of this subrequest in the request.- Specified by:
getIndexin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- the zero based index.
-
setQuery
Description copied from interface:SubRequestSets the query associated with this subrequest. The query is not used by the request itself but may be stored here for further reference while processing this sub-requests.- Specified by:
setQueryin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Parameters:
query- aMOQueryinstance representing the query resulting from this sub-request.
-
getQuery
Description copied from interface:SubRequestGets the query previously associated with this sub-request. A sub-request is associated during requests processing with a instrumentation query.- Specified by:
getQueryin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a
MOQuerythat describes which manage objects match this sub-request.
-
toString
-
repetitions
Description copied from interface:SubRequestReturns an iterator on the repetitions of this sub-request. On requests other than GETBULK requests this method returns an empty iterator.- Specified by:
repetitionsin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a SubRequestIterator enumerating the repetitions on this sub-requests starting with this sub-request.
-
updateNextRepetition
public void updateNextRepetition()Description copied from interface:SubRequestUpdates the next repetition's scope and reset any previously set query tonull. The scope of the next repetition is updated according to the value of this variable binding. If this sub-request has an error status or exception value, the following repetitions are set to the same value and exception. Otherwise, the scope of the following sub-request is the open interval from this sub-request's OID (not-including) to any OID value.- Specified by:
updateNextRepetitionin interfaceSubRequest<SnmpRequest.SnmpSubRequest>
-
getErrorStatus
public final int getErrorStatus()Description copied from interface:SubRequestGets the error status for this sub-request. Calling this method is a shortcut for.SubRequest.getStatus().getErrorStatus()- Specified by:
getErrorStatusin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- a SNMPv2/v3 error status.
-
getUserObject
Description copied from interface:SubRequestGets the user object that has previously associated with this sub-request.- Specified by:
getUserObjectin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Returns:
- an object.
-
setUserObject
Description copied from interface:SubRequestSets the user object. The user object can be used to associate resources or any other type of information necessary for a managed object instance to process a SNMP request. When the request is processed, this reference will be set tonull.- Specified by:
setUserObjectin interfaceSubRequest<SnmpRequest.SnmpSubRequest>- Parameters:
userObject- an object that is not processed or interpreted by the agent API.
-