Top Description Fields Constructors Methods
liquibase.integration.ant

public abstract Class BaseLiquibaseTask

extends Task
Class Inheritance
Known Direct Subclasses
liquibase.integration.ant.DBDocTask, liquibase.integration.ant.DropAllTask, liquibase.integration.ant.GenerateChangeLogTask, liquibase.integration.ant.TagDatabaseTask, liquibase.integration.ant.AbstractChangeLogBasedTask, liquibase.integration.ant.AbstractDatabaseDiffTask
Imports
liquibase.GlobalConfiguration, .Liquibase, .Scope, liquibase.database.Database, liquibase.exception.DatabaseException, liquibase.integration.ant.type.ChangeLogParametersType, .DatabaseType, liquibase.integration.commandline.LiquibaseCommandLineConfiguration, liquibase.resource.ClassLoaderResourceAccessor, .ResourceAccessor, .SearchPathResourceAccessor, org.apache.tools.ant.AntClassLoader, .BuildException, .Project, .Task, org.apache.tools.ant.types.Path, .Reference, java.util.HashMap, .Map, .ResourceBundle

Base class for all Ant Liquibase tasks. This class sets up Liquibase and defines parameters that are common to all tasks.

Field Summary

Modifier and TypeField and Description
private ChangeLogParametersType
private AntClassLoader
private Path
private static final ResourceBundle
private DatabaseType
private Liquibase
private ResourceAccessor
private final Map<String, Object>
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
addDatabase(DatabaseType databaseType)

protected void
closeDatabase(Database
The database to close.
database
)

Convenience method to safely close the database connection.

public Path
protected Database
protected Database
createDatabaseFromType(DatabaseType databaseType, ResourceAccessor resourceAccessor)

private ResourceAccessor

Returns:

A ResourceAccessor.
createResourceAccessor
(AntClassLoader
The ClassLoader to use in the ResourceAccessor. It is preferable that it is an AntClassLoader.
classLoader
)

Creates a suitable ResourceAccessor for use in an Ant task..

public final void
execute()

Overrides org.apache.tools.ant.Task.execute.

Called by the project to let the task do its work.

protected abstract void
public String

Returns:

Returns null in this implementation. Subclasses that need a change log should implement.
getChangeLogDirectory
()

This method is designed to be overridden by subclasses when a change log is needed.

protected String

Returns:

Returns null in this implementation. Subclasses that need a change log should implement.
getChangeLogFile
()

This method is designed to be overridden by subclasses when a change log is needed.

protected String
protected Liquibase
protected ResourceAccessor
public String

Returns:

Returns null in this implementation. Subclasses that need a change log should implement.
getSearchPath
()

This method is designed to be overridden by subclasses when a change log is needed.

public void
init()

Overrides org.apache.tools.ant.Task.init.

Called by the project to let the task initialize properly.

public boolean
isPromptOnNonLocalDatabase()
Deprecated no longer prompts

public void
setChangeLogParametersRef(Reference changeLogParametersRef)

public void
public void
public void
setPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)
Deprecated no longer prompts

protected boolean
protected void
validateParameters()

Subclasses that override this method must always call super.validateParameters() method.

Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

changeLogParametersback to summary
private ChangeLogParametersType changeLogParameters
classLoaderback to summary
private AntClassLoader classLoader
classpathback to summary
private Path classpath
coreBundleback to summary
private static final ResourceBundle coreBundle
databaseTypeback to summary
private DatabaseType databaseType
liquibaseback to summary
private Liquibase liquibase
resourceAccessorback to summary
private ResourceAccessor resourceAccessor
scopeValuesback to summary
private final Map<String, Object> scopeValues

Constructor Detail

BaseLiquibaseTaskback to summary
public BaseLiquibaseTask()

Method Detail

addChangeLogParametersback to summary
public void addChangeLogParameters(ChangeLogParametersType changeLogParameters)
addDatabaseback to summary
public void addDatabase(DatabaseType databaseType)
closeDatabaseback to summary
protected void closeDatabase(Database database)

Convenience method to safely close the database connection.

Parameters
database:Database

The database to close.

createClasspathback to summary
public Path createClasspath()
createDatabaseFromConfiguredDatabaseTypeback to summary
protected Database createDatabaseFromConfiguredDatabaseType()
createDatabaseFromTypeback to summary
protected Database createDatabaseFromType(DatabaseType databaseType, ResourceAccessor resourceAccessor)
createResourceAccessorback to summary
private ResourceAccessor createResourceAccessor(AntClassLoader classLoader)

Creates a suitable ResourceAccessor for use in an Ant task..

Parameters
classLoader:AntClassLoader

The ClassLoader to use in the ResourceAccessor. It is preferable that it is an AntClassLoader.

Returns:ResourceAccessor

A ResourceAccessor.

Annotations
@SuppressWarnings:java:S2095
executeback to summary
public final void execute() throws BuildException

Overrides org.apache.tools.ant.Task.execute.

Doc from org.apache.tools.ant.Task.execute.

Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice.

Annotations
@Override
Exceptions
BuildException:
if something goes wrong with the build.
executeWithLiquibaseClassloaderback to summary
protected abstract void executeWithLiquibaseClassloader() throws BuildException
getChangeLogDirectoryback to summary
public String getChangeLogDirectory()

This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.

Returns:String

Returns null in this implementation. Subclasses that need a change log should implement.

See Also
AbstractChangeLogBasedTask#getChangeLogDirectory()
getChangeLogFileback to summary
protected String getChangeLogFile()

This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.

Returns:String

Returns null in this implementation. Subclasses that need a change log should implement.

See Also
AbstractChangeLogBasedTask#getChangeLogFile()
getDefaultOutputEncodingback to summary
protected String getDefaultOutputEncoding()
getLiquibaseback to summary
protected Liquibase getLiquibase()
getResourceAccessorback to summary
protected ResourceAccessor getResourceAccessor()
getSearchPathback to summary
public String getSearchPath()

This method is designed to be overridden by subclasses when a change log is needed. By default it returns null.

Returns:String

Returns null in this implementation. Subclasses that need a change log should implement.

initback to summary
public void init() throws BuildException

Overrides org.apache.tools.ant.Task.init.

Doc from org.apache.tools.ant.Task.init.

Called by the project to let the task initialize properly. The default implementation is a no-op.

Annotations
@Override
Exceptions
BuildException:
if something goes wrong with the build
isPromptOnNonLocalDatabaseback to summary
public boolean isPromptOnNonLocalDatabase()

Deprecated

no longer prompts

setChangeLogParametersRefback to summary
public void setChangeLogParametersRef(Reference changeLogParametersRef)
setClasspathRefback to summary
public void setClasspathRef(Reference r)
setDatabaseRefback to summary
public void setDatabaseRef(Reference databaseRef)
setPromptOnNonLocalDatabaseback to summary
public void setPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)

Deprecated

no longer prompts

shouldRunback to summary
protected boolean shouldRun()
validateParametersback to summary
protected void validateParameters()

Subclasses that override this method must always call super.validateParameters() method.