org.opennms.bb.dp.events
Class EventSnmpInfo

java.lang.Object
  |
  +--org.opennms.bb.dp.events.EventSnmpInfo
All Implemented Interfaces:
Serializable

public class EventSnmpInfo
extends Object
implements Serializable

This class is designed to encapsulate the SNMP related parts of the Event DTD into a single class. The class encapsulates all the values contained in the snmp element of the Event DTD.

Version:
CVS $Revision: 1.4 $
Author:
Brian Weaver, OpenNMS
See Also:
Serialized Form

Field Summary
static int AUTHENTICATION_FAILURE
          Signals that the agent received a protocol message that failed authentication.
static int COLD_START
          The SNMP agent is reinitialize itself and the agent's configuration may be altered.
static int EGP_NEIGHBOR_LOSS
          Signals that an EGP neighbor with whom the sender was an EGP peer is down and the relationship no longer exist.
static int ENTERPRISE_SPECIFIC
          Signals that an enterprise specific event has occured and that the specific number, along with the enterprise id denotes the trap.
static int LINK_DOWN
          Signals a failure in one of the communication links for the agent.
static int LINK_UP
          Signals that a failed communication link has come back online.
private  String m_eid
          The enterprise identifier.
private  String m_eidText
          Enterprise text information, if any.
private  int m_generic
          The generic trap number.
private  int m_specific
          The specific trap number that is specified if the generic is set to ENTERPRISE_SPECIFIC.
static int WARM_START
          The agent is restarting self and the configuration has not been altered.
 
Constructor Summary
EventSnmpInfo()
          Constructs a new instance used to represent snmp information contained in the event stream.
EventSnmpInfo(EventSnmpInfo second)
          Constructs a new instance that is identical to the initial instance that is passed to the constructor.
EventSnmpInfo(int generic)
          Constructs a new instance with the generic value.
EventSnmpInfo(int specific, String eid)
          Constructs a new instance with the generic value equal to ENTERPRISE_SPECIFIC, plus the passed information.
EventSnmpInfo(int specific, String eid, String text)
          Constructs a new instance with the generic value equal to ENTERPRISE_SPECIFIC, plus the passed information.
 
Method Summary
 String getEnterpriseID()
          Returns the enterprise identifier for the current instance of the object.
 String getEnterpriseText()
          Returns the textual inforamation associated with the enterprise identifier.
 int getGeneric()
          Gets the generic trap type for the instance.
 int getSpecific()
          Returns the specific trap number for this instance.
(package private)  void serializeToXML(PrintStream ps)
          Writes self to event stream
 void setEnterpriseID(String eid)
          Sets the enterprise identifier for the instance.
 void setEnterpriseText(String text)
          Sets the textual information associated with the enterprise identifier.
 void setGeneric(int generic)
          Sets the generic trap type for the instance.
 void setSpecific(int specific)
          Sets the specific number for this trap information.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

COLD_START

public static final int COLD_START
The SNMP agent is reinitialize itself and the agent's configuration may be altered. Additionally, this is normally due to an unexpected restart due to a crash or major fault.

WARM_START

public static final int WARM_START
The agent is restarting self and the configuration has not been altered. This is normally due to a routine restarting of the agent.

LINK_DOWN

public static final int LINK_DOWN
Signals a failure in one of the communication links for the agent. The first element of the variable bindings is the name and value of the ifIndex of the referenced interface.

LINK_UP

public static final int LINK_UP
Signals that a failed communication link has come back online. The first element of the variable bindings is the name and value of the ifIndex for the communication link.

AUTHENTICATION_FAILURE

public static final int AUTHENTICATION_FAILURE
Signals that the agent received a protocol message that failed authentication.

EGP_NEIGHBOR_LOSS

public static final int EGP_NEIGHBOR_LOSS
Signals that an EGP neighbor with whom the sender was an EGP peer is down and the relationship no longer exist.

ENTERPRISE_SPECIFIC

public static final int ENTERPRISE_SPECIFIC
Signals that an enterprise specific event has occured and that the specific number, along with the enterprise id denotes the trap.

m_eid

