public abstract class EventUtils extends Object
Abstract EventUtils class.
Constructor and Description |
---|
EventUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
checkInterface(Event e)
Ensures the given event has an interface
|
static void |
checkInterface(IEvent e) |
static void |
checkNodeId(Event e)
Ensures that the given Event has a node id
|
static void |
checkNodeId(IEvent e) |
static void |
checkService(Event e)
Ensures that the given event has a service parameter
|
static void |
checkService(IEvent e) |
static Event |
createApplicationDeletedEvent(String source,
int applicationId,
String applicationName)
Constructs a applicationDeleted Event for a given application id and name
|
static Event |
createAssetInfoChangedEvent(String source,
long nodeId,
long txNo)
Construct a deleteNode event for the given nodeId.
|
static Event |
createDeleteInterfaceEvent(String source,
long nodeId,
String ipAddr,
int ifIndex,
long txNo)
Constructs a deleteInterface event for the given nodeId, ipAddress (or ifIndex) pair.
|
static Event |
createDeleteNodeEvent(String source,
long nodeId,
long txNo) |
static Event |
createDeleteServiceEvent(String source,
long nodeId,
String ipAddr,
String service,
long txNo)
Constructs a deleteService event for the given nodeId, ipAddress,
serviceName triple.
|
static Event |
createInterfaceDeletedEvent(String source,
int nodeId,
InetAddress addr)
Construct an interfaceDeleted event for an interface.
|
static Event |
createNodeAddedEvent(String source,
int nodeId,
String nodeLabel,
OnmsNode.NodeLabelSource labelSource)
createNodeAddedEvent
|
static Event |
createNodeCategoryMembershipChangedEvent(String source,
Integer nodeId,
String nodeLabel,
String[] categoriesAdded,
String[] categoriesDeleted) |
static Event |
createNodeDeletedEvent(String source,
int nodeId,
String hostName,
String nodeLabel,
OnmsMonitoringLocation nodeLocation,
String nodeForeignId,
String nodeForeignSource,
OnmsIpInterface nodePrimaryInterface)
This method is responsible for generating a nodeDeleted event and sending
it to eventd..
|
static Event |
createNodeGainedInterfaceEvent(String source,
int nodeId,
InetAddress ifaddr)
createNodeGainedInterfaceEvent
|
static Event |
createNodeGainedServiceEvent(String source,
int nodeId,
InetAddress ifaddr,
String service,
String nodeLabel,
OnmsNode.NodeLabelSource labelSource,
String sysName,
String sysDescr)
createNodeGainedServiceEvent
|
static Event |
createNodeLocationChangedEvent(String source,
Integer nodeId,
String nodeLabel,
String prevLocation,
String currentLocation)
createNodeLocationChangedEvent
|
static Event |
createNodeUpdatedEvent(String source,
Integer nodeId,
String nodeLabel,
OnmsNode.NodeLabelSource labelSource,
String rescanExisting)
createNodeUpdatedEvent
|
static Event |
createServiceDeletedEvent(String source,
int nodeId,
InetAddress addr,
String service)
Constructs a serviceDeleted Event for the nodeId, ipAddr, serviceName
triple
|
static boolean |
eventsMatch(Event e1,
Event e2)
eventsMatch
|
static boolean |
eventsMatch(IEvent e1,
IEvent e2)
eventsMatch
|
static int |
getIntParm(Event e,
String parmName,
int defaultValue)
Retrieve the value associated with an event parameter and parse it to an
int.
|
static int |
getIntParm(IEvent e,
String parmName,
int defaultValue) |
static long |
getLongParm(Event e,
String parmName,
long defaultValue)
Retrieve the value associated with an event parameter and parse it to a
long.
|
static String |
getParm(Event e,
String parmName)
Return the value of an event parameter of null if it does not exist.
|
static String |
getParm(Event e,
String parmName,
String defaultValue)
Retrieve a parameter from and event, returning defaultValue of the
parameter is not set.
|
static String |
getParm(IEvent e,
String parmName) |
static String |
getParm(IEvent e,
String parmName,
String defaultValue) |
static boolean |
isNonIpInterface(String intf)
Is the given interface a non-IP interface
|
static void |
requireParm(Event e,
String parmName)
Throw an exception if an event does have the required parameter
|
static void |
requireParm(IEvent e,
String parmName) |
static String |
toString(Collection<Parm> parms) |
static String |
toString(Event event)
toString
|
static String |
toString(Snmp snmp)
toString
|
static String |
toString(Value value)
toString
|
public static Event createNodeAddedEvent(String source, int nodeId, String nodeLabel, OnmsNode.NodeLabelSource labelSource)
createNodeAddedEvent
public static Event createNodeGainedInterfaceEvent(String source, int nodeId, InetAddress ifaddr)
createNodeGainedInterfaceEvent
source
- a String
object.nodeId
- a int.ifaddr
- a InetAddress
object.Event
object.public static Event createNodeGainedServiceEvent(String source, int nodeId, InetAddress ifaddr, String service, String nodeLabel, OnmsNode.NodeLabelSource labelSource, String sysName, String sysDescr)
createNodeGainedServiceEvent
public static Event createNodeDeletedEvent(String source, int nodeId, String hostName, String nodeLabel, OnmsMonitoringLocation nodeLocation, String nodeForeignId, String nodeForeignSource, OnmsIpInterface nodePrimaryInterface)
source
- A string representing the source of the eventnodeId
- Nodeid of the node got deleted.hostName
- the Host server name.nodeLabel
- the node label of the deleted node.Event
object.public static Event createInterfaceDeletedEvent(String source, int nodeId, InetAddress addr)
source
- the source of the eventnodeId
- the nodeId of the node the interface resides inipAddr
- the ipAdddr of the eventpublic static Event createServiceDeletedEvent(String source, int nodeId, InetAddress addr, String service)
source
- the source of the eventnodeId
- the nodeId that the service resides onipAddr
- the interface that the service resides onservice
- the name of the service that was deletedpublic static Event createApplicationDeletedEvent(String source, int applicationId, String applicationName)
source
- the source of the eventapplicationId
- the id of the deleted applicationapplicationName
- the name of the deleted applicationpublic static long getLongParm(Event e, String parmName, long defaultValue)
e
- the Event to retrieve the parameter fromparmName
- the name of the parameter to retrievedefaultValue
- the value to return if the paramter can not be retrieved or
parsedpublic static int getIntParm(Event e, String parmName, int defaultValue)
e
- the Event to retrieve the parameter fromparmName
- the name of the parameter to retrievedefaultValue
- the value to return if the paramter can not be retrieved or
parsedpublic static String getParm(Event e, String parmName, String defaultValue)
e
- The Event to retrieve the parameter fromparmName
- the name of the parameter to retrievedefaultValue
- the default value to return if the parameter is not setpublic static String getParm(Event e, String parmName)
e
- the Event to get the parameter forparmName
- the name of the parameter to retrievepublic static Event createNodeUpdatedEvent(String source, Integer nodeId, String nodeLabel, OnmsNode.NodeLabelSource labelSource, String rescanExisting)
createNodeUpdatedEvent
public static Event createNodeLocationChangedEvent(String source, Integer nodeId, String nodeLabel, String prevLocation, String currentLocation)
createNodeLocationChangedEvent
public static Event createNodeCategoryMembershipChangedEvent(String source, Integer nodeId, String nodeLabel, String[] categoriesAdded, String[] categoriesDeleted)
public static String toString(Collection<Parm> parms)
public static void checkInterface(Event e) throws InsufficientInformationException
e
- the eventorg.opennms.netmgt.capsd.InsufficientInformationException
- if an interface is not availableInsufficientInformationException
public static boolean isNonIpInterface(String intf)
intf
- the interfacepublic static void checkNodeId(Event e) throws InsufficientInformationException
e
- the eventorg.opennms.netmgt.capsd.InsufficientInformationException
- if a node id is not availableInsufficientInformationException
public static void checkService(Event e) throws InsufficientInformationException
e
- the event to checkorg.opennms.netmgt.capsd.InsufficientInformationException
- if the event does not have a serviceInsufficientInformationException
public static Event createDeleteInterfaceEvent(String source, long nodeId, String ipAddr, int ifIndex, long txNo)
source
- the source for the eventnodeId
- the nodeId of the node that owns the interfaceipAddr
- the ipAddress of the interface being deletedifIndex
- the ifIndex of the interface being deletedtxNo
- the transaction number to use for processing this eventpublic static Event createDeleteNodeEvent(String source, long nodeId, long txNo)
public static Event createAssetInfoChangedEvent(String source, long nodeId, long txNo)
source
- the source for the eventnodeId
- the node to be deleted.txNo
- the transaction number associated with deleting the nodepublic static Event createDeleteServiceEvent(String source, long nodeId, String ipAddr, String service, long txNo)
source
- the source for the eventnodeId
- the nodeId of the node that service resides onipAddr
- the ipAddress of the interface the service resides onservice
- the service that is being deletedtxNo
- the transaction number to use for processing this eventpublic static void requireParm(Event e, String parmName) throws InsufficientInformationException
e
- the event the parameter must reside onparmName
- a String
object.org.opennms.netmgt.capsd.InsufficientInformationException
- if the paramter is not set on the event or if its value has
no contentInsufficientInformationException
public static void requireParm(IEvent e, String parmName) throws InsufficientInformationException
InsufficientInformationException
public static void checkInterface(IEvent e) throws InsufficientInformationException
InsufficientInformationException
public static void checkNodeId(IEvent e) throws InsufficientInformationException
InsufficientInformationException
public static void checkService(IEvent e) throws InsufficientInformationException
InsufficientInformationException
Copyright © 2021. All rights reserved.