org.compass.core.lucene.engine.store.jdbc
Class AbstractDataSourceProvider

java.lang.Object
  extended by org.compass.core.lucene.engine.store.jdbc.AbstractDataSourceProvider
All Implemented Interfaces:
DataSourceProvider
Direct Known Subclasses:
C3P0DataSourceProvider, DbcpDataSourceProvider, DriverManagerDataSourceProvider, ExternalDataSourceProvider, JndiDataSourceProvider

public abstract class AbstractDataSourceProvider
extends Object
implements DataSourceProvider

Author:
kimchy

Field Summary
protected  boolean autoCommit
           
protected  String driverClass
           
protected  boolean externalAutoCommit
           
protected  String password
           
protected  String username
           
 
Constructor Summary
AbstractDataSourceProvider()
           
 
Method Summary
 void closeDataSource()
          Closes the created data source.
 void configure(String url, CompassSettings settings)
          Configures the data source provider with the give settings and url, the configuration will control the DataSource that will be instansiated.
protected abstract  DataSource doCreateDataSource(String url, CompassSettings settings)
           
 DataSource getDataSource()
          Retuns an instance of the data source, as per the configuration set for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

driverClass

protected String driverClass

username

protected String username

password

protected String password

autoCommit

protected boolean autoCommit

externalAutoCommit

protected boolean externalAutoCommit
Constructor Detail

AbstractDataSourceProvider

public AbstractDataSourceProvider()
Method Detail

configure

public void configure(String url,
                      CompassSettings settings)
               throws CompassException
Description copied from interface: DataSourceProvider
Configures the data source provider with the give settings and url, the configuration will control the DataSource that will be instansiated.

Specified by:
configure in interface DataSourceProvider
Parameters:
url - The jdbc url connection string
settings - The settings for the given data source provider (and the DataSource).
Throws:
CompassException

getDataSource

public DataSource getDataSource()
Description copied from interface: DataSourceProvider
Retuns an instance of the data source, as per the configuration set for it.

Note, that the instance should be created (either in the configure method, or lazily in this method), and shared for all repeating calls. This will also allow DataSourceProvider.closeDataSource() to close the actual data source.

Specified by:
getDataSource in interface DataSourceProvider

closeDataSource

public void closeDataSource()
Description copied from interface: DataSourceProvider
Closes the created data source.

Specified by:
closeDataSource in interface DataSourceProvider

doCreateDataSource

protected abstract DataSource doCreateDataSource(String url,
                                                 CompassSettings settings)
                                          throws CompassException
Throws:
CompassException


Copyright (c) 2004-2009 The Compass Project.