liquibase.integration.ant
Class BaseLiquibaseTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by 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.Task

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


Nested Class Summary
static class BaseLiquibaseTask.ChangeLogProperty
          Deprecated. Use ChangeLogParametersType instead.
protected static class BaseLiquibaseTask.LogRedirector
          Deprecated. 
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
BaseLiquibaseTask()
           
 
Method Summary
 void addChangeLogParameters(ChangeLogParametersType changeLogParameters)
           
 void addConfiguredChangeLogProperty(BaseLiquibaseTask.ChangeLogProperty changeLogProperty)
          Deprecated. Use ChangeLogParametersType.addConfiguredChangeLogParameter(Property) instead.
 void addDatabase(DatabaseType databaseType)
           
protected  void closeDatabase(Database database)
          Convenience method to safely close the database connection.
protected  void closeDatabase(Liquibase liquibase)
          Deprecated. Use closeDatabase(liquibase.database.Database) instead.
 org.apache.tools.ant.types.Path createClasspath()
           
protected  Database createDatabaseFromConfiguredDatabaseType()
           
protected  Database createDatabaseFromType(DatabaseType databaseType)
           
protected  Database createDatabaseObject(String driverClassName, String databaseUrl, String username, String password, String defaultCatalogName, String defaultSchemaName, String databaseClass)
          Deprecated. Use createDatabaseFromType(DatabaseType) instead.
protected  Liquibase createLiquibase()
          Deprecated. The Liquibase class is now created automatically when the Ant task is executed. Use getLiquibase() instead.
 Writer createOutputWriter()
          Deprecated. Subclasses of this class should either instantiate their own output writers or use AbstractChangeLogBasedTask if their task involves a change log.
 PrintStream createPrintStream()
          Deprecated. Subclasses of this class should either instantiate their own output writers or use AbstractChangeLogBasedTask if the task involves a change log.
 void execute()
           
protected abstract  void executeWithLiquibaseClassloader()
           
protected  String getChangeLogFile()
          This method is designed to be overridden by subclasses when a change log is needed.
 String getContexts()
          This method no longer does anything.
 String getCurrentDateTimeFunction()
          Deprecated. Use DatabaseType.getCurrentDateTimeFunction() instead.
 String getDatabaseChangeLogLockTableName()
          Deprecated. Use DatabaseType.getDatabaseChangeLogLockTableName() instead.
 String getDatabaseChangeLogObjectsTablespace()
          Deprecated. Use DatabaseType.getLiquibaseTablespaceName() instead.
 String getDatabaseChangeLogTableName()
          Deprecated. Use DatabaseType.getDatabaseChangeLogTableName() instead.
 String getDatabaseClass()
          Deprecated. Use DatabaseType.getDatabaseClass() instead.
 String getDefaultCatalogName()
          Deprecated. Use DatabaseType.getDefaultCatalogName() instead.
protected  String getDefaultOutputEncoding()
           
 String getDefaultSchemaName()
          Deprecated. Use DatabaseType.getDefaultSchemaName() instead.
 String getDriver()
          Deprecated. Use DatabaseType.getDriver() instead.
