com.googlecode.flyway.ant
Class AbstractMigrationLoadingTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.googlecode.flyway.ant.AbstractFlywayTask
              extended by com.googlecode.flyway.ant.AbstractMigrationLoadingTask
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
MigrateTask, ValidateTask

public abstract class AbstractMigrationLoadingTask
extends AbstractFlywayTask

Base class for tasks that rely on loading migrations from the classpath.


Nested Class Summary
static class AbstractMigrationLoadingTask.LocationElement
          One <location> sub-element within the <locations> element.
static class AbstractMigrationLoadingTask.Locations
          The nested <locations> element of the task.
 
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
AbstractMigrationLoadingTask()
           
 
Method Summary
 void addConfiguredLocations(AbstractMigrationLoadingTask.Locations locations)
          Do not use.
protected  void doExecute(Flyway flyway)
          Executes this task.
 void setBaseDir(java.lang.String baseDir)
          Deprecated. Use locations instead. Will be removed in Flyway 2.0.
 void setBasePackage(java.lang.String basePackage)
          Deprecated. Use locations instead. Will be removed in Flyway 2.0.
 void setEncoding(java.lang.String encoding)
           
 void setSqlMigrationPrefix(java.lang.String sqlMigrationPrefix)
           
 void setSqlMigrationSuffix(java.lang.String sqlMigrationSuffix)
           
 void setValidationErrorMode(java.lang.String validationErrorMode)
           
 
Methods inherited from class com.googlecode.flyway.ant.AbstractFlywayTask
execute, setClasspath, setClasspathref, setDriver, setPassword, setSchemas, setTable, setUrl, setUser, useValueIfPropertyNotSet
 
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
 

Constructor Detail

AbstractMigrationLoadingTask

public AbstractMigrationLoadingTask()
Method Detail

addConfiguredLocations

public void addConfiguredLocations(AbstractMigrationLoadingTask.Locations locations)
Do not use. For Ant itself.

Parameters:
locations - The locations on the classpath.

setBasePackage

@Deprecated
public void setBasePackage(java.lang.String basePackage)
Deprecated. Use locations instead. Will be removed in Flyway 2.0.

Parameters:
basePackage - The base package where the Java migrations are located. (default: db.migration)
Also configurable with Ant Property: ${flyway.basePackage}

setBaseDir

@Deprecated
public void setBaseDir(java.lang.String baseDir)
Deprecated. Use locations instead. Will be removed in Flyway 2.0.

Parameters:
baseDir - The base directory on the classpath where the Sql migrations are located. (default: db/migration)
Also configurable with Ant Property: ${flyway.baseDir}

setEncoding

public void setEncoding(java.lang.String encoding)
Parameters:
encoding - The encoding of Sql migrations. (default: UTF-8)
Also configurable with Ant Property: ${flyway.encoding}

setSqlMigrationPrefix

public void setSqlMigrationPrefix(java.lang.String sqlMigrationPrefix)
Parameters:
sqlMigrationPrefix - The file name prefix for Sql migrations (default: V)
Also configurable with Ant Property: ${flyway.sqlMigrationPrefix}

setSqlMigrationSuffix

public void setSqlMigrationSuffix(java.lang.String sqlMigrationSuffix)
Parameters:
sqlMigrationSuffix - The file name suffix for Sql migrations (default: .sql)
Also configurable with Ant Property: ${flyway.sqlMigrationSuffix}

setValidationErrorMode

public void setValidationErrorMode(java.lang.String validationErrorMode)
Parameters:
validationErrorMode - The action to take when validation fails.

Possible values are:

FAIL (default)
Throw an exception and fail.

CLEAN (Warning ! Do not use in produktion !)
Cleans the database.

This is exclusively intended as a convenience for development. Even tough we strongly recommend not to change migration scripts once they have been checked into SCM and run, this provides a way of dealing with this case in a smooth manner. The database will be wiped clean automatically, ensuring that the next migration will bring you back to the state checked into SCM.

This property has no effect when validationMode is set to NONE.

Also configurable with Ant Property: ${flyway.validationErrorMode}

doExecute

protected void doExecute(Flyway flyway)
                  throws java.lang.Exception
Description copied from class: AbstractFlywayTask
Executes this task.

Specified by:
doExecute in class AbstractFlywayTask
Parameters:
flyway - The flyway instance to operate on.
Throws:
java.lang.Exception - any exception


Copyright © 2012. All Rights Reserved.