|
||||||||||
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 loaddb-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" /> </bean>
Nested Class Summary | |
---|---|
class |
SpringLiquibase.SpringResourceOpener
|
Field Summary | |
---|---|
protected String |
beanName
|
protected String |
changeLog
|
protected String |
contexts
|
protected DataSource |
dataSource
|
protected String |
defaultSchema
|
protected boolean |
dropFirst
|
protected String |
labels
|
protected Logger |
log
|
protected Map<String,String> |
parameters
|
protected org.springframework.core.io.ResourceLoader |
resourceLoader
|
protected File |
rollbackFile
|
protected boolean |
shouldRun
|
protected String |
tag
|
Constructor Summary | |
---|---|
SpringLiquibase()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Executed automatically when the bean is initialized. |
protected Database |
createDatabase(Connection c,
ResourceAccessor resourceAccessor)
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()
|
String |
getLabels()
|
org.springframework.core.io.ResourceLoader |
getResourceLoader()
|
String |
getTag()
|
boolean |
isDropFirst()
|
boolean |
isIgnoreClasspathPrefix()
|
protected void |
performUpdate(Liquibase liquibase)
|
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 |
setIgnoreClasspathPrefix(boolean ignoreClasspathPrefix)
|
void |
setLabels(String labels)
|
void |
setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
|
void |
setRollbackFile(File rollbackFile)
|
void |
setShouldRun(boolean shouldRun)
|
void |
setTag(String tag)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String beanName
protected org.springframework.core.io.ResourceLoader resourceLoader
protected DataSource dataSource
protected final Logger log
protected String changeLog
protected String contexts
protected String labels
protected String tag
protected Map<String,String> parameters
protected String defaultSchema
protected boolean dropFirst
protected boolean shouldRun
protected File rollbackFile
Constructor Detail |
---|
public SpringLiquibase()
Method Detail |
---|
public boolean isDropFirst()
public void setDropFirst(boolean dropFirst)
public void setShouldRun(boolean shouldRun)
public String getDatabaseProductName() throws DatabaseException
DatabaseException
public 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 getLabels()
public void setLabels(String labels)
public String getTag()
public void setTag(String tag)
public String getDefaultSchema()
public void setDefaultSchema(String defaultSchema)
public void afterPropertiesSet() throws LiquibaseException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
LiquibaseException
protected void performUpdate(Liquibase liquibase) throws LiquibaseException
LiquibaseException
protected Liquibase createLiquibase(Connection c) throws LiquibaseException
LiquibaseException
protected Database createDatabase(Connection c, ResourceAccessor resourceAccessor) throws DatabaseException
c
-
DatabaseFactory
.
DatabaseException
public void setChangeLogParameters(Map<String,String> parameters)
protected SpringLiquibase.SpringResourceOpener createResourceOpener()
public void setBeanName(String name)
setBeanName
in interface org.springframework.beans.factory.BeanNameAware
public String getBeanName()
public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
setResourceLoader
in interface org.springframework.context.ResourceLoaderAware
public org.springframework.core.io.ResourceLoader getResourceLoader()
public void setRollbackFile(File rollbackFile)
public boolean isIgnoreClasspathPrefix()
public void setIgnoreClasspathPrefix(boolean ignoreClasspathPrefix)
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |