Module org.snmp4j

Class RetrievalEvent

  • All Implemented Interfaces:
    Serializable
    Direct Known Subclasses:
    TableEvent, TreeEvent

    public abstract class RetrievalEvent
    extends EventObject
    The RetrievalEvent is an abstract class representing the result of one or more GET/GETNEXT/GETBULK requests.
    Since:
    1.8
    Version:
    1.8
    Author:
    Frank Fock
    See Also:
    Serialized Form
    • Field Detail

      • STATUS_OK

        public static final int STATUS_OK
        Retrieval operation was successful.
        See Also:
        Constant Field Values
      • STATUS_TIMEOUT

        public static final int STATUS_TIMEOUT
        A request to the agent timed out.
        See Also:
        Constant Field Values
      • STATUS_WRONG_ORDER

        public static final int STATUS_WRONG_ORDER
        The agent failed to return the objects in lexicographic order.
        See Also:
        Constant Field Values
      • status

        protected int status
      • userObject

        protected Object userObject
      • reportPDU

        protected PDU reportPDU
    • Constructor Detail

      • RetrievalEvent

        public RetrievalEvent​(org.snmp4j.util.TreeUtils.TreeRequest source,
                              Object userObject,
                              int status)
        Creates a retrieval event with a status.
        Parameters:
        source - the source of the event.
        userObject - the user object or null.
        status - one of the status constants defined for this object.
      • RetrievalEvent

        public RetrievalEvent​(org.snmp4j.util.TreeUtils.TreeRequest source,
                              Object userObject,
                              Exception exception)
        Creates a retrieval event with an exception.
        Parameters:
        source - the source of the event.
        userObject - the user object or null.
        exception - an exception instance.
      • RetrievalEvent

        public RetrievalEvent​(org.snmp4j.util.TreeUtils.TreeRequest source,
                              Object userObject,
                              PDU report)
        Creates a retrieval event with a report PDU.
        Parameters:
        source - the source of the event.
        userObject - the user object or null.
        report - a PDU of type PDU.REPORT.
      • RetrievalEvent

        public RetrievalEvent​(ResponseListener source,
                              Object userObject,
                              VariableBinding[] variableBindings)
        Creates a retrieval event with row data.
        Parameters:
        source - the source of the event.
        userObject - the user object or null.
        variableBindings - an array of VariableBinding instances.
    • Method Detail

      • getStatus

        public int getStatus()
        Gets the status of the table operation.
        Returns:
        one of the status constants defined for this object. STATUS_OK indicates success, all other values indicate failure of the operation which corresponds to a SNMP error status as defined by PDU.getErrorStatus().
      • isError

        public boolean isError()
        Indicates whether the event reports an error or not.
        Returns:
        true if the operation failed with an error.
      • getUserObject

        public Object getUserObject()
        Gets the user object that has been specified by the user when the retrieval operation that fired this event has been requested.
        Returns:
        an object instance if an user object has been specified or null otherwise.
      • getException

        public Exception getException()
        Gets the exception associated with this event.
        Returns:
        an Exception instance if there has been an exception instance associated with this event (getStatus() returns STATUS_EXCEPTION), or null otherwise.
      • getReportPDU

        public PDU getReportPDU()
        Gets the report PDU associated with this event.
        Returns:
        a ScopedPDU instance if there has been a report PDU instance associated with this event (getStatus() returns STATUS_REPORT), or null otherwise.
      • getErrorMessage

        public String getErrorMessage()
        Returns a textual error message for the error.
        Returns:
        an error message or an empty string if no error occurred.