org.logicalcobwebs.proxool
Class ProxoolAdapter

java.lang.Object
  extended by org.logicalcobwebs.proxool.ProxoolAdapter
All Implemented Interfaces:
ConnectionAdapterIF, ConfigurationListenerIF

public class ProxoolAdapter
extends java.lang.Object
implements ConnectionAdapterIF, ConfigurationListenerIF

Provides Proxool connections to the ScriptFacade

Since:
Proxool 0.5
Version:
$Revision: 1.21 $, $Date: 2003/03/04 10:24:40 $
Author:
Bill Horsman (bill@logicalcobwebs.co.uk), $Author: billhorsman $ (current maintainer)

Field Summary
private  java.lang.String alias
           
private  java.util.Properties changedInfo
           
private  java.util.Properties completeInfo
           
private  java.lang.String fullUrl
           
private static Log LOG
           
 
Constructor Summary
ProxoolAdapter()
          Default constructor.
ProxoolAdapter(java.lang.String alias)
          Use this constructor if you want to define the alias
 
Method Summary
 void closeConnection(java.sql.Connection connection)
          This gives the adapter the flexibilty of closing the connection for real or just putting it back in a pool.
 void definitionUpdated(ConnectionPoolDefinitionIF connectionPoolDefinition, java.util.Properties completeInfo, java.util.Properties changedInfo)
          Gets called once after a pool has been updated.
 java.util.Properties getChangedInfo()
           
 java.util.Properties getCompleteInfo()
           
 java.sql.Connection getConnection()
          Simply get a connection (using the definitions defined in ConnectionAdapterIF.setup(java.lang.String, java.lang.String, java.util.Properties)
 java.lang.String getFullUrl()
           
 java.lang.String getName()
          Convenient name so we can identify this adapter in logs.
 void setChangedInfo(java.util.Properties changedInfo)
           
 void setCompleteInfo(java.util.Properties completeInfo)
           
 void setup(java.lang.String driver, java.lang.String url, java.util.Properties info)
          Setup the adapter.
 void tearDown()
          Reclaim resources used by the adapter (for instance, close any open connections)
 void update(java.util.Properties info)
           
 void update(java.lang.String url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final Log LOG

alias

private java.lang.String alias

fullUrl

private java.lang.String fullUrl

changedInfo

private java.util.Properties changedInfo

completeInfo

private java.util.Properties completeInfo
Constructor Detail

ProxoolAdapter

public ProxoolAdapter(java.lang.String alias)
Use this constructor if you want to define the alias

Parameters:
alias - the alias of the pool

ProxoolAdapter

public ProxoolAdapter()
Default constructor. Will use the hashCode as the alias for the pool

Method Detail

definitionUpdated

public void definitionUpdated(ConnectionPoolDefinitionIF connectionPoolDefinition,
                              java.util.Properties completeInfo,
                              java.util.Properties changedInfo)
Description copied from interface: ConfigurationListenerIF
Gets called once after a pool has been updated.

Specified by:
definitionUpdated in interface ConfigurationListenerIF
Parameters:
connectionPoolDefinition - the new definition
completeInfo - the properties that could be used to create this definition
changedInfo - only the properties that have changed since the pool was registered, or this method was las called.

getChangedInfo

public java.util.Properties getChangedInfo()

setChangedInfo

public void setChangedInfo(java.util.Properties changedInfo)

getCompleteInfo

public java.util.Properties getCompleteInfo()

setCompleteInfo

public void setCompleteInfo(java.util.Properties completeInfo)

getName

public java.lang.String getName()
Description copied from interface: ConnectionAdapterIF
Convenient name so we can identify this adapter in logs.

Specified by:
getName in interface ConnectionAdapterIF
Returns:
name

update

public void update(java.util.Properties info)
            throws java.sql.SQLException,
                   ProxoolException
Throws:
java.sql.SQLException
ProxoolException

update

public void update(java.lang.String url)
            throws java.sql.SQLException,
                   ProxoolException
Throws:
java.sql.SQLException
ProxoolException

setup

public void setup(java.lang.String driver,
                  java.lang.String url,
                  java.util.Properties info)
           throws java.sql.SQLException,
                  ProxoolException
Description copied from interface: ConnectionAdapterIF
Setup the adapter. Define the connection. Prototype any connections as necessary.

Specified by:
setup in interface ConnectionAdapterIF
Parameters:
driver - the name of the class
url - the url to pass to the driver
info - the properties to pass to the driver
Throws:
java.sql.SQLException - if anything goes wrong
ProxoolException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Description copied from interface: ConnectionAdapterIF
Simply get a connection (using the definitions defined in ConnectionAdapterIF.setup(java.lang.String, java.lang.String, java.util.Properties)

Specified by:
getConnection in interface ConnectionAdapterIF
Returns:
the connection
Throws:
java.sql.SQLException - if anything goes wrong

getFullUrl

public java.lang.String getFullUrl()

closeConnection

public void closeConnection(java.sql.Connection connection)
                     throws java.sql.SQLException
Description copied from interface: ConnectionAdapterIF
This gives the adapter the flexibilty of closing the connection for real or just putting it back in a pool.

Specified by:
closeConnection in interface ConnectionAdapterIF
Parameters:
connection - the connection to "close"
Throws:
java.sql.SQLException - if anything goes wrong

tearDown

public void tearDown()
Description copied from interface: ConnectionAdapterIF
Reclaim resources used by the adapter (for instance, close any open connections)

Specified by:
tearDown in interface ConnectionAdapterIF