OpenNMS API 1.2.3

org.opennms.netmgt.poller
Class DefaultQueryManager

java.lang.Object
  extended byorg.opennms.netmgt.poller.DefaultQueryManager
All Implemented Interfaces:
QueryManager

public class DefaultQueryManager
extends java.lang.Object
implements QueryManager

Author:
brozow TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
private  DbConnectionFactory m_dbConnectionFactory
           
(package private) static java.lang.String SQL_COUNT_IFSERVICE_STATUS
          SQL statement used to query the 'ifServices' for a nodeid/ipaddr/service combination on the receipt of a 'nodeGainedService' to make sure there is atleast one row where the service status for the tuple is 'A'.
(package private) static java.lang.String SQL_COUNT_IFSERVICES_TO_POLL
          SQL statement used to count the active ifservices on the specified ip address.
(package private) static java.lang.String SQL_FETCH_IFSERVICES_TO_POLL
          SQL statement used to retrieve an active ifservice for the scheduler to poll.
(package private) static java.lang.String SQL_RETRIEVE_INTERFACES
           
(package private) static java.lang.String SQL_RETRIEVE_SERVICE_IDS
           
(package private) static java.lang.String SQL_RETRIEVE_SERVICE_STATUS
           
 
Constructor Summary
DefaultQueryManager()
           
 
Method Summary
 boolean activeServiceExists(java.lang.String whichEvent, int nodeId, java.lang.String ipAddr, java.lang.String serviceName)
           
 void buildServiceNameToIdMaps(java.util.Map nameToId, java.util.Map idToName)
           
 java.sql.Timestamp convertEventTimeToTimeStamp(java.lang.String time)
           
 java.util.List getActiveServiceIdsForInterface(java.lang.String ipaddr)
           
