1 32 33 package com.jeantessier.dependencyfinder.ant; 34 35 import java.io.*; 36 import java.util.*; 37 38 import org.apache.tools.ant.*; 39 import org.apache.tools.ant.types.*; 40 41 import com.jeantessier.dependency.*; 42 43 public abstract class GraphTask extends Task { 44 private boolean validate = false; 45 private Path src; 46 private File destfile; 47 48 public boolean getValidate() { 49 return validate; 50 } 51 52 public void setValidate(boolean validate) { 53 this.validate = validate; 54 } 55 56 public Path createSrc() { 57 if (src == null) { 58 src = new Path(getProject()); 59 } 60 61 return src; 62 } 63 64 public Path getSrc() { 65 return src; 66 } 67 68 public Path getSrcfile() { 69 return src; 70 } 71 72 public void setSrcfile(Path srcfile) { 73 if (src == null) { 74 src = srcfile; 75 } else { 76 src.append(srcfile); 77 } 78 } 79 80 public File getDestfile() { 81 return destfile; 82 } 83 84 public void setDestfile(File destfile) { 85 this.destfile = destfile; 86 } 87 88 protected void validateParameters() throws BuildException { 89 if (getSrcfile() == null) { 90 throw new BuildException("src or srcfile must be set!"); 91 } 92 93 if (getSrc().size() == 0) { 94 throw new BuildException("src and srcfile are both empty!"); 95 } 96 97 if (getDestfile() == null) { 98 throw new BuildException("destfile must be set!"); 99 } 100 } 101 } 102 | Popular Tags |