Package org.apache.commons.vfs2.tasks
Class AbstractSyncTask
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.commons.vfs2.tasks.VfsTask
org.apache.commons.vfs2.tasks.AbstractSyncTask
- All Implemented Interfaces:
- Cloneable
- Direct Known Subclasses:
- CopyTask
An abstract file synchronization task. Scans a set of source files and folders, and a destination folder, and
 performs actions on missing and out-of-date files. Specifically, performs actions on the following:
 
- Missing destination file.
- Missing source file.
- Out-of-date destination file.
- Up-to-date destination file.
- TODO - Deal with case where dest file maps to a child of one of the source files.
- TODO - Deal with case where dest file already exists and is incorrect type (not file, not a folder).
- TODO - Use visitors.
- TODO - Add default excludes.
- TODO - Allow selector, mapper, filters, etc to be specified.
- TODO - Handle source/dest directories as well.
- TODO - Allow selector to be specified for choosing which dest files to sync.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classInformation about a source file.
- 
Field SummaryFields inherited from class org.apache.tools.ant.Tasktarget, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a nested <src> element.protected booleanCheck if this task cares about destination files with a missing source file.voidexecute()Executes this task.protected voidhandleMissingSourceFile(FileObject destFile) Handles a destination for which there is no corresponding source file.protected voidhandleOutOfDateFile(FileObject srcFile, FileObject destFile) Handles an out-of-date file.protected voidhandleUpToDateFile(FileObject srcFile, FileObject destFile) Handles an up-to-date file.booleanSets whether we should fail if there was an error or not.protected voidLogs a message or throws aBuildExceptiondepending onisFailonerror().voidsetDestDir(String destDirUrl) Sets the destination directory.voidsetDestFile(String destFileUrl) Sets the destination file.voidsetFailonerror(boolean failOnError) Sets whether we should fail if there was an error or not.voidsetIncludes(String filesList) Sets the files to includes.voidSets the source file.voidSets the source directory.voidsetSrcDirIsBase(boolean srcDirIsBase) Sets whether the source directory should be considered as the base directory.Methods inherited from class org.apache.commons.vfs2.tasks.VfsTaskcloseManager, resolveFileMethods inherited from class org.apache.tools.ant.TaskbindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
- 
Constructor Details- 
AbstractSyncTaskpublic AbstractSyncTask()Constructs a new instance.
 
- 
- 
Method Details- 
addConfiguredSrcpublic void addConfiguredSrc(AbstractSyncTask.SourceInfo srcInfo) throws org.apache.tools.ant.BuildException Adds a nested <src> element.- Parameters:
- srcInfo- A nested source element.
- Throws:
- org.apache.tools.ant.BuildException- if the SourceInfo doesn't reference a file.
 
- 
detectMissingSourceFilesCheck if this task cares about destination files with a missing source file.This implementation returns false. - Returns:
- True if missing file is detected.
 
- 
executeExecutes this task.- Overrides:
- executein class- org.apache.tools.ant.Task
- Throws:
- org.apache.tools.ant.BuildException- if an error occurs.
 
- 
handleMissingSourceFileHandles a destination for which there is no corresponding source file.This implementation does nothing. - Parameters:
- destFile- The existing destination file.
- Throws:
- Exception- Implementation can throw any Exception.
 
- 
handleOutOfDateFileHandles an out-of-date file.This is a file where the destination file either doesn't exist, or is older than the source file. This implementation does nothing. - Parameters:
- srcFile- The source file.
- destFile- The destination file.
- Throws:
- Exception- Implementation can throw any Exception.
 
- 
handleUpToDateFileHandles an up-to-date file.This is where the destination file exists and is newer than the source file. This implementation does nothing. - Parameters:
- srcFile- The source file.
- destFile- The destination file.
- Throws:
- Exception- Implementation can throw any Exception.
 
- 
isFailonerrorSets whether we should fail if there was an error or not.- Returns:
- true if the operation should fail if there was an error.
 
- 
logOrDieLogs a message or throws aBuildExceptiondepending onisFailonerror().- Parameters:
- message- The message to using in logging or BuildException.
- level- The log level.
 
- 
setDestDirSets the destination directory.- Parameters:
- destDirUrl- The destination directory.
 
- 
setDestFileSets the destination file.- Parameters:
- destFileUrl- The destination file name.
 
- 
setFailonerrorSets whether we should fail if there was an error or not.- Parameters:
- failOnError- true if the operation should fail if there is an error.
 
- 
setIncludesSets the files to includes.- Parameters:
- filesList- The list of files to include.
 
- 
setSrcSets the source file.- Parameters:
- srcFile- The source file name.
 
- 
setSrcDirSets the source directory.- Parameters:
- srcDirUrl- The source directory.
 
- 
setSrcDirIsBaseSets whether the source directory should be considered as the base directory.- Parameters:
- srcDirIsBase- true if the source directory is the base directory.
 
 
-