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
ConstructorDescriptionAgentXResponseEvent
(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject) Creates anAgentXResponseEvent
instance.AgentXResponseEvent
(Object source, AgentXTarget<A> target, A peerAddress, AgentXPDU request, AgentXResponsePDU response, Object userObject, Exception error) Creates anResponseEvent
instance 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 void
setPeerAddress
(A peerAddress) Sets the peer address.protected final void
setRequest
(AgentXPDU request) Sets the request PDU.protected final void
setResponse
(AgentXResponsePDU response) Sets the response PDU.protected final void
setUserObject
(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 anAgentXResponseEvent
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 benull
).response
- the AgentXResponsePDU ornull
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 anResponseEvent
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 benull
).response
- the response PDU ornull
if 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
null
will 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
Exception
instance.
-
getPeerAddress
Gets the transport address of the response sender.- Returns:
- the transport
Address
of the command responder that send this response, ornull
if 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
.
-