OpenNMS API 1.2.9

## org.opennms.netmgt
Class DBTools

    java.lang.Object
      org.opennms.netmgt.DBTools

public class DBTools
extends java.lang.Object

This class is intended to be group some utility classes related with RDBMS and the capsd and monitoring plugins.

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` `_counter`
`private static DBTools` `_instance`
`private static java.util.regex.Pattern` `_pattern`
`static java.lang.String` `DEFAULT_DATABASE_PASSWORD` Default database password.
`static java.lang.String` `DEFAULT_DATABASE_USER` Default user to use when connecting to the database.
`static java.lang.String` `DEFAULT_JDBC_DRIVER` Default Sybase JDBC driver to use.
`static int` `DEFAULT_PORT` Default port to use to check this service.
`static java.lang.String` `DEFAULT_URL` Default vendor protocol, like jdbc:sybase:Tds:
`static java.lang.String` `JDBC_HOST` The JDBC hostname.
`static int` `MAX_PORT_VALUE` Maximun port range
`static int` `MIN_PORT_VALUE` Minimal port range

Constructor Summary
`private` `DBTools()` Hide the constructor, this class follows the "Singleton" pattern.

Method Summary
`static java.lang.String` `constructUrl(java.lang.String url_, java.lang.String hostname_)` Constructs a JDBC url given a set of fragments.
`static DBTools` `getInstance()` Returns a single instance of this class to the caller.
`int` `getNumberOfInstances()` Return how many instances of this objects are loaded now

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

Field Detail

### _counter

    private static int _counter

### _instance

    private static DBTools _instance

### JDBC_HOST

    public static final java.lang.String JDBC_HOST

  The JDBC hostname. This token is replaced when the url is constructed.

  See Also:
    `constructUrl(java.lang.String, java.lang.String)`, Constant Field Values

### MIN_PORT_VALUE

    public static int MIN_PORT_VALUE

  Minimal port range

### MAX_PORT_VALUE

    public static int MAX_PORT_VALUE

  Maximun port range

### DEFAULT_JDBC_DRIVER

    public static final java.lang.String DEFAULT_JDBC_DRIVER

  Default Sybase JDBC driver to use. Defults to 'com.sybase.jdbc2.jdbc.SybDriver'

  See Also:
    Constant Field Values

### DEFAULT_DATABASE_USER

    public static final java.lang.String DEFAULT_DATABASE_USER

  Default user to use when connecting to the database. Defaults to 'sa'

  See Also:
    Constant Field Values

### DEFAULT_PORT

    public static final int DEFAULT_PORT

  Default port to use to check this service. Defaults to '4100' Make sure than is less than MAX_PORT_VALUE and greather than MIN_PORT_VALUE

  See Also:
    `MIN_PORT_VALUE`, `MAX_PORT_VALUE`, Constant Field Values

### DEFAULT_DATABASE_PASSWORD

    public static final java.lang.String DEFAULT_DATABASE_PASSWORD

  Default database password. Should be empty. You should not put a database password here (or event worst, harcode it in the code) Instead call the class method that accepts a map

  See Also:
    Constant Field Values

### DEFAULT_URL

    public static final java.lang.String DEFAULT_URL

  Default vendor protocol, like jdbc:sybase:Tds:

  See Also:
    Constant Field Values

### _pattern

    private static final java.util.regex.Pattern _pattern

Constructor Detail

### DBTools

    private DBTools()

  Hide the constructor, this class follows the "Singleton" pattern.

Method Detail

### getInstance

    public static DBTools getInstance()

  Returns a single instance of this class to the caller. We do not want multplie copies of this class loaded, just one.

  Returns:
    DBTools A class instance

### getNumberOfInstances

    public int getNumberOfInstances()

  Return how many instances of this objects are loaded now

  Returns:
    int Nnumber of instances on this JVM

### constructUrl

    public static java.lang.String constructUrl(java.lang.String url_,
                                                java.lang.String hostname_)
                                         throws java.lang.IllegalArgumentException,
                                                java.lang.NullPointerException

  Constructs a JDBC url given a set of fragments. The resulting Url will have the form:
  `jdbc:<protocol:hostname:4100`

  Parameters:
    `hostname_` - The hostname where the database server is
    `url_` - (for example jdbc:sybase:Tds:@{link #JDBC_HOST JDBC_HOST}:4100/tempdb). The JDBC_HOST is replaced by the real hostname
  Throws:
    `java.lang.NullPointerException` - If one of the arguments is null
    `java.lang.IllegalArgumentException` - If the JDBC_HOST is not part of the JDBC url

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.