01: package liquibase.ant;
02:
03: import liquibase.Liquibase;
04: import liquibase.util.StringUtils;
05: import org.apache.tools.ant.BuildException;
06:
07: public class DBDocTask extends BaseLiquibaseTask {
08:
09: private String outputDirectory;
10:
11: public String getOutputDirectory() {
12: return outputDirectory;
13: }
14:
15: public void setOutputDirectory(String outputDirectory) {
16: this .outputDirectory = outputDirectory;
17: }
18:
19: public void execute() throws BuildException {
20: if (StringUtils.trimToNull(getOutputDirectory()) == null) {
21: throw new BuildException(
22: "dbDoc requires outputDirectory to be set");
23: }
24:
25: Liquibase liquibase = null;
26: try {
27: liquibase = createLiquibase();
28: liquibase.generateDocumentation(getOutputDirectory());
29:
30: } catch (Exception e) {
31: throw new BuildException(e);
32: } finally {
33: closeDatabase(liquibase);
34: }
35: }
36: }
|