org.opennms.netmgt.capsd
Interface CapsdDbSyncer

All Known Implementing Classes:
JdbcCapsdDbSyncer

public interface CapsdDbSyncer


Method Summary
 Integer getServiceId(String name)
          Returns the service ID from the service table that was loaded during class initialization for the specified name.
 String getServiceName(Integer id)
          Returns the service name from the service table that was loaded during class initialization for the specified ID.
 boolean isInterfaceInDB(Connection dbConn, InetAddress ifAddress)
           
 boolean isInterfaceInDB(InetAddress ifAddress)
           
 void syncManagementState()
          Responsible for syncing up the 'isManaged' field of the ipInterface table and the 'status' field of the ifServices table based on the capsd and poller configurations.
 void syncServices()
          This method is responsible for sync'ing the content of the 'service' table with the protocols listed in the caspd-configuration.xml file.
 List<String> syncServicesTable()
          Synchronize configured services list with the database.
 void syncSnmpPrimaryState()
          Responsible for syncing up the 'isPrimarySnmp' field of the ipInterface table based on the capsd and collectd configurations.
 

Method Detail

syncServices

void syncServices()
This method is responsible for sync'ing the content of the 'service' table with the protocols listed in the caspd-configuration.xml file. First a list of services currently contained in the 'service' table in the database is built. Next, the list of services defined in capsd-configuration.xml is iterated over and if any services are defined but do not yet exist in the 'service' table they are added to the table. Finally, the list of services in the database is iterated over and if any service exists in the database but is no longer listed in the capsd-configuration.xml file then that the following occurs: 1. All 'outage' table entries which refer to the service are deleted. 2. All 'ifServices' table entries which refer to the service are deleted. Note that the 'service' table entry will remain in the database since events most likely exist which refer to the service.


syncServicesTable

List<String> syncServicesTable()
Synchronize configured services list with the database.


syncManagementState

void syncManagementState()
Responsible for syncing up the 'isManaged' field of the ipInterface table and the 'status' field of the ifServices table based on the capsd and poller configurations. Note that the 'sync' only takes place for interfaces and services that are not deleted or force unmanaged.
 Here is how the statuses are set:
  If an interface is 'unmanaged' based on the capsd configuration,
      ipManaged='U' and status='U'
 
  If an interface is 'managed' based on the capsd configuration,
    1. If the interface is not in any pacakge, ipManaged='N' and status ='N'
    2. If the interface in atleast one package but the service is not polled by
       by any of the packages, ipManaged='M' and status='N'
    3. If the interface in atleast one package and the service is polled by a
       package that this interface belongs to, ipManaged='M' and status'=A'
 
 

Parameters:
conn - Connection to the database.
Throws:
SQLException - Thrown if an error occurs while syncing the database.

syncSnmpPrimaryState

void syncSnmpPrimaryState()
Responsible for syncing up the 'isPrimarySnmp' field of the ipInterface table based on the capsd and collectd configurations. Note that the 'sync' only takes place for interfaces that are not deleted. Also, it will prefer a loopback interface over other interfaces.

Parameters:
conn - Connection to the database.
Throws:
SQLException - Thrown if an error occurs while syncing the database.

isInterfaceInDB

boolean isInterfaceInDB(InetAddress ifAddress)

isInterfaceInDB

boolean isInterfaceInDB(Connection dbConn,
                        InetAddress ifAddress)
                        throws SQLException
Throws:
SQLException

getServiceId

Integer getServiceId(String name)
Returns the service ID from the service table that was loaded during class initialization for the specified name.

Parameters:
name - the name of the service to look up
Returns:
The result of the lookup, or null if a matching service name wasn't found

getServiceName

String getServiceName(Integer id)
Returns the service name from the service table that was loaded during class initialization for the specified ID.

Parameters:
name - the ID of the service to look up
Returns:
The result of the lookup, or null if a matching service ID wasn't found


Copyright © 2009. All Rights Reserved.