org.nocrala.tools.database.sentinel.ant.ShowSnapshotAntTask Maven / Gradle / Ivy
package org.nocrala.tools.database.sentinel.ant;
import java.io.File;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.nocrala.tools.database.sentinel.plugin.ShowSnapshotOperation;
import org.nocrala.tools.database.sentinel.util.SUtil;
public class ShowSnapshotAntTask extends Task {
private static final Logger log = LogManager.getLogger(ShowSnapshotAntTask.class);
private String snapshotfile;
@Override
public void execute() {
log.debug("init");
validateParameters();
try {
new ShowSnapshotOperation(new File(this.snapshotfile)).execute(new AntFeedback(this));
} catch (Exception e) {
throw new BuildException(e.getMessage(), e.getCause());
}
}
private void validateParameters() {
if (SUtil.isEmpty(this.snapshotfile)) {
throw new BuildException("Parameter 'snapshotfile' must be specified.");
}
}
// Setters
public void setSnapshotfile(final String snapshotfile) {
this.snapshotfile = snapshotfile;
}
}