OpenNMS API 1.2.3

org.opennms.netmgt.capsd
Class BroadcastEventProcessor

java.lang.Object
  extended byorg.opennms.netmgt.capsd.BroadcastEventProcessor
All Implemented Interfaces:
EventListener

final class BroadcastEventProcessor
extends java.lang.Object
implements EventListener

Author:
Matt Brozowski , OpenNMS

Field Summary
private  java.lang.String m_localServer
          local openNMS server name
private  java.util.Set m_notifySet
          Set of event ueis that we should notify when we receive and when a success or failure occurs.
private  Scheduler m_scheduler
          The Capsd rescan scheduler
private  FifoQueue m_suspectQ
          The location where suspectInterface events are enqueued for processing.
private static java.lang.String SQL_ADD_INTERFACE_TO_SERVER
          SQL statement used to add an interface/server mapping into the database;
private static java.lang.String SQL_ADD_SERVICE_TO_MAPPING
          SQL statement used to add an interface/service mapping into the database.
private static java.lang.String SQL_COUNT_INTERFACES_ON_NODE
          SQL statement used to count all the interface on a node
private static java.lang.String SQL_DELETE_ALL_INTERFACES_ON_NODE
          SQL statement used to delete all the ipinterfaces with a specified nodeid.
private static java.lang.String SQL_DELETE_ALL_SERVICES_INTERFACE_MAPPING
          SQL statement used to delete all services mapping to a specified interface from the database.
private static java.lang.String SQL_DELETE_ASSETS_ON_NODE
          SQL statement used to delete all assets from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_EVENTS_ON_INTERFACE
          SQL statement used to delete all events associated with a specified interface from the database.
private static java.lang.String SQL_DELETE_EVENTS_ON_NODE
          SQL statement used to delete all events from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_IFSERVICES_ON_INTERFACE
          SQL statement used to delete all ifservices from the database with a specified interface.
private static java.lang.String SQL_DELETE_IFSERVICES_ON_NODE
          SQL statement used to delete all ifservices from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_INTERFACE
          SQL statement used to delete an ipinterfac with a specified nodeid and ipaddress.
private static java.lang.String SQL_DELETE_INTERFACE_ON_SERVER
          SQL statement used to delete an interface/server mapping from the database.
private static java.lang.String SQL_DELETE_NODEID
          SQL statement used to delete a node from the database with a specified nodelabel.
private static java.lang.String SQL_DELETE_NOTIFICATIONS_ON_INTERFACE
          SQL statement used to delete all notifications associated with a specified interface from the database.
private static java.lang.String SQL_DELETE_NOTIFICATIONS_ON_NODE
          SQL statement used to delete all notifications from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_OUTAGES_ON_INTERFACE
          SQL statement used to delete all notifications associated with a specified interface from the database.
private static java.lang.String SQL_DELETE_OUTAGES_ON_NODE
          SQL statement used to delete all outages from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_SERVICE_INTERFACE_MAPPING
          SQL statement used to delete an interface/service mapping from the database.
private static java.lang.String SQL_DELETE_SNMPINTERFACE_ON_INTERFACE
          SQL statement used to delete the snmpinterface entry associated with a specified interface from the database.
private static java.lang.String SQL_DELETE_SNMPINTERFACE_ON_NODE
          SQL statement used to delete all snmpinterface from the database with a specified nodeid.
private static java.lang.String SQL_DELETE_USERSNOTIFIED_ON_INTERFACE
          SQL statement used to delete all usersnotified info associated with a specified interface from the database.
private static java.lang.String SQL_DELETE_USERSNOTIFIED_ON_NODE
          SQL statement used to delete all usersNotified from the database with a specified nodeid.
private static java.lang.String SQL_FIND_SERVICES_ON_NODE
          SQL statement used to count all the interface on a node
private static java.lang.String SQL_QUERY_IPADDRESS_EXIST
          SQL statement used to verify if an ipinterface with the specified ip address exists in the database and retrieve the nodeid if exists.
private static java.lang.String SQL_QUERY_IPINTERFACE_EXIST
          SQL statement used to query the 'node' and 'ipinterface' tables to verify if a specified ipaddr and node label have already exist in the database.
private static java.lang.String SQL_QUERY_NODE_EXIST
          SQL statement used to query if a node with the specified nodelabel exist in the database, and the nodeid from the database if exists.
private static java.lang.String SQL_QUERY_PRIMARY_INTERFACE
          SQL statement used to query if an interface is the snmp primary interface of a node.
private static java.lang.String SQL_QUERY_SERVICE_EXIST
          SQL statement used to verify if an ifservice with the specified ip address and service name exists in the database.
