ParkNPark.middletier
Class DatabaseManager

java.lang.Object
  extended by ParkNPark.middletier.DatabaseManager

public class DatabaseManager
extends Object

Manages the server's database parameters


Field Summary
protected  WeakHashMap<Connection,Object> connections
          Weak set of references to our created connections so that we can hose them upon request
private  String jdbcDriver
          The JDBC driver class
private  String jdbcPassword
          The password
private  String jdbcURL
          The JDBC URL
private  String jdbcUsername
          The user name
 
Constructor Summary
DatabaseManager(String jdbcURL, String jdbcUsername, String jdbcPassword)
          Create the database manager and initialize the JDBC driver
 
Method Summary
 Connection getConnection()
          Returns a new database connection using the database manager's current configuration
 void hoseConnection()
          Hose all current and future connections
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jdbcDriver

private String jdbcDriver
The JDBC driver class


jdbcURL

private String jdbcURL
The JDBC URL


jdbcUsername

private String jdbcUsername
The user name


jdbcPassword

private String jdbcPassword
The password


connections

protected WeakHashMap<Connection,Object> connections
Weak set of references to our created connections so that we can hose them upon request

Constructor Detail

DatabaseManager

public DatabaseManager(String jdbcURL,
                       String jdbcUsername,
                       String jdbcPassword)
Create the database manager and initialize the JDBC driver

Parameters:
jdbcURL - The JDBC URL to use in the database connection
jdbcUsername - The username to use in the database connection
jdbcPassword - The password to use in the database connection
Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Returns a new database connection using the database manager's current configuration

Returns:
A new database connection using the database manager's current configuration
Throws:
SQLException - Thrown when a problem arises while creating a new connection to the database

hoseConnection

public void hoseConnection()
Hose all current and future connections