org.dellroad.stuff.schema
Class SchemaUpdatingDataSource

java.lang.Object
  extended by org.dellroad.stuff.schema.AbstractUpdatingDataSource
      extended by org.dellroad.stuff.schema.SchemaUpdatingDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource

public class SchemaUpdatingDataSource
extends AbstractUpdatingDataSource

A DataSource that wraps an inner DataSource and automatically intializes and updates the database schema using a SQLSchemaUpdater on first access.

See Also:
SQLSchemaUpdater

Constructor Summary
SchemaUpdatingDataSource()
           
 
Method Summary
 void setSchemaUpdater(SQLSchemaUpdater schemaUpdater)
          Configure the SQLSchemaUpdater that will initialize and update the database.
protected  void updateDataSource(DataSource dataSource)
          Update the inner DataSource.
 
Methods inherited from class org.dellroad.stuff.schema.AbstractUpdatingDataSource
getConnection, getConnection, getInnerDataSource, getLoginTimeout, getLogWriter, isUpdated, isWrapperFor, setDataSource, setLoginTimeout, setLogWriter, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaUpdatingDataSource

public SchemaUpdatingDataSource()
Method Detail

setSchemaUpdater

public void setSchemaUpdater(SQLSchemaUpdater schemaUpdater)
Configure the SQLSchemaUpdater that will initialize and update the database. Required property.


updateDataSource

protected void updateDataSource(DataSource dataSource)
                         throws SQLException
Description copied from class: AbstractUpdatingDataSource
Update the inner DataSource.

This method will be invoked at most once.

Specified by:
updateDataSource in class AbstractUpdatingDataSource
Throws:
SQLException