Browse Source

remove imports, change _copy to myCopy

Obtained from: Kevin Jackson


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277294 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
2d15e8d8b3
1 changed files with 19 additions and 23 deletions
  1. +19
    -23
      src/main/org/apache/tools/ant/taskdefs/Sync.java

+ 19
- 23
src/main/org/apache/tools/ant/taskdefs/Sync.java View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2003-2004 The Apache Software Foundation
* Copyright 2003-2005 The Apache Software Foundation
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ package org.apache.tools.ant.taskdefs;
import java.io.File; import java.io.File;


import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Set; import java.util.Set;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -34,9 +33,6 @@ import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task; import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
import org.apache.tools.ant.util.FileNameMapper;
import org.apache.tools.ant.util.IdentityMapper;


/** /**
* Synchronize a local target directory from the files defined * Synchronize a local target directory from the files defined
@@ -57,19 +53,19 @@ import org.apache.tools.ant.util.IdentityMapper;
public class Sync extends Task { public class Sync extends Task {


// Same as regular <copy> task... see at end-of-file! // Same as regular <copy> task... see at end-of-file!
private MyCopy _copy;
private MyCopy myCopy;


// Override Task#init // Override Task#init
public void init() public void init()
throws BuildException { throws BuildException {
// Instantiate it // Instantiate it
_copy = new MyCopy();
configureTask(_copy);
myCopy = new MyCopy();
configureTask(myCopy);


// Default config of <mycopy> for our purposes. // Default config of <mycopy> for our purposes.
_copy.setFiltering(false);
_copy.setIncludeEmptyDirs(false);
_copy.setPreserveLastModified(true);
myCopy.setFiltering(false);
myCopy.setIncludeEmptyDirs(false);
myCopy.setPreserveLastModified(true);
} }


private void configureTask(Task helper) { private void configureTask(Task helper) {
@@ -83,10 +79,10 @@ public class Sync extends Task {
public void execute() public void execute()
throws BuildException { throws BuildException {
// The destination of the files to copy // The destination of the files to copy
File toDir = _copy.getToDir();
File toDir = myCopy.getToDir();


// The complete list of files to copy // The complete list of files to copy
Set allFiles = _copy.nonOrphans;
Set allFiles = myCopy.nonOrphans;


// If the destination directory didn't already exist, // If the destination directory didn't already exist,
// or was empty, then no previous file removal is necessary! // or was empty, then no previous file removal is necessary!
@@ -94,7 +90,7 @@ public class Sync extends Task {


// Copy all the necessary out-of-date files // Copy all the necessary out-of-date files
log("PASS#1: Copying files to " + toDir, Project.MSG_DEBUG); log("PASS#1: Copying files to " + toDir, Project.MSG_DEBUG);
_copy.execute();
myCopy.execute();


// Do we need to perform further processing? // Do we need to perform further processing?
if (noRemovalNecessary) { if (noRemovalNecessary) {
@@ -109,7 +105,7 @@ public class Sync extends Task {
logRemovedCount(removedFileCount[1], "dangling file", "", "s"); logRemovedCount(removedFileCount[1], "dangling file", "", "s");


// Get rid of empty directories on the destination side // Get rid of empty directories on the destination side
if (!_copy.getIncludeEmptyDirs()) {
if (!myCopy.getIncludeEmptyDirs()) {
log("PASS#3: Removing empty directories from " + toDir, log("PASS#3: Removing empty directories from " + toDir,
Project.MSG_DEBUG); Project.MSG_DEBUG);
int removedDirCount = removeEmptyDirectories(toDir, false); int removedDirCount = removeEmptyDirectories(toDir, false);
@@ -119,7 +115,7 @@ public class Sync extends Task {


private void logRemovedCount(int count, String prefix, private void logRemovedCount(int count, String prefix,
String singularSuffix, String pluralSuffix) { String singularSuffix, String pluralSuffix) {
File toDir = _copy.getToDir();
File toDir = myCopy.getToDir();


String what = (prefix == null) ? "" : prefix; String what = (prefix == null) ? "" : prefix;
what += (count < 2) ? singularSuffix : pluralSuffix; what += (count < 2) ? singularSuffix : pluralSuffix;
@@ -230,28 +226,28 @@ public class Sync extends Task {
* Sets the destination directory. * Sets the destination directory.
*/ */
public void setTodir(File destDir) { public void setTodir(File destDir) {
_copy.setTodir(destDir);
myCopy.setTodir(destDir);
} }


/** /**
* Used to force listing of all names of copied files. * Used to force listing of all names of copied files.
*/ */
public void setVerbose(boolean verbose) { public void setVerbose(boolean verbose) {
_copy.setVerbose(verbose);
myCopy.setVerbose(verbose);
} }


/** /**
* Overwrite any existing destination file(s). * Overwrite any existing destination file(s).
*/ */
public void setOverwrite(boolean overwrite) { public void setOverwrite(boolean overwrite) {
_copy.setOverwrite(overwrite);
myCopy.setOverwrite(overwrite);
} }


/** /**
* Used to copy empty directories. * Used to copy empty directories.
*/ */
public void setIncludeEmptyDirs(boolean includeEmpty) { public void setIncludeEmptyDirs(boolean includeEmpty) {
_copy.setIncludeEmptyDirs(includeEmpty);
myCopy.setIncludeEmptyDirs(includeEmpty);
} }


/** /**
@@ -259,14 +255,14 @@ public class Sync extends Task {
* @param failonerror true or false * @param failonerror true or false
*/ */
public void setFailOnError(boolean failonerror) { public void setFailOnError(boolean failonerror) {
_copy.setFailOnError(failonerror);
myCopy.setFailOnError(failonerror);
} }


/** /**
* Adds a set of files to copy. * Adds a set of files to copy.
*/ */
public void addFileset(FileSet set) { public void addFileset(FileSet set) {
_copy.addFileset(set);
myCopy.addFileset(set);
} }


/** /**
@@ -278,7 +274,7 @@ public class Sync extends Task {
* @since Ant 1.6.2 * @since Ant 1.6.2
*/ */
public void setGranularity(long granularity) { public void setGranularity(long granularity) {
_copy.setGranularity(granularity);
myCopy.setGranularity(granularity);
} }


/** /**


Loading…
Cancel
Save