|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectliquibase.integration.spring.SpringLiquibase
public class SpringLiquibase
A Spring-ified wrapper for Liquibase. Example Configuration:
This Spring configuration example will cause liquibase to run
automatically when the Spring context is initialized. It will load
db-changelog.xml from the classpath and apply it against
myDataSource.
<bean id="myLiquibase"
class="liquibase.spring.SpringLiquibase"
>
<property name="dataSource" ref="myDataSource" />
<property name="changeLog" value="classpath:db-changelog.xml" />
<!-- The following configuration options are optional -->
<property name="executeEnabled" value="true" />
<!--
If set to true, writeSqlFileEnabled will write the generated
SQL to a file before executing it.
-->
<property name="writeSqlFileEnabled" value="true" />
<!--
sqlOutputDir specifies the directory into which the SQL file
will be written, if so configured.
-->
<property name="sqlOutputDir" value="c:\sql" />
</bean>
| Nested Class Summary | |
|---|---|
class |
SpringLiquibase.SpringResourceOpener
|
| Constructor Summary | |
|---|---|
SpringLiquibase()
|
|
| Method Summary | |
|---|---|
void |
afterPropertiesSet()
Executed automatically when the bean is initialized. |
protected Database |
createDatabase(Connection c)
Subclasses may override this method add change some database settings such as default schema before returning the database object. |
protected Liquibase |
createLiquibase(Connection c)
|
protected SpringLiquibase.SpringResourceOpener |
createResourceOpener()
Create a new resourceOpener. |
String |
getBeanName()
Gets the Spring-name of this instance. |
String |
getChangeLog()
Returns a Resource that is able to resolve to a file or classpath resource. |
String |
getContexts()
|
String |
getDatabaseProductName()
|
DataSource |
getDataSource()
The DataSource that liquibase will use to perform the migration. |
String |
getDefaultSchema()
|
org.springframework.core.io.ResourceLoader |
getResourceLoader()
|
boolean |
isDropFirst()
|
void |
setBeanName(String name)
Spring sets this automatically to the instance's configured bean name. |
void |
setChangeLog(String dataModel)
Sets a Spring Resource that is able to resolve to a file or classpath resource. |
void |
setChangeLogParameters(Map<String,String> parameters)
|
void |
setContexts(String contexts)
|
void |
setDataSource(DataSource dataSource)
The DataSource that liquibase will use to perform the migration. |
void |
setDefaultSchema(String defaultSchema)
|
void |
setDropFirst(boolean dropFirst)
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
|
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SpringLiquibase()
| Method Detail |
|---|
public boolean isDropFirst()
public void setDropFirst(boolean dropFirst)
public String getDatabaseProductName()
throws DatabaseException
DatabaseExceptionpublic DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public String getChangeLog()
public void setChangeLog(String dataModel)
classpath:db-changelog.xml.
public String getContexts()
public void setContexts(String contexts)
public String getDefaultSchema()
public void setDefaultSchema(String defaultSchema)
public void afterPropertiesSet()
throws LiquibaseException
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanLiquibaseException
protected Liquibase createLiquibase(Connection c)
throws LiquibaseException
LiquibaseException
protected Database createDatabase(Connection c)
throws DatabaseException
c -
DatabaseFactory.
DatabaseExceptionpublic void setChangeLogParameters(Map<String,String> parameters)
protected SpringLiquibase.SpringResourceOpener createResourceOpener()
public void setBeanName(String name)
setBeanName in interface org.springframework.beans.factory.BeanNameAwarepublic String getBeanName()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader in interface org.springframework.context.ResourceLoaderAwarepublic org.springframework.core.io.ResourceLoader getResourceLoader()
public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||