private static java.lang.String SQL_QUERY_SERVICE_MAPPING_EXIST
          SQL statement used to query if an interface/service mapping already exists in the database.
private static java.lang.String SQL_RETRIEVE_NODEID
          SQL query to retrieve nodeid of a particulary interface address
private static java.lang.String SQL_RETRIEVE_SERVICE_ID
          SQL statement used to retrieve the serviced id from the database with a specified service name.
 
Constructor Summary
(package private) BroadcastEventProcessor(FifoQueue suspectQ, Scheduler scheduler)
          Constructor
 
Method Summary
 void close()
          Unsubscribe from eventd
private  int countOtherInterfacesOnNode(java.sql.Connection dbConn, long nodeId, java.lang.String ipAddr)
          Counts the number of interfaces on the node other than a given interface
private  int countOtherServicesOnInterface(java.sql.Connection dbConn, long nodeId, java.lang.String ipAddr, java.lang.String service)
          Counts the number of other non deleted services associated with the interface defined by nodeid/ipAddr
private  int countServicesOnOtherInterfaces(java.sql.Connection dbConn, long nodeId, java.lang.String ipAddr)
          Counts the number of non deleted services on a node on interfaces other than a given interface
private  java.util.List createInterfaceOnNode(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, long txNo)
          FIXME: finish the doc here
private  void createMessageSelectorAndSubscribe()
          Create message selector to set to the subscription
private  java.util.List createNodeWithInterface(java.sql.Connection conn, java.lang.String nodeLabel, java.lang.String ipaddr, long txNo)
          This method add a node with the specified node label to the database.
private  java.util.List doAddInterface(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, long txNo)
          FIXME: finish the docs here
private  java.util.List doAddNode(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, long txNo)
          Perform the buld of the work for processing an addNode event
private  java.util.List doAddServiceMapping(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName, long txNo)
          FIXME: finish the doc here
private  java.util.List doAddServiceToInterface(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName, int serviceId, long txNo)
          FIXME: finish the doc here
private  java.util.List doChangeService(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName, java.lang.String action, long txNo)
          FIXME: finish the doc here
private  java.util.List doCreateInterfaceMappings(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, java.lang.String hostName, long txNo)
          FIXME: finish the doc here
private  java.util.List doDeleteInterface(java.sql.Connection dbConn, java.lang.String source, long nodeid, java.lang.String ipAddr, long txNo)
          Mark as deleted the specified interface and its associated services, if delete propagation is enable and the interface is the only one on the node, delete the node as well.
private  java.util.List doDeleteInterfaceMappings(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, java.lang.String hostName, long txNo)
          FIXME: finish the doc here
private  java.util.List doDeleteNode(java.sql.Connection dbConn, java.lang.String source, long nodeid, long txNo)
          Mark as deleted the specified node, its associated interfaces and services.
private  java.util.List doDeleteService(java.sql.Connection dbConn, java.lang.String source, long nodeid, java.lang.String ipAddr, java.lang.String service, long txNo)
          Mark as deleted the specified service, if this is the only service on an interface or node and deletePropagation is enabled, the interface or node is marked as deleted as well.
private  java.util.List doDeleteServiceMapping(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName, long txNo)
          FIXME: finish the doc here
private  java.util.List doUpdateServer(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr, java.lang.String action, java.lang.String hostName, long txNo)
          FIXME: finish the doc here
private  java.util.List doUpdateService(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName, java.lang.String action, long txNo)
          FIXME: finish the doc here
private  boolean existsInServerMap(java.sql.Connection dbConn, java.lang.String hostName, java.lang.String ipaddr)
          FIXME: finish the doc here
private  int[] findNodeIdForServiceAndInterface(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName)
          FIXME: finish the doc here
private  long[] findNodeIdsForInterfaceAndLabel(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipAddr)
          FIXME: finish the doc here
 java.lang.String getLocalServer()
          Get the local server name
 java.lang.String getName()
          Return an id for this event listener
private  void handleAddInterface(Event event)
          Process the event, add the specified interface into database.
private  void handleAddNode(Event event)
          Process an addNode event.
private  void handleChangeService(Event event)
          Process the event, add or remove a specified service from an interface.
private  void handleDeleteInterface(Event e)
          Handle a deleteInterface Event.
private  void handleDeleteNode(Event e)
          Handle a deleteNode Event.
private  void handleDeleteService(Event e)
          Handle a deleteService Event.
private  void handleDupNodeDeleted(Event event)
          FIXME: finish the doc here
private  void handleForceRescan(Event event)
          FIXME: finish the doc here
private  void handleNewSuspect(Event event)
          FIXME: finish the doc here
private  void handleNodeAdded(Event event)
          FIXME: finish the doc here
private  void handleNodeDeleted(Event event)
          FIXME: finish the doc here
