ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject svn commit: r668724 - in /ant/core/trunk/src/main/org/apache/tools/ant: taskdefs/ taskdefs/email/ taskdefs/optional/ types/resources/ types/resources/comparators/
Date Tue, 17 Jun 2008 16:04:19 GMT
Author: mbenson
Date: Tue Jun 17 09:04:18 2008
New Revision: 668724

URL: http://svn.apache.org/viewvc?rev=668724&view=rev
Log:
[43348] Use FileProvider interface

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/DependSet.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Pack.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Truncate.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Unpack.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java
    ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java Tue Jun 17 09:04:18
2008
@@ -42,10 +42,11 @@
 import org.apache.tools.ant.taskdefs.condition.Condition;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.Union;
 import org.apache.tools.ant.types.resources.Restrict;
-import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.selectors.Type;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
@@ -392,13 +393,13 @@
         try {
             if (resources != null) {
                 for (Iterator i = resources.iterator(); i.hasNext();) {
-                    FileResource fr = (FileResource) i.next();
-                    File src = fr.getFile();
+                    Resource r = (Resource) i.next();
+                    File src = ((FileProvider) r).getFile();
                     if (totalproperty != null || todir != null) {
                         // Use '/' to calculate digest based on file name.
                         // This is required in order to get the same result
                         // on different platforms.
-                        relativeFilePaths.put(src, fr.getName().replace(File.separatorChar,
'/'));
+                        relativeFilePaths.put(src, r.getName().replace(File.separatorChar,
'/'));
                     }
                     addToIncludeFileMap(src);
                 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java Tue Jun 17 09:04:18
2008
@@ -45,9 +45,9 @@
 import org.apache.tools.ant.types.FilterChain;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.Restrict;
 import org.apache.tools.ant.types.resources.Resources;
-import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.StringResource;
 import org.apache.tools.ant.types.resources.selectors.Not;
 import org.apache.tools.ant.types.resources.selectors.Exists;
@@ -854,8 +854,8 @@
         if (destinationFile != null) {
             for (Iterator i = rc.iterator(); i.hasNext();) {
                 Object o = i.next();
-                if (o instanceof FileResource) {
-                    File f = ((FileResource) o).getFile();
+                if (o instanceof FileProvider) {
+                    File f = ((FileProvider) o).getFile();
                     if (FILE_UTILS.fileNameEquals(f, destinationFile)) {
                         throw new BuildException("Input file \""
                             + f + "\" is the same as the output file.");

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java Tue Jun 17 09:04:18 2008
@@ -41,6 +41,7 @@
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
 import org.apache.tools.ant.types.ResourceFactory;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.FileNameMapper;
@@ -465,8 +466,8 @@
 
                         File baseDir = NULL_FILE_PLACEHOLDER;
                         String name = r.getName();
-                        if (r instanceof FileResource) {
-                            FileResource fr = (FileResource) r;
+                        if (r instanceof FileProvider) {
+                            FileResource fr = ResourceUtils.asFileResource((FileProvider)
r);
                             baseDir = getKeyFile(fr.getBaseDir());
                             if (fr.getBaseDir() == null) {
                                 name = fr.getFile().getAbsolutePath();
@@ -476,7 +477,7 @@
                         // copying of dirs is trivial and can be done
                         // for non-file resources as well as for real
                         // files.
-                        if (r.isDirectory() || r instanceof FileResource) {
+                        if (r.isDirectory() || r instanceof FileProvider) {
                             add(baseDir, name,
                                 r.isDirectory() ? dirsByBasedir
                                                 : filesByBasedir);
@@ -620,7 +621,7 @@
                     throw new BuildException(
                         "Cannot perform operation from directory to file.");
                 } else if (rc.size() == 1) {
-                    FileResource r = (FileResource) rc.iterator().next();
+                    FileProvider r = (FileProvider) rc.iterator().next();
                     if (file == null) {
                         file = r.getFile();
                         rcs.removeElementAt(0);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java Tue Jun 17 09:04:18
2008
@@ -30,10 +30,10 @@
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.PatternSet;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.Sort;
 import org.apache.tools.ant.types.resources.Restrict;
 import org.apache.tools.ant.types.resources.Resources;
-import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.FileResourceIterator;
 import org.apache.tools.ant.types.resources.comparators.Reverse;
 import org.apache.tools.ant.types.resources.comparators.FileSystem;
@@ -590,17 +590,17 @@
         try {
             if (resourcesToDelete.isFilesystemOnly()) {
                 for (Iterator iter = resourcesToDelete.iterator(); iter.hasNext();) {
-                    FileResource r = (FileResource) iter.next();
                     // nonexistent resources could only occur if we already
                     // deleted something from a fileset:
-                    if (!r.isExists()) {
+                    File f = ((FileProvider) iter.next()).getFile();
+                    if (!f.exists()) {
                         continue;
                     }
-                    if (!(r.isDirectory()) || r.getFile().list().length == 0) {
-                        log("Deleting " + r, verbosity);
-                        if (!delete(r.getFile()) && failonerror) {
+                    if (!(f.isDirectory()) || f.list().length == 0) {
+                        log("Deleting " + f, verbosity);
+                        if (!delete(f) && failonerror) {
                             handle("Unable to delete "
-                                + (r.isDirectory() ? "directory " : "file ") + r);
+                                + (f.isDirectory() ? "directory " : "file ") + f);
                         }
                     }
                 }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/DependSet.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/DependSet.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/DependSet.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/DependSet.java Tue Jun 17 09:04:18
2008
@@ -31,7 +31,6 @@
 import org.apache.tools.ant.types.resources.Union;
 import org.apache.tools.ant.types.resources.Restrict;
 import org.apache.tools.ant.types.resources.Resources;
-import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.selectors.Not;
 import org.apache.tools.ant.types.resources.selectors.Exists;
 import org.apache.tools.ant.types.resources.selectors.ResourceSelector;
@@ -205,7 +204,7 @@
             log(neTargets + " nonexistent targets", Project.MSG_VERBOSE);
             return false;
         }
-        FileResource oldestTarget = (FileResource) getOldest(targets);
+        Resource oldestTarget = getOldest(targets);
         log(oldestTarget + " is oldest target file", Project.MSG_VERBOSE);
 
         logFuture(sources, datesel);

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java Tue Jun 17 09:04:18
2008
@@ -35,9 +35,11 @@
 import org.apache.tools.ant.types.Mapper;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.Union;
 import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.ResourceUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
 
 /**
@@ -424,8 +426,8 @@
 
                     File base = null;
                     String name = res.getName();
-                    if (res instanceof FileResource) {
-                        FileResource fr = (FileResource) res;
+                    if (res instanceof FileProvider) {
+                        FileResource fr = ResourceUtils.asFileResource((FileProvider) res);
                         base = fr.getBaseDir();
                         if (base == null) {
                             name = fr.getFile().getAbsolutePath();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java Tue Jun 17 09:04:18
2008
@@ -38,7 +38,7 @@
 import org.apache.tools.ant.types.PatternSet;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.Union;
 import org.apache.tools.ant.types.selectors.SelectorUtils;
 import org.apache.tools.ant.util.FileNameMapper;
@@ -114,8 +114,8 @@
                 continue;
             }
 
-            if (r instanceof FileResource) {
-                expandFile(FILE_UTILS, ((FileResource) r).getFile(), dest);
+            if (r instanceof FileProvider) {
+                expandFile(FILE_UTILS, ((FileProvider) r).getFile(), dest);
             } else {
                 expandResource(r, dest);
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java Tue Jun 17 09:04:18
2008
@@ -46,7 +46,7 @@
 import org.apache.tools.ant.types.PatternSet;
 import org.apache.tools.ant.types.Reference;
 import org.apache.tools.ant.types.ResourceCollection;
-import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.JavaEnvUtils;
 
@@ -1910,7 +1910,7 @@
                 "Error creating or writing temporary file for javadoc options",
                 ex, getLocation());
         } finally {
-            FILE_UTILS.close(optionsListWriter);
+            FileUtils.close(optionsListWriter);
         }
     }
 
@@ -2267,7 +2267,7 @@
             }
             Iterator iter = rc.iterator();
             while (iter.hasNext()) {
-                sf.addElement(new SourceFile(((FileResource) iter.next())
+                sf.addElement(new SourceFile(((FileProvider) iter.next())
                                              .getFile()));
             }
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Pack.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Pack.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Pack.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Pack.java Tue Jun 17 09:04:18 2008
@@ -26,6 +26,7 @@
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 
 /**
@@ -74,11 +75,10 @@
         if (src.isDirectory()) {
             throw new BuildException("the source can't be a directory");
         }
-        if (src instanceof FileResource) {
-            source = ((FileResource) src).getFile();
+        if (src instanceof FileProvider) {
+            source = ((FileProvider) src).getFile();
         } else if (!supportsNonFileResources()) {
-            throw new BuildException("Only FileSystem resources are"
-                                     + " supported.");
+            throw new BuildException("Only FileSystem resources are supported.");
         }
         this.src = src;
     }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/SignJar.java Tue Jun 17 09:04:18
2008
@@ -26,10 +26,12 @@
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.condition.IsSigned;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.IdentityMapper;
 import org.apache.tools.ant.util.FileNameMapper;
+import org.apache.tools.ant.util.ResourceUtils;
 
 /**
  * Signs JAR or ZIP files with the javasign command line tool. The tool detailed
@@ -320,7 +322,7 @@
             // deal with the paths
             Iterator iter = sources.iterator();
             while (iter.hasNext()) {
-                FileResource fr = (FileResource) iter.next();
+                FileResource fr = ResourceUtils.asFileResource((FileProvider) iter.next());
 
                 //calculate our destination directory; it is either the destDir
                 //attribute, or the base dir of the fileset (for in situ updates)

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Tar.java Tue Jun 17 09:04:18 2008
@@ -39,11 +39,13 @@
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
 import org.apache.tools.ant.types.resources.ArchiveResource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.selectors.SelectorUtils;
 import org.apache.tools.ant.types.resources.TarResource;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.MergingMapper;
+import org.apache.tools.ant.util.ResourceUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
 import org.apache.tools.bzip2.CBZip2OutputStream;
 import org.apache.tools.tar.TarConstants;
@@ -559,7 +561,7 @@
             HashMap basedirToFilesMap = new HashMap();
             Iterator iter = rc.iterator();
             while (iter.hasNext()) {
-                FileResource r = (FileResource) iter.next();
+                FileResource r = ResourceUtils.asFileResource((FileProvider) iter.next());
                 File base = r.getBaseDir();
                 if (base == null) {
                     base = Copy.NULL_FILE_PLACEHOLDER;
@@ -652,7 +654,7 @@
         } else if (rc.isFilesystemOnly()) {
             Iterator iter = rc.iterator();
             while (iter.hasNext()) {
-                FileResource r = (FileResource) iter.next();
+                FileResource r = ResourceUtils.asFileResource((FileProvider) iter.next());
                 File f = r.getFile();
                 if (f == null) {
                     f = new File(r.getBaseDir(), r.getName());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Touch.java Tue Jun 17 09:04:18 2008
@@ -35,6 +35,7 @@
 import org.apache.tools.ant.types.FileList;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.Touchable;
 import org.apache.tools.ant.types.resources.Union;
@@ -338,9 +339,9 @@
 
     private void touch(Resource r, long defaultTimestamp) {
         if (fileNameMapper == null) {
-            if (r instanceof FileResource) {
+            if (r instanceof FileProvider) {
                 // use this to create file and deal with non-writable files
-                touch(((FileResource) r).getFile(), defaultTimestamp);
+                touch(((FileProvider) r).getFile(), defaultTimestamp);
             } else {
                 ((Touchable) r).touch(defaultTimestamp);
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Truncate.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Truncate.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Truncate.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Truncate.java Tue Jun 17 09:04:18
2008
@@ -27,6 +27,7 @@
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Path;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.util.FileUtils;
 
@@ -125,7 +126,7 @@
             throw new BuildException(NO_CHILD);
         }
         for (Iterator it = path.iterator(); it.hasNext();) {
-            File f = ((FileResource) it.next()).getFile();
+            File f = ((FileProvider) it.next()).getFile();
             if (shouldProcess(f)) {
                 process(f);
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Unpack.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Unpack.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Unpack.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Unpack.java Tue Jun 17 09:04:18
2008
@@ -24,6 +24,7 @@
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 
 /**
@@ -90,8 +91,8 @@
             throw new BuildException(
                 "the archive " + src.getName() + " can't be a directory");
         }
-        if (src instanceof FileResource) {
-            source = ((FileResource) src).getFile();
+        if (src instanceof FileProvider) {
+            source = ((FileProvider) src).getFile();
         } else if (!supportsNonFileResources()) {
             throw new BuildException(
                 "The source " + src.getName()

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/VerifyJar.java Tue Jun 17 09:04:18
2008
@@ -24,6 +24,7 @@
 import org.apache.tools.ant.types.RedirectorElement;
 import org.apache.tools.ant.types.FilterChain;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 
 import java.util.Iterator;
@@ -90,7 +91,7 @@
             Path sources = createUnifiedSourcePath();
             Iterator iter = sources.iterator();
             while (iter.hasNext()) {
-                FileResource fr = (FileResource) iter.next();
+                FileProvider fr = (FileProvider) iter.next();
                 verifyOneJar(fr.getFile());
             }
 

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java Tue Jun 17 09:04:18
2008
@@ -38,6 +38,7 @@
 import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.FileUtils;
+import org.apache.tools.ant.util.ResourceUtils;
 
 /**
  * Processes a set of XML documents via XSLT. This is
@@ -591,8 +592,8 @@
             }
             File base = baseDir;
             String name = r.getName();
-            if (r instanceof FileResource) {
-                FileResource f = (FileResource) r;
+            if (r instanceof FileProvider) {
+                FileResource f = ResourceUtils.asFileResource((FileProvider) r);
                 base = f.getBaseDir();
                 if (base == null) {
                     name = f.getFile().getAbsolutePath();

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/XmlProperty.java Tue Jun 17 09:04:18
2008
@@ -29,6 +29,7 @@
 import org.apache.tools.ant.types.Resource;
 import org.apache.tools.ant.types.ResourceCollection;
 import org.apache.tools.ant.types.XMLCatalog;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.util.FileUtils;
 import org.w3c.dom.Document;
@@ -243,8 +244,8 @@
               DocumentBuilder builder = factory.newDocumentBuilder();
               builder.setEntityResolver(getEntityResolver());
               Document document = null;
-              if (src instanceof FileResource) {
-                  document = builder.parse(((FileResource) src).getFile());
+              if (src instanceof FileProvider) {
+                  document = builder.parse(((FileProvider) src).getFile());
               } else {
                   document = builder.parse(src.getInputStream());
               }
@@ -573,10 +574,11 @@
         if (src.isDirectory()) {
             throw new BuildException("the source can't be a directory");
         }
-        if (src instanceof FileResource && !supportsNonFileResources()) {
+        if (src instanceof FileProvider || supportsNonFileResources()) {
+            this.src = src;
+        } else {
             throw new BuildException("Only FileSystem resources are supported.");
         }
-        this.src = src;
     }
 
     /**
@@ -667,7 +669,7 @@
      * @return the file attribute.
      */
     protected File getFile () {
-        return src instanceof FileResource ? ((FileResource) src).getFile() : null;
+        return src instanceof FileProvider ? ((FileProvider) src).getFile() : null;
     }
 
     /**
@@ -677,8 +679,8 @@
         // delegate this way around to support subclasses that
         // overwrite getFile
         File f = getFile();
-        return f == null ? src : src instanceof FileResource
-                && ((FileResource) src).getFile().equals(f) ? src : new FileResource(f);
+        return f == null ? src : src instanceof FileProvider
+                && ((FileProvider) src).getFile().equals(f) ? src : new FileResource(f);
     }
 
     /**

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java Tue Jun 17 09:04:18 2008
@@ -46,7 +46,7 @@
 import org.apache.tools.ant.types.ZipFileSet;
 import org.apache.tools.ant.types.ZipScanner;
 import org.apache.tools.ant.types.resources.ArchiveResource;
-import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.GlobPatternMapper;
@@ -863,8 +863,8 @@
                 continue;
             }
             File base = null;
-            if (resources[i] instanceof FileResource) {
-                base = ((FileResource) resources[i]).getBaseDir();
+            if (resources[i] instanceof FileProvider) {
+                base = ResourceUtils.asFileResource((FileProvider) resources[i]).getBaseDir();
             }
             if (resources[i].isDirectory()) {
                 if (!name.endsWith("/")) {
@@ -876,8 +876,8 @@
                           ArchiveFileSet.DEFAULT_DIR_MODE);
 
             if (!resources[i].isDirectory()) {
-                if (resources[i] instanceof FileResource) {
-                    File f = ((FileResource) resources[i]).getFile();
+                if (resources[i] instanceof FileProvider) {
+                    File f = ((FileProvider) resources[i]).getFile();
                     zipFile(f, zOut, name, ArchiveFileSet.DEFAULT_FILE_MODE);
                 } else {
                     InputStream is = null;
@@ -1254,8 +1254,8 @@
             }
 
             for (int j = 0; j < initialResources[i].length; j++) {
-                if (initialResources[i][j] instanceof FileResource
-                    && zipFile.equals(((FileResource)
+                if (initialResources[i][j] instanceof FileProvider
+                    && zipFile.equals(((FileProvider)
                                        initialResources[i][j]).getFile())) {
                     throw new BuildException("A zip file cannot include "
                                              + "itself", getLocation());

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java Tue Jun 17
09:04:18 2008
@@ -28,6 +28,7 @@
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.util.ClasspathUtils;
 
@@ -499,8 +500,7 @@
                 Iterator iter = attachments.iterator();
 
                 while (iter.hasNext()) {
-                    FileResource fr = (FileResource) iter.next();
-                    files.addElement(fr.getFile());
+                    files.addElement(((FileProvider) iter.next()).getFile());
                 }
             }
             // let the user know what's going to happen

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java Tue Jun
17 09:04:18 2008
@@ -52,6 +52,7 @@
 import org.apache.tools.ant.taskdefs.XSLTProcess;
 import org.apache.tools.ant.types.XMLCatalog;
 import org.apache.tools.ant.types.Resource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.types.resources.FileResource;
 import org.apache.tools.ant.types.resources.URLResource;
 import org.apache.tools.ant.util.FileUtils;
@@ -271,8 +272,8 @@
     }
 
     private String resourceToURI(Resource resource) {
-        if (resource instanceof FileResource) {
-            File f = ((FileResource) resource).getFile();
+        if (resource instanceof FileProvider) {
+            File f = ((FileProvider) resource).getFile();
             return FILE_UTILS.toURI(f.getAbsolutePath());
         }
         if (resource instanceof URLResource) {

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionContainer.java
Tue Jun 17 09:04:18 2008
@@ -158,7 +158,7 @@
         /* now check each Resource in case the child only
            lets through files from any children IT may have: */
         for (Iterator i = cacheCollection().iterator(); i.hasNext();) {
-            if (!(i.next() instanceof FileResource)) {
+            if (!(i.next() instanceof FileProvider)) {
                 return false;
             }
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
Tue Jun 17 09:04:18 2008
@@ -122,7 +122,7 @@
         /* now check each Resource in case the child only
            lets through files from any children IT may have: */
         for (Iterator i = cacheCollection().iterator(); i.hasNext();) {
-            if (!(i.next() instanceof FileResource)) {
+            if (!(i.next() instanceof FileProvider)) {
                 return false;
             }
         }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/FileResource.java Tue Jun
17 09:04:18 2008
@@ -228,13 +228,12 @@
         if (this.equals(another)) {
             return 0;
         }
-        if (another.getClass().equals(getClass())) {
-            FileResource otherfr = (FileResource) another;
+        if (another instanceof FileProvider) {
             File f = getFile();
             if (f == null) {
                 return -1;
             }
-            File of = otherfr.getFile();
+            File of = ((FileProvider) another).getFile();
             if (of == null) {
                 return 1;
             }

Modified: ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java?rev=668724&r1=668723&r2=668724&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java
(original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/types/resources/comparators/FileSystem.java
Tue Jun 17 09:04:18 2008
@@ -19,7 +19,7 @@
 
 import java.io.File;
 import org.apache.tools.ant.types.Resource;
-import org.apache.tools.ant.types.resources.FileResource;
+import org.apache.tools.ant.types.resources.FileProvider;
 import org.apache.tools.ant.util.FileUtils;
 
 /**
@@ -38,8 +38,8 @@
      * @throws ClassCastException if either resource is not an instance of FileResource.
      */
     protected int resourceCompare(Resource foo, Resource bar) {
-        File foofile = ((FileResource) foo).getFile();
-        File barfile = ((FileResource) bar).getFile();
+        File foofile = ((FileProvider) foo).getFile();
+        File barfile = ((FileProvider) bar).getFile();
         return foofile.equals(barfile) ? 0
             : FILE_UTILS.isLeadingPath(foofile, barfile) ? -1
             : FILE_UTILS.normalize(foofile.getAbsolutePath()).compareTo(



Mime
View raw message