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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
setSchemaUpdater
(SQLSchemaUpdater schemaUpdater) Configure theSQLSchemaUpdater
that will initialize and update the database.protected void
updateDataSource
(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, unwrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
SchemaUpdatingDataSource
public SchemaUpdatingDataSource()
-
-
Method Details
-
setSchemaUpdater
Configure theSQLSchemaUpdater
that will initialize and update the database. Required property.- Parameters:
schemaUpdater
- schema updater
-
updateDataSource
Description copied from class:AbstractUpdatingDataSource
Update the innerDataSource
.This method will be invoked at most once.
- Specified by:
updateDataSource
in classAbstractUpdatingDataSource
- Parameters:
dataSource
- theDataSource
to update- Throws:
SQLException
- if the update attempt fails
-