com.funambol.email.inboxlistener.engine
Class DBConnectionProvider

java.lang.Object
  extended by com.funambol.email.inboxlistener.engine.DBConnectionProvider

public class DBConnectionProvider
extends java.lang.Object

Provides a db connection pool using a org.apache.commons.dbcp.BasicDataSource. It's a singleton class but it must be configured calling the method configure(BasicDataSource)


Method Summary
static void close()
          Closes the datasource
protected static void configure(org.apache.commons.dbcp.BasicDataSource ds)
          Configures the DBConnectionProvider instance.
static java.sql.Connection getConnection()
          Returns an available connection
static int getMaxActive()
          Returns the max active cnnections of the DBConnectionProvider
static int getMaxIdle()
          Returns the max idle cnnections of the DBConnectionProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public static java.sql.Connection getConnection()
                                         throws java.sql.SQLException
Returns an available connection

Returns:
an available connection
Throws:
java.sql.SQLException - if an error occurs

close

public static void close()
                  throws java.sql.SQLException
Closes the datasource

Throws:
java.sql.SQLException - if an error occurs

getMaxActive

public static int getMaxActive()
Returns the max active cnnections of the DBConnectionProvider

Returns:
the max active cnnections of the DBConnectionProvider

getMaxIdle

public static int getMaxIdle()
Returns the max idle cnnections of the DBConnectionProvider

Returns:
the max idle cnnections of the DBConnectionProvider

configure

protected static void configure(org.apache.commons.dbcp.BasicDataSource ds)
                         throws java.sql.SQLException
Configures the DBConnectionProvider instance. This is protected so just the class in this package (like the PushListener) can configure it.

Parameters:
ds - the BasicDataSource
Throws:
java.sql.SQLException - if an error occurs


Copyright © 2005-2006 Funambol.