Package org.dellroad.stuff.schema
Class UpdatingDataSource
java.lang.Object
org.dellroad.stuff.schema.AbstractUpdatingDataSource
org.dellroad.stuff.schema.UpdatingDataSource
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
A
DataSource that wraps an inner DataSource and automatically applies a configured
SQLCommandList on first access.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetSQLCommandList(SQLCommandList action) Configure theSQLCommandListto be applied to the database on first access.voidsetTransactional(boolean transactional) Configure whether theSQLCommandListis applied transactionally or not.protected voidupdateDataSource(DataSource dataSource) Update the innerDataSource.Methods inherited from class org.dellroad.stuff.schema.AbstractUpdatingDataSource
getConnection, getConnection, getInnerDataSource, getLoginTimeout, getLogWriter, getParentLogger, getUpdateCompleteFuture, getUpdatedDataSource, isAsynchronous, isUpdated, isWrapperFor, setAsynchronous, setDataSource, setLoginTimeout, setLogWriter, triggerUpdate, triggerUpdate, unwrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
UpdatingDataSource
public UpdatingDataSource()
-
-
Method Details
-
setSQLCommandList
Configure theSQLCommandListto be applied to the database on first access. Required property.- Parameters:
action- SQL command(s) to apply exactly once to the underlyingDataSource
-
setTransactional
public void setTransactional(boolean transactional) Configure whether theSQLCommandListis applied transactionally or not. Default istrue.- Parameters:
transactional- true for transactional application of SQL command(s)
-
updateDataSource
Description copied from class:AbstractUpdatingDataSourceUpdate the innerDataSource.This method will be invoked at most once.
- Specified by:
updateDataSourcein classAbstractUpdatingDataSource- Parameters:
dataSource- theDataSourceto update- Throws:
SQLException- if the update attempt fails
-