com.facetmap.sql
Class ConnectionPoolManager

java.lang.Object
  extended by com.facetmap.sql.ConnectionPoolManager
All Implemented Interfaces:
ConnectionManager

public class ConnectionPoolManager
extends java.lang.Object
implements ConnectionManager

Pools a number of connections specified by properties, and reuses connections from the pool. Required properties are:

  • com.facetmap.sql.jdbcDriver - fully-qualified name of the driver class
  • com.facetmap.sql.jdbcUrl - JDBC-protocol URL of the database to use, for example jdbc:mysql://localhost:3306/databaseName?user=facetmap

  • Nested Class Summary
     
    Nested classes/interfaces inherited from interface com.facetmap.sql.ConnectionManager
    ConnectionManager.Basic, ConnectionManager.DataSourceWrapper
     
    Field Summary
    protected  java.lang.String poolName
               
    protected  java.lang.String poolUrl
               
     
    Constructor Summary
    ConnectionPoolManager(java.util.Properties props)
               
    ConnectionPoolManager(java.lang.String poolName, java.util.Properties props)
               
     
    Method Summary
     java.sql.Connection getConnection()
               
     java.lang.String getConnectionUrl()
               
     java.lang.String getPoolName()
               
     void install(java.util.Properties props)
               
     java.lang.String registerDriver(java.lang.String poolName, java.lang.String underlyingJdbcUrl)
               
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    poolName

    protected java.lang.String poolName

    poolUrl

    protected java.lang.String poolUrl
    Constructor Detail

    ConnectionPoolManager

    public ConnectionPoolManager(java.util.Properties props)
                          throws DataException
    Throws:
    DataException

    ConnectionPoolManager

    public ConnectionPoolManager(java.lang.String poolName,
                                 java.util.Properties props)
                          throws DataException
    Throws:
    DataException
    Method Detail

    getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException
    Specified by:
    getConnection in interface ConnectionManager
    Throws:
    java.sql.SQLException

    install

    public void install(java.util.Properties props)
                 throws DataException
    Parameters:
    props - com.facetmap.sql properties representing the connections to be pooled
    Throws:
    DataException

    registerDriver

    public java.lang.String registerDriver(java.lang.String poolName,
                                           java.lang.String underlyingJdbcUrl)
    Parameters:
    underlyingJdbcUrl - The url of the connections to be pooled
    Returns:
    the jdbc url of the newly registered Connection pool

    getPoolName

    public java.lang.String getPoolName()

    getConnectionUrl

    public java.lang.String getConnectionUrl()