org.opennms.bb.dp.events
Class EventBase

java.lang.Object
  |
  +--org.opennms.bb.dp.events.EventBase
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Event

public class EventBase
extends Object
implements Serializable

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

Field Summary
protected  List m_autoaction
          Automatic actions to be performed.
protected  String m_descr
          A description of the event
protected  List m_forward
          The list of forwarding information
protected  List m_loggroup
          The list of log group messages.
protected  EventLogMessage m_logmsg
          A log message for the event
protected  String m_mouseovertext
          The mouse over text for the end user console.
protected  List m_notification
          The list of notification events
protected  List m_operaction
          Operator actions to be performed.
protected  String m_operinstruct
          Operator instructions
protected  String m_severity
          The severity of the event
protected  EventSnmpInfo m_snmp
          The snmp information
protected  EventTroubleTicket m_tticket
          The trouble ticket information
protected  String m_uei
          The Universal Event Identifier
 
Constructor Summary
EventBase()
          Constructs a new event object with all the default values.
EventBase(Event second)
          Constucts a new event object that is a duplicate of the current event.
 
Method Summary
 void addAutoAction(String action)
          Adds a new automatic action string to the event.
 void addForward(EventForward fwd)
          Adds a new forwarding event to the list of forwarding events.
 void addLogGroup(String loggrp)
          Adds a new log group to the current list of log groups.
 void addNotification(String notify)
          Adds a new notification ot the current event.
 void addOperatorAction(EventOperatorAction eoa)
          Adds a new operator action to the list of current operator actions.
 String getAutoAction(int which)
          Returns the automatic action located at the specific index.
 List getAutoActions()
          Returns the list of automatic actions.
 int getAutoActionsSize()
          Return the size of the automatic actions.
 String getDescription()
          Returns the currently defined desription for the event, if any.
 EventForward getForward(int which)
          Returns the forwarding information in the event at the specific index.
 List getForwards()
          Returns the list of forwarding elements.
 int getForwardsSize()
          Returns the current number of forwarding elements in the list
 String getLogGroup(int which)
          Returns the specific log group located at the defined index.
 List getLogGroups()
          Returns the current list of log groups for the event.
 int getLogGroupsSize()
          Returns the current number of log groups for the event.
 EventLogMessage getLogMessage()
          Returns the current log message for the event.
 String getMouseOverText()
          Returns the current mouse over text, if any.
 String getNotification(int which)
          Returns the notification at the specific index defined by the passed parameter.
 List getNotifications()
          Returns the list of notifications for the event.
 int getNotificationsSize()
          Returns the number of notifications currently defined in the list.
 EventOperatorAction getOperatorAction(int which)
          Returns the specific action that is defined at the passed index.
 List getOperatorActions()
          Returns the list of operator actions for the event.
 int getOperatorActionsSize()
          Returns the number of actions currently defined for the event.
 String getOperatorInstruction()
          Returns the current operator instruction for the event.
 String getSeverity()
          Returns the currently associated severity for the event.
 EventSnmpInfo getSnmpInfo()
          Returns the current snmp information if it is defined.
 EventTroubleTicket getTroubleTicket()
          Returns the trouble ticket currently associated with the event.
 String getUEI()
          Returns the universal event identifier.
 boolean hasAutoActions()
          Returns true if there is at least one automatic action defined for the event.
 boolean hasDescription()
          Returns true if the current event has a description associated with it.
 boolean hasForwards()
          Returns true if the event has forwarding information
 boolean hasLogGroups()
          Returns true if the event has log group information
 boolean hasLogMessage()
          Returns true if there is a log message that is currently associated with the event.
 boolean hasMouseOverText()
          Returns true if the event has mouse over textual information.
 boolean hasNotifications()
          Returns true if there is at least one notification for the event.
 boolean hasOperatorActions()
          Returns true if the operator has at least one operator action defined for the event.
 boolean hasOperatorInstruction()
          Returns true if there is an operator instruction currently associated with the event.
 boolean hasSeverity()
          Returns true if there is a severity associated with the current event.
 boolean hasSnmpInfo()
          Returns true if there is any snmp information defined for the host.
 boolean hasTroubleTicket()
          Returns true if there is a trouble ticket currently associated with the event.
 boolean hasUEI()
          Returns true if the event has a Universal Event Identifier.
 void serializeToXML(OutputStream ostream)
          Serializes the event to an XML stream.
(package private)  void serializeToXML(PrintStream ps)
          Writes self to event stream.
