net.cafebabe.sat.util
Class FileTask

java.lang.Object
  |
  +--org.apache.tools.ant.ProjectComponent
        |
        +--org.apache.tools.ant.Task
              |
              +--net.cafebabe.sat.util.FileTask
Direct Known Subclasses:
BshTask, InsertTask, LinkTask, MergeTask, NestTask, SplitTask, ValidTask, WordCountTask, XTask

public abstract class FileTask
extends org.apache.tools.ant.Task

This is the ancestor of all the file related tasks. It manages file and dir attributes and fileset nested elements.

Author:
Michel CASABIANCA

Field Summary
(package private)  java.lang.String dir
          The coma separated list of directories to process
(package private)  java.lang.String file
          The coma separated list of files to process
(package private)  java.util.Vector filesets
          The Vector of filesets to process
 
Fields inherited from class org.apache.tools.ant.Task
description, location, target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
FileTask()
           
 
Method Summary
 void addFileset(org.apache.tools.ant.types.FileSet fileset)
          Fileset nested element.
 java.util.Vector getFiles(boolean strict)
          Return the list of files to process.
 java.util.Vector getNewFiles(boolean strict, java.io.File timeFile)
          Return the list of files that are newer than the reference file.
 boolean newerFilesThan(java.io.File timeFile)
          Tell if files were modified since the reference was generated.
 void setDir(java.lang.String dir)
          Dir attribute.
 void setFile(java.lang.String file)
          File attribute.
 
Methods inherited from class org.apache.tools.ant.Task
execute, getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

java.lang.String file
The coma separated list of files to process


dir

java.lang.String dir
The coma separated list of directories to process


filesets

java.util.Vector filesets
The Vector of filesets to process

Constructor Detail

FileTask

public FileTask()
Method Detail

setFile

public void setFile(java.lang.String file)
File attribute. This is a coma separated list of files to process.

Parameters:
file - The coma separated list of files to process.

setDir

public void setDir(java.lang.String dir)
Dir attribute. This is a coma separated list of directories to process. All the files in the directory are processed. Subdirectories are not scanned.

Parameters:
dir - The coma separated list of directories to process.

addFileset

public void addFileset(org.apache.tools.ant.types.FileSet fileset)
Fileset nested element. The fileset is added to the list.

Parameters:
fileset - The fileset to add.

getFiles

public java.util.Vector getFiles(boolean strict)
                          throws org.apache.tools.ant.BuildException
Return the list of files to process. This is a Vector built from the files, directories and filesets of the task.

Parameters:
strict - A flag that indicates if we should check that at least one file or directory is set. If false, the files and directories are checked anyway.
Returns:
A Vector of Files.
org.apache.tools.ant.BuildException

getNewFiles

public java.util.Vector getNewFiles(boolean strict,
                                    java.io.File timeFile)
Return the list of files that are newer than the reference file.

Parameters:
strict - States if an error should be raised if no file is found.
Returns:
The filtered file list as a Vector

newerFilesThan

public boolean newerFilesThan(java.io.File timeFile)
Tell if files were modified since the reference was generated. Useful for the merge task for instance because it is not necessary to merge again if no file was modified (or added) since the resulting file was generated.

Returns:
The reponse as a boolean