Package org.opennms.core.utils
Class DBTools
- java.lang.Object
-
- org.opennms.core.utils.DBTools
-
public abstract class DBTools extends 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
Fields Modifier and Type Field Description static String
DEFAULT_DATABASE_PASSWORD
Default database password.static String
DEFAULT_DATABASE_USER
Default user to use when connecting to the database.static String
DEFAULT_JDBC_DRIVER
Default Sybase JDBC driver to use.static String
DEFAULT_URL
Default vendor protocol, like jdbc:postgresqlstatic int
MAX_PORT_VALUE
Maximum port rangestatic int
MIN_PORT_VALUE
Minimal port rangestatic String
POSTGRESQL_JDBC_DRIVER
PostgreSQL JDBC driver
-
Constructor Summary
Constructors Constructor Description DBTools()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
constructUrl(String url_, String hostname_)
Constructs a JDBC url given a set of fragments.
-
-
-
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 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 String POSTGRESQL_JDBC_DRIVER
PostgreSQL JDBC driver- See Also:
- Constant Field Values
-
DEFAULT_DATABASE_USER
public static final 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 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 String DEFAULT_URL
Default vendor protocol, like jdbc:postgresql- See Also:
- Constant Field Values
-
-
Method Detail
-
constructUrl
public static String constructUrl(String url_, String hostname_) throws IllegalArgumentException, 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 isurl_
- (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:
NullPointerException
- If one of the arguments is nullIllegalArgumentException
- If the OPENNMS_JDBC_HOSTNAME is not part of the JDBC url
-
-