private  void handleUpdateServer(Event event)
          FIXME: finish the doc here
private  void handleUpdateService(Event event)
          Process the event, add or remove a specified interface/service pair into the database.
private  boolean interfaceExists(java.sql.Connection dbConn, java.lang.String nodeLabel, java.lang.String ipaddr)
          Returns true if and only an interface with the given ipaddr on a node with the give label exists
static boolean isPropagationEnabled()
          Determines if deletePropagation is enabled in the Outage Manager.
static boolean isXmlRpcEnabled()
          FIXME: finish the doc here
private  java.util.List markAllServicesForInterfaceDeleted(java.sql.Connection dbConn, java.lang.String source, long nodeId, java.lang.String ipAddr, long txNo)
          Mark all the services associated with a given interface as deleted and create service deleted events for each one that gets deleted
private  java.util.List markInterfaceDeleted(java.sql.Connection dbConn, java.lang.String source, long nodeId, java.lang.String ipAddr, long txNo)
          Mark the given interface deleted
private  java.util.List markInterfacesAndServicesDeleted(java.sql.Connection dbConn, java.lang.String source, long nodeId, long txNo)
          Marks all the interfaces and services for a given node deleted and constructs events for each.
private  java.util.List markNodeDeleted(java.sql.Connection dbConn, java.lang.String source, long nodeId, long txNo)
          Marks a node deleted and creates an event for it if necessary.
private  java.util.List markServiceDeleted(java.sql.Connection dbConn, java.lang.String source, long nodeId, java.lang.String ipAddr, java.lang.String service, long txNo)
          Marks the service deleted in the database and returns a serviceDeleted event for the service, if and only if the service existed
private  boolean nodeExists(java.sql.Connection dbConn, java.lang.String nodeLabel)
          Returns true if and only a node with the give label exists
private  void notifyEventError(Event event, java.lang.String msg, java.lang.Exception ex)
          FIXME: finish the doc here
private  void notifyEventReceived(Event event)
          FIXME: finish the doc here
private  void notifyEventSuccess(Event event)
          FIXME: finish the doc here
 void onEvent(Event event)
          This method is invoked by the EventIpcManager when a new event is available for processing.
private  boolean serviceMappingExists(java.sql.Connection dbConn, java.lang.String ipaddr, java.lang.String serviceName)
          FIXME: finish the doc here
private  int verifyServiceExists(java.sql.Connection dbConn, java.lang.String serviceName)
          FIXME: finish the doc here
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_ADD_INTERFACE_TO_SERVER

private static java.lang.String SQL_ADD_INTERFACE_TO_SERVER
SQL statement used to add an interface/server mapping into the database;


SQL_ADD_SERVICE_TO_MAPPING

private static java.lang.String SQL_ADD_SERVICE_TO_MAPPING
SQL statement used to add an interface/service mapping into the database.


SQL_COUNT_INTERFACES_ON_NODE

private static java.lang.String SQL_COUNT_INTERFACES_ON_NODE
SQL statement used to count all the interface on a node


SQL_DELETE_ALL_INTERFACES_ON_NODE

private static java.lang.String SQL_DELETE_ALL_INTERFACES_ON_NODE
SQL statement used to delete all the ipinterfaces with a specified nodeid.


SQL_DELETE_ALL_SERVICES_INTERFACE_MAPPING

private static java.lang.String SQL_DELETE_ALL_SERVICES_INTERFACE_MAPPING
SQL statement used to delete all services mapping to a specified interface from the database.


SQL_DELETE_ASSETS_ON_NODE

private static java.lang.String SQL_DELETE_ASSETS_ON_NODE
SQL statement used to delete all assets from the database with a specified nodeid.


SQL_DELETE_EVENTS_ON_INTERFACE

private static java.lang.String SQL_DELETE_EVENTS_ON_INTERFACE
SQL statement used to delete all events associated with a specified interface from the database.


SQL_DELETE_EVENTS_ON_NODE

private static java.lang.String SQL_DELETE_EVENTS_ON_NODE
SQL statement used to delete all events from the database with a specified nodeid.


SQL_DELETE_IFSERVICES_ON_INTERFACE

private static java.lang.String SQL_DELETE_IFSERVICES_ON_INTERFACE
SQL statement used to delete all ifservices from the database with a specified interface.


SQL_DELETE_IFSERVICES_ON_NODE

private static java.lang.String SQL_DELETE_IFSERVICES_ON_NODE
SQL statement used to delete all ifservices from the database with a specified nodeid.


SQL_DELETE_INTERFACE

private static java.lang.String SQL_DELETE_INTERFACE
SQL statement used to delete an ipinterfac with a specified nodeid and ipaddress.


