Methods Summary |
---|
public org.apache.tools.ant.types.Mapper | createMapper()Defines the FileNameMapper to use (nested mapper element).
if (mapperElement != null) {
throw new BuildException("Cannot define more than one mapper");
}
mapperElement = new Mapper(getProject());
return mapperElement;
|
public boolean | isSelected(java.io.File basedir, java.lang.String filename, java.io.File file)The heart of the matter. This is where the selector gets to decide
on the inclusion of a file in a particular fileset.
// throw BuildException on error
validate();
// Determine file whose out-of-dateness is to be checked
String[] destfiles = map.mapFileName(filename);
// If filename does not match the To attribute of the mapper
// then filter it out of the files we are considering
if (destfiles == null) {
return false;
}
// Sanity check
if (destfiles.length != 1 || destfiles[0] == null) {
throw new BuildException("Invalid destination file results for "
+ targetdir.getName() + " with filename " + filename);
}
String destname = destfiles[0];
File destfile = new File(targetdir, destname);
boolean selected = selectionTest(file, destfile);
return selected;
|
protected abstract boolean | selectionTest(java.io.File srcfile, java.io.File destfile)this test is our selection test that compared the file with the destfile
|
public void | setGranularity(int granularity)Sets the number of milliseconds leeway we will give before we consider
a file out of date. Defaults to 2000 on MS-DOS derivatives and 1000 on
others.
this.granularity = granularity;
|
public void | setTargetdir(java.io.File targetdir)The name of the file or directory which is checked for out-of-date
files.
this.targetdir = targetdir;
|
public void | verifySettings()Checks to make sure all settings are kosher. In this case, it
means that the dest attribute has been set and we have a mapper.
if (targetdir == null) {
setError("The targetdir attribute is required.");
}
if (mapperElement == null) {
map = new IdentityMapper();
} else {
map = mapperElement.getImplementation();
}
if (map == null) {
setError("Could not set <mapper> element.");
}
|