org.snmp4j.event
Class ResponseEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.snmp4j.event.ResponseEvent
All Implemented Interfaces:
java.io.Serializable

public class ResponseEvent
extends java.util.EventObject

ResponseEvent associates a request PDU with the corresponding response and an optional user object.

Version:
1.1
Author:
Frank Fock
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ResponseEvent(java.lang.Object source, Address peerAddress, PDU request, PDU response, java.lang.Object userObject)
          Creates an ResponseEvent instance.
ResponseEvent(java.lang.Object source, Address peerAddress, PDU request, PDU response, java.lang.Object userObject, java.lang.Exception error)
          Creates an ResponseEvent instance with an exception object indicating a message processing error.
 
Method Summary
 java.lang.Exception getError()
          Gets the exception object from the exception that has been generated when the request processing has failed due to an error.
 Address getPeerAddress()
          Gets the transport address of the response sender.
 PDU getRequest()
          Gets the request PDU.
 PDU getResponse()
          Gets the response PDU.
 java.lang.Object getUserObject()
          Gets the user object that has been supplied to the asynchronous request Session.send(PDU pdu, Target target, Object userHandle, ResponseListener listener).
protected  void setPeerAddress(Address peerAddress)
           
protected  void setRequest(PDU request)
           
protected  void setResponse(PDU response)
           
protected  void setUserObject(java.lang.Object userObject)
           
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ResponseEvent

public ResponseEvent(java.lang.Object source,
                     Address peerAddress,
                     PDU request,
                     PDU response,
                     java.lang.Object userObject)
Creates an ResponseEvent instance.

Parameters:
source - the event source.
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.

ResponseEvent

public ResponseEvent(java.lang.Object source,
                     Address peerAddress,
                     PDU request,
                     PDU response,
                     java.lang.Object userObject,
                     java.lang.Exception error)
Creates an ResponseEvent instance with an exception object indicating a message processing error.

Parameters:
source - the event source.
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 Detail

getRequest

public PDU getRequest()
Gets the request PDU.

Returns:
a PDU.

setPeerAddress

protected final void setPeerAddress(Address peerAddress)

setRequest

protected final void setRequest(PDU request)

setResponse

protected final void setResponse(PDU response)

getResponse

public 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

protected final void setUserObject(java.lang.Object userObject)

getUserObject

public java.lang.Object getUserObject()
Gets the user object that has been supplied to the asynchronous request Session.send(PDU pdu, Target target, Object userHandle, ResponseListener listener).

Returns:
an Object.

getError

public java.lang.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 Address 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()).

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.