protected  Liquibase getLiquibase()
           
 String getLogLevel()
          Deprecated. No longer needed. This method has no replacement.
 org.apache.tools.ant.types.resources.FileResource getOutputFile()
          This method does nothing.
 String getPassword()
          Deprecated. Use DatabaseType.getPassword() instead.
 String getUrl()
          Deprecated. Use DatabaseType.getUrl() instead.
 String getUsername()
          Deprecated. Use DatabaseType.getUser() instead.
 void init()
           
 boolean isOutputDefaultCatalog()
          Deprecated. Use DatabaseType.isOutputDefaultCatalog() instead.
 boolean isOutputDefaultSchema()
          Deprecated. Use DatabaseType.isOutputDefaultSchema() instead.
 boolean isPromptOnNonLocalDatabase()
           
 void setChangeLogFile(String changeLogFile)
           
 void setChangeLogParametersRef(org.apache.tools.ant.types.Reference changeLogParametersRef)
           
 void setClasspathRef(org.apache.tools.ant.types.Reference r)
           
 void setContexts(String cntx)
          This method no longer does anything.
 void setCurrentDateTimeFunction(String currentDateTimeFunction)
          Deprecated. Use DatabaseType.setCurrentDateTimeFunction(String) instead.
 void setDatabaseChangeLogLockTableName(String tableName)
          Deprecated. 
 void setDatabaseChangeLogObjectsTablespace(String tablespaceName)
          Deprecated. Use DatabaseType.setLiquibaseTablespaceName(String) instead.
 void setDatabaseChangeLogTableName(String tableName)
          Deprecated. Use DatabaseType.setDatabaseChangeLogTableName(String) instead.
 void setDatabaseClass(String databaseClass)
          Deprecated. Use DatabaseType.setDatabaseClass(String) instead.
 void setDatabaseRef(org.apache.tools.ant.types.Reference databaseRef)
           
 void setDefaultCatalogName(String defaultCatalogName)
          Deprecated. Use DatabaseType.setDefaultCatalogName(String) instead.
 void setDefaultSchemaName(String defaultSchemaName)
          Deprecated. Use DatabaseType.setDefaultSchemaName(String) instead.
 void setDriver(String driver)
          Deprecated. Use DatabaseType.setDriver(String) instead.
 void setLogLevel(String level)
          Deprecated. Use the ant logging flags (-debug, -verbose, -quiet) instead of this method to control logging output. This will no longer change log levels.
 void setOutputDefaultCatalog(boolean outputDefaultCatalog)
          Deprecated. Use DatabaseType.setOutputDefaultCatalog(boolean) instead.
 void setOutputDefaultSchema(boolean outputDefaultSchema)
          Deprecated. Use a nested DatabaseType instead.
 void setOutputEncoding(String outputEncoding)
           
 void setOutputFile(org.apache.tools.ant.types.resources.FileResource outputFile)
          This method does nothing.
 void setPassword(String password)
          Deprecated. Use DatabaseType.setPassword(String) instead.
 void setPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)
           
 void setUrl(String url)
          Deprecated. Use DatabaseType.setUrl(String) instead.
 void setUsername(String username)
          Deprecated. Use DatabaseType.setUser(String) instead.
protected  boolean shouldRun()
           
protected  void validateParameters()
          Subclasses that override this method must always call super.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
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseLiquibaseTask

public BaseLiquibaseTask()
Method Detail

init

public void init()
          throws org.apache.tools.ant.BuildException
Overrides:
init in class org.apache.tools.ant.Task
Throws:
org.apache.tools.ant.BuildException

execute

public final void execute()
                   throws org.apache.tools.ant.BuildException
Overrides:
execute in class org.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)

getLiquibase

protected Liquibase getLiquibase()

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 call super.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()

setPromptOnNonLocalDatabase

public void setPromptOnNonLocalDatabase(boolean promptOnNonLocalDatabase)

getDriver

@Deprecated
public String getDriver()
Deprecated. Use DatabaseType.getDriver() instead.


setDriver

@Deprecated
public void setDriver(String driver)
Deprecated. Use DatabaseType.setDriver(String) instead.


getUrl

@Deprecated
public String getUrl()
Deprecated. Use DatabaseType.getUrl() instead.


setUrl

@Deprecated
public void setUrl(String url)
Deprecated. Use DatabaseType.setUrl(String) instead.


getUsername

@Deprecated
public String getUsername()
Deprecated. Use DatabaseType.getUser() instead.


setUsername

@Deprecated
public void setUsername(String username)
Deprecated. Use DatabaseType.setUser(String) instead.


getPassword

@Deprecated
public String getPassword()
Deprecated. Use DatabaseType.getPassword() instead.


setPassword

@Deprecated
public void setPassword(String password)
Deprecated. Use DatabaseType.setPassword(String) instead.


setChangeLogFile

public void setChangeLogFile(String changeLogFile)

getCurrentDateTimeFunction

@Deprecated
public String getCurrentDateTimeFunction()
Deprecated. Use DatabaseType.getCurrentDateTimeFunction() instead.


setCurrentDateTimeFunction

@Deprecated
public void setCurrentDateTimeFunction(String currentDateTimeFunction)
Deprecated. Use DatabaseType.setCurrentDateTimeFunction(String) instead.


getOutputFile

public org.apache.tools.ant.types.resources.FileResource getOutputFile()
This method does nothing. Use child implementations.


setOutputFile

public void setOutputFile(org.apache.tools.ant.types.resources.FileResource outputFile)
This method does nothing. Use child implementations.


createOutputWriter

@Deprecated
public Writer createOutputWriter()
                          throws IOException
Deprecated. Subclasses of this class should either instantiate their own output writers or use AbstractChangeLogBasedTask if their task involves a change log.

Throws:
IOException

createPrintStream

@Deprecated
public PrintStream createPrintStream()
                              throws IOException
Deprecated. Subclasses of this class should either instantiate their own output writers or use AbstractChangeLogBasedTask if the task involves a change log.

Throws:
IOException

setOutputEncoding

public void setOutputEncoding(String outputEncoding)

getDefaultCatalogName

@Deprecated
public String getDefaultCatalogName()
Deprecated. Use DatabaseType.getDefaultCatalogName() instead.


