Package liquibase.integration.cdi
Class CDILiquibase
- java.lang.Object
-
- liquibase.integration.cdi.CDILiquibase
-
- All Implemented Interfaces:
javax.enterprise.inject.spi.Extension
@ApplicationScoped public class CDILiquibase extends Object implements javax.enterprise.inject.spi.Extension
A CDI wrapper for Liquibase. Example Configuration: This CDI configuration example will cause liquibase to run automatically when the CDI container is initialized. It will loaddb-changelog.xmlfrom the classpath and apply it againstmyDataSource. Various producers methods are required to resolve the dependencies, i.e.{@code public class CDILiquibaseProducer {
-
-
Field Summary
Fields Modifier and Type Field Description protected CDILiquibaseConfigconfig
-
Constructor Summary
Constructors Constructor Description CDILiquibase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DatabasecreateDatabase(Connection c)Creates and returns aDatabaseobject retrieved from theDatabaseFactory.protected LiquibasecreateLiquibase(Connection c)booleanisInitialized()booleanisUpdateSuccessful()voidonStartup()protected voidperformUpdate()
-
-
-
Field Detail
-
config
@Inject protected CDILiquibaseConfig config
-
-
Method Detail
-
isInitialized
public boolean isInitialized()
-
isUpdateSuccessful
public boolean isUpdateSuccessful()
-
onStartup
@PostConstruct public void onStartup()
-
performUpdate
protected void performUpdate() throws LiquibaseException- Throws:
LiquibaseException
-
createLiquibase
protected Liquibase createLiquibase(Connection c) throws LiquibaseException
- Throws:
LiquibaseException
-
createDatabase
protected Database createDatabase(Connection c) throws DatabaseException
Creates and returns aDatabaseobject retrieved from theDatabaseFactory. Subclasses may override this method to change some database settings, such as default schema, before returning the database object.- Parameters:
c- theJDBCconnection to use for creating the database- Returns:
- a
Databaseimplementation retrieved from theDatabaseFactory - Throws:
DatabaseException- if there is an error accessing the database
-
-