Package liquibase.integration.ant
Class BaseLiquibaseTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- liquibase.integration.ant.BaseLiquibaseTask
-
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
AbstractChangeLogBasedTask,AbstractDatabaseDiffTask,DBDocTask,DropAllTask,GenerateChangeLogTask,TagDatabaseTask
public abstract class BaseLiquibaseTask extends org.apache.tools.ant.TaskBase class for all Ant Liquibase tasks. This class sets up Liquibase and defines parameters that are common to all tasks.
-
-
Constructor Summary
Constructors Constructor Description BaseLiquibaseTask()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddChangeLogParameters(ChangeLogParametersType changeLogParameters)voidaddDatabase(DatabaseType databaseType)protected voidcloseDatabase(Database database)Convenience method to safely close the database connection.org.apache.tools.ant.types.PathcreateClasspath()protected DatabasecreateDatabaseFromConfiguredDatabaseType()protected DatabasecreateDatabaseFromType(DatabaseType databaseType, ResourceAccessor resourceAccessor)voidexecute()protected abstract voidexecuteWithLiquibaseClassloader()StringgetChangeLogDirectory()This method is designed to be overridden by subclasses when a change log is needed.protected StringgetChangeLogFile()This method is designed to be overridden by subclasses when a change log is needed.protected StringgetDefaultOutputEncoding()protected LiquibasegetLiquibase()protected ResourceAccessorgetResourceAccessor()StringgetSearchPath()This method is designed to be overridden by subclasses when a change log is needed.voidinit()booleanisPromptOnNonLocalDatabase()Deprecated.no longer promptsvoidsetChangeLogParametersRef(org.apache.tools.ant.types.Reference changeLogParametersRef)voidsetClasspathRef(org.apache.tools.ant.types.Reference r)voidsetDatabaseRef(org.apache.tools.ant.types.Reference databaseRef)voidsetPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)Deprecated.no longer promptsprotected booleanshouldRun()protected voidvalidateParameters()Subclasses that override this method must always callsuper.validateParameters()method.-
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
-
-
-
-
Method Detail
-
init
public void init() throws org.apache.tools.ant.BuildException- Overrides:
initin classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
execute
public final void execute() throws org.apache.tools.ant.BuildException- Overrides:
executein classorg.apache.tools.ant.Task- Throws:
org.apache.tools.ant.BuildException
-
executeWithLiquibaseClassloader
protected abstract void executeWithLiquibaseClassloader() throws org.apache.tools.ant.BuildException- Throws:
org.apache.tools.ant.BuildException
-
createDatabaseFromConfiguredDatabaseType
protected Database createDatabaseFromConfiguredDatabaseType()
-
createDatabaseFromType
protected Database createDatabaseFromType(DatabaseType databaseType, ResourceAccessor resourceAccessor)
-
getLiquibase
protected Liquibase getLiquibase()
-
getResourceAccessor
protected ResourceAccessor getResourceAccessor()
-
getChangeLogDirectory
public String getChangeLogDirectory()
This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.- Returns:
- Returns null in this implementation. Subclasses that need a change log should implement.
- See Also:
AbstractChangeLogBasedTask.getChangeLogDirectory()
-
getSearchPath
public String getSearchPath()
This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.- Returns:
- Returns null in this implementation. Subclasses that need a change log should implement.
-
getChangeLogFile
protected String getChangeLogFile()
This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.- Returns:
- Returns null in this implementation. Subclasses that need a change log should implement.
- See Also:
AbstractChangeLogBasedTask.getChangeLogFile()
-
shouldRun
protected boolean shouldRun()
-
getDefaultOutputEncoding
protected String getDefaultOutputEncoding()
-
validateParameters
protected void validateParameters()
Subclasses that override this method must always callsuper.validateParameters()method.
-
closeDatabase
protected void closeDatabase(Database database)
Convenience method to safely close the database connection.- Parameters:
database- The database to close.
-
createClasspath
public org.apache.tools.ant.types.Path createClasspath()
-
setClasspathRef
public void setClasspathRef(org.apache.tools.ant.types.Reference r)
-
addDatabase
public void addDatabase(DatabaseType databaseType)
-
setDatabaseRef
public void setDatabaseRef(org.apache.tools.ant.types.Reference databaseRef)
-
addChangeLogParameters
public void addChangeLogParameters(ChangeLogParametersType changeLogParameters)
-
setChangeLogParametersRef
public void setChangeLogParametersRef(org.apache.tools.ant.types.Reference changeLogParametersRef)
-
isPromptOnNonLocalDatabase
public boolean isPromptOnNonLocalDatabase()
Deprecated.no longer prompts
-
setPromptOnNonLocalDatabase
public void setPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)
Deprecated.no longer prompts
-
-