private  java.sql.Connection getConnection()
           
 java.util.List getInterfacesWithService(java.lang.String svcName)
           
 int getNodeIDForInterface(java.lang.String ipaddr)
           
 java.lang.String getNodeLabel(int nodeId)
           
 int getServiceCountForInterface(java.lang.String ipaddr)
           
 java.util.Date getServiceLostDate(int nodeId, java.lang.String ipAddr, java.lang.String svcName, int serviceId)
           
 void openOutage(java.lang.String outageIdSQL, int nodeId, java.lang.String ipAddr, int serviceId, int dbId, java.lang.String time)
           
 void reparentOutages(java.lang.String ipAddr, int oldNodeId, int newNodeId)
           
 void resolveOutage(int nodeId, java.lang.String ipAddr, int serviceId, int dbId, java.lang.String time)
           
 void setDbConnectionFactory(DbConnectionFactory dbConnectionFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQL_RETRIEVE_INTERFACES

static final java.lang.String SQL_RETRIEVE_INTERFACES
See Also:
Constant Field Values

SQL_RETRIEVE_SERVICE_IDS

static final java.lang.String SQL_RETRIEVE_SERVICE_IDS
See Also:
Constant Field Values

SQL_RETRIEVE_SERVICE_STATUS

static final java.lang.String SQL_RETRIEVE_SERVICE_STATUS
See Also:
Constant Field Values

SQL_COUNT_IFSERVICE_STATUS

static final java.lang.String SQL_COUNT_IFSERVICE_STATUS
SQL statement used to query the 'ifServices' for a nodeid/ipaddr/service combination on the receipt of a 'nodeGainedService' to make sure there is atleast one row where the service status for the tuple is 'A'.

See Also:
Constant Field Values

SQL_COUNT_IFSERVICES_TO_POLL

static final java.lang.String SQL_COUNT_IFSERVICES_TO_POLL
SQL statement used to count the active ifservices on the specified ip address.

See Also:
Constant Field Values

SQL_FETCH_IFSERVICES_TO_POLL

static final java.lang.String SQL_FETCH_IFSERVICES_TO_POLL
SQL statement used to retrieve an active ifservice for the scheduler to poll.

See Also:
Constant Field Values

m_dbConnectionFactory

private DbConnectionFactory m_dbConnectionFactory
Constructor Detail

DefaultQueryManager

public DefaultQueryManager()
Method Detail

activeServiceExists

public boolean activeServiceExists(java.lang.String whichEvent,
                                   int nodeId,
                                   java.lang.String ipAddr,
                                   java.lang.String serviceName)
Specified by:
activeServiceExists in interface QueryManager
Parameters:
whichEvent -
nodeId -
ipAddr -
serviceName -
Returns:

getConnection

private java.sql.Connection getConnection()
                                   throws java.sql.SQLException
Throws:
java.sql.SQLException

buildServiceNameToIdMaps

public void buildServiceNameToIdMaps(java.util.Map nameToId,
                                     java.util.Map idToName)
Specified by:
buildServiceNameToIdMaps in interface QueryManager
Parameters:
nameToId -
idToName -
Returns:

getActiveServiceIdsForInterface

public java.util.List getActiveServiceIdsForInterface(java.lang.String ipaddr)
                                               throws java.sql.SQLException
Specified by:
getActiveServiceIdsForInterface in interface QueryManager
Parameters:
ipaddr -
Returns:
Throws:
java.sql.SQLException

getNodeIDForInterface

public int getNodeIDForInterface(java.lang.String ipaddr)
                          throws java.sql.SQLException
Specified by:
getNodeIDForInterface in interface QueryManager
Parameters:
ipaddr -
Returns:
Throws:
java.sql.SQLException

getNodeLabel

public java.lang.String getNodeLabel(int nodeId)
                              throws java.sql.SQLException
Specified by:
getNodeLabel in interface QueryManager
Parameters:
nodeId -
Returns:
Throws:
java.sql.SQLException

getServiceCountForInterface

public int getServiceCountForInterface(java.lang.String ipaddr)
                                throws java.sql.SQLException
Specified by:
getServiceCountForInterface in interface QueryManager
Parameters:
ipaddr -
Returns:
Throws:
java.sql.SQLException

getInterfacesWithService

public java.util.List getInterfacesWithService(java.lang.String svcName)
                                        throws java.sql.SQLException
Specified by:
getInterfacesWithService in interface QueryManager
Parameters:
svcName -
Returns:
Throws:
java.sql.SQLException

getServiceLostDate

public java.util.Date getServiceLostDate(int nodeId,
                                         java.lang.String ipAddr,
                                         java.lang.String svcName,
                                         int serviceId)
Specified by:
getServiceLostDate in interface QueryManager
Parameters:
nodeId -
ipAddr -
svcName -
Returns:

setDbConnectionFactory

public void setDbConnectionFactory(DbConnectionFactory dbConnectionFactory)
Specified by:
setDbConnectionFactory in interface QueryManager
Parameters:
dbConnectionFactory -

convertEventTimeToTimeStamp

public java.sql.Timestamp convertEventTimeToTimeStamp(java.lang.String time)

openOutage

public void openOutage(java.lang.String outageIdSQL,
                       int nodeId,
                       java.lang.String ipAddr,
                       int serviceId,
                       int dbId,
                       java.lang.String time)
Specified by:
openOutage in interface QueryManager
Parameters:
nodeId -
ipAddr -
serviceId -
dbId -
time -

resolveOutage

public void resolveOutage(int nodeId,
                          java.lang.String ipAddr,
                          int serviceId,
                          int dbId,
                          java.lang.String time)
Specified by:
resolveOutage in interface QueryManager
Parameters:
nodeId -
ipAddr -
serviceId -
dbId -
time -

reparentOutages

public void reparentOutages(java.lang.String ipAddr,
                            int oldNodeId,
                            int newNodeId)
Specified by:
reparentOutages in interface QueryManager
Parameters:
ipAddr -
oldNodeId -
newNodeId -

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.