com.googlecode.flyway.ant
Class AbstractFlywayTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.googlecode.flyway.ant.AbstractFlywayTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
AbstractMigrationLoadingTask, CleanTask, HistoryTask, InitTask, RepairTask, StatusTask

public abstract class AbstractFlywayTask
extends org.apache.tools.ant.Task

Base class for all Flyway Ant tasks.


Field Summary
protected  com.googlecode.flyway.core.util.logging.Log log
          Logger.
 
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
AbstractFlywayTask()
           
 
Method Summary
protected abstract  void doExecute(Flyway flyway)
          Executes this task.
 void execute()
           
 void setClasspath(org.apache.tools.ant.types.Path classpath)
           
 void setClasspathref(org.apache.tools.ant.types.Reference classpathref)
           
 void setDriver(String driver)
           
 void setPassword(String password)
           
 void setSchemas(String schemas)
           
 void setTable(String table)
           
 void setUrl(String url)
           
 void setUser(String user)
           
protected  boolean useValueIfPropertyNotSet(boolean value, String flywayProperty)
          Retrieves a boolean value either from an Ant property or if not set, directly.
protected  String useValueIfPropertyNotSet(String value, String flywayProperty)
          Retrieves a value either from an Ant property or if not set, directly.
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, 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
 

Field Detail

log

protected com.googlecode.flyway.core.util.logging.Log log
Logger.

Constructor Detail

AbstractFlywayTask

public AbstractFlywayTask()
Method Detail

setClasspath

public void setClasspath(org.apache.tools.ant.types.Path classpath)
Parameters:
classpath - The classpath used to load the JDBC driver and the migrations.
Also configurable with Ant Property: ${flyway.classpath}

setClasspathref

public void setClasspathref(org.apache.tools.ant.types.Reference classpathref)
Parameters:
classpathref - The reference to the classpath used to load the JDBC driver and the migrations.
Also configurable with Ant Property: ${flyway.classpathref}

setDriver

public void setDriver(String driver)
Parameters:
driver - The fully qualified classname of the jdbc driver to use to connect to the database.
Also configurable with Ant Property: ${flyway.driver}

setUrl

public void setUrl(String url)
Parameters:
url - The jdbc url to use to connect to the database.
Also configurable with Ant Property: ${flyway.url}

setUser

public void setUser(String user)
Parameters:
user - The user to use to connect to the database.
Also configurable with Ant Property: ${flyway.user}

setPassword

public void setPassword(String password)
Parameters:
password - The password to use to connect to the database. (default: blank)
Also configurable with Ant Property: ${flyway.password}

setSchemas

public void setSchemas(String schemas)
Parameters:
schemas - Comma-separated list of the schemas managed by Flyway. The first schema in the list will be automatically set as the default one during the migration. It will also be the one containing the metadata table. These schema names are case-sensitive. (default: The default schema for the datasource connection)
Also configurable with Ant Property: ${flyway.schemas}

setTable

public void setTable(String table)
Parameters:
table -

The name of the schema metadata table that will be used by Flyway.

By default (single-schema mode) the metadata table is placed in the default schema for the connection provided by the datasource.

When the flyway.schemas property is set (multi-schema mode), the metadata table is placed in the first schema of the list.

(default: schema_version)
Also configurable with Ant Property: ${flyway.table}

useValueIfPropertyNotSet

protected String useValueIfPropertyNotSet(String value,
                                          String flywayProperty)
Retrieves a value either from an Ant property or if not set, directly.

Parameters:
value - The value to check.
flywayProperty - The flyway Ant property. Ex. 'url' for 'flyway.url'
Returns:
The value.

useValueIfPropertyNotSet

protected boolean useValueIfPropertyNotSet(boolean value,
                                           String flywayProperty)
Retrieves a boolean value either from an Ant property or if not set, directly.

Parameters:
value - The boolean value to check.
flywayProperty - The flyway Ant property. Ex. 'url' for 'flyway.url'
Returns:
The boolean value.

execute

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

doExecute

protected abstract void doExecute(Flyway flyway)
                           throws Exception
Executes this task.

Parameters:
flyway - The flyway instance to operate on.
Throws:
Exception - any exception


Copyright © 2012. All Rights Reserved.