org.dellroad.stuff.schema
Class UpdatingDataSource

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

public class UpdatingDataSource
extends AbstractUpdatingDataSource

A DataSource that wraps an inner DataSource and automatically applies a configured SQLCommandList on first access.

See Also:
SQLCommandList

Constructor Summary
UpdatingDataSource()
           
 
Method Summary
 void setSQLCommandList(SQLCommandList action)
          Configure the SQLCommandList to be applied to the database on first access.
 void setTransactional(boolean transactional)
          Configure whether the SQLCommandList is applied transactionally or not.
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

UpdatingDataSource

public UpdatingDataSource()
Method Detail

setSQLCommandList

public void setSQLCommandList(SQLCommandList action)
Configure the SQLCommandList to be applied to the database on first access. Required property.


setTransactional

public void setTransactional(boolean transactional)
Configure whether the SQLCommandList is applied transactionally or not. Default is true.


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