SQL_DELETE_INTERFACE_ON_SERVER

private static java.lang.String SQL_DELETE_INTERFACE_ON_SERVER
SQL statement used to delete an interface/server mapping from the database.


SQL_DELETE_NODEID

private static java.lang.String SQL_DELETE_NODEID
SQL statement used to delete a node from the database with a specified nodelabel.


SQL_DELETE_NOTIFICATIONS_ON_INTERFACE

private static java.lang.String SQL_DELETE_NOTIFICATIONS_ON_INTERFACE
SQL statement used to delete all notifications associated with a specified interface from the database.


SQL_DELETE_NOTIFICATIONS_ON_NODE

private static java.lang.String SQL_DELETE_NOTIFICATIONS_ON_NODE
SQL statement used to delete all notifications from the database with a specified nodeid.


SQL_DELETE_OUTAGES_ON_INTERFACE

private static java.lang.String SQL_DELETE_OUTAGES_ON_INTERFACE
SQL statement used to delete all notifications associated with a specified interface from the database.


SQL_DELETE_OUTAGES_ON_NODE

private static java.lang.String SQL_DELETE_OUTAGES_ON_NODE
SQL statement used to delete all outages from the database with a specified nodeid.


SQL_DELETE_SERVICE_INTERFACE_MAPPING

private static java.lang.String SQL_DELETE_SERVICE_INTERFACE_MAPPING
SQL statement used to delete an interface/service mapping from the database.


SQL_DELETE_SNMPINTERFACE_ON_INTERFACE

private static java.lang.String SQL_DELETE_SNMPINTERFACE_ON_INTERFACE
SQL statement used to delete the snmpinterface entry associated with a specified interface from the database.


SQL_DELETE_SNMPINTERFACE_ON_NODE

private static java.lang.String SQL_DELETE_SNMPINTERFACE_ON_NODE
SQL statement used to delete all snmpinterface from the database with a specified nodeid.


SQL_DELETE_USERSNOTIFIED_ON_INTERFACE

private static java.lang.String SQL_DELETE_USERSNOTIFIED_ON_INTERFACE
SQL statement used to delete all usersnotified info associated with a specified interface from the database.


SQL_DELETE_USERSNOTIFIED_ON_NODE

private static java.lang.String SQL_DELETE_USERSNOTIFIED_ON_NODE
SQL statement used to delete all usersNotified from the database with a specified nodeid.


SQL_FIND_SERVICES_ON_NODE

private static java.lang.String SQL_FIND_SERVICES_ON_NODE
SQL statement used to count all the interface on a node


SQL_QUERY_IPADDRESS_EXIST

private static java.lang.String SQL_QUERY_IPADDRESS_EXIST
SQL statement used to verify if an ipinterface with the specified ip address exists in the database and retrieve the nodeid if exists.


SQL_QUERY_IPINTERFACE_EXIST

private static java.lang.String SQL_QUERY_IPINTERFACE_EXIST
SQL statement used to query the 'node' and 'ipinterface' tables to verify if a specified ipaddr and node label have already exist in the database.


SQL_QUERY_NODE_EXIST

private static java.lang.String SQL_QUERY_NODE_EXIST
SQL statement used to query if a node with the specified nodelabel exist in the database, and the nodeid from the database if exists.


SQL_QUERY_PRIMARY_INTERFACE

private static java.lang.String SQL_QUERY_PRIMARY_INTERFACE
SQL statement used to query if an interface is the snmp primary interface of a node.


SQL_QUERY_SERVICE_EXIST

private static java.lang.String SQL_QUERY_SERVICE_EXIST
SQL statement used to verify if an ifservice with the specified ip address and service name exists in the database.


SQL_QUERY_SERVICE_MAPPING_EXIST

private static java.lang.String SQL_QUERY_SERVICE_MAPPING_EXIST
SQL statement used to query if an interface/service mapping already exists in the database.


SQL_RETRIEVE_NODEID

private static java.lang.String SQL_RETRIEVE_NODEID
SQL query to retrieve nodeid of a particulary interface address


SQL_RETRIEVE_SERVICE_ID

private static java.lang.String SQL_RETRIEVE_SERVICE_ID
SQL statement used to retrieve the serviced id from the database with a specified service name.


m_localServer

private java.lang.String m_localServer
local openNMS server name


m_notifySet

private java.util.Set m_notifySet
Set of event ueis that we should notify when we receive and when a success or failure occurs.


m_scheduler

private Scheduler m_scheduler
The Capsd rescan scheduler


m_suspectQ

private FifoQueue m_suspectQ
The location where suspectInterface events are enqueued for processing.

Constructor Detail

BroadcastEventProcessor

