Module org.snmp4j.agent
Package org.snmp4j.agent.request
Interface SubRequest<N extends SubRequest<N>>
-
- All Known Subinterfaces:
SnmpSubRequest<S>
- All Known Implementing Classes:
SnmpRequest.SnmpSubRequest
public interface SubRequest<N extends SubRequest<N>>TheSubRequestinterface defines general sub-request properties and behavior.- Version:
- 3.0.4
- Author:
- Frank Fock
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcompleted()Marks the sub-request as completed.intgetErrorStatus()Gets the error status for this sub-request.intgetIndex()Returns the index of this subrequest in the request.MOQuerygetQuery()Gets the query previously associated with this sub-request.Request<?,?,?>getRequest()Gets the request this sub-request belongs to.MOScopegetScope()Gets the scope for this subrequest.RequestStatusgetStatus()Gets the status object associated with this sub-request.ManagedObject<? super N>getTargetMO()Gets theManagedObjectthat is responsible for processing this sub-request.ObjectgetUndoValue()Gets the undo value object associated with this sub-request.ObjectgetUserObject()Gets the user object that has previously associated with this sub-request.org.snmp4j.smi.VariableBindinggetVariableBinding()Returns the variable binding associated with the sub-request.booleanhasError()Indicates whether this (sub-)request has an error.booleanisComplete()Checks whether the sub-request has been completed and needs no further processing.SubRequestIterator<N>repetitions()Returns an iterator on the repetitions of this sub-request.voidsetErrorStatus(int errorStatus)Sets the error status for this sub-request.voidsetQuery(MOQuery query)Sets the query associated with this subrequest.voidsetTargetMO(ManagedObject<? super N> 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.voidupdateNextRepetition()Updates the next repetition's scope and reset any previously set query tonull.
-
-
-
Method Detail
-
hasError
boolean hasError()
Indicates whether this (sub-)request has an error.- Returns:
trueif this request (and thus also this sub-request) has an error status greater than zero.
-
setErrorStatus
void setErrorStatus(int errorStatus)
Sets the error status for this sub-request. Calling this method is a shortcut for.getStatus().setErrorStatus(int errorStatus)- Parameters:
errorStatus- a SNMPv2/v3 error status.- Since:
- 1.0.1
-
getErrorStatus
int getErrorStatus()
Gets the error status for this sub-request. Calling this method is a shortcut for.getStatus().getErrorStatus()- Returns:
- a SNMPv2/v3 error status.
- Since:
- 1.0.1
-
getStatus
RequestStatus getStatus()
Gets the status object associated with this sub-request.- Returns:
- a RequestStatus instance.
-
getScope
MOScope getScope()
Gets 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.- Returns:
- a
MOScopeinstance.
-
getVariableBinding
org.snmp4j.smi.VariableBinding getVariableBinding()
Returns 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).- Returns:
- the
VariableBindingthat holds the sub-request result or operation parameter (in case of a SET request).
-
getRequest
Request<?,?,?> getRequest()
Gets the request this sub-request belongs to.- Returns:
- a Request instance.
-
getUndoValue
Object getUndoValue()
Gets the undo value object associated with this sub-request.- Returns:
- an Object that has previously been associated with this request by
calling
setUndoValue(java.lang.Object).
-
setUndoValue
void setUndoValue(Object undoInformation)
Associates 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.- Parameters:
undoInformation- an object that represents/contains all necessary information to undo this sub-request.
-
completed
void completed()
Marks the sub-request as completed. This is a shortcut for callinggetStatus()and thenRequestStatus.setPhaseComplete(boolean)totrue.
-
isComplete
boolean isComplete()
Checks whether the sub-request has been completed and needs no further processing.- Returns:
trueif the sub-request has been finished and should not be processed any more.
-
setTargetMO
void setTargetMO(ManagedObject<? super N> managedObject)
Sets 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.- Parameters:
managedObject- theManagedObjectresponsible for processing this sub- request.
-
getTargetMO
ManagedObject<? super N> getTargetMO()
Gets theManagedObjectthat is responsible for processing this sub-request.- Returns:
ManagedObjectinstance.
-
getIndex
int getIndex()
Returns the index of this subrequest in the request.- Returns:
- the zero based index.
-
setQuery
void setQuery(MOQuery query)
Sets 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.- Parameters:
query- aMOQueryinstance representing the query resulting from this sub-request.
-
getQuery
MOQuery getQuery()
Gets the query previously associated with this sub-request. A sub-request is associated during requests processing with a instrumentation query.- Returns:
- a
MOQuerythat describes which manage objects match this sub-request.
-
repetitions
SubRequestIterator<N> repetitions()
Returns an iterator on the repetitions of this sub-request. On requests other than GETBULK requests this method returns an empty iterator.- Returns:
- a SubRequestIterator enumerating the repetitions on this sub-requests starting with this sub-request.
-
updateNextRepetition
void updateNextRepetition()
Updates 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.
-
getUserObject
Object getUserObject()
Gets the user object that has previously associated with this sub-request.- Returns:
- an object.
- Since:
- 1.0.1
-
setUserObject
void setUserObject(Object userObject)
Sets 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.- Parameters:
userObject- an object that is not processed or interpreted by the agent API.- Since:
- 1.0.1
-
-