protected  void serializeToXML(PrintStream ps, boolean includeEventTag)
          Writes self to event stream.
 void setAutoActions(List actions)
          Allows the setting of the auto actions by passing in the complete list
 void setDescription(String descr)
          Sets the current description for the event.
 void setForwards(List fwds)
          Sets the list of forwards
 void setLogGroups(List lgrps)
          Sets the log groups for the event.
 void setLogMessage(EventLogMessage msg)
          Sets the log message for the current event.
 void setMouseOverText(String text)
          Sets the current mouse over text information.
 void setNotifications(List notify)
          Sets the notifications for the list
 void setOperatorActions(List ops)
          Sets the list of operator actions.
 void setOperatorInstruction(String instruction)
          Sets the operating instruction for the current event.
 void setSeverity(String severity)
          Sets the current severity for the event.
 void setSnmpInfo(EventSnmpInfo info)
          Sets the snmp information for the event to the passed value.
 void setTroubleTicket(EventTroubleTicket tticket)
          Sets the current trouble ticket for the event.
 void setUEI(String uei)
          Sets the universal event identifier for the event.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_uei

protected String m_uei
The Universal Event Identifier

m_snmp

protected EventSnmpInfo m_snmp
The snmp information

m_descr

protected String m_descr
A description of the event

m_logmsg

protected EventLogMessage m_logmsg
A log message for the event

m_severity

protected String m_severity
The severity of the event

m_operinstruct

protected String m_operinstruct
Operator instructions

m_autoaction

protected List m_autoaction
Automatic actions to be performed. A list of java.lang.String objects.

m_operaction

protected List m_operaction
Operator actions to be performed.

m_loggroup

protected List m_loggroup
The list of log group messages.

m_notification

protected List m_notification
The list of notification events

m_tticket

protected EventTroubleTicket m_tticket
The trouble ticket information

m_forward

protected List m_forward
The list of forwarding information

m_mouseovertext

protected String m_mouseovertext
The mouse over text for the end user console.
Constructor Detail

EventBase

public EventBase()
Constructs a new event object with all the default values.

EventBase

public EventBase(Event second)
Constucts a new event object that is a duplicate of the current event. This is a shallow copy and if a list in second event is modified, then that change will also appear in this copy.
Parameters:
second - The event to copy into self.
Method Detail

serializeToXML

protected void serializeToXML(PrintStream ps,
                              boolean includeEventTag)

Writes self to event stream. This implementation is based upon the format of an event object in the eventcfg.dtd, and should be compatable with the format of the event.dtd.

Should either format diverge then derived classes cannot depend on this serialization to work correctly!

Parameters:
ps - The print stream to serialize to.
includeEventTag - If true then the <event>...</event;> tag should wrap the data in the event.

hasUEI

public boolean hasUEI()
Returns true if the event has a Universal Event Identifier.

getUEI

public String getUEI()
Returns the universal event identifier. If no identifier is currently set then a null pointer is returned.

setUEI

public void setUEI(String uei)
Sets the universal event identifier for the event. If the identifer was previously set then it is lost.
Parameters:
uei - The new identifier for the event.

hasSnmpInfo

public boolean hasSnmpInfo()
Returns true if there is any snmp information defined for the host.

getSnmpInfo

public EventSnmpInfo getSnmpInfo()
Returns the current snmp information if it is defined. If there is no currently registered snmp information for the event then a null is returned.

setSnmpInfo

public void setSnmpInfo(EventSnmpInfo info)
Sets the snmp information for the event to the passed value.
Parameters:
info - The snmp information.

hasDescription

public boolean hasDescription()
Returns true if the current event has a description associated with it.

getDescription

public String getDescription()
Returns the currently defined desription for the event, if any. If no description is currently registered then a null value is returned.

setDescription

public void setDescription(String descr)
Sets the current description for the event.
Parameters:
descr - The new description for the event.

hasLogMessage

public boolean hasLogMessage()
Returns true if there is a log message that is currently associated with the event.

getLogMessage

public EventLogMessage getLogMessage()
Returns the current log message for the event. If there is no log message currently defined then a null is returned to the caller.

setLogMessage

public void setLogMessage(EventLogMessage msg)
Sets the log message for the current event.
Parameters:
msg - The current log message for the event.

hasSeverity

public boolean hasSeverity()
Returns true if there is a severity associated with the current event.

getSeverity

public String getSeverity()
Returns the currently associated severity for the event. If there is no defined severity then a null will be returned to the caller.

setSeverity

public void setSeverity(String severity)
Sets the current severity for the event.
Parameters:
severity - The new severity for the event.

hasOperatorInstruction

public boolean hasOperatorInstruction()
Returns true if there is an operator instruction currently associated with the event.

getOperatorInstruction

public String getOperatorInstruction()
Returns the current operator instruction for the event. If this has not been defined then a null will be returned to the caller.

setOperatorInstruction

public void setOperatorInstruction(String instruction)
Sets the operating instruction for the current event.
Parameters:
instruction - The new instruction for the event.

hasAutoActions

public boolean hasAutoActions()
Returns true if there is at least one automatic action defined for the event.

getAutoActions

public List getAutoActions()
Returns the list of automatic actions. If there are no actions defined for the current event, then a null or empty list will be returned to the caller.

setAutoActions

public void setAutoActions(List actions)
Allows the setting of the auto actions by passing in the complete list

getAutoActionsSize

public int getAutoActionsSize()
Return the size of the automatic actions.

