ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs Move.java Copy.java
Date Fri, 25 Jul 2003 08:31:45 GMT
peterreilly    2003/07/25 01:31:45

  Modified:    src/main/org/apache/tools/ant/taskdefs Move.java Copy.java
  Log:
  checkstyle
  
  Revision  Changes    Path
  1.40      +24 -4     ant/src/main/org/apache/tools/ant/taskdefs/Move.java
  
  Index: Move.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Move.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- Move.java	24 Jul 2003 13:14:20 -0000	1.39
  +++ Move.java	25 Jul 2003 08:31:45 -0000	1.40
  @@ -90,15 +90,25 @@
    */
   public class Move extends Copy {
   
  +    /**
  +     * Constructor of object.
  +     * This sets the forceOverwrite attribute of the Copy parent class
  +     * to true.
  +     *
  +     */
       public Move() {
           super();
  -        forceOverwrite = true;
  +        setOverwrite(true);
       }
   
   //************************************************************************
   //  protected and private methods
   //************************************************************************
   
  +    /**
  +     * Override copy's doFileOperations to move the
  +     * files instead of copying them.
  +     */
       protected void doFileOperations() {
           //Attempt complete directory renames, if any, first.
           if (completeDirMap.size() > 0) {
  @@ -190,7 +200,7 @@
               if (createCount > 0) {
                   log("Moved " + dirCopyMap.size()
                       + " empty director"
  -                    + (dirCopyMap.size()== 1 ? "y" : "ies")
  +                    + (dirCopyMap.size() == 1 ? "y" : "ies")
                       + " to " + createCount
                       + " empty director"
                       + (createCount == 1 ? "y" : "ies") + " under "
  @@ -274,6 +284,7 @@
       /**
        * Its only ok to delete a directory tree if there are
        * no files in it.
  +     * @param d the directory to check
        * @return true if a deletion can go ahead
        */
       protected boolean okToDelete(File d) {
  @@ -299,6 +310,7 @@
   
       /**
        * Go and delete the directory tree.
  +     * @param d the directory to delete
        */
       protected void deleteDir(File d) {
           String[] list = d.list();
  @@ -332,7 +344,15 @@
        * Method then checks if token filtering is used.  If it is, this method
        * returns false assuming it is the responsibility to the copyFile method.
        *
  -     * @throws IOException
  +     * @param sourceFile the file to rename
  +     * @param destFile   the destination file
  +     * @param filtering  if true, filtering is in operation, file will
  +     *                   be copied/deleted instead of renamed
  +     * @param overwrite  if true force overwrite even if destination file
  +     *                   is newer than source file
  +     * @return true if the file was renamed
  +     * @exception IOException if an error occurs
  +     * @exception BuildException if an error occurs
        */
       protected boolean renameFile(File sourceFile, File destFile,
                                    boolean filtering, boolean overwrite)
  
  
  
  1.64      +43 -6     ant/src/main/org/apache/tools/ant/taskdefs/Copy.java
  
  Index: Copy.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Copy.java,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- Copy.java	24 Jul 2003 13:14:20 -0000	1.63
  +++ Copy.java	25 Jul 2003 08:31:45 -0000	1.64
  @@ -129,12 +129,16 @@
           fileUtils = FileUtils.newFileUtils();
       }
   
  +    /**
  +     * @return the fileutils object
  +     */
       protected FileUtils getFileUtils() {
           return fileUtils;
       }
   
       /**
        * Sets a single source file to copy.
  +     * @param file the file to copy
        */
       public void setFile(File file) {
           this.file = file;
  @@ -142,6 +146,7 @@
   
       /**
        * Sets the destination file.
  +     * @param destFile the file to copy to
        */
       public void setTofile(File destFile) {
           this.destFile = destFile;
  @@ -149,6 +154,7 @@
   
       /**
        * Sets the destination directory.
  +     * @param destDir the destination directory
        */
       public void setTodir(File destDir) {
           this.destDir = destDir;
  @@ -156,6 +162,7 @@
   
       /**
        * Adds a FilterChain.
  +     * @return a filter chain object
        */
       public FilterChain createFilterChain() {
           FilterChain filterChain = new FilterChain();
  @@ -165,6 +172,7 @@
   
       /**
        * Adds a filterset.
  +     * @return a filter set object
        */
       public FilterSet createFilterSet() {
           FilterSet filterSet = new FilterSet();
  @@ -174,6 +182,7 @@
   
       /**
        * Give the copied files the same last modified time as the original files.
  +     * @param preserve a boolean string
        * @deprecated setPreserveLastModified(String) has been deprecated and
        *             replaced with setPreserveLastModified(boolean) to
        *             consistently let the Introspection mechanism work.
  @@ -184,6 +193,7 @@
   
       /**
        * Give the copied files the same last modified time as the original files.
  +     * @param preserve if true perserce the modified time, default is false
        */
       public void setPreserveLastModified(boolean preserve) {
           preserveLastModified = preserve;
  @@ -192,7 +202,7 @@
       /**
        * Whether to give the copied files the same last modified time as
        * the original files.
  -     *
  +     * @return the preserveLastModified attribute
        * @since 1.32, Ant 1.5
        */
       public boolean getPreserveLastModified() {
  @@ -219,6 +229,7 @@
   
       /**
        * If true, enables filtering.
  +     * @param filtering if true enable filtering, default is false
        */
       public void setFiltering(boolean filtering) {
           this.filtering = filtering;
  @@ -226,6 +237,9 @@
   
       /**
        * Overwrite any existing destination file(s).
  +     * @param overwrite if true force overwriting of destination file(s)
  +     *                  even if the destination file(s) are younger than
  +     *                  the corresponding source file. Default is false.
        */
       public void setOverwrite(boolean overwrite) {
           this.forceOverwrite = overwrite;
  @@ -237,6 +251,8 @@
        * the same name in the source directory tree, only the first
        * file will be copied into the "flattened" directory, unless
        * the forceoverwrite attribute is true.
  +     * @param flatten if true flatten the destination directory. Default
  +     *                is false.
        */
       public void setFlatten(boolean flatten) {
           this.flatten = flatten;
  @@ -244,6 +260,7 @@
   
       /**
        * Used to force listing of all names of copied files.
  +     * @param verbose output the names of copied files. Default is false.
        */
       public void setVerbose(boolean verbose) {
           if (verbose) {
  @@ -255,6 +272,7 @@
   
       /**
        * Used to copy empty directories.
  +     * @param includeEmpty if true copy empty directories. Default is true.
        */
       public void setIncludeEmptyDirs(boolean includeEmpty) {
           this.includeEmpty = includeEmpty;
  @@ -281,7 +299,7 @@
       public boolean isEnableMultipleMapping() {
           return enableMultipleMappings;
       }
  -    
  +
       /**
        * If false, note errors to the output but keep going.
        * @param failonerror true or false
  @@ -292,6 +310,7 @@
   
       /**
        * Adds a set of files to copy.
  +     * @param set a set of files to copy
        */
       public void addFileset(FileSet set) {
           filesets.addElement(set);
  @@ -299,6 +318,8 @@
   
       /**
        * Defines the mapper to map source to destination files.
  +     * @return a mapper to be configured
  +     * @exception BuildException if more than one mapper is defined
        */
       public Mapper createMapper() throws BuildException {
           if (mapperElement != null) {
  @@ -311,10 +332,10 @@
   
       /**
        * Sets the character encoding
  -     *
  +     * @param encoding the character encoding
        * @since 1.32, Ant 1.5
        */
  -    public void setEncoding (String encoding) {
  +    public void setEncoding(String encoding) {
           this.inputEncoding = encoding;
           if (outputEncoding == null) {
               outputEncoding = encoding;
  @@ -332,7 +353,7 @@
   
       /**
        * Sets the character encoding for output files.
  -     *
  +     * @param encoding the character encoding
        * @since Ant 1.6
        */
       public void setOutputEncoding(String encoding) {
  @@ -351,6 +372,7 @@
   
       /**
        * Performs the copy operation.
  +     * @exception BuildException if an error occurs
        */
       public void execute() throws BuildException {
           File savedFile = file; // may be altered in validateAttributes
  @@ -456,6 +478,7 @@
        * Ensure we have a consistent and legal set of attributes, and set
        * any internal flags necessary based on different combinations
        * of attributes.
  +     * @exception BuildException if an error occurs
        */
       protected void validateAttributes() throws BuildException {
           if (file == null && filesets.size() == 0) {
  @@ -512,6 +535,11 @@
       /**
        * Compares source files to destination files to see if they should be
        * copied.
  +     *
  +     * @param fromDir  The source directory
  +     * @param toDir    The destination dirctory
  +     * @param files    A list of files to copy
  +     * @param dirs     A list of directories to copy
        */
       protected void scan(File fromDir, File toDir, String[] files,
                           String[] dirs) {
  @@ -531,6 +559,15 @@
           }
       }
   
  +    /**
  +     * Add to a map of files/directories to copy
  +     *
  +     * @param fromDir the source directory
  +     * @param toDir   the destination directory
  +     * @param names   a list of filenames
  +     * @param mapper  a <code>FileNameMapper</code> value
  +     * @param map     a map of source file to array of destination files
  +     */
       protected void buildMap(File fromDir, File toDir, String[] names,
                               FileNameMapper mapper, Hashtable map) {
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message