01: package liquibase.ant;
02:
03: import liquibase.Liquibase;
04: import org.apache.tools.ant.BuildException;
05:
06: import java.io.Writer;
07:
08: /**
09: * Ant task for rolling back a database.
10: */
11: public class DatabaseRollbackFutureTask extends BaseLiquibaseTask {
12:
13: public void execute() throws BuildException {
14: Liquibase liquibase = null;
15: try {
16: Writer writer = createOutputWriter();
17: if (writer == null) {
18: throw new BuildException(
19: "rollbackFutureDatabase requires outputFile to be set");
20: }
21:
22: liquibase = createLiquibase();
23:
24: liquibase.futureRollbackSQL(getContexts(), writer);
25:
26: writer.flush();
27: writer.close();
28: } catch (Exception e) {
29: throw new BuildException(e);
30: } finally {
31: closeDatabase(liquibase);
32: }
33: }
34: }
|