getAutoAction

public String getAutoAction(int which)
Returns the automatic action located at the specific index.
Parameters:
which - The request action.
Throws:
IndexOutOfBoundsException - Thrown if the requested index is out of range.

addAutoAction

public void addAutoAction(String action)
Adds a new automatic action string to the event.
Parameters:
action - The new automatic action to add.

hasOperatorActions

public boolean hasOperatorActions()
Returns true if the operator has at least one operator action defined for the event.

getOperatorActions

public List getOperatorActions()
Returns the list of operator actions for the event. If there are no operator actions defined for the event then either a null or empty list will be returned to the caller.

setOperatorActions

public void setOperatorActions(List ops)
Sets the list of operator actions.

getOperatorActionsSize

public int getOperatorActionsSize()
Returns the number of actions currently defined for the event.

getOperatorAction

public EventOperatorAction getOperatorAction(int which)
Returns the specific action that is defined at the passed index. If there is no action at the index then an exception will be thrown.
Parameters:
which - The index of the operator action
Returns:
The operator action at the specific location.
Throws:
IndexOutOfBoundsException - Thrown if an illegal index is requested.

addOperatorAction

public void addOperatorAction(EventOperatorAction eoa)
Adds a new operator action to the list of current operator actions. If this is the first event to be added then a new list will be allocated for the event.
Parameters:
eoa - The new event operator action

hasLogGroups

public boolean hasLogGroups()
Returns true if the event has log group information

getLogGroups

public List getLogGroups()
Returns the current list of log groups for the event.

setLogGroups

public void setLogGroups(List lgrps)
Sets the log groups for the event.

getLogGroupsSize

public int getLogGroupsSize()
Returns the current number of log groups for the event.

getLogGroup

public String getLogGroup(int which)
Returns the specific log group located at the defined index. If there is currently no element defined at that index then an IndexOutOfBoundsException will be generated.
Parameters:
which - The index of the desired element
Returns:
The log group information at the index.

addLogGroup

public void addLogGroup(String loggrp)
Adds a new log group to the current list of log groups. If this is the first log group to be added then a new list will be allocated to contain all the log groups.
Parameters:
loggrp - The log group to add to the list.

hasNotifications

public boolean hasNotifications()
Returns true if there is at least one notification for the event.

getNotifications

public List getNotifications()
Returns the list of notifications for the event. If there are no notifications currently defined for the event then a null will be returned to the caller. Also, the list may be empty, so the size of the list should be checked by the caller.

setNotifications

public void setNotifications(List notify)
Sets the notifications for the list

getNotificationsSize

public int getNotificationsSize()
Returns the number of notifications currently defined in the list.

getNotification

public String getNotification(int which)
Returns the notification at the specific index defined by the passed parameter.
Parameters:
which - The index of the desireed notification
Returns:
The notification string
Throws:
IndexOutOfBoundsException - Thrown if the index is out of bounds or the list is empty.

addNotification

public void addNotification(String notify)
Adds a new notification ot the current event. The notification is added at the end of the list of current notifications.
Parameters:
notify - The new notification string.

hasTroubleTicket

public boolean hasTroubleTicket()
Returns true if there is a trouble ticket currently associated with the event.

getTroubleTicket

public EventTroubleTicket getTroubleTicket()
Returns the trouble ticket currently associated with the event.

setTroubleTicket

public void setTroubleTicket(EventTroubleTicket tticket)
Sets the current trouble ticket for the event.
Parameters:
tticket - The trouble ticket information for the event.

hasForwards

public boolean hasForwards()
Returns true if the event has forwarding information

getForwards

public List getForwards()
Returns the list of forwarding elements.

setForwards

public void setForwards(List fwds)
Sets the list of forwards

getForwardsSize

public int getForwardsSize()
Returns the current number of forwarding elements in the list

getForward

public EventForward getForward(int which)
Returns the forwarding information in the event at the specific index. If there is no element at the index then an exception will be generated.
Parameters:
which - The event desired from the list of events.
Returns:
The event forwarding information.
Throws:
IndexOutOfBoundsException - Thrown if there is no element in the list at the specific index.

addForward

public void addForward(EventForward fwd)
Adds a new forwarding event to the list of forwarding events.

hasMouseOverText

public boolean hasMouseOverText()
Returns true if the event has mouse over textual information.

getMouseOverText

public String getMouseOverText()
Returns the current mouse over text, if any. If there is currently no text information defined then a null will be returned.

setMouseOverText

public void setMouseOverText(String text)
Sets the current mouse over text information.
Parameters:
text - The mouse over text information.

serializeToXML

public void serializeToXML(OutputStream ostream)
Serializes the event to an XML stream.
Parameters:
ostream - The output stream that will receive the xml data.

serializeToXML

void serializeToXML(PrintStream ps)

Writes self to event stream. This implementation is based upon the format of an event object in the eventcfg.dtd.

Parameters:
ps - The print stream to serialize to.