OpenNMS API 1.2.9

## org.opennms.netmgt.capsd
Class JDBCPlugin

    java.lang.Object
      org.opennms.netmgt.capsd.AbstractPlugin
          org.opennms.netmgt.capsd.JDBCPlugin

All Implemented Interfaces:
  Plugin

Direct Known Subclasses:
  JDBCStoredProcedurePlugin

public class JDBCPlugin
extends AbstractPlugin

This OpenNMS capsd plugin checks if a given server is running a server that can talk JDBC on a given interface. If true then the interface is "saved" for future service state checking. This plugin is slow; Establishing a connection between the client and the server is an slow operation. A connection pool doesn't make any sense when discovering a database, Also opening and closing a connection every time helps to discover problems like a RDBMS running out of connections.

More plugin information available at: OpenNMS developer site

Since:
  0.1
Version:
  0.1 - 07/22/2002
Author:
  Jose Vicente Nunez Zuleta (josevnz@users.sourceforge.net) - RHCE, SJCD, SJCP

Field Summary
`private static int` `DEFAULT_RETRY` Default number of retries for TCP requests
`private static int` `DEFAULT_TIMEOUT` Default timeout (in milliseconds) for TCP requests
`private static java.lang.String` `PROTOCOL_NAME` The protocol supported by the plugin

Constructor Summary
`JDBCPlugin()` Class constructor.

Method Summary
`boolean` `checkStatus(org.apache.log4j.Category log, java.sql.Connection con, java.util.Map qualifiers)`
`java.lang.String` `getProtocolName()` Returns the default protocol name
`boolean` `isProtocolSupported(java.net.InetAddress address)` Default checking method, asuming all the parameters by default.
`boolean` `isProtocolSupported(java.net.InetAddress address, java.util.Map qualifiers)` Checking method, receives all the parameters as a Map.
`private boolean` `isServer(java.lang.String hostname, java.util.Map qualifiers)` Checks if a given server is listening o a given interface

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROTOCOL_NAME

    private static final java.lang.String PROTOCOL_NAME

  The protocol supported by the plugin

  See Also:
    Constant Field Values

### DEFAULT_RETRY

    private static final int DEFAULT_RETRY

  Default number of retries for TCP requests

  See Also:
    Constant Field Values

### DEFAULT_TIMEOUT

    private static final int DEFAULT_TIMEOUT

  Default timeout (in milliseconds) for TCP requests

  See Also:
    Constant Field Values

Constructor Detail

### JDBCPlugin

    public JDBCPlugin()

  Class constructor. Load the JDBC drivers.

Method Detail

### isServer

    private boolean isServer(java.lang.String hostname,
                             java.util.Map qualifiers)

  Checks if a given server is listening o a given interface

  Parameters:
    `hostname` - name of the RDBMS server
    `qualifiers` - Map of parameters.
  See Also:
    `DBTools.constructUrl(java.lang.String, java.lang.String)`

### checkStatus

    public boolean checkStatus(org.apache.log4j.Category log,
                               java.sql.Connection con,
                               java.util.Map qualifiers)

### getProtocolName

    public java.lang.String getProtocolName()

  Returns the default protocol name

  Specified by:
    `getProtocolName` in interface `Plugin`
  Specified by:
    `getProtocolName` in class `AbstractPlugin`
  Returns:
    String Protocol Name

### isProtocolSupported

    public boolean isProtocolSupported(java.net.InetAddress address)

  Default checking method, asuming all the parameters by default. This method is likely to skip some machines because the default password is empty. is recomended to use the parametric method instead (unless your DBA is dummy enugh to leave a JDBC server with no password!!!).

  Specified by:
    `isProtocolSupported` in interface `Plugin`
  Specified by:
    `isProtocolSupported` in class `AbstractPlugin`
  Parameters:
    `address` - Address of the JDBC server to poll
  Returns:
    True if a JDBC server is running on this server, false otherwise

### isProtocolSupported

    public boolean isProtocolSupported(java.net.InetAddress address,
                                       java.util.Map qualifiers)

  Checking method, receives all the parameters as a Map. Currently supported:
  - port - Port where the JDBC server is listening (defaults to DEFAULT_PORT). Type: Integer
  - user - Database user (defaults to DEFAULT_DATABASE_USER if not provided). Type String
  - password - Database password (defaults to DEFAULT_DATABASE_PASSWORD). Type String
  - timeout - Timeout
  - retry - How many times will try to check for the service

  Specified by:
    `isProtocolSupported` in interface `Plugin`
  Specified by:
    `isProtocolSupported` in class `AbstractPlugin`
  Parameters:
    `address` - Address of the JDBC server to poll
    `qualifiers` - Set of properties to be passed to the JDBC driver.
  Returns:
    True if a JDBC server is running on this server, false otherwise
  Throws:
    `java.lang.NullPointerException` - if the properties or the address are not defined

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.