Package org.dellroad.stuff.schema
Class SchemaUpdatingDataSource
java.lang.Object
org.dellroad.stuff.schema.AbstractUpdatingDataSource
org.dellroad.stuff.schema.SchemaUpdatingDataSource
- All Implemented Interfaces:
Wrapper,CommonDataSource,DataSource
A
DataSource that wraps an inner DataSource and automatically intializes and updates
the database schema using a SQLSchemaUpdater on first access.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetSchemaUpdater(SQLSchemaUpdater schemaUpdater) Configure theSQLSchemaUpdaterthat will initialize and update the database.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
-
SchemaUpdatingDataSource
public SchemaUpdatingDataSource()
-
-
Method Details
-
setSchemaUpdater
Configure theSQLSchemaUpdaterthat will initialize and update the database. Required property.- Parameters:
schemaUpdater- schema updater
-
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
-