Methods Summary |
---|
public boolean | eval()
validate();
try {
if (JavaEnvUtils.isAtLeastJavaVersion("1.6")) {
//reflection to avoid bootstrap/build problems
File fs = new File(partition);
ReflectWrapper w = new ReflectWrapper(fs);
long free = ((Long)w.invoke("getFreeSpace")).longValue();
return free >= StringUtils.parseHumanSizes(needed);
} else {
throw new BuildException("HasFreeSpace condition not supported on Java5 or less.");
}
} catch (Exception e) {
throw new BuildException(e);
}
|
public java.lang.String | getNeeded()The amount of free space required
return needed;
|
public java.lang.String | getPartition()The partition/device to check
return partition;
|
public void | setNeeded(java.lang.String needed)
this.needed = needed;
|
public void | setPartition(java.lang.String partition)
this.partition = partition;
|
private void | validate()
if(null == partition) {
throw new BuildException("Please set the partition attribute.");
}
if(null == needed) {
throw new BuildException("Please set the needed attribute.");
}
|