Package org.snmp4j.agent.agentx
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
The
AgentXResponseEvent informs about a received AgentX response from a sub-agent.- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source -
Constructor Summary
ConstructorsConstructorDescriptionAgentXResponseEvent(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject) Creates anAgentXResponseEventinstance.AgentXResponseEvent(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject, Exception error) Creates anResponseEventinstance with an exception object indicating a message processing error. -
Method Summary
Modifier and TypeMethodDescriptiongetError()Gets the exception object from the exception that has been generated when the request processing has failed due to an error.Gets the transport address of the response sender.Gets the request PDU.Gets the response PDU.Gets the target for this request/response pair.Gets the user object that has been supplied to the asynchronous requestAgentX.send(AgentXPDU, AgentXTarget, TransportMapping).protected final voidsetPeerAddress(A peerAddress) Sets the peer address.protected final voidsetRequest(AgentXPDU request) Sets the request PDU.protected final voidsetResponse(AgentXResponsePDU response) Sets the response PDU.protected final voidsetUserObject(Object userObject) Sets the user object associated with this request.Methods inherited from class java.util.EventObject
getSource, toString
-
Constructor Details
-
AgentXResponseEvent
public AgentXResponseEvent(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject) Creates anAgentXResponseEventinstance.- 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 benull).response- the AgentXResponsePDU ornullif 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 anResponseEventinstance 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 benull).response- the response PDU ornullif the request timed out.userObject- an optional user object.error- anException.
-
-
Method Details
-
getRequest
Gets the request PDU.- Returns:
- a
PDU.
-
setPeerAddress
Sets the peer address.- Parameters:
peerAddress- the address of theAgentXPeer.
-
setRequest
Sets the request PDU.- Parameters:
request- a request PDU.
-
setResponse
Sets the response PDU.- Parameters:
response- a response PDU.
-
getResponse
Gets the response PDU.- Returns:
- a PDU instance if a response has been received. If the request
timed out then
nullwill be returned.
-
setUserObject
Sets the user object associated with this request.- Parameters:
userObject- an object (preferably serializable)
-
getUserObject
Gets the user object that has been supplied to the asynchronous requestAgentX.send(AgentXPDU, AgentXTarget, TransportMapping).- Returns:
- an Object.
-
getError
Gets the exception object from the exception that has been generated when the request processing has failed due to an error.- Returns:
- an
Exceptioninstance.
-
getPeerAddress
Gets the transport address of the response sender.- Returns:
- the transport
Addressof the command responder that send this response, ornullif no response has been received within the time-out interval or if an error occured (seegetError()).
-
getTarget
Gets the target for this request/response pair.- Returns:
- the
AgentXTarget.
-