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 TagDatabaseTask extends BaseLiquibaseTask {
08:
09: private String tag;
10:
11: public String getTag() {
12: return tag;
13: }
14:
15: public void setTag(String tag) {
16: this .tag = tag;
17: }
18:
19: public void execute() throws BuildException {
20: if (StringUtils.trimToNull(getTag()) == null) {
21: throw new BuildException(
22: "tagDatabase requires tag parameter to be set");
23: }
24:
25: Liquibase liquibase = null;
26: try {
27: liquibase = createLiquibase();
28: liquibase.tag(getTag());
29:
30: } catch (Exception e) {
31: throw new BuildException(e);
32: } finally {
33: closeDatabase(liquibase);
34: }
35: }
36: }
|