Class DBTools


  • public abstract 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
    • Constructor Summary

      Constructors 
      Constructor Description
      DBTools()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String constructUrl​(java.lang.String url_, java.lang.String hostname_)
      Constructs a JDBC url given a set of fragments.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MIN_PORT_VALUE

        public static final int MIN_PORT_VALUE
        Minimal port range
        See Also:
        Constant Field Values
      • MAX_PORT_VALUE

        public static final int MAX_PORT_VALUE
        Maximum port range
        See Also:
        Constant Field Values
      • DEFAULT_JDBC_DRIVER

        public static final java.lang.String DEFAULT_JDBC_DRIVER
        Default Sybase JDBC driver to use. Defaults to 'com.sybase.jdbc2.jdbc.SybDriver'
        See Also:
        Constant Field Values
      • POSTGRESQL_JDBC_DRIVER

        public static final java.lang.String POSTGRESQL_JDBC_DRIVER
        PostgreSQL JDBC driver
        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_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, hardcode 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:postgresql
        See Also:
        Constant Field Values
    • Constructor Detail

      • DBTools

        public DBTools()
    • Method Detail

      • 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 #OPENNMS_JDBC_HOSTNAME OPENNMS_JDBC_HOSTNAME}:4100/tempdb). The OPENNMS_JDBC_HOSTNAME is replaced by the real hostname
        Returns:
        a String object.
        Throws:
        java.lang.NullPointerException - If one of the arguments is null
        java.lang.IllegalArgumentException - If the OPENNMS_JDBC_HOSTNAME is not part of the JDBC url