BroadcastEventProcessor(FifoQueue suspectQ,
                        Scheduler scheduler)
Constructor

Parameters:
suspectQ - The queue where new SuspectEventProcessor objects are enqueued for running..
scheduler - Rescan scheduler.
Method Detail

isPropagationEnabled

public static boolean isPropagationEnabled()
Determines if deletePropagation is enabled in the Outage Manager.

Returns:
true if deletePropagation is enable, false otherwise

isXmlRpcEnabled

public static boolean isXmlRpcEnabled()
FIXME: finish the doc here

Returns:
Returns the xmlrpc.

close

public void close()
Unsubscribe from eventd


countOtherInterfacesOnNode

private int countOtherInterfacesOnNode(java.sql.Connection dbConn,
                                       long nodeId,
                                       java.lang.String ipAddr)
                                throws java.sql.SQLException
Counts the number of interfaces on the node other than a given interface

Parameters:
dbConn - the database connection
ipAddr - the interface not to include in the count
Returns:
the numer of interfaces other than the given one
Throws:
java.sql.SQLException - if an error occurs talking to the database

countOtherServicesOnInterface

private int countOtherServicesOnInterface(java.sql.Connection dbConn,
                                          long nodeId,
                                          java.lang.String ipAddr,
                                          java.lang.String service)
                                   throws java.sql.SQLException
Counts the number of other non deleted services associated with the interface defined by nodeid/ipAddr

Parameters:
dbConn - the database connection
nodeId - the node to chck
ipAddr - the interface to check
service - the name of the service not to include
Returns:
the number of non deleted services, other than serviceId
Throws:
java.sql.SQLException

countServicesOnOtherInterfaces

private int countServicesOnOtherInterfaces(java.sql.Connection dbConn,
                                           long nodeId,
                                           java.lang.String ipAddr)
                                    throws java.sql.SQLException
Counts the number of non deleted services on a node on interfaces other than a given interface

Parameters:
dbConn - the database connection
nodeId - the nodeid to check
ipAddr - the address of the interface not to include
Returns:
the number of non deleted services on other interfaces
Throws:
java.sql.SQLException

createInterfaceOnNode

private java.util.List createInterfaceOnNode(java.sql.Connection dbConn,
                                             java.lang.String nodeLabel,
                                             java.lang.String ipaddr,
                                             long txNo)
                                      throws java.sql.SQLException,
                                             FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
nodeLabel -
ipaddr -
txNo -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

createMessageSelectorAndSubscribe

private void createMessageSelectorAndSubscribe()
Create message selector to set to the subscription


createNodeWithInterface

private java.util.List createNodeWithInterface(java.sql.Connection conn,
                                               java.lang.String nodeLabel,
                                               java.lang.String ipaddr,
                                               long txNo)
                                        throws java.sql.SQLException,
                                               FailedOperationException
This method add a node with the specified node label to the database. If also adds in interface with the given ipaddress to the node, if the ipaddr is not null

Parameters:
conn - The JDBC Database connection.
nodeLabel - the node label to identify the node to create.
ipaddr - the ipaddress to be added into the ipinterface table.
txNo - the transaction no.
Throws:
java.sql.SQLException - if a database error occurs
FailedOperationException - if the ipaddr is not resolvable

doAddInterface

private java.util.List doAddInterface(java.sql.Connection dbConn,
                                      java.lang.String nodeLabel,
                                      java.lang.String ipaddr,
                                      long txNo)
                               throws java.sql.SQLException,
                                      FailedOperationException
FIXME: finish the docs here

Parameters:
dbConn -
nodeLabel -
ipaddr -
txNo -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

doAddNode

private java.util.List doAddNode(java.sql.Connection dbConn,
                                 java.lang.String nodeLabel,
                                 java.lang.String ipaddr,
                                 long txNo)
                          throws java.sql.SQLException,
                                 FailedOperationException
Perform the buld of the work for processing an addNode event

Parameters:
dbConn - the database connection
nodeLabel - the label for the node to add
ipaddr - an interface on the node (may be null if no interface is supplied)
txNo - a transaction number to associate with the modification
Returns:
a list of events that need to be sent in response to these changes
Throws:
java.sql.SQLException - if a database error occurrs
FailedOperationException - if other errors occur

doAddServiceMapping

private java.util.List doAddServiceMapping(java.sql.Connection dbConn,
                                           java.lang.String ipaddr,
                                           java.lang.String serviceName,
                                           long txNo)
                                    throws java.sql.SQLException,
                                           FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
txNo -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

doAddServiceToInterface

private java.util.List doAddServiceToInterface(java.sql.Connection dbConn,
                                               java.lang.String ipaddr,
                                               java.lang.String serviceName,
                                               int serviceId,
                                               long txNo)
                                        throws java.sql.SQLException,
                                               FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
