OpenNMS API 1.2.9

org.opennms.netmgt.config
Class LegacyDbConnectionFactory

java.lang.Object
  extended byorg.opennms.netmgt.config.LegacyDbConnectionFactory
All Implemented Interfaces:
DbConnectionFactory

public final class LegacyDbConnectionFactory
extends java.lang.Object
implements DbConnectionFactory

This is the singleton class used to load the OpenNMS database configuration from the opennms-database.xml. This provides convenience methods to create database connections to the database configured in this default xml

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

Author:
Brian Weaver , OpenNMS

Nested Class Summary
(package private) static class LegacyDbConnectionFactory.CachedConnection
          This class is used to represent a cached database connection within this factory.
 
Field Summary
private  java.util.LinkedList m_dbcCache
          The linked list of cached connections that are reused if the garbage collector has not finalized them yet.
private  DbConfiguration m_dbConfig
          Configuation of the database
private static int MAX_AGE
          The maximum age before a connection is closed
 
Constructor Summary
LegacyDbConnectionFactory(DbConfiguration dbConfig)
           
 
Method Summary
 java.sql.Connection getConnection()
          Return a new database connection to the database configured in the opennms-database.xml.
private  java.lang.String getDriverPass()
           
private  java.lang.String getDriverUrl()
           
private  java.lang.String getDriverUser()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_AGE

private static final int MAX_AGE
The maximum age before a connection is closed

See Also:
Constant Field Values

m_dbConfig

private DbConfiguration m_dbConfig
Configuation of the database


m_dbcCache

private java.util.LinkedList m_dbcCache
The linked list of cached connections that are reused if the garbage collector has not finalized them yet.

Constructor Detail

LegacyDbConnectionFactory

public LegacyDbConnectionFactory(DbConfiguration dbConfig)
                          throws java.lang.ClassNotFoundException
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Return a new database connection to the database configured in the opennms-database.xml. The database connection is not managed by the factory and must be release by the caller by using the close method.

Specified by:
getConnection in interface DbConnectionFactory
Returns:
a new database connection to the database configured in the opennms-database.xml
Throws:
java.sql.SQLException - Thrown if there is an error opening the connection to the database.

getDriverUrl

private java.lang.String getDriverUrl()

getDriverUser

private java.lang.String getDriverUser()

getDriverPass

private java.lang.String getDriverPass()

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.