Class SnmpRequest.SnmpSubRequest

java.lang.Object
org.snmp4j.agent.request.SnmpRequest.SnmpSubRequest
All Implemented Interfaces:
EventListener, RequestStatusListener, SnmpSubRequest, SubRequest
Enclosing class:
SnmpRequest

public class SnmpRequest.SnmpSubRequest extends Object implements SnmpSubRequest, RequestStatusListener
Version:
1.0
Author:
Frank Fock
  • Constructor Details

    • SnmpSubRequest

      protected SnmpSubRequest(org.snmp4j.smi.VariableBinding subrequest, int index)
    • SnmpSubRequest

      protected SnmpSubRequest(SnmpRequest.SnmpSubRequest predecessor, int index)
  • Method Details

    • getNextScope

      protected MOScope getNextScope(org.snmp4j.smi.OID previousOID)
    • getRequest

      public SnmpRequest getRequest()
      Description copied from interface: SubRequest
      Gets the request this sub-request belongs to.
      Specified by:
      getRequest in interface SubRequest
      Returns:
      a Request instance.
    • getStatus

      public RequestStatus getStatus()
      Description copied from interface: SubRequest
      Gets the status object associated with this sub-request.
      Specified by:
      getStatus in interface SnmpSubRequest
      Specified by:
      getStatus in interface SubRequest
      Returns:
      a RequestStatus instance.
    • getVariableBinding

      public org.snmp4j.smi.VariableBinding getVariableBinding()
      Description copied from interface: SubRequest
      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).
      Specified by:
      getVariableBinding in interface SnmpSubRequest
      Specified by:
      getVariableBinding in interface SubRequest
      Returns:
      the VariableBinding that holds the sub-request result or operation parameter (in case of a SET request).
    • setStatus

      public void setStatus(RequestStatus status)
      Specified by:
      setStatus in interface SnmpSubRequest
    • getUndoValue

      public Object getUndoValue()
      Description copied from interface: SubRequest
      Gets the undo value object associated with this sub-request.
      Specified by:
      getUndoValue in interface SubRequest
      Returns:
      an Object that has previously been associated with this request by calling SubRequest.setUndoValue(java.lang.Object).
    • setUndoValue

      public void setUndoValue(Object undoInformation)
      Description copied from interface: SubRequest
      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 the ManagedObject interface that does not extend any other API class.
      Specified by:
      setUndoValue in interface SubRequest
      Parameters:
      undoInformation - an object that represents/contains all necessary information to undo this sub-request.
    • requestStatusChanged

      public void requestStatusChanged(RequestStatusEvent event)
      Specified by:
      requestStatusChanged in interface RequestStatusListener
    • getScope

      public MOScope getScope()
      Description copied from interface: SubRequest
      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.
      Specified by:
      getScope in interface SubRequest
      Returns:
      a MOScope instance.
    • completed

      public void completed()
      Description copied from interface: SubRequest
      Marks the sub-request as completed. This is a shortcut for calling SubRequest.getStatus() and then RequestStatus.setPhaseComplete(boolean) to true.
      Specified by:
      completed in interface SubRequest
    • hasError

      public boolean hasError()
      Description copied from interface: SubRequest
      Indicates whether this (sub-)request has an error.
      Specified by:
      hasError in interface SubRequest
      Returns:
      true if this request (and thus also this sub-request) has an error status greater than zero.
    • isComplete

      public boolean isComplete()
      Description copied from interface: SubRequest
      Checks whether the sub-request has been completed and needs no further processing.
      Specified by:
      isComplete in interface SubRequest
      Returns:
      true if the sub-request has been finished and should not be processed any more.
    • setTargetMO

      public void setTargetMO(ManagedObject managedObject)
      Description copied from interface: SubRequest
      Sets the ManagedObject that 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:
      setTargetMO in interface SubRequest
      Parameters:
      managedObject - the ManagedObject responsible for processing this sub- request.
    • getTargetMO

      public ManagedObject getTargetMO()
      Description copied from interface: SubRequest
      Gets the ManagedObject that is responsible for processing this sub-request.
      Specified by:
      getTargetMO in interface SubRequest
      Returns:
      ManagedObject instance.
    • getSnmpRequest

      public SnmpRequest getSnmpRequest()
      Specified by:
      getSnmpRequest in interface SnmpSubRequest
    • setErrorStatus

      public void setErrorStatus(int errorStatus)
      Description copied from interface: SubRequest
      Sets the error status for this sub-request. Calling this method is a shortcut for SubRequest.getStatus().setErrorStatus(int errorStatus) .
      Specified by:
      setErrorStatus in interface SnmpSubRequest
      Specified by:
      setErrorStatus in interface SubRequest
      Parameters:
      errorStatus - a SNMPv2/v3 error status.
    • getIndex

      public int getIndex()
      Description copied from interface: SubRequest
      Returns the index of this subrequest in the request.
      Specified by:
      getIndex in interface SubRequest
      Returns:
      the zero based index.
    • setQuery

      public void setQuery(MOQuery query)
      Description copied from interface: SubRequest
      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.
      Specified by:
      setQuery in interface SubRequest
      Parameters:
      query - a MOQuery instance representing the query resulting from this sub-request.
    • getQuery

      public MOQuery getQuery()
      Description copied from interface: SubRequest
      Gets the query previously associated with this sub-request. A sub-request is associated during requests processing with a instrumentation query.
      Specified by:
      getQuery in interface SubRequest
      Returns:
      a MOQuery that describes which manage objects match this sub-request.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • repetitions

      public SubRequestIterator<? extends SubRequest> repetitions()
      Description copied from interface: SubRequest
      Returns an iterator on the repetitions of this sub-request. On requests other than GETBULK requests this method returns an empty iterator.
      Specified by:
      repetitions in interface SubRequest
      Returns:
      a SubRequestIterator enumerating the repetitions on this sub-requests starting with this sub-request.
    • updateNextRepetition

      public void updateNextRepetition()
      Description copied from interface: SubRequest
      Updates the next repetition's scope and reset any previously set query to null. 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:
      updateNextRepetition in interface SubRequest
    • getErrorStatus

      public final int getErrorStatus()
      Description copied from interface: SubRequest
      Gets the error status for this sub-request. Calling this method is a shortcut for SubRequest.getStatus().getErrorStatus() .
      Specified by:
      getErrorStatus in interface SubRequest
      Returns:
      a SNMPv2/v3 error status.
    • getUserObject

      public Object getUserObject()
      Description copied from interface: SubRequest
      Gets the user object that has previously associated with this sub-request.
      Specified by:
      getUserObject in interface SubRequest
      Returns:
      an object.
    • setUserObject

      public void setUserObject(Object userObject)
      Description copied from interface: SubRequest
      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 to null.
      Specified by:
      setUserObject in interface SubRequest
      Parameters:
      userObject - an object that is not processed or interpreted by the agent API.