serviceId -
txNo -
Throws:
java.sql.SQLException
FailedOperationException

doChangeService

private java.util.List doChangeService(java.sql.Connection dbConn,
                                       java.lang.String ipaddr,
                                       java.lang.String serviceName,
                                       java.lang.String action,
                                       long txNo)
                                throws java.sql.SQLException,
                                       FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
action -
txNo -
Throws:
java.sql.SQLException
FailedOperationException

doCreateInterfaceMappings

private java.util.List doCreateInterfaceMappings(java.sql.Connection dbConn,
                                                 java.lang.String nodeLabel,
                                                 java.lang.String ipaddr,
                                                 java.lang.String hostName,
                                                 long txNo)
                                          throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
nodeLabel -
ipaddr -
hostName -
txNo -
Returns:
Throws:
java.sql.SQLException

doDeleteInterface

private java.util.List doDeleteInterface(java.sql.Connection dbConn,
                                         java.lang.String source,
                                         long nodeid,
                                         java.lang.String ipAddr,
                                         long txNo)
                                  throws java.sql.SQLException
Mark as deleted the specified interface and its associated services, if delete propagation is enable and the interface is the only one on the node, delete the node as well.

Parameters:
dbConn - the database connection
source - the source for any events that must be sent
nodeid - the id of the node the interface resides on
ipAddr - the ip address of the interface to be deleted
txNo - a transaction number to associate with the deletion
Returns:
a list of events that need to be sent w.r.t. this deletion
Throws:
java.sql.SQLException - if any database errors occur

doDeleteInterfaceMappings

private java.util.List doDeleteInterfaceMappings(java.sql.Connection dbConn,
                                                 java.lang.String nodeLabel,
                                                 java.lang.String ipaddr,
                                                 java.lang.String hostName,
                                                 long txNo)
                                          throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
nodeLabel -
ipaddr -
hostName -
txNo -
Returns:
Throws:
java.sql.SQLException

doDeleteNode

private java.util.List doDeleteNode(java.sql.Connection dbConn,
                                    java.lang.String source,
                                    long nodeid,
                                    long txNo)
                             throws java.sql.SQLException
Mark as deleted the specified node, its associated interfaces and services.

Parameters:
dbConn - the connection to the database
source - the source for any events to send
nodeid - the nodeid to be deleted
txNo - a transaction id to associate with this deletion
Returns:
the list of events that need to be sent in response to the node being deleted
Throws:
java.sql.SQLException - if any exception occurs communicating with the database

doDeleteService

private java.util.List doDeleteService(java.sql.Connection dbConn,
                                       java.lang.String source,
                                       long nodeid,
                                       java.lang.String ipAddr,
                                       java.lang.String service,
                                       long txNo)
                                throws java.sql.SQLException
Mark as deleted the specified service, if this is the only service on an interface or node and deletePropagation is enabled, the interface or node is marked as deleted as well.

Parameters:
dbConn - the connection to the database
source - the source for any events to send
nodeid - the nodeid that the service resides on
ipAddr - the interface that the service resides on
service - the name of the service
txNo - a transaction id to associate with this deletion
Returns:
the list of events that need to be sent in response to the service being deleted
Throws:
java.sql.SQLException - if any exception occurs communicating with the database

doDeleteServiceMapping

private java.util.List doDeleteServiceMapping(java.sql.Connection dbConn,
                                              java.lang.String ipaddr,
                                              java.lang.String serviceName,
                                              long txNo)
                                       throws java.sql.SQLException,
                                              FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
txNo -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

doUpdateServer

private java.util.List doUpdateServer(java.sql.Connection dbConn,
                                      java.lang.String nodeLabel,
                                      java.lang.String ipaddr,
                                      java.lang.String action,
                                      java.lang.String hostName,
                                      long txNo)
                               throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
nodeLabel -
ipaddr -
action -
hostName -
txNo -
Throws:
java.sql.SQLException

doUpdateService

private java.util.List doUpdateService(java.sql.Connection dbConn,
                                       java.lang.String ipaddr,
                                       java.lang.String serviceName,
                                       java.lang.String action,
                                       long txNo)
                                throws java.sql.SQLException,
                                       FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
action -
txNo -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

existsInServerMap

private boolean existsInServerMap(java.sql.Connection dbConn,
                                  java.lang.String hostName,
                                  java.lang.String ipaddr)
                           throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
hostName -
ipaddr -
Returns:
Throws:
java.sql.SQLException

findNodeIdForServiceAndInterface

private int[] findNodeIdForServiceAndInterface(java.sql.Connection dbConn,
                                               java.lang.String ipaddr,
                                               java.lang.String serviceName)
                                        throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
