|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opennms.netmgt.capsd.EventUtils
Provides a collection of utility methods used by the DeleteEvent Processor for dealing with Events
Constructor Summary | |
EventUtils()
|
Method Summary | |
static void |
addEventListener(EventListener listener,
java.util.List ueiList)
Make the given listener object a listener for the list of events referenced in the ueiList. |
static void |
checkEventId(Event e)
Ensures that the event has a database eventId |
static void |
checkHost(Event e)
Ensures the given event has a host |
static void |
checkInterface(Event e)
Ensures the given event has an interface |
static void |
checkNodeId(Event e)
Ensures that the given Event has a node id |
static void |
checkService(Event e)
Ensures that the given event has a service parameter |
static Event |
createAddInterfaceEvent(java.lang.String source,
java.lang.String nodeLabel,
java.lang.String ipaddr,
java.lang.String hostName,
long txNo)
This method is responsible for generating an addInterface event and sending it to eventd.. |
static Event |
createAndSendDeleteInterfaceEvent(java.lang.String source,
java.lang.String nodeLabel,
java.lang.String ipaddr,
java.lang.String hostName,
long txNo)
This method is responsible for generating a deleteInterface event and sending it to eventd.. |
static Event |
createAndSendDeleteNodeEvent(java.lang.String source,
java.lang.String nodeLabel,
java.lang.String hostName,
long txNo)
This method is responsible for generating a deleteNode event and sending it to eventd.. |
static Event |
createAndSendDeleteServiceEvent(java.lang.String source,
DbNodeEntry nodeEntry,
java.net.InetAddress ifaddr,
java.lang.String service,
java.lang.String hostName,
long txNo)
This method is responsible for generating a deleteService event and sending it to eventd.. |
static Event |
createAndSendInterfaceDeletedEvent(java.lang.String source,
int nodeId,
java.lang.String ipaddr,
java.lang.String hostName,
long txNo)
This method is responsible for generating an interfaceDeleted event and sending it to eventd... |
static Event |
createAssetInfoChangedEvent(java.lang.String source,
long nodeId,
long txNo)
Construct a deleteNode event for the given nodeId. |
static Event |
createChangeServiceEvent(java.lang.String source,
java.lang.String ipaddr,
java.lang.String service,
java.lang.String action,
java.lang.String hostName,
long txNo)
This method is responsible for generating a changeService event and sending it to eventd.. |
static Event |
createDeleteInterfaceEvent(java.lang.String source,
long nodeId,
java.lang.String ipAddr,
long txNo)
Constructs a deleteInterface event for the given nodeId, ipAddress pair. |
static Event |
createDeleteNodeEvent(java.lang.String source,
long nodeId,
long txNo)
Construct a deleteNode event for the given nodeId. |
static Event |
createDeleteServiceEvent(java.lang.String source,
long nodeId,
java.lang.String ipAddr,
java.lang.String service,
long txNo)
Constructs a deleteService event for the given nodeId, ipAddress, serivcename triple. |
static Event |
createForceRescanEvent(java.lang.String hostName,
long nodeId)
This method is responsible for generating a forceRescan event and sending it to eventd.. |
static Event |
createInterfaceDeletedEvent(java.lang.String source,
long nodeId,
java.lang.String ipAddr,
long txNo)
Construct an interfaceDeleted event for an interface. |
static Event |
createNodeAddedEvent(DbNodeEntry nodeEntry,
long txNo)
This method is responsible for generating a nodeAdded event and sending it to eventd.. |
static Event |
createNodeDeletedEvent(java.lang.String source,
int nodeId,
java.lang.String hostName,
java.lang.String nodeLabel,
long txNo)
This method is responsible for generating a nodeDeleted event and sending it to eventd.. |
static Event |
createNodeDeletedEvent(java.lang.String source,
long nodeId,
long txNo)
Construct a nodeDeleteed event for the given nodeId |
static Event |
createNodeGainedInterfaceEvent(DbNodeEntry nodeEntry,
java.net.InetAddress ifaddr,
long txNo)
This method is responsible for generating a nodeGainedInterface event and sending it to eventd.. |
static Event |
createNodeGainedServiceEvent(DbNodeEntry nodeEntry,
java.net.InetAddress ifaddr,
java.lang.String service,
long txNo)
This method is responsible for generating a nodeGainedService event and sending it to eventd.. |
static Event |
createServiceDeletedEvent(java.lang.String source,
long nodeId,
java.lang.String ipAddr,
java.lang.String service,
long txNo)
Constructs a serviceDeleted Event for the nodeId, ipAddr, serviceName triple |
static long |
getEventID(Event e)
Get the eventId for the given event |
static long |
getLongParm(Event e,
java.lang.String parmName,
long defaultValue)
Retrieve the value associated with an event parameter and parse it to a long. |
static long |
getNodeId(Event e)
Return the nodeId of the node associated with and event, or -1 of no node is associated. |
static java.lang.String |
getParm(Event e,
java.lang.String parmName)
Return the value of an event parameter of null if it does not exist. |
static java.lang.String |
getParm(Event e,
java.lang.String parmName,
java.lang.String defaultValue)
Retrieve a parameter from and event, returning defaultValue of the parameter is not set. |
static void |
requireParm(Event e,
java.lang.String parmName)
Throw an exception if an event does have the required parameter |
static void |
sendEvent(Event newEvent,
java.lang.String callerUei,
long txNo,
boolean isXmlRpcEnabled)
Send an event to the Event manaager to be broadcast to interested listeners |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public EventUtils()
Method Detail |
public static void addEventListener(EventListener listener, java.util.List ueiList)
listener
- the lister to addueiList
- the list of events the listener is interestedpublic static void checkEventId(Event e) throws InsufficientInformationException
e
- the event
InsufficientInformationException
- if an event id is not evailablepublic static void checkInterface(Event e) throws InsufficientInformationException
e
- the event
InsufficientInformationException
- if an interface is not availablepublic static void checkHost(Event e) throws InsufficientInformationException
e
- the event
InsufficientInformationException
- if an interface is not availablepublic static void checkNodeId(Event e) throws InsufficientInformationException
e
- the event
InsufficientInformationException
- if a node id is not availablepublic static void checkService(Event e) throws InsufficientInformationException
e
- the event to check
InsufficientInformationException
- if the event does not have a servicepublic static Event createDeleteInterfaceEvent(java.lang.String source, long nodeId, java.lang.String ipAddr, long txNo)
source
- the source for the eventnodeId
- the nodeId of the node that owns the interfaceipAddr
- the ipAddress of the interface being deletedtxNo
- the transaction number to use for processing this event
public static Event createDeleteNodeEvent(java.lang.String source, long nodeId, long txNo)
source
- the source for the ventnodeId
- the node to be deleted.txNo
- the transaction number associated with deleting the node
public static Event createAssetInfoChangedEvent(java.lang.String source, long nodeId, long txNo)
source
- the source for the ventnodeId
- the node to be deleted.txNo
- the transaction number associated with deleting the node
public static Event createInterfaceDeletedEvent(java.lang.String source, long nodeId, java.lang.String ipAddr, long txNo)
source
- the source of the eventnodeId
- the nodeId of the node the interface resides inipAddr
- the ipAdddr of the eventtxNo
- a transaction number associated with the event
public static Event createNodeDeletedEvent(java.lang.String source, long nodeId, long txNo)
source
- the source for the evnetnodeId
- the id of the node being deletedtxNo
- a transaction number associated with the event
public static Event createServiceDeletedEvent(java.lang.String source, long nodeId, java.lang.String ipAddr, java.lang.String service, long txNo)
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 deletedtxNo
- a transaction number associated with the event
public static long getEventID(Event e)
e
- the event to get the eventId for
public static long getLongParm(Event e, java.lang.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
parsed
public static long getNodeId(Event e)
e
- the event
public static java.lang.String getParm(Event e, java.lang.String parmName)
e
- the Event to get the parameter forparmName
- the name of the parameter to retrieve
public static java.lang.String getParm(Event e, java.lang.String parmName, java.lang.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 set
public static void requireParm(Event e, java.lang.String parmName) throws InsufficientInformationException
e
- the event the parameter must reside on
InsufficientInformationException
- if the paramter is not set on the event or if its value has
no contentpublic static void sendEvent(Event newEvent, java.lang.String callerUei, long txNo, boolean isXmlRpcEnabled)
newEvent
- the event to sendisXmlRpcEnabled
- FIXMEpublic static Event createNodeAddedEvent(DbNodeEntry nodeEntry, long txNo)
nodeEntry
- The node Added.txNo
- the transaction no.public static Event createNodeGainedInterfaceEvent(DbNodeEntry nodeEntry, java.net.InetAddress ifaddr, long txNo)
nodeEntry
- The node that gained the interface.ifaddr
- the interface gained on the node.txNo
- the transaction no.public static Event createNodeDeletedEvent(java.lang.String source, int nodeId, java.lang.String hostName, java.lang.String nodeLabel, long txNo)
source
- FIXMEnodeId
- Nodeid of the node got deleted.hostName
- the Host server name.nodeLabel
- the node label of the deleted node.public static Event createAndSendDeleteNodeEvent(java.lang.String source, java.lang.String nodeLabel, java.lang.String hostName, long txNo)
source
- FIXMEnodeLabel
- the nodelabel of the deleted node.hostName
- the Host server name.txNo
- the external transaction No of the event.public static Event createForceRescanEvent(java.lang.String hostName, long nodeId)
hostName
- the Host server name.nodeId
- the node ID of the node to rescan.public static Event createAndSendInterfaceDeletedEvent(java.lang.String source, int nodeId, java.lang.String ipaddr, java.lang.String hostName, long txNo)
source
- FIXMEnodeId
- Nodeid of the node that the deleted interface resides on.ipaddr
- the ipaddress of the deleted Interface.hostName
- the Host server name.txNo
- the external transaction No. of the original event.public static Event createNodeGainedServiceEvent(DbNodeEntry nodeEntry, java.net.InetAddress ifaddr, java.lang.String service, long txNo)
nodeEntry
- The node that gained the service.ifaddr
- the interface gained the service.service
- the service gained.txNo
- the transaction no.public static Event createAndSendDeleteServiceEvent(java.lang.String source, DbNodeEntry nodeEntry, java.net.InetAddress ifaddr, java.lang.String service, java.lang.String hostName, long txNo)
source
- FIXMEnodeEntry
- The node that the service to get deleted on.ifaddr
- the interface the service to get deleted on.service
- the service to delete.hostName
- FIXMEtxNo
- the transaction no.public static Event createAddInterfaceEvent(java.lang.String source, java.lang.String nodeLabel, java.lang.String ipaddr, java.lang.String hostName, long txNo)
source
- FIXMEnodeLabel
- the node label of the node where the interface resides.ipaddr
- IP address of the interface to be added.hostName
- the Host server name.txNo
- the exteranl transaction numberpublic static Event createAndSendDeleteInterfaceEvent(java.lang.String source, java.lang.String nodeLabel, java.lang.String ipaddr, java.lang.String hostName, long txNo)
source
- FIXMEnodeLabel
- the node label of the node where the interface resides.ipaddr
- IP address of the interface to be deleted.hostName
- the Host server name.txNo
- the external transaction No.public static Event createChangeServiceEvent(java.lang.String source, java.lang.String ipaddr, java.lang.String service, java.lang.String action, java.lang.String hostName, long txNo)
source
- FIXMEipaddr
- IP address of the interface where the service resides.service
- the service to be changed(add or remove).action
- what operation to perform for the service/interface pair.hostName
- FIXMEtxNo
- the external transaction No.public static Event createDeleteServiceEvent(java.lang.String source, long nodeId, java.lang.String ipAddr, java.lang.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 event
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |