Class AgentXResponseEvent<A extends org.snmp4j.smi.Address>

java.lang.Object
java.util.EventObject
org.snmp4j.agent.agentx.AgentXResponseEvent<A>
Type Parameters:
A - the address type of the associated connection.
All Implemented Interfaces:
Serializable

public class AgentXResponseEvent<A extends org.snmp4j.smi.Address> extends EventObject
The AgentXResponseEvent informs about a received AgentX response from a sub-agent.
See Also:
  • Constructor Details

    • AgentXResponseEvent

      public AgentXResponseEvent(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject)
      Creates an AgentXResponseEvent instance.
      Parameters:
      source - the event source.
      target - the target where the request has been sent to.
      peerAddress - the transport address of the entity that send the response.
      request - the request AgentXPDU (must not be null).
      response - the AgentXResponsePDU or null if the request timed out.
      userObject - an optional user object.
    • AgentXResponseEvent

      public AgentXResponseEvent(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject, Exception error)
      Creates an ResponseEvent instance with an exception object indicating a message processing error.
      Parameters:
      source - the event source.
      target - the target where the request has been sent to.
      peerAddress - the transport address of the entity that send the response.
      request - the request PDU (must not be null).
      response - the response PDU or null if the request timed out.
      userObject - an optional user object.
      error - an Exception.
  • Method Details

    • getRequest

      public AgentXPDU getRequest()
      Gets the request PDU.
      Returns:
      a PDU.
    • setPeerAddress

      protected final void setPeerAddress(A peerAddress)
      Sets the peer address.
      Parameters:
      peerAddress - the address of the AgentXPeer.
    • setRequest

      protected final void setRequest(AgentXPDU request)
      Sets the request PDU.
      Parameters:
      request - a request PDU.
    • setResponse

      protected final void setResponse(AgentXResponsePDU response)
      Sets the response PDU.
      Parameters:
      response - a response PDU.
    • getResponse

      public AgentXResponsePDU getResponse()
      Gets the response PDU.
      Returns:
      a PDU instance if a response has been received. If the request timed out then null will be returned.
    • setUserObject

      protected final void setUserObject(Object userObject)
      Sets the user object associated with this request.
      Parameters:
      userObject - an object (preferably serializable)
    • getUserObject

      public Object getUserObject()
      Gets the user object that has been supplied to the asynchronous request AgentX.send(AgentXPDU, AgentXTarget, TransportMapping).
      Returns:
      an Object.
    • getError

      public Exception getError()
      Gets the exception object from the exception that has been generated when the request processing has failed due to an error.
      Returns:
      an Exception instance.
    • getPeerAddress

      public A getPeerAddress()
      Gets the transport address of the response sender.
      Returns:
      the transport Address of the command responder that send this response, or null if no response has been received within the time-out interval or if an error occured (see getError()).
    • getTarget

      public AgentXTarget<A> getTarget()
      Gets the target for this request/response pair.
      Returns:
      the AgentXTarget.