Returns:
Throws:
java.sql.SQLException

findNodeIdsForInterfaceAndLabel

private long[] findNodeIdsForInterfaceAndLabel(java.sql.Connection dbConn,
                                               java.lang.String nodeLabel,
                                               java.lang.String ipAddr)
                                        throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
nodeLabel -
ipAddr -
Returns:
Throws:
java.sql.SQLException

getLocalServer

public java.lang.String getLocalServer()
Get the local server name


getName

public java.lang.String getName()
Return an id for this event listener

Specified by:
getName in interface EventListener

handleAddInterface

private void handleAddInterface(Event event)
                         throws InsufficientInformationException,
                                FailedOperationException
Process the event, add the specified interface into database. If the associated node does not exist in the database yet, add a node into the database.

Parameters:
event - The event to process.
Throws:
InsufficientInformationException - if the event is missing essential information
FailedOperationException - if the operation fails (because of database error for example)

handleAddNode

private void handleAddNode(Event event)
                    throws InsufficientInformationException,
                           FailedOperationException
Process an addNode event.

Parameters:
event - The event to process.
Throws:
InsufficientInformationException - if the event is missing information
FailedOperationException - if an error occurs during processing

handleChangeService

private void handleChangeService(Event event)
                          throws InsufficientInformationException,
                                 FailedOperationException
Process the event, add or remove a specified service from an interface. An 'action' parameter wraped in the event will tell which action to take to the service.

Parameters:
event - The event to process.
Throws:
FailedOperationException - FIXME: finish the doc here
InsufficientInformationException

handleDeleteInterface

private void handleDeleteInterface(Event e)
                            throws InsufficientInformationException,
                                   FailedOperationException
Handle a deleteInterface Event. Here we process the event by marking all the appropriate data rows as deleted. FIXME: finish the doc here

Parameters:
e - The event indicating what interface to delete
Throws:
InsufficientInformationException - if the required information is not part of the event
FailedOperationException

handleDeleteNode

private void handleDeleteNode(Event e)
                       throws InsufficientInformationException,
                              FailedOperationException
Handle a deleteNode Event. Here we process the event by marking all the appropriate data rows as deleted. FIXME: finish the doc here

Parameters:
e - The event indicating what node to delete
Throws:
InsufficientInformationException - if the required information is not part of the event
FailedOperationException

handleDeleteService

private void handleDeleteService(Event e)
                          throws InsufficientInformationException,
                                 FailedOperationException
Handle a deleteService Event. Here we process the event by marking all the appropriate data rows as deleted. FIXME: finish the doc here

Parameters:
e - The event indicating what service to delete
Throws:
InsufficientInformationException - if the required information is not part of the event
FailedOperationException

handleDupNodeDeleted

private void handleDupNodeDeleted(Event event)
                           throws InsufficientInformationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException

handleForceRescan

private void handleForceRescan(Event event)
                        throws InsufficientInformationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException

handleNewSuspect

private void handleNewSuspect(Event event)
                       throws InsufficientInformationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException

handleNodeAdded

private void handleNodeAdded(Event event)
                      throws InsufficientInformationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException

handleNodeDeleted

private void handleNodeDeleted(Event event)
                        throws InsufficientInformationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException

handleUpdateServer

private void handleUpdateServer(Event event)
                         throws InsufficientInformationException,
                                FailedOperationException
FIXME: finish the doc here

Parameters:
event -
Throws:
InsufficientInformationException
FailedOperationException

handleUpdateService

private void handleUpdateService(Event event)
                          throws InsufficientInformationException,
                                 FailedOperationException
Process the event, add or remove a specified interface/service pair into the database. this event will cause an changeService event with the specified action. An 'action' parameter wraped in the event will tell which action to take to the service on the specified interface. The ipaddress of the interface, the service name must be included in the event.

Parameters:
event - The event to process.
Throws:
InsufficientInformationException - if there is missing information in the event
FailedOperationException - if the operation fails for some reason

interfaceExists

private boolean interfaceExists(java.sql.Connection dbConn,
                                java.lang.String nodeLabel,
                                java.lang.String ipaddr)
                         throws java.sql.SQLException
Returns true if and only an interface with the given ipaddr on a node with the give label exists

Parameters:
dbConn - a database connection
nodeLabel - the label of the node the interface must reside on
ipaddr - the ip address the interface should have
Returns:
true iff the interface exists
Throws:
java.sql.SQLException - if a database error occurs

markAllServicesForInterfaceDeleted

private java.util.List markAllServicesForInterfaceDeleted(java.sql.Connection dbConn,
                                                          java.lang.String source,
                                                          long nodeId,
                                                          java.lang.String ipAddr,
                                                          long txNo)
                                                   throws java.sql.SQLException
