org.deegree.commons.jdbc
Class ConnectionManager

java.lang.Object
  extended by org.deegree.commons.jdbc.ConnectionManager

public class ConnectionManager
extends java.lang.Object

Entry point for accessing JDBC connections in deegree that are defined in JDBC configuration files.

Configuration of JDBC connections used in deegree is based on simple string identifiers: each configured JDBC connection has a unique identifier. This class allows the retrieval of connections based on their identifier.

Version:
$Revision: $, $Date: $
Author:
Markus Schneider, last edited by: $Author: schneider $

Constructor Summary
ConnectionManager()
           
 
Method Summary
static void addConnection(JDBCConnection jaxbConn, java.lang.String connId)
          Adds a connection pool from the given pool definition.
static void addConnection(java.lang.String connId, java.lang.String url, java.lang.String user, java.lang.String password, int poolMinSize, int poolMaxSize)
          Adds a connection pool as specified in the parameters.
static void addConnection(java.net.URL jdbcConfigUrl, java.lang.String connId)
          Adds the connection pool defined in the given file.
static void destroy()
           
static java.sql.Connection getConnection(java.lang.String id)
          Returns a connection from the connection pool with the given id.
static java.util.Set<java.lang.String> getConnectionIds()
           
static void init(java.io.File jdbcDir)
          Initializes the ConnectionManager by loading all JDBC pool configurations from the given directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionManager

public ConnectionManager()
Method Detail

init

public static void init(java.io.File jdbcDir)
Initializes the ConnectionManager by loading all JDBC pool configurations from the given directory.

Parameters:
jdbcDir -

destroy

public static void destroy()

getConnection

public static java.sql.Connection getConnection(java.lang.String id)
                                         throws java.sql.SQLException
Returns a connection from the connection pool with the given id.

Parameters:
id - id of the connection pool
Returns:
connection from the corresponding connection pool
Throws:
java.sql.SQLException - if the connection pool is unknown or a SQLException occurs creating the connection

addConnection

public static void addConnection(java.net.URL jdbcConfigUrl,
                                 java.lang.String connId)
                          throws javax.xml.bind.JAXBException
Adds the connection pool defined in the given file.

Parameters:
jdbcConfigUrl -
connId -
Throws:
javax.xml.bind.JAXBException

addConnection

public static void addConnection(JDBCConnection jaxbConn,
                                 java.lang.String connId)
Adds a connection pool from the given pool definition.

Parameters:
jaxbConn -
connId -

addConnection

public static void addConnection(java.lang.String connId,
                                 java.lang.String url,
                                 java.lang.String user,
                                 java.lang.String password,
                                 int poolMinSize,
                                 int poolMaxSize)
Adds a connection pool as specified in the parameters.

Parameters:
connId -
url -
user -
password -
poolMinSize -
poolMaxSize -

getConnectionIds

public static java.util.Set<java.lang.String> getConnectionIds()
Returns:
all currently available connection ids


Copyright © 2011. All Rights Reserved.