private String m_eid
The enterprise identifier. This is represented an object identifier and should only be present when the generic is equal to ENTERPRISE_SPECIFIC

m_eidText

private String m_eidText
Enterprise text information, if any.

m_generic

private int m_generic

The generic trap number. This must be in the range of [0..6]. This corresponds to the values:

  • COLD_START
  • WARM_START
  • LINK_DOWN
  • LINK_UP
  • AUTHENTICATION_FAILURE
  • EGP_NEIGHBOR_LOSS
  • ENTERPRISE_SPECIFIC
See Also:
COLD_START, WARM_START, LINK_DOWN, LINK_UP, AUTHENTICATION_FAILURE, EGP_NEIGHBOR_LOSS, ENTERPRISE_SPECIFIC

m_specific

private int m_specific
The specific trap number that is specified if the generic is set to ENTERPRISE_SPECIFIC.
See Also:
ENTERPRISE_SPECIFIC
Constructor Detail

EventSnmpInfo

public EventSnmpInfo()

Constructs a new instance used to represent snmp information contained in the event stream. This is normally information gleaned from a SNMP trap. The default instance is created with a generic value of COLD_START, speicific of zero, and an enterprise id of null.


EventSnmpInfo

public EventSnmpInfo(EventSnmpInfo second)

Constructs a new instance that is identical to the initial instance that is passed to the constructor.

Parameters:
second - The instance to copy to self.

EventSnmpInfo

public EventSnmpInfo(int generic)

Constructs a new instance with the generic value. If the inforamtion pertains to an enterprise specific trap then an alternate constructor should be used.

Parameters:
generic - The generic value for the trap.
See Also:
EventSnmpInfo(int,java.lang.String)

EventSnmpInfo

public EventSnmpInfo(int specific,
                     String eid)

Constructs a new instance with the generic value equal to ENTERPRISE_SPECIFIC, plus the passed information. The specific and enterprise identifier are set appropriately.

Parameters:
specific - The specific enterprise id
eid - The enterprise object identifier.

EventSnmpInfo

public EventSnmpInfo(int specific,
                     String eid,
                     String text)

Constructs a new instance with the generic value equal to ENTERPRISE_SPECIFIC, plus the passed information. The specific and enterprise identifier are set appropriately.

Parameters:
specific - The specific enterprise id
eid - The enterprise object identifier.
text - The text associated with the enterprise identifer.
Method Detail

serializeToXML

void serializeToXML(PrintStream ps)
Writes self to event stream

getGeneric

public int getGeneric()
Gets the generic trap type for the instance.
Returns:
The generic trap number.
See Also:
COLD_START, WARM_START, LINK_DOWN, LINK_UP, AUTHENTICATION_FAILURE, EGP_NEIGHBOR_LOSS, ENTERPRISE_SPECIFIC

setGeneric

public void setGeneric(int generic)
Sets the generic trap type for the instance.
Parameters:
generic - The generic identifier for the instance.
See Also:
COLD_START, WARM_START, LINK_DOWN, LINK_UP, AUTHENTICATION_FAILURE, EGP_NEIGHBOR_LOSS, ENTERPRISE_SPECIFIC

getSpecific

public int getSpecific()
Returns the specific trap number for this instance.
Returns:
The specific trap number.

setSpecific

public void setSpecific(int specific)
Sets the specific number for this trap information. This is not normally set unless it is an enterprise specific trap number.
Parameters:
specific - The specific number for the trap.

getEnterpriseID

public String getEnterpriseID()
Returns the enterprise identifier for the current instance of the object.
Returns:
The enterprise identifier, null if it was not set.

setEnterpriseID

public void setEnterpriseID(String eid)
Sets the enterprise identifier for the instance. No check is performed to ensure that the actual informaiton is correct.
Parameters:
eid - The enterprise identifier

getEnterpriseText

public String getEnterpriseText()
Returns the textual inforamation associated with the enterprise identifier.
Returns:
The textual information, null if not set.

setEnterpriseText

public void setEnterpriseText(String text)
Sets the textual information associated with the enterprise identifier.
Parameters:
text - The textual information.