Mark all the services associated with a given interface as deleted and create service deleted events for each one that gets deleted

Parameters:
dbConn - the database connection
nodeId - the node that interface resides on
ipAddr - the ipAddress of the interface
txNo - a transaction number that can be associated with this deletion
Returns:
a List of serviceDeleted events, one for each service marked
Throws:
java.sql.SQLException - if a database error occurs

markInterfaceDeleted

private java.util.List markInterfaceDeleted(java.sql.Connection dbConn,
                                            java.lang.String source,
                                            long nodeId,
                                            java.lang.String ipAddr,
                                            long txNo)
                                     throws java.sql.SQLException
Mark the given interface deleted

Parameters:
dbConn - the database connection
source - the source for any events set
nodeId - the id the interface resides on
ipAddr - the ipAddress of the interface
txNo - a transaction no to associate with this deletion
Returns:
a List containing an interfaceDeleted event for the interface if it was actually marked
Throws:
java.sql.SQLException - if a database error occurs

markInterfacesAndServicesDeleted

private java.util.List markInterfacesAndServicesDeleted(java.sql.Connection dbConn,
                                                        java.lang.String source,
                                                        long nodeId,
                                                        long txNo)
                                                 throws java.sql.SQLException
Marks all the interfaces and services for a given node deleted and constructs events for each. The order of events is significant representing the hierarchy, service events preceed the event for the interface the service is on

Parameters:
dbConn - the database connection
source - the source for use in the constructed events
nodeId - the node whose interfaces and services are to be deleted
txNo - a transaction number to associate with this deletion
Returns:
a List of events indicating which nodes and services have been deleted
Throws:
java.sql.SQLException

markNodeDeleted

private java.util.List markNodeDeleted(java.sql.Connection dbConn,
                                       java.lang.String source,
                                       long nodeId,
                                       long txNo)
                                throws java.sql.SQLException
Marks a node deleted and creates an event for it if necessary.

Parameters:
dbConn - the database connection
source - the source to use for constructed events
nodeId - the node to delete
txNo - a transaction number to associate with this deletion
Returns:
a List containing the node deleted event if necessary
Throws:
java.sql.SQLException - if a database error occurs

markServiceDeleted

private java.util.List markServiceDeleted(java.sql.Connection dbConn,
                                          java.lang.String source,
                                          long nodeId,
                                          java.lang.String ipAddr,
                                          java.lang.String service,
                                          long txNo)
                                   throws java.sql.SQLException
Marks the service deleted in the database and returns a serviceDeleted event for the service, if and only if the service existed

Parameters:
dbConn - the database connection
source - the source for any events sent
nodeId - the node the service resides on
ipAddr - the interface the service resides on
service - the name of the service
txNo - a transaction number to associate with this deletion
Returns:
a List containing a service deleted event.
Throws:
java.sql.SQLException - if an error occurs communicating with the database

nodeExists

private boolean nodeExists(java.sql.Connection dbConn,
                           java.lang.String nodeLabel)
                    throws java.sql.SQLException
Returns true if and only a node with the give label exists

Parameters:
dbConn - a database connection
nodeLabel - the label to check
Returns:
true iff the node exists
Throws:
java.sql.SQLException - if a database error occurs

notifyEventError

private void notifyEventError(Event event,
                              java.lang.String msg,
                              java.lang.Exception ex)
FIXME: finish the doc here

Parameters:
event -
msg -
ex -

notifyEventReceived

private void notifyEventReceived(Event event)
FIXME: finish the doc here

Parameters:
event -

notifyEventSuccess

private void notifyEventSuccess(Event event)
FIXME: finish the doc here

Parameters:
event -

onEvent

public void onEvent(Event event)
This method is invoked by the EventIpcManager when a new event is available for processing. Currently only text based messages are processed by this callback. Each message is examined for its Universal Event Identifier and the appropriate action is taking based on each UEI.

Specified by:
onEvent in interface EventListener
Parameters:
event - The event.

serviceMappingExists

private boolean serviceMappingExists(java.sql.Connection dbConn,
                                     java.lang.String ipaddr,
                                     java.lang.String serviceName)
                              throws java.sql.SQLException
FIXME: finish the doc here

Parameters:
dbConn -
ipaddr -
serviceName -
Returns:
Throws:
java.sql.SQLException

verifyServiceExists

private int verifyServiceExists(java.sql.Connection dbConn,
                                java.lang.String serviceName)
                         throws java.sql.SQLException,
                                FailedOperationException
FIXME: finish the doc here

Parameters:
dbConn -
serviceName -
Returns:
Throws:
java.sql.SQLException
FailedOperationException

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.