OpenNMS API 1.2.9

## org.opennms.netmgt.eventd.adaptors.udp
Class UdpReceivedEvent

    java.lang.Object
      org.opennms.netmgt.eventd.adaptors.udp.UdpReceivedEvent

final class UdpReceivedEvent
extends java.lang.Object

Author:
  Brian Weaver , Oculan Corporation

Field Summary
`private java.util.List` `m_ackEvents` The list of event that have been acknowledged.
`private java.lang.String` `m_eventXML` The received XML event, decoded using the US-ASCII encoding.
`private Log` `m_log` The decoded event document.
`private int` `m_port` The port of the agent on the remote system.
`private java.net.InetAddress` `m_sender` The internet addrress of the sending agent.

Constructor Summary
`private` `UdpReceivedEvent()` Private constructor to prevent the used of new except by the `make` method.

Method Summary
`(package private) void` `ackEvent(Event e)` Adds the event to the list of events acknowledged in this event XML document.
`boolean` `equals(java.lang.Object o)` Returns true if the instance matches the object based upon the remote agent's address & port.
`java.util.List` `getAckedEvents()` Get the acknowledged events
`(package private) int` `getPort()` Returns the sender's port
`(package private) java.net.InetAddress` `getSender()` Returns the sender's address.
`(package private) java.lang.String` `getXmlData()` Returns the raw XML data as a string.
`int` `hashCode()` Returns the hash code of the instance.
`(package private) static UdpReceivedEvent` `make(java.net.DatagramPacket packet)` Constructs a new event encapsulation instance based upon the information passed to the method.
`(package private) static UdpReceivedEvent` `make(java.net.InetAddress addr, int port, byte[] data, int len)` Constructs a new event encapsulation instance based upon the information passed to the method.
`(package private) Log` `unmarshal()` Decodes the XML package from the remote agent.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_eventXML

    private java.lang.String m_eventXML

  The received XML event, decoded using the US-ASCII encoding.

### m_log

    private Log m_log

  The decoded event document. The classes are defined in an XSD and generated by castor.

### m_sender

    private java.net.InetAddress m_sender

  The internet addrress of the sending agent.

### m_port

    private int m_port

  The port of the agent on the remote system.

### m_ackEvents

    private java.util.List m_ackEvents

  The list of event that have been acknowledged.

Constructor Detail

### UdpReceivedEvent

    private UdpReceivedEvent()

  Private constructor to prevent the used of new except by the `make` method.

Method Detail

### make

    static UdpReceivedEvent make(java.net.DatagramPacket packet)
                          throws java.io.UnsupportedEncodingException

  Constructs a new event encapsulation instance based upon the information passed to the method. The passed datagram data is decoded into a string using the `US-ASCII` character encoding.

  Parameters:
    `packet` - The datagram received from the remote agent.
  Throws:
    `java.io.UnsupportedEncodingException` - Thrown if the data buffer cannot be decoded using the US-ASCII encoding.

### make

    static UdpReceivedEvent make(java.net.InetAddress addr,
                                 int port,
                                 byte[] data,
                                 int len)
                          throws java.io.UnsupportedEncodingException

  Constructs a new event encapsulation instance based upon the information passed to the method. The passed byte array is decoded into a string using the `US-ASCII` character encoding.

  Parameters:
    `addr` - The remote agent's address.
    `port` - The remote agent's port
    `data` - The XML data in US-ASCII encoding.
    `len` - The length of the XML data in the buffer.
  Throws:
    `java.io.UnsupportedEncodingException` - Thrown if the data buffer cannot be decoded using the US-ASCII encoding.

### unmarshal

    Log unmarshal()
            throws org.exolab.castor.xml.ValidationException,
                   org.exolab.castor.xml.MarshalException

  Decodes the XML package from the remote agent. If an error occurs or the datagram had malformed XML then an exception is generated.

  Returns:
    The toplevel `Log` element of the XML document.
  Throws:
    `org.exolab.castor.xml.ValidationException` - Throws if the documents data does not match the defined XML Schema Definition.
    `org.exolab.castor.xml.MarshalException` - Thrown if the XML is malformed and cannot be converted.

### ackEvent

    void ackEvent(Event e)

  Adds the event to the list of events acknowledged in this event XML document.

  Parameters:
    `e` - The event to acknowledge.

### getXmlData

    java.lang.String getXmlData()

  Returns the raw XML data as a string.

### getSender

    java.net.InetAddress getSender()

  Returns the sender's address.

### getPort

    int getPort()

  Returns the sender's port

### getAckedEvents

    public java.util.List getAckedEvents()

  Get the acknowledged events

### equals

    public boolean equals(java.lang.Object o)

  Returns true if the instance matches the object based upon the remote agent's address & port. If the passed instance is from the same agent then it is considered equal.

  Parameters:
    `o` - instance of the class to compare.
  Returns:
    Returns true if the objects are logically equal, false otherwise.

### hashCode

    public int hashCode()

  Returns the hash code of the instance. The hash code is computed by taking the bitwise XOR of the port and the agent's internet address hash code.

  Returns:
    The 32-bit has code for the instance.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.