Class EventKey
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- java.util.LinkedHashMap<java.lang.String,java.lang.Object>
-
- org.opennms.netmgt.eventd.datablock.EventKey
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<EventKey>
,java.util.Map<java.lang.String,java.lang.Object>
public class EventKey extends java.util.LinkedHashMap<java.lang.String,java.lang.Object> implements java.io.Serializable, java.lang.Comparable<EventKey>
The key for an event - it extends the
LinkedHashMap
and basically is a map of name/value pairs of the 'maskelements' block in the event. While the names are maskelement names, - if the event is a 'org.opennms.netmgt.xml.eventconf.Event', the maskvalue list is taken as the value - if the event is an 'org.opennms.netmgt.xml.event.Event', the value in the event for the mask element is used as the value. This hashtable is pretty much constant once constructed - so the hashcode is evaluated once at construction and reused(if new values are added or values changed, hashcode is re-evaluated)- Author:
- Sowmya Nataraj , OpenNMS.org
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TAG_HOST
The event host xml tagstatic java.lang.String
TAG_INTERFACE
The event interface xml tagstatic java.lang.String
TAG_NODEID
The event nodeid xml tagstatic java.lang.String
TAG_SERVICE
The event service xml tagstatic java.lang.String
TAG_SNMP_COMMUNITY
The SNMP community xml tagstatic java.lang.String
TAG_SNMP_EID
The SNMP EID xml tagstatic java.lang.String
TAG_SNMP_GENERIC
The SNMP generic xml tagstatic java.lang.String
TAG_SNMP_SPECIFIC
The SNMP specific xml tagstatic java.lang.String
TAG_SNMP_TRAPOID
static java.lang.String
TAG_SNMPHOST
The event snmp host xml tagstatic java.lang.String
TAG_SOURCE
The event source xml tagstatic java.lang.String
TAG_UEI
The UEI xml tag
-
Constructor Summary
Constructors Constructor Description EventKey()
Default constructor for this classEventKey(int initCapacity)
Constructor for this classEventKey(int initCapacity, float loadFactor)
Constructor for this classEventKey(java.util.Map<java.lang.String,java.lang.Object> maskelements)
Constructor for this classEventKey(Event event)
Constructor for this classEventKey(Event event)
Constructor for this class
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Override to re-evaluate hashcodeint
compareTo(EventKey obj)
Implementation for the Comparable interfacestatic java.lang.String
getMaskElementValue(Event event, java.lang.String mename)
Get the value of the mask element for this event.int
hashCode()
Overrides the 'hashCode()' method in the superclassjava.lang.Object
put(java.lang.String key, java.lang.Object value)
Override to re-evaluate hashcodevoid
putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
Override to re-evaluate hashcodejava.lang.Object
remove(java.lang.Object key)
Override to re-evaluate hashcodejava.lang.String
toString()
Returns a String equivalent of this object-
Methods inherited from class java.util.LinkedHashMap
containsValue, entrySet, forEach, get, getOrDefault, keySet, removeEldestEntry, replaceAll, values
-
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, putIfAbsent, remove, replace, replace, size
-
-
-
-
Field Detail
-
TAG_UEI
public static final java.lang.String TAG_UEI
The UEI xml tag- See Also:
- Constant Field Values
-
TAG_SOURCE
public static final java.lang.String TAG_SOURCE
The event source xml tag- See Also:
- Constant Field Values
-
TAG_NODEID
public static final java.lang.String TAG_NODEID
The event nodeid xml tag- See Also:
- Constant Field Values
-
TAG_HOST
public static final java.lang.String TAG_HOST
The event host xml tag- See Also:
- Constant Field Values
-
TAG_INTERFACE
public static final java.lang.String TAG_INTERFACE
The event interface xml tag- See Also:
- Constant Field Values
-
TAG_SNMPHOST
public static final java.lang.String TAG_SNMPHOST
The event snmp host xml tag- See Also:
- Constant Field Values
-
TAG_SERVICE
public static final java.lang.String TAG_SERVICE
The event service xml tag- See Also:
- Constant Field Values
-
TAG_SNMP_EID
public static final java.lang.String TAG_SNMP_EID
The SNMP EID xml tag- See Also:
- Constant Field Values
-
TAG_SNMP_TRAPOID
public static final java.lang.String TAG_SNMP_TRAPOID
- See Also:
- Constant Field Values
-
TAG_SNMP_SPECIFIC
public static final java.lang.String TAG_SNMP_SPECIFIC
The SNMP specific xml tag- See Also:
- Constant Field Values
-
TAG_SNMP_GENERIC
public static final java.lang.String TAG_SNMP_GENERIC
The SNMP generic xml tag- See Also:
- Constant Field Values
-
TAG_SNMP_COMMUNITY
public static final java.lang.String TAG_SNMP_COMMUNITY
The SNMP community xml tag- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EventKey
public EventKey()
Default constructor for this class
-
EventKey
public EventKey(int initCapacity)
Constructor for this class- Parameters:
initCapacity
- a int.- See Also:
HashMap(int)
-
EventKey
public EventKey(int initCapacity, float loadFactor)
Constructor for this class- Parameters:
initCapacity
- a int.loadFactor
- a float.- See Also:
HashMap(int, float)
-
EventKey
public EventKey(java.util.Map<java.lang.String,java.lang.Object> maskelements)
Constructor for this class- Parameters:
maskelements
- the maskelements that should form this key
-
EventKey
public EventKey(Event event)
Constructor for this class- Parameters:
event
- the config event that this will be the key for
-
EventKey
public EventKey(Event event)
Constructor for this class- Parameters:
event
- the event that this will be the key for
-
-
Method Detail
-
clear
public void clear()
Override to re-evaluate hashcode- Specified by:
clear
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
clear
in classjava.util.LinkedHashMap<java.lang.String,java.lang.Object>
- See Also:
HashMap.clear()
-
put
public java.lang.Object put(java.lang.String key, java.lang.Object value)
Override to re-evaluate hashcode- Specified by:
put
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
put
in classjava.util.HashMap<java.lang.String,java.lang.Object>
- See Also:
HashMap.put(Object, Object)
-
putAll
public void putAll(java.util.Map<? extends java.lang.String,? extends java.lang.Object> m)
Override to re-evaluate hashcode- Specified by:
putAll
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
putAll
in classjava.util.HashMap<java.lang.String,java.lang.Object>
- See Also:
HashMap.putAll(Map)
-
remove
public java.lang.Object remove(java.lang.Object key)
Override to re-evaluate hashcode- Specified by:
remove
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
remove
in classjava.util.HashMap<java.lang.String,java.lang.Object>
- See Also:
HashMap.remove(Object)
-
compareTo
public int compareTo(EventKey obj)
Implementation for the Comparable interface
-
hashCode
public int hashCode()
Overrides the 'hashCode()' method in the superclass- Specified by:
hashCode
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
hashCode
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
- Returns:
- a hash code for this object
-
toString
public java.lang.String toString()
Returns a String equivalent of this object- Overrides:
toString
in classjava.util.AbstractMap<java.lang.String,java.lang.Object>
- Returns:
- a String equivalent of this object
-
getMaskElementValue
public static java.lang.String getMaskElementValue(Event event, java.lang.String mename)
Get the value of the mask element for this event. Note: The only event elements that can occur to uniquely identify an event are - uei, source, host, snmphost, nodeid, interface, service, id(SNMP EID), specific, generic, community
- Parameters:
event
- aEvent
object.mename
- aString
object.- Returns:
- value of the event element
-
-