org.apache.commons.pipeline.stage
Class FtpFileDownloadStage.FileSpec

java.lang.Object
  extended by org.apache.commons.pipeline.stage.FtpFileDownloadStage.FileSpec
Enclosing class:
FtpFileDownloadStage

public static class FtpFileDownloadStage.FileSpec
extends Object

This class is used to specify a path and pattern of file for the FtpFileDownload to retrieve. There are some parameters that can be configured in the filespec that will control download behavior for recursive searching, the overwrite of locally existing files, and to ignoreExisting files.

If a file already exists in the local directory, it is only replaced if overwrite is set to true. If it is replaced, then the filename is passed on to the next stage. Existing files are passed on to the stage unless ignoreExisting is true. Note that the ignoreExisting flag is only used if overwrite is false (it's assumed that if a file will be downloaded, then it shouldn't be ignored).

Pseudocode to summarize the interaction of overwrite and ignoreExisting:

     if (file exists) {
        if (overwrite) {
            download file over existing local copy
            and pass it on to the next stage
        } else {
            if (ignoreExisting) {
                skip this file
            } else {
                pass existing file on to the next stage
            }
        }
     } else {
        download new file 
        and pass it on to the next stage
     }
 


Nested Class Summary
static class FtpFileDownloadStage.FileSpec.FileType
          Enumeration of legal FTP file tranfer types
 
Constructor Summary
FtpFileDownloadStage.FileSpec()
           
 
Method Summary
 void addCriterion(FtpFileDownloadStage.Criterion crit)
          Add a criterion to the set of criteria that must be matched for files to be downloaded
 String getFileType()
          Returns the file type for the transfer.
 String getPath()
          Getter for property path.
 String getPattern()
          Deprecated. - not retrievable from criterion
 boolean isIgnoreExisting()
          Getter for property ignoreExisting.
 boolean isOverwrite()
          Getter for property overwrite.
 boolean isRecursive()
          Returns whether or not the stage will recursively traverse the directory tree to find files.
 void setFileType(String fileType)
          Sets the file type for the transfer.
 void setIgnoreExisting(boolean ignoreExisting)
          Setter for property ignoreExisting.
 void setOverwrite(boolean overwrite)
          Setter for property overwrite.
 void setPath(String path)
          Setter for property path.
 void setPattern(String pattern)
          Setter for property pattern.
 void setRecursive(boolean recursive)
          Sets the flag determining whether or not the stage will recursively traverse the directory tree to find files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FtpFileDownloadStage.FileSpec

public FtpFileDownloadStage.FileSpec()
Method Detail

getPath

public String getPath()
Getter for property path.

Returns:
Value of property path.

setPath

public void setPath(String path)
Setter for property path.

Parameters:
path - New value of property path.

getPattern

public String getPattern()
Deprecated. - not retrievable from criterion

Getter for property pattern.

Returns:
Value of property pattern.

setPattern

public void setPattern(String pattern)
Setter for property pattern.

Parameters:
pattern - New value of property pattern.

addCriterion

public void addCriterion(FtpFileDownloadStage.Criterion crit)
Add a criterion to the set of criteria that must be matched for files to be downloaded

Parameters:
crit - FtpFileDownloadStage.Criterion used to match desired files for download, typically a filename pattern

setRecursive

public void setRecursive(boolean recursive)
Sets the flag determining whether or not the stage will recursively traverse the directory tree to find files.

Parameters:
recursive - this value is true to recursively search the remote directories for matches to the criterion, false to turn off recursive searching

isRecursive

public boolean isRecursive()
Returns whether or not the stage will recursively traverse the directory tree to find files.

Returns:
the current recursive search setting

setFileType

public void setFileType(String fileType)
Sets the file type for the transfer. Legal values are "ascii" and "binary". Binary transfers are the default.

Parameters:
fileType - the FTP transfer type to use, "ascii" or "binary"

getFileType

public String getFileType()
Returns the file type for the transfer.

Returns:
the current FTP transfer type setting

isOverwrite

public boolean isOverwrite()
Getter for property overwrite. The default value for this flag is false, so existing local files will not be replaced by downloading remote files. This flag should be set to true if it is expected that the remote file is periodically updated and the local file is and out of date copy from a previous run of this pipeline.

Returns:
Value of property overwrite.

setOverwrite

public void setOverwrite(boolean overwrite)
Setter for property overwrite.

Parameters:
overwrite - New value of property overwrite.

isIgnoreExisting

public boolean isIgnoreExisting()
Getter for property ignoreExisting. The default value for this flag is false, so existing files that aren't downloaded are still passed on to the next stage.

Returns:
Value of property ignoreExisting.

setIgnoreExisting

public void setIgnoreExisting(boolean ignoreExisting)
Setter for property ignoreExisting.

Parameters:
ignoreExisting - New value of property ignoreExisting.


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.