OpenNMS API 1.2.3

org.opennms.netmgt.eventd.datablock
Class EventConfData

java.lang.Object
  extended byorg.opennms.netmgt.eventd.datablock.EventConfData

public class EventConfData
extends java.lang.Object

 The information read from the eventconf.xml is stored here. It maintains
  a map,  keyed with 'EventKey's. 
 
  It also has an UEI to 'EventKey'list map - this mapping fastens the lookup 
  for OpenNMS internal events when different masks are configured for the
  same UEI.
 
  When a lookup is to be done for an 'Event',  
  - its 'key' is used to get a lookup,
  - if no match is found for the key, UEI is used to lookup the keys that got added for that UEI
    and the first best fit in the event map for any of the UEI keys are used
  - if there is still no match at this point, all keys in the eventconf are iterated through to
    find a match
  
 

Author:
Sowmya Nataraj , OpenNMS.org

Field Summary
private  java.util.LinkedHashMap m_eventMap
          The map keyed with 'EventKey's
private  java.util.LinkedHashMap m_ueiToKeyListMap
          The map of UEI to 'EventKey's list - used mainly to find matches for the OpenNMS internal events faster(in cases where there are multiple masks for the same UEI)
 
Constructor Summary
EventConfData()
          Default constructor - allocate the maps
 
Method Summary
 void clear()
          Clear out the data
private  void dumpEventMap()
          Purely used for debugging
private  boolean eventMatchesKey(EventKey eventKey, Event event)
          Check whether the event matches the passed key
private  boolean eventValuePassesMaskValue(java.lang.String eventvalue, java.util.List maskValues)
          Check whether the eventvalue passes any of the mask values Mask values ending with a '%' only need to be a substring of the eventvalue for the eventvalue to pass the mask
 Event getEvent(Event event)
           Get the right configuration for the event - the eventkey is used first.
 Event getEventBySnmp(java.lang.String eid)
          Get the event with the specified snmp key
 Event getEventByUEI(java.lang.String uei)
          Get the event with the specified uei
private  Event getMatchInKeyList(java.util.List keylist, Event event)
          See if there is a match for the event from the list of event keys
 void put(Event event)
          Add an event - add to the 'EventKey' map using the event mask by default.
 void put(EventKey key, Event event)
          Add an event with the specified key
private  void updateUeiToKeyListMap(EventKey eventKey, Event event)
          Update the uei to keylist map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_eventMap

private java.util.LinkedHashMap m_eventMap
The map keyed with 'EventKey's


m_ueiToKeyListMap

private java.util.LinkedHashMap m_ueiToKeyListMap
The map of UEI to 'EventKey's list - used mainly to find matches for the OpenNMS internal events faster(in cases where there are multiple masks for the same UEI)

Constructor Detail

EventConfData

public EventConfData()
Default constructor - allocate the maps

Method Detail

dumpEventMap

private void dumpEventMap()
Purely used for debugging


getMatchInKeyList

private Event getMatchInKeyList(java.util.List keylist,
                                Event event)
See if there is a match for the event from the list of event keys

Returns:
the eventconf entry if a match is found

eventMatchesKey

private boolean eventMatchesKey(EventKey eventKey,
                                Event event)
Check whether the event matches the passed key

Returns:
true if the event matches the passed key

eventValuePassesMaskValue

private boolean eventValuePassesMaskValue(java.lang.String eventvalue,
                                          java.util.List maskValues)
Check whether the eventvalue passes any of the mask values Mask values ending with a '%' only need to be a substring of the eventvalue for the eventvalue to pass the mask

Returns:
true if the values passes the mask

updateUeiToKeyListMap

private void updateUeiToKeyListMap(EventKey eventKey,
                                   Event event)
Update the uei to keylist map


put

public void put(Event event)
Add an event - add to the 'EventKey' map using the event mask by default. If the event has snmp information, add using the snmp EID

Parameters:
event - the org.opennms.netmgt.xml.eventconf.Event

put

public void put(EventKey key,
                Event event)
Add an event with the specified key

Parameters:
key - the EventKey for this event
event - the org.opennms.netmgt.xml.eventconf.Event

getEvent

public Event getEvent(Event event)
 Get the right configuration for the event - the eventkey is used first.
  If no match is found, the event's uei to keylist is iterated through, and these keys
  used to lookup the event map. if still no match is found, all eventconf
  keys are iterated through to find a match. The first successful match is returned.
 
  
 
 NOTE:
 
 The first right config event that the event matches is returned.
  The ordering of the configurations is the responsibility of the user
 

Parameters:
event - the event which is to be looked up

getEventBySnmp

public Event getEventBySnmp(java.lang.String eid)
Get the event with the specified snmp key

Parameters:
eid - the snmp eid

getEventByUEI

public Event getEventByUEI(java.lang.String uei)
Get the event with the specified uei

Parameters:
uei - the uei

clear

public void clear()
Clear out the data


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.