01: package liquibase.ant;
02:
03: import liquibase.Liquibase;
04: import org.apache.tools.ant.BuildException;
05:
06: import java.io.Writer;
07:
08: public class ChangeLogSyncTask extends BaseLiquibaseTask {
09:
10: public void execute() throws BuildException {
11:
12: Liquibase liquibase = null;
13: try {
14: liquibase = createLiquibase();
15:
16: Writer writer = createOutputWriter();
17: if (writer == null) {
18: liquibase.changeLogSync(getContexts());
19: } else {
20: liquibase.changeLogSync(getContexts(), writer);
21: writer.flush();
22: writer.close();
23: }
24:
25: } catch (Exception e) {
26: throw new BuildException(e);
27: } finally {
28: closeDatabase(liquibase);
29: }
30: }
31: }
|