setDefaultCatalogName

@Deprecated
public void setDefaultCatalogName(String defaultCatalogName)
Deprecated. Use DatabaseType.setDefaultCatalogName(String) instead.


getDefaultSchemaName

@Deprecated
public String getDefaultSchemaName()
Deprecated. Use DatabaseType.getDefaultSchemaName() instead.


setDefaultSchemaName

@Deprecated
public void setDefaultSchemaName(String defaultSchemaName)
Deprecated. Use DatabaseType.setDefaultSchemaName(String) instead.


addConfiguredChangeLogProperty

@Deprecated
public void addConfiguredChangeLogProperty(BaseLiquibaseTask.ChangeLogProperty changeLogProperty)
Deprecated. Use ChangeLogParametersType.addConfiguredChangeLogParameter(Property) instead.


createLiquibase

@Deprecated
protected Liquibase createLiquibase()
                             throws Exception
Deprecated. The Liquibase class is now created automatically when the Ant task is executed. Use getLiquibase() instead.

Throws:
Exception

createDatabaseObject

@Deprecated
protected Database createDatabaseObject(String driverClassName,
                                                   String databaseUrl,
                                                   String username,
                                                   String password,
                                                   String defaultCatalogName,
                                                   String defaultSchemaName,
                                                   String databaseClass)
                                 throws Exception
Deprecated. Use createDatabaseFromType(DatabaseType) instead.

Throws:
Exception

getContexts

public String getContexts()
This method no longer does anything. Please extend from AbstractChangeLogBasedTask which has the equivalent method.


setContexts

public void setContexts(String cntx)
This method no longer does anything. Please extend from AbstractChangeLogBasedTask which has the equivalent method.


closeDatabase

@Deprecated
protected void closeDatabase(Liquibase liquibase)
Deprecated. Use closeDatabase(liquibase.database.Database) instead.


getDatabaseClass

@Deprecated
public String getDatabaseClass()
Deprecated. Use DatabaseType.getDatabaseClass() instead.


setDatabaseClass

@Deprecated
public void setDatabaseClass(String databaseClass)
Deprecated. Use DatabaseType.setDatabaseClass(String) instead.


getDatabaseChangeLogTableName

@Deprecated
public String getDatabaseChangeLogTableName()
Deprecated. Use DatabaseType.getDatabaseChangeLogTableName() instead.


setDatabaseChangeLogTableName

@Deprecated
public void setDatabaseChangeLogTableName(String tableName)
Deprecated. Use DatabaseType.setDatabaseChangeLogTableName(String) instead.


getDatabaseChangeLogLockTableName

@Deprecated
public String getDatabaseChangeLogLockTableName()
Deprecated. Use DatabaseType.getDatabaseChangeLogLockTableName() instead.


setDatabaseChangeLogLockTableName

@Deprecated
public void setDatabaseChangeLogLockTableName(String tableName)
Deprecated. 


getDatabaseChangeLogObjectsTablespace

@Deprecated
public String getDatabaseChangeLogObjectsTablespace()
Deprecated. Use DatabaseType.getLiquibaseTablespaceName() instead.


setDatabaseChangeLogObjectsTablespace

@Deprecated
public void setDatabaseChangeLogObjectsTablespace(String tablespaceName)
Deprecated. Use DatabaseType.setLiquibaseTablespaceName(String) instead.


isOutputDefaultSchema

@Deprecated
public boolean isOutputDefaultSchema()
Deprecated. Use DatabaseType.isOutputDefaultSchema() instead.


setOutputDefaultSchema

@Deprecated
public void setOutputDefaultSchema(boolean outputDefaultSchema)
Deprecated. Use a nested DatabaseType instead.

If not set, defaults to true.

Parameters:
outputDefaultSchema - True to output the default schema.

isOutputDefaultCatalog

@Deprecated
public boolean isOutputDefaultCatalog()
Deprecated. Use DatabaseType.isOutputDefaultCatalog() instead.


setOutputDefaultCatalog

@Deprecated
public void setOutputDefaultCatalog(boolean outputDefaultCatalog)
Deprecated. Use DatabaseType.setOutputDefaultCatalog(boolean) instead.

If not set, defaults to true

Parameters:
outputDefaultCatalog - True to output the default catalog.

getLogLevel

@Deprecated
public String getLogLevel()
Deprecated. No longer needed. This method has no replacement.

Returns:
Log level.

setLogLevel

@Deprecated
public void setLogLevel(String level)
Deprecated. Use the ant logging flags (-debug, -verbose, -quiet) instead of this method to control logging output. This will no longer change log levels.

Parameters:
level - Log level to set.


Copyright © 2016 Liquibase.org. All rights reserved.