Class AbstractSyncTask

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.commons.vfs.tasks.VfsTask
org.apache.commons.vfs.tasks.AbstractSyncTask
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
CopyTask

public abstract class AbstractSyncTask extends VfsTask
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.
Version:
$Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Wed, 29 Nov 2006) $
Author:
Adam Murdoch
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Information about a source file.
  • Field Summary

    Fields inherited from class org.apache.tools.ant.Task

    target, taskName, taskType, wrapper

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Adds a nested element.
    protected boolean
    Check if this task cares about destination files with a missing source file.
    void
    Executes this task.
    protected void
    Handles a destination for which there is no corresponding source file.
    protected void
    Handles an out-of-date file (a file where the destination file either doesn't exist, or is older than the source file).
    protected void
    Handles an up-to-date file (where the destination file exists and is newer than the source file).
    boolean
    Sets whether we should fail if there was an error or not
    protected void
    logOrDie(String message, int level)
     
    void
    setDestDir(String destDir)
    Sets the destination directory.
    void
    setDestFile(String destFile)
    Sets the destination file.
    void
    setFailonerror(boolean failonerror)
    Sets whether we should fail if there was an error or not
    void
    setIncludes(String filesList)
    Sets the files to includes
    void
    setSrc(String srcFile)
    Sets the source file
    void
    setSrcDir(String srcDir)
    Sets the source directory
    void
    setSrcDirIsBase(boolean srcDirIsBase)
    Sets whether the source directory should be consider as the base directory.

    Methods inherited from class org.apache.commons.vfs.tasks.VfsTask

    closeManager, resolveFile

    Methods inherited from class org.apache.tools.ant.Task

    bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType

    Methods inherited from class org.apache.tools.ant.ProjectComponent

    clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractSyncTask

      public AbstractSyncTask()
  • Method Details

    • setDestFile

      public void setDestFile(String destFile)
      Sets the destination file.
    • setDestDir

      public void setDestDir(String destDir)
      Sets the destination directory.
    • setSrc

      public void setSrc(String srcFile)
      Sets the source file
    • setSrcDir

      public void setSrcDir(String srcDir)
      Sets the source directory
    • setSrcDirIsBase

      public void setSrcDirIsBase(boolean srcDirIsBase)
      Sets whether the source directory should be consider as the base directory.
    • setFailonerror

      public void setFailonerror(boolean failonerror)
      Sets whether we should fail if there was an error or not
    • isFailonerror

      public boolean isFailonerror()
      Sets whether we should fail if there was an error or not
    • setIncludes

      public void setIncludes(String filesList)
      Sets the files to includes
    • addConfiguredSrc

      public void addConfiguredSrc(AbstractSyncTask.SourceInfo srcInfo) throws org.apache.tools.ant.BuildException
      Adds a nested element.
      Throws:
      org.apache.tools.ant.BuildException
    • execute

      public void execute() throws org.apache.tools.ant.BuildException
      Executes this task.
      Overrides:
      execute in class org.apache.tools.ant.Task
      Throws:
      org.apache.tools.ant.BuildException
    • logOrDie

      protected void logOrDie(String message, int level)
    • handleOutOfDateFile

      protected void handleOutOfDateFile(FileObject srcFile, FileObject destFile) throws Exception
      Handles an out-of-date file (a file where the destination file either doesn't exist, or is older than the source file). This implementation does nothing.
      Throws:
      Exception
    • handleUpToDateFile

      protected void handleUpToDateFile(FileObject srcFile, FileObject destFile) throws Exception
      Handles an up-to-date file (where the destination file exists and is newer than the source file). This implementation does nothing.
      Throws:
      Exception
    • handleMissingSourceFile

      protected void handleMissingSourceFile(FileObject destFile) throws Exception
      Handles a destination for which there is no corresponding source file. This implementation does nothing.
      Throws:
      Exception
    • detectMissingSourceFiles

      protected boolean detectMissingSourceFiles()
      Check if this task cares about destination files with a missing source file. This implementation returns false.