All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dbdeploy.CreateChangeScriptTarget Maven / Gradle / Ivy

package com.dbdeploy;

import com.dbdeploy.exceptions.UsageException;
import com.dbdeploy.scripts.ChangeScriptCreator;
import java.io.File;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;

/**
 * Ant task that will create a new dbdeploy
 * change script with a timestamp and
 * specified file name.
 *
 * @author jbogan
 */
public class CreateChangeScriptTarget extends Task {
    final ChangeScriptCreator changeScriptCreator = new ChangeScriptCreator();

    private static String ANT_USAGE = "\n\nDbdeploy Create Script Ant Task Usage"
            + "\n======================="
            + "\n\n\t"
            + "\n\n* - Indicates mandatory parameter";

    @Override
    public void execute() throws BuildException {
        try {
            changeScriptCreator.go();
        } catch (UsageException ex) {
            System.err.println(ANT_USAGE);
            throw new BuildException(ex.getMessage());
        } catch (Exception ex) {
            throw new BuildException(ex);
        }
    }

    public void setName(final String name) {
        changeScriptCreator.setScriptDescription(name);
    }

    public void setDir(final File dir) {
        changeScriptCreator.setScriptDirectory(dir);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy