|
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.config.CapsdConfigFactory
This is the singleton class used to load the configuration for the OpenNMS Capsd service from the capsd-configuration xml file. Note: Users of this class should make sure the init() is called before calling any other method to ensure the config is loaded before accessing other convenience methods.
Nested Class Summary | |
private static class |
CapsdConfigFactory.LightWeightIfEntry
LightWeightIfEntry is designed to hold specific information about an IP interface in the database such as its IP address, its parent node id, and its managed status and represents a lighter weight version of the DbIpInterfaceEntry class. |
static class |
CapsdConfigFactory.ProtocolInfo
This class is used to encapsulate the basic protocol information read from the config file. |
Field Summary | |
static java.lang.Integer |
AUTO_SET
This integer value is used to represent the state when the protocol should be automatically set, with any status checks. |
private static char |
COMMENT_CHAR
This character at the start of a line indicates a comment line in a URL file |
private static java.lang.String |
COMMENT_STR
The string indicating the start of the comments in a line containing the IP address in a file URL |
private static java.lang.String |
DELETE_IFSERVICES_SQL
The SQL statement used to mark all ifservices table entries which refer to the specified serviceId as deleted. |
private static java.lang.String |
DELETE_OUTAGES_SQL
The SQL statement used to delete all entries from the outage table which refer to the specified serviceId |
static int |
LAME_SNMP_HOST_IFINDEX
This integer value is used to represent the primary snmp interface ifindex in the ipinterface table for SNMP hosts that don't support the MIB2 ipAddrTable |
private CapsdConfiguration |
m_config
The config class loaded from the config file |
private static boolean |
m_loaded
This member is set to true if the configuration file has been loaded. |
private static java.util.Map |
m_plugins
The map of capsd plugins. |
private static java.util.Map |
m_serviceIds
The map of service identifiers, mapped by the service id and name. |
private static CapsdConfigFactory |
m_singleton
The singleton instance of this factory |
private java.util.Map |
m_urlMap
Maps url names to a list of addresses specified by the url. |
private static java.lang.String |
NEXT_SVC_ID_SQL
The SQL statement used to get the next value for a service identifier. |
private static java.lang.String |
RETRIEVE_IPADDR_NODEID_SQL
The SQL statement used to determine if an IP address is already in the ipInterface table and if so what its parent nodeid is. |
private static java.lang.String |
RETRIEVE_IPADDR_SQL
The SQL statement used to determine if an IP address is already in the ipInterface table and there is known. |
static java.lang.Integer |
SCAN
The integer value that is used to represent the protocol scan configuration. |
static java.lang.Integer |
SKIP
This integer value is used to represent that the protocol plugin should not be used to scan the interface. |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_IF_SERVICES
The SQL statement used to retrieve all non-deleted/non-forced unamanaged services for a nodeid/ip from the 'ifservices' table. |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_IP_INTERFACE
The SQL statement used to retrieve all non-deleted/non-forced unamanaged IP interfaces from the 'ipInterface' table. |
(package private) static java.lang.String |
SQL_DB_RETRIEVE_IP_INTERFACE_IN_LOCAL_SERVER
The SQL statement used to retrieve all non-deleted/non-forced unamanaged IP interfaces from the 'ipInterface' table with the local OpenNMS server restriction. |
private static java.lang.String |
SQL_DB_RETRIEVE_SNMP_IP_INTERFACES
SQL statement to retrieve all non-deleted IP addresses from the ipInterface table which support SNMP. |
(package private) static java.lang.String |
SQL_DB_UPDATE_ALL_SERVICES_FOR_NIP
The SQL statement which updates the 'status' field in the ifServices table for a specific node/ipAddr pair |
(package private) static java.lang.String |
SQL_DB_UPDATE_IP_INTERFACE
The SQL statement which updates the 'isManaged' field in the ipInterface table for a specific node/ipAddr pair |
(package private) static java.lang.String |
SQL_DB_UPDATE_SERVICE_FOR_NIP
|
private static java.lang.String |
SQL_DB_UPDATE_SNMP_PRIMARY_STATE
SQL statement used to update the 'isSnmpPrimary' field of the ipInterface table. |
private static java.lang.String |
SVCTBL_ADD_SQL
The SQL statement used to add a new entry into the service table |
private static java.lang.String |
SVCTBL_LOAD_SQL
The SQL statement used to load the currenly defined service table. |
Constructor Summary | |
private |
CapsdConfigFactory(java.lang.String configFile)
Constructs a new CapsdConfigFactory object for access to the Capsd configuration information. |
Method Summary | |
boolean |
getAbortProtocolScansFlag()
Defines Capsd's behavior when, during a protocol scan, it gets a java.net.NoRouteToHostException exception. |
private java.util.List |
getAddressesFromURL(java.lang.String url)
The file URL is read and a 'specific IP' is added for each entry in this file. |
CapsdConfiguration |
getConfiguration()
Return the Capsd configuration object. |
boolean |
getDeletePropagationEnabled()
|
long |
getInitialSleepTime()
|
static CapsdConfigFactory |
getInstance()
Return the singleton instance of this factory. |
int |
getInterfaceDbNodeId(java.sql.Connection dbConn,
java.net.InetAddress ifAddress,
int ifIndex)
|
int |
getMaxRescanThreadPoolSize()
|
int |
getMaxSuspectThreadPoolSize()
|
CapsdConfigFactory.ProtocolInfo[] |
getProtocolSpecification(java.net.InetAddress address)
Returns the list of protocol plugins and the associated actions for the named address. |
long |
getRescanFrequency()
|
java.lang.Object |
getServiceIdentifier(java.lang.Object key)
Returns the protocol identifier from the service table that was loaded during class initialization. |
SmbAuth |
getSmbAuth(java.lang.String target)
Finds the SMB authentication object using the netbios name. |
java.lang.String |
getXmlrpc()
Return the boolean xmlrpc as string to indicate if notification to external xmlrpc server is needed. |
static void |
init()
Load the config from the default config file and create the singleton instance of this factory. |
boolean |
isAddressUnmanaged(java.net.InetAddress target)
Checks the configuration to determine if the target is managed or unmanaged. |
boolean |
isInterfaceInDB(java.sql.Connection dbConn,
java.net.InetAddress ifAddress)
|
static void |
reload()
Reload the config from the default config file |
void |
syncManagementState(java.sql.Connection conn)
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(java.sql.Connection conn)
This method is responsible for sync'ing the content of the 'service' table with the protocols listed in the caspd-configuration.xml file. |
void |
syncSnmpPrimaryState(java.sql.Connection conn)
Responsible for syncing up the 'isPrimarySnmp' field of the ipInterface table based on the capsd and collectd configurations. |
private static long |
toLong(java.net.InetAddress addr)
Deprecated. Use org.opennms.netmgt.utils.IPSorter.convertToLong() instead. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COMMENT_STR
private static final char COMMENT_CHAR
private static boolean m_loaded
private static CapsdConfigFactory m_singleton
private CapsdConfiguration m_config
private java.util.Map m_urlMap
static final java.lang.String SQL_DB_RETRIEVE_IP_INTERFACE
static final java.lang.String SQL_DB_RETRIEVE_IP_INTERFACE_IN_LOCAL_SERVER
private static java.lang.String SQL_DB_RETRIEVE_SNMP_IP_INTERFACES
private static java.lang.String SQL_DB_UPDATE_SNMP_PRIMARY_STATE
static final java.lang.String SQL_DB_RETRIEVE_IF_SERVICES
static final java.lang.String SQL_DB_UPDATE_IP_INTERFACE
static final java.lang.String SQL_DB_UPDATE_ALL_SERVICES_FOR_NIP
static final java.lang.String SQL_DB_UPDATE_SERVICE_FOR_NIP
private static final java.lang.String RETRIEVE_IPADDR_SQL
private static final java.lang.String RETRIEVE_IPADDR_NODEID_SQL
private static final java.lang.String SVCTBL_LOAD_SQL
private static final java.lang.String SVCTBL_ADD_SQL
private static final java.lang.String NEXT_SVC_ID_SQL
private static final java.lang.String DELETE_OUTAGES_SQL
private static final java.lang.String DELETE_IFSERVICES_SQL
private static final java.util.Map m_serviceIds
private static final java.util.Map m_plugins
public static final java.lang.Integer SCAN
public static final java.lang.Integer SKIP
public static final java.lang.Integer AUTO_SET
public static final int LAME_SNMP_HOST_IFINDEX
Constructor Detail |
private CapsdConfigFactory(java.lang.String configFile) throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
configFile
- The configuration file to load.
java.io.IOException
- Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.Method Detail |
public static void init() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config file cannot be read
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.public static void reload() throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
java.io.IOException
- Thrown if the specified config file cannot be read/loaded
org.exolab.castor.xml.MarshalException
- Thrown if the file does not conform to the schema.
org.exolab.castor.xml.ValidationException
- Thrown if the contents do not match the required schema.public static CapsdConfigFactory getInstance()
java.lang.IllegalStateException
- Thrown if the factory has not yet been initialized.public CapsdConfiguration getConfiguration()
public void syncServices(java.sql.Connection conn) throws java.sql.SQLException
java.sql.SQLException
public void syncManagementState(java.sql.Connection conn) throws java.sql.SQLException
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'
conn
- Connection to the database.
java.sql.SQLException
- Thrown if an error occurs while syncing the database.public void syncSnmpPrimaryState(java.sql.Connection conn) throws java.sql.SQLException
conn
- Connection to the database.
java.sql.SQLException
- Thrown if an error occurs while syncing the database.private static long toLong(java.net.InetAddress addr)
long
value. The address is converted in network byte order
(big endin). This is compatable with the number format of the JVM, and
thus the return longs can be compared with other converted IP Addresses
to determine inclusion.
addr
- The IP address to convert.
public CapsdConfigFactory.ProtocolInfo[] getProtocolSpecification(java.net.InetAddress address)
address
- The address to get protocol information for.
public java.lang.Object getServiceIdentifier(java.lang.Object key)
key
- The value used to lookup the result in in the preloaded map.
public SmbAuth getSmbAuth(java.lang.String target)
public boolean isAddressUnmanaged(java.net.InetAddress target)
target
- The target to check against.private java.util.List getAddressesFromURL(java.lang.String url)
url
- the URL file
public boolean isInterfaceInDB(java.sql.Connection dbConn, java.net.InetAddress ifAddress) throws java.sql.SQLException
java.sql.SQLException
public int getInterfaceDbNodeId(java.sql.Connection dbConn, java.net.InetAddress ifAddress, int ifIndex) throws java.sql.SQLException
java.sql.SQLException
public long getRescanFrequency()
public long getInitialSleepTime()
public int getMaxSuspectThreadPoolSize()
public int getMaxRescanThreadPoolSize()
public boolean getAbortProtocolScansFlag()
public boolean getDeletePropagationEnabled()
public java.lang.String getXmlrpc()
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |