liquibase.integration.spring
Class MultiTenantSpringLiquibase

java.lang.Object
  extended by liquibase.integration.spring.MultiTenantSpringLiquibase
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware

public class MultiTenantSpringLiquibase
extends Object
implements org.springframework.beans.factory.InitializingBean, org.springframework.context.ResourceLoaderAware

A wrapper of Liquibase suitable in multi-tenant environments where multiple data sources represent tenants. It utilizes SpringLiquibase per each data source. All the parameters are the same as for SpringLiquibase except of the data source definition - in this case it is a list of data sources available under specified JNDI subtree. You have to define the subtree with jndiBase property.

The wrapper scans the subtree for all data sources and creates SpringLiquibase instances.

Example:

 <bean id="liquibase" class="liquibase.integration.spring.MultiTenantSpringLiquibase">
        <property name="jndiBase" value="java:comp/env/jdbc/db" />
        <property name="changeLog" value="classpath:db/migration/db-changelog.xml" />     
 </bean>
 

Author:
ladislav.gazo
See Also:
SpringLiquibase

Constructor Summary
MultiTenantSpringLiquibase()
           
 
Method Summary
 void afterPropertiesSet()
           
 String getChangeLog()
           
 String getContexts()
           
 DataSource getDataSource()
           
 String getDefaultSchema()
           
 String getJndiBase()
           
 String getLabels()
           
 Map<String,String> getParameters()
           
 File getRollbackFile()
           
 List<String> getSchemas()
           
 boolean isDropFirst()
           
 boolean isShouldRun()
           
 void setChangeLog(String changeLog)
           
 void setContexts(String contexts)
           
 void setDataSource(DataSource dataSource)
           
 void setDefaultSchema(String defaultSchema)
           
 void setDropFirst(boolean dropFirst)
           
 void setJndiBase(String jndiBase)
           
 void setLabels(String labels)
           
 void setParameters(Map<String,String> parameters)
           
 void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
           
 void setRollbackFile(File rollbackFile)
           
 void setSchemas(List<String> schemas)
           
 void setShouldRun(boolean shouldRun)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiTenantSpringLiquibase

public MultiTenantSpringLiquibase()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception

getJndiBase

public String getJndiBase()

setJndiBase

public void setJndiBase(String jndiBase)

getChangeLog

public String getChangeLog()

setChangeLog

public void setChangeLog(String changeLog)

getContexts

public String getContexts()

setContexts

public void setContexts(String contexts)

getLabels

public String getLabels()

setLabels

public void setLabels(String labels)

getParameters

public Map<String,String> getParameters()

setParameters

public void setParameters(Map<String,String> parameters)

getDefaultSchema

public String getDefaultSchema()

setDefaultSchema

public void setDefaultSchema(String defaultSchema)

isDropFirst

public boolean isDropFirst()

setDropFirst

public void setDropFirst(boolean dropFirst)

isShouldRun

public boolean isShouldRun()

setShouldRun

public void setShouldRun(boolean shouldRun)

getRollbackFile

public File getRollbackFile()

setRollbackFile

public void setRollbackFile(File rollbackFile)

setResourceLoader

public void setResourceLoader(org.springframework.core.io.ResourceLoader resourceLoader)
Specified by:
setResourceLoader in interface org.springframework.context.ResourceLoaderAware

getSchemas

public List<String> getSchemas()

setSchemas

public void setSchemas(List<String> schemas)

getDataSource

public DataSource getDataSource()

setDataSource

public void setDataSource(DataSource dataSource)


Copyright © 2016 Liquibase.org. All rights reserved.