com.pow2.dao
Class ConnectionProvider

java.lang.Object
  extended bycom.pow2.dao.ConnectionProvider
Direct Known Subclasses:
JakartaConnectionProvider, ProtomatterConnectionProvider, SimpleConnectionProvider

public abstract class ConnectionProvider
extends Object

ConnectionProvider base class.
To create a ConnectionProvider for your preferred ConnectionPooler, extend this calss and implement initialize and getConnection methods.

Author:
Luca Fossato

Field Summary
protected  org.apache.log4j.Category cat
          Log4j category
protected  ConnectionProviderPrefs prefs
          ConnectionProvider preferences
 
Constructor Summary
ConnectionProvider()
          Constructor for the ConnectionProvider object.
 
Method Summary
protected abstract  Connection getConnection()
          Get a JDBC Connection.
protected  Connection getConnection(int isolationLevel)
          Get a "transactional" JDBC connection.
protected  String getLastToken(String str, String tokenSeparator)
          Get the last token from the input string.
 ConnectionProviderPrefs getPrefs()
          Gets the prefs attribute of the ConnectionProvider object
protected abstract  void init()
          Initialize the connection pool provider.
 void setPrefs(ConnectionProviderPrefs prefs)
          Sets the prefs attribute of the ConnectionProvider object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cat

protected org.apache.log4j.Category cat
Log4j category


prefs

protected ConnectionProviderPrefs prefs
ConnectionProvider preferences

Constructor Detail

ConnectionProvider

public ConnectionProvider()
                   throws Exception
Constructor for the ConnectionProvider object.

Throws:
Exception - Description of the Exception
Method Detail

getPrefs

public ConnectionProviderPrefs getPrefs()
Gets the prefs attribute of the ConnectionProvider object

Returns:
The prefs value

setPrefs

public void setPrefs(ConnectionProviderPrefs prefs)
Sets the prefs attribute of the ConnectionProvider object

Parameters:
prefs - The new prefs value

init

protected abstract void init()
                      throws Exception
Initialize the connection pool provider.

Throws:
Exception - Description of the Exception

getConnection

protected abstract Connection getConnection()
                                     throws SQLException
Get a JDBC Connection.

Returns:
a JDBC Connection
Throws:
SQLException - Description of the Exception

getConnection

protected Connection getConnection(int isolationLevel)
                            throws SQLException
Get a "transactional" JDBC connection.

Parameters:
isolationLevel - the isolation level to set the connection to
Returns:
the new "transactional" connection object
Throws:
SQLException - if any error occurs

getLastToken

protected String getLastToken(String str,
                              String tokenSeparator)
Get the last token from the input string.

Parameters:
str - the string containing the token
tokenSeparator - the token separator string (i.e.: "'", ":", etc)
Returns:
the last token from the input string


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.