You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by xa...@apache.org on 2007/12/28 01:11:43 UTC

svn commit: r607146 [1/4] - in /ant/ivy/core/trunk: ./ src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/ src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/ src...

Author: xavier
Date: Thu Dec 27 16:11:39 2007
New Revision: 607146

URL: http://svn.apache.org/viewvc?rev=607146&view=rev
Log:
TASK: Remove cache attribute on Ant tasks (IVY-685)

Added:
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/AbstractDependencyResolverTest.java   (with props)
Modified:
    ant/ivy/core/trunk/CHANGES.txt
    ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheFileset.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCachePath.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInstall.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheManager.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngineSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngineSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ConfigurationResolveReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/DownloadStatus.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ResolveReport.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/DownloadOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/IvyNode.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngine.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveEngineSettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/retrieve/RetrieveOptions.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomModuleDescriptorParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/BasicResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/CacheResolver.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/DependencyResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactReportTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInstallTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyPublishTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyReportTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRepositoryReportTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyResolveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyRetrieveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/install/InstallTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/publish/PublishEngineTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/RegexpConflictManagerTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportParserTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportWriterTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/DualResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java
    ant/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/VfsResolverTest.java

Modified: ant/ivy/core/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/CHANGES.txt?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/CHANGES.txt (original)
+++ ant/ivy/core/trunk/CHANGES.txt Thu Dec 27 16:11:39 2007
@@ -69,6 +69,8 @@
 - FIX: NPE in namespace transformation during the ivy:findrevision and ivy:resolve task execution (IVY-659) (thanks to Andrea Bernardo Ciddio)
 - FIX: Maven test scope includes all runtime dependencies (IVY-682)
 
+- TASK: Remove cache attribute on Ant tasks (IVY-685)
+
    2.0.0-beta1
 =====================================
 - NEW: Share cache with locking (IVY-654)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java Thu Dec 27 16:11:39 2007
@@ -31,6 +31,8 @@
 
 import org.apache.ivy.core.IvyContext;
 import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
 import org.apache.ivy.core.check.CheckEngine;
 import org.apache.ivy.core.deliver.DeliverEngine;
 import org.apache.ivy.core.deliver.DeliverOptions;
@@ -511,12 +513,12 @@
     // ///////////////////////////////////////////////////////////////////////
 
     public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive,
-            boolean validate, boolean overwrite, Filter artifactFilter, File cache,
-            String matcherName) throws IOException {
+            boolean validate, boolean overwrite, Filter artifactFilter, String matcherName) 
+            throws IOException {
         pushContext();
         try {
             return installEngine.install(mrid, from, to, transitive, validate, overwrite,
-                artifactFilter, cache, matcherName);
+                artifactFilter, matcherName);
         } finally {
             popContext();
         }
@@ -645,7 +647,6 @@
         try {
             ResolveOptions options = new ResolveOptions();
             options.setValidate(false);
-            options.setCache(CacheManager.getInstance(settings));
             return resolveEngine.findModule(mrid, options);
         } finally {
             popContext();
@@ -796,9 +797,10 @@
         return "working@" + HostUtil.getLocalHostName();
     }
 
-    public CacheManager getCacheManager(File cache) {
-        return CacheManager.getInstance(settings, cache);
+    public ResolutionCacheManager getResolutionCacheManager() {
+        return settings.getResolutionCacheManager();
     }
+
 
     private void assertBound() {
         if (!bound) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java Thu Dec 27 16:11:39 2007
@@ -106,7 +106,7 @@
             String status, Date pubdate, PublishingDependencyRevisionResolver pdrResolver,
             boolean validate, boolean resolveDynamicRevisions) throws IOException, ParseException {
         ivy.deliver(mrid, revision, destIvyPattern, new DeliverOptions(status, pubdate,
-                CacheManager.getInstance(ivy.getSettings(), cache), pdrResolver, validate,
+                pdrResolver, validate,
                 resolveDynamicRevisions, null));
     }
 
@@ -123,8 +123,7 @@
         return ivy.getRetrieveEngine().determineArtifactsToCopy(
             new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
             destFilePattern,
-            new RetrieveOptions().setConfs(confs).setCache(
-                CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+            new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                 destIvyPattern).setArtifactFilter(artifactFilter));
     }
 
@@ -133,24 +132,22 @@
         return ivy.getRetrieveEngine().determineArtifactsToCopy(
             new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
             destFilePattern,
-            new RetrieveOptions().setConfs(confs).setCache(
-                CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+            new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                 destIvyPattern));
     }
 
     public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
-        return ivy.getResolveEngine().download(artifact, ivy.getCacheManager(cache), useOrigin);
+        return ivy.getResolveEngine().download(artifact, useOrigin);
     }
 
     public void downloadArtifacts(ResolveReport report, CacheManager cacheManager,
             boolean useOrigin, Filter artifactFilter) {
-        ivy.getResolveEngine().downloadArtifacts(report, cacheManager, useOrigin, artifactFilter);
+        ivy.getResolveEngine().downloadArtifacts(report, useOrigin, artifactFilter);
     }
 
     public ResolvedModuleRevision findModule(ModuleRevisionId id) {
         ResolveOptions options = new ResolveOptions();
         options.setValidate(false);
-        options.setCache(CacheManager.getInstance(ivy.getSettings()));
         return ivy.getResolveEngine().findModule(id, options);
     }
 
@@ -185,7 +182,7 @@
     public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive,
             boolean validate, boolean overwrite, Filter artifactFilter, File cache,
             String matcherName) throws IOException {
-        return ivy.install(mrid, from, to, transitive, validate, overwrite, artifactFilter, cache,
+        return ivy.install(mrid, from, to, transitive, validate, overwrite, artifactFilter, 
             matcherName);
     }
 
@@ -252,8 +249,7 @@
             Collection srcArtifactPattern, String resolverName, String srcIvyPattern,
             String status, Date pubdate, Artifact[] extraArtifacts, boolean validate,
             boolean overwrite, boolean update, String conf) throws IOException {
-        return ivy.publish(mrid, srcArtifactPattern, resolverName, new PublishOptions().setCache(
-            ivy.getCacheManager(cache == null ? ivy.getSettings().getDefaultCache() : cache))
+        return ivy.publish(mrid, srcArtifactPattern, resolverName, new PublishOptions()
                 .setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
                 .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
                 .setUpdate(update).setValidate(validate).setOverwrite(overwrite).setConfs(
@@ -264,8 +260,7 @@
             String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate,
             boolean overwrite) throws IOException {
         return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
-            new PublishOptions().setCache(
-                ivy.getCacheManager(cache == null ? ivy.getSettings().getDefaultCache() : cache))
+            new PublishOptions()
                     .setPubrevision(pubrevision).setSrcIvyPattern(srcIvyPattern).setValidate(
                         validate).setOverwrite(overwrite));
     }
@@ -274,8 +269,7 @@
             String srcArtifactPattern, String resolverName, String srcIvyPattern, boolean validate)
             throws IOException {
         return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
-            new PublishOptions().setCache(
-                ivy.getCacheManager(cache == null ? ivy.getSettings().getDefaultCache() : cache))
+            new PublishOptions()
                     .setPubrevision(pubrevision).setSrcIvyPattern(srcIvyPattern).setValidate(
                         validate));
     }
@@ -285,8 +279,7 @@
             Date pubdate, Artifact[] extraArtifacts, boolean validate, boolean overwrite,
             boolean update, String conf) throws IOException {
         return ivy.publish(mrid, Collections.singleton(srcArtifactPattern), resolverName,
-            new PublishOptions().setCache(
-                ivy.getCacheManager(cache == null ? ivy.getSettings().getDefaultCache() : cache))
+            new PublishOptions()
                     .setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
                     .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts).setUpdate(
                         update).setValidate(validate).setOverwrite(overwrite).setConfs(
@@ -308,8 +301,7 @@
     private ResolveOptions newResolveOptions(String[] confs, String revision, File cache,
             Date date, boolean validate, boolean useCacheOnly, boolean transitive,
             boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) {
-        return new ResolveOptions().setConfs(confs).setRevision(revision).setCache(
-            ivy.getCacheManager(cache == null ? ivy.getSettings().getDefaultCache() : cache))
+        return new ResolveOptions().setConfs(confs).setRevision(revision)
                 .setValidate(validate).setUseCacheOnly(useCacheOnly).setTransitive(transitive)
                 .setUseOrigin(useOrigin).setDownload(download).setOutputReport(outputReport)
                 .setArtifactFilter(artifactFilter);
@@ -399,8 +391,7 @@
             boolean makeSymlinks) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
-                    CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+                destFilePattern, new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                     destIvyPattern).setArtifactFilter(artifactFilter).setSync(sync).setUseOrigin(
                     useOrigin).setMakeSymlinks(makeSymlinks));
         } catch (IOException e) {
@@ -412,8 +403,7 @@
             String destIvyPattern, Filter artifactFilter, boolean sync, boolean useOrigin) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
-                    CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+                destFilePattern, new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                     destIvyPattern).setArtifactFilter(artifactFilter).setSync(sync).setUseOrigin(
                     useOrigin));
         } catch (IOException e) {
@@ -425,8 +415,7 @@
             String destIvyPattern, Filter artifactFilter) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
-                    CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+                destFilePattern, new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                     destIvyPattern).setArtifactFilter(artifactFilter));
         } catch (IOException e) {
             throw new RuntimeException(e);
@@ -437,8 +426,7 @@
             String destIvyPattern) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
-                    CacheManager.getInstance(ivy.getSettings(), cache)).setDestIvyPattern(
+                destFilePattern, new RetrieveOptions().setConfs(confs).setDestIvyPattern(
                     destIvyPattern));
         } catch (IOException e) {
             throw new RuntimeException(e);
@@ -448,8 +436,7 @@
     public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern) {
         try {
             return ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
-                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
-                    CacheManager.getInstance(ivy.getSettings(), cache)));
+                destFilePattern, new RetrieveOptions().setConfs(confs));
         } catch (IOException e) {
             throw new RuntimeException(e);
         }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/Main.java Thu Dec 27 16:11:39 2007
@@ -44,13 +44,14 @@
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
 import org.apache.ivy.core.deliver.DeliverOptions;
-import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.publish.PublishOptions;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.retrieve.RetrieveOptions;
@@ -227,8 +228,8 @@
                 }
             }
 
-            ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs).setCache(
-                cacheManager).setValidate(validate).setUseOrigin(line.hasOption("useOrigin"));
+            ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs)
+                .setValidate(validate).setUseOrigin(line.hasOption("useOrigin"));
             ResolveReport report = ivy.resolve(ivyfile.toURL(), resolveOptions);
             if (report.hasError()) {
                 System.exit(1);
@@ -244,7 +245,7 @@
                     retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[ext]";
                 }
                 ivy.retrieve(md.getModuleRevisionId(), retrievePattern, new RetrieveOptions()
-                        .setConfs(confs).setCache(cacheManager).setSync(line.hasOption("sync"))
+                        .setConfs(confs).setSync(line.hasOption("sync"))
                         .setUseOrigin(line.hasOption("useOrigin")));
             }
             if (line.hasOption("cachepath")) {
@@ -257,12 +258,12 @@
                         .getOptionValue("revision")), settings.substitute(line.getOptionValue(
                     "deliverto", "ivy-[revision].xml")), DeliverOptions.newInstance(settings)
                         .setStatus(settings.substitute(line.getOptionValue("status", "release")))
-                        .setValidate(validate).setCache(cacheManager));
+                        .setValidate(validate));
                 if (line.hasOption("publish")) {
                     ivy.publish(md.getResolvedModuleRevisionId(), Collections.singleton(settings
                             .substitute(line.getOptionValue("publishpattern",
                                 "distrib/[type]s/[artifact]-[revision].[ext]"))), line
-                            .getOptionValue("publish"), new PublishOptions().setCache(cacheManager)
+                            .getOptionValue("publish"), new PublishOptions()
                             .setPubrevision(settings.substitute(line.getOptionValue("revision")))
                             .setValidate(validate).setSrcIvyPattern(
                                 settings.substitute(line.getOptionValue("deliverto",
@@ -384,26 +385,27 @@
             String pathSeparator = System.getProperty("path.separator");
             StringBuffer buf = new StringBuffer();
             Collection all = new LinkedHashSet();
-            CacheManager cacheMgr = ivy.getCacheManager(cache);
+            ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
             XmlReportParser parser = new XmlReportParser();
             for (int i = 0; i < confs.length; i++) {
                 String resolveId = ResolveOptions.getDefaultResolveId(md);
                 File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
                 parser.parse(report);
 
-                Artifact[] artifacts = parser.getArtifacts();
-                all.addAll(Arrays.asList(artifacts));
+                all.addAll(Arrays.asList(parser.getArtifactReports()));
             }
             for (Iterator iter = all.iterator(); iter.hasNext();) {
-                Artifact artifact = (Artifact) iter.next();
-                buf.append(ivy.getCacheManager(cache).getArchiveFileInCache(artifact)
-                        .getCanonicalPath());
-                if (iter.hasNext()) {
+                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+                if (artifact.getLocalFile() != null) {
+                    buf.append(artifact.getLocalFile().getCanonicalPath());
                     buf.append(pathSeparator);
                 }
             }
+            
             PrintWriter writer = new PrintWriter(new FileOutputStream(outFile));
-            writer.println(buf.toString());
+            if (buf.length() > 0) {
+                writer.println(buf.substring(0, buf.length() - pathSeparator.length()));
+            }
             writer.close();
             System.out.println("cachepath output to " + outFile);
 
@@ -431,20 +433,21 @@
         
         try {
             Collection all = new LinkedHashSet();
-            CacheManager cacheMgr = ivy.getCacheManager(cache);
+            ResolutionCacheManager cacheMgr = ivy.getResolutionCacheManager();
             XmlReportParser parser = new XmlReportParser();
             for (int i = 0; i < confs.length; i++) {
                 String resolveId = ResolveOptions.getDefaultResolveId(md);
                 File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
                 parser.parse(report);
 
-                Artifact[] artifacts = parser.getArtifacts();
-                all.addAll(Arrays.asList(artifacts));
+                all.addAll(Arrays.asList(parser.getArtifactReports()));
             }
             for (Iterator iter = all.iterator(); iter.hasNext();) {
-                Artifact artifact = (Artifact) iter.next();
+                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
 
-                urls.add(cacheMgr.getArchiveFileInCache(artifact).toURL());
+                if (artifact.getLocalFile() != null) {
+                    urls.add(artifact.getLocalFile().toURL());
+                }
             }
         } catch (Exception ex) {
             throw new RuntimeException(

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactProperty.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactProperty.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactProperty.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactProperty.java Thu Dec 27 16:11:39 2007
@@ -61,7 +61,7 @@
         prepareAndCheck();
 
         try {
-            ResolutionCacheManager cacheMgr = getIvyInstance().getCacheManager(getCache());
+            ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
             String[] confs = splitConfs(getConf());
             String resolveId = getResolveId();
             if (resolveId == null) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java Thu Dec 27 16:11:39 2007
@@ -35,10 +35,11 @@
 import javax.xml.transform.stream.StreamResult;
 
 import org.apache.ivy.core.cache.ArtifactOrigin;
-import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.retrieve.RetrieveOptions;
@@ -82,7 +83,6 @@
 
         try {
             String[] confs = splitConfs(getConf());
-            CacheManager cacheManager = CacheManager.getInstance(getSettings(), getCache());
             ModuleDescriptor md = null;
             if (getResolveId() != null) {
                 md = (ModuleDescriptor) getResolvedDescriptor(getResolveId());
@@ -92,28 +92,28 @@
             }
             IvyNode[] dependencies = getIvyInstance().getResolveEngine().getDependencies(
                 md,
-                new ResolveOptions().setConfs(confs).setCache(cacheManager).setResolveId(
+                new ResolveOptions().setConfs(confs).setResolveId(
                     getResolveId()).setValidate(doValidate(getSettings())), null);
 
             Map artifactsToCopy = getIvyInstance().getRetrieveEngine().determineArtifactsToCopy(
                 ModuleRevisionId.newInstance(getOrganisation(), getModule(), getRevision()),
                 pattern,
-                new RetrieveOptions().setConfs(confs).setResolveId(getResolveId()).setCache(
-                    cacheManager));
+                new RetrieveOptions().setConfs(confs).setResolveId(getResolveId()));
 
             Map moduleRevToArtifactsMap = new HashMap();
             for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
-                Artifact artifact = (Artifact) iter.next();
-                Set moduleRevArtifacts = (Set) moduleRevToArtifactsMap.get(artifact
+                ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+                Set moduleRevArtifacts = (Set) moduleRevToArtifactsMap.get(artifact.getArtifact()
                         .getModuleRevisionId());
                 if (moduleRevArtifacts == null) {
                     moduleRevArtifacts = new HashSet();
-                    moduleRevToArtifactsMap.put(artifact.getModuleRevisionId(), moduleRevArtifacts);
+                    moduleRevToArtifactsMap.put(
+                        artifact.getArtifact().getModuleRevisionId(), moduleRevArtifacts);
                 }
                 moduleRevArtifacts.add(artifact);
             }
 
-            generateXml(cacheManager, dependencies, moduleRevToArtifactsMap, artifactsToCopy);
+            generateXml(dependencies, moduleRevToArtifactsMap, artifactsToCopy);
         } catch (ParseException e) {
             log(e.getMessage(), Project.MSG_ERR);
             throw new BuildException("syntax errors in ivy file: " + e, e);
@@ -122,7 +122,7 @@
         }
     }
 
-    private void generateXml(CacheManager cache, IvyNode[] dependencies,
+    private void generateXml(IvyNode[] dependencies,
             Map moduleRevToArtifactsMap, Map artifactsToCopy) {
         try {
             FileOutputStream fileOuputStream = new FileOutputStream(tofile);
@@ -145,13 +145,16 @@
                             .getModuleRevision().getId());
                     if (artifactsOfModuleRev != null) {
                         for (Iterator iter = artifactsOfModuleRev.iterator(); iter.hasNext();) {
-                            Artifact artifact = (Artifact) iter.next();
+                            ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();
+                            
+                            RepositoryCacheManager cache = dependency.getModuleRevision()
+                                .getArtifactResolver().getRepositoryCacheManager();
 
-                            startArtifact(saxHandler, artifact);
+                            startArtifact(saxHandler, artifact.getArtifact());
 
-                            writeOriginLocationIfPresent(cache, saxHandler, artifact);
+                            writeOriginLocationIfPresent(cache, saxHandler, artifact.getArtifact());
 
-                            writeCacheLocation(cache, saxHandler, artifact);
+                            writeCacheLocation(cache, saxHandler, artifact.getArtifact());
 
                             Set artifactDestPaths = (Set) artifactsToCopy.get(artifact);
                             for (Iterator iterator = artifactDestPaths.iterator(); iterator
@@ -212,8 +215,9 @@
         saxHandler.startElement(null, "artifact", "artifact", artifactAttrs);
     }
 
-    private void writeOriginLocationIfPresent(CacheManager cache, TransformerHandler saxHandler,
-            Artifact artifact) throws IOException, SAXException {
+    private void writeOriginLocationIfPresent(
+            RepositoryCacheManager cache, TransformerHandler saxHandler, Artifact artifact) 
+            throws IOException, SAXException {
         ArtifactOrigin origin = cache.getSavedArtifactOrigin(artifact);
         if (origin != null) {
             String originName = origin.getLocation();
@@ -236,7 +240,7 @@
         }
     }
 
-    private void writeCacheLocation(CacheManager cache, TransformerHandler saxHandler,
+    private void writeCacheLocation(RepositoryCacheManager cache, TransformerHandler saxHandler,
             Artifact artifact) throws SAXException {
         ArtifactOrigin origin = cache.getSavedArtifactOrigin(artifact);
         File archiveInCache = cache.getArchiveFileInCache(artifact, origin, false);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheFileset.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheFileset.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheFileset.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheFileset.java Thu Dec 27 16:11:39 2007
@@ -17,11 +17,11 @@
  */
 package org.apache.ivy.ant;
 
+import java.io.File;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.ivy.core.cache.RepositoryCacheManager;
-import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.PatternSet.NameEntry;
@@ -59,22 +59,72 @@
             FileSet fileset = new FileSet();
             fileset.setProject(getProject());
             getProject().addReference(setid, fileset);
-            fileset.setDir(getCache());
 
-            List paths = getArtifacts();
-            if (paths.isEmpty()) {
+            List paths = getArtifactReports();
+            File base = null;
+            for (Iterator iter = paths.iterator(); iter.hasNext();) {
+                ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
+                if (a.getLocalFile() != null) {
+                    base = getBaseDir(base, a.getLocalFile());
+                }
+            }
+            if (base == null) {
+                fileset.setDir(new File("."));
                 NameEntry ne = fileset.createExclude();
                 ne.setName("**/*");
             } else {
-                RepositoryCacheManager cache = getCacheManager();
+                fileset.setDir(base);
                 for (Iterator iter = paths.iterator(); iter.hasNext();) {
-                    Artifact a = (Artifact) iter.next();
-                    NameEntry ne = fileset.createInclude();
-                    ne.setName(cache.getArchivePathInCache(a, cache.getSavedArtifactOrigin(a)));
+                    ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
+                    if (a.getLocalFile() != null) {
+                        NameEntry ne = fileset.createInclude();
+                        ne.setName(getPath(base, a.getLocalFile()));
+                    }
                 }
             }
         } catch (Exception ex) {
             throw new BuildException("impossible to build ivy cache fileset: " + ex, ex);
+        }
+    }
+
+    /**
+     * Returns the path of the file relative to the given base directory.
+     * 
+     * @param base the parent directory to which the file must be evaluated.
+     * @param file the file for which the path should be returned
+     * @returnthe path of the file relative to the given base directory.
+     */
+    private String getPath(File base, File file) {
+        return file.getAbsolutePath().substring(base.getAbsolutePath().length() + 1);
+    }
+
+    /**
+     * Returns the common base directory between a current base directory and a given file.
+     * <p>
+     * The returned base directory must be a parent of both the current base and the given file.
+     * </p>
+     * 
+     * @param base
+     *            the current base directory, may be null.
+     * @param file
+     *            the file for which the new base directory should be returned.
+     * @return the common base directory between a current base directory and a given file.
+     */
+    private File getBaseDir(File base, File file) {
+        if (base == null) {
+            return file.getParentFile();
+        } else {
+            String basePath = base.getAbsolutePath();
+            String filePath = file.getAbsolutePath();
+            for (int i = 0; i < basePath.length(); i++) {
+                if (i >= filePath.length()) {
+                    return file.getParentFile();
+                }
+                if (basePath.charAt(i) != filePath.charAt(i)) {
+                    return new File(basePath.substring(0, i));
+                }
+            }
+            return base;
         }
     }
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCachePath.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCachePath.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCachePath.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCachePath.java Thu Dec 27 16:11:39 2007
@@ -19,8 +19,7 @@
 
 import java.util.Iterator;
 
-import org.apache.ivy.core.cache.RepositoryCacheManager;
-import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.types.Path;
@@ -62,11 +61,9 @@
         try {
             Path path = new Path(getProject());
             getProject().addReference(pathid, path);
-            RepositoryCacheManager cache = getCacheManager();
-            for (Iterator iter = getArtifacts().iterator(); iter.hasNext();) {
-                Artifact a = (Artifact) iter.next();
-                path.createPathElement().setLocation(
-                    cache.getArchiveFileInCache(a, cache.getSavedArtifactOrigin(a), isUseOrigin()));
+            for (Iterator iter = getArtifactReports().iterator(); iter.hasNext();) {
+                ArtifactDownloadReport a = (ArtifactDownloadReport) iter.next();
+                path.createPathElement().setLocation(a.getLocalFile());
             }
         } catch (Exception ex) {
             throw new BuildException("impossible to build ivy path: " + ex, ex);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheTask.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyCacheTask.java Thu Dec 27 16:11:39 2007
@@ -28,9 +28,7 @@
 import java.util.List;
 import java.util.Set;
 
-import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.cache.ResolutionCacheManager;
-import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ConfigurationResolveReport;
@@ -46,20 +44,20 @@
  */
 public abstract class IvyCacheTask extends IvyPostResolveTask {
 
-    protected List getArtifacts() throws BuildException, ParseException, IOException {
-        Collection artifacts = getAllArtifacts();
+    protected List getArtifactReports() throws BuildException, ParseException, IOException {
+        Collection artifacts = getAllArtifactReports();
         List ret = new ArrayList();
         for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
-            Artifact artifact = (Artifact) iter.next();
-            if (getArtifactFilter().accept(artifact)) {
-                ret.add(artifact);
+            ArtifactDownloadReport artifactReport = (ArtifactDownloadReport) iter.next();
+            if (getArtifactFilter().accept(artifactReport.getArtifact())) {
+                ret.add(artifactReport);
             }
         }
 
         return ret;
     }
 
-    private Collection getAllArtifacts() throws ParseException, IOException {
+    private Collection getAllArtifactReports() throws ParseException, IOException {
         String[] confs = splitConfs(getConf());
         Collection all = new LinkedHashSet();
 
@@ -76,17 +74,16 @@
                 Set revisions = configurationReport.getModuleRevisionIds();
                 for (Iterator it = revisions.iterator(); it.hasNext();) {
                     ModuleRevisionId revId = (ModuleRevisionId) it.next();
-                    ArtifactDownloadReport[] aReps = configurationReport.getDownloadReports(revId);
-                    for (int j = 0; j < aReps.length; j++) {
-                        all.add(aReps[j].getArtifact());
-                    }
+                    ArtifactDownloadReport[] aReports 
+                        = configurationReport.getDownloadReports(revId);
+                    all.addAll(Arrays.asList(aReports));
                 }
             }
         } else {
             Message.debug("using stored report to get artifacts list");
 
             XmlReportParser parser = new XmlReportParser();
-            ResolutionCacheManager cacheMgr = getIvyInstance().getCacheManager(getCache());
+            ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
             String resolvedId = getResolveId();
             if (resolvedId == null) {
                 resolvedId = ResolveOptions.getDefaultResolveId(getResolvedModuleId());
@@ -96,14 +93,10 @@
                     confs[i]);
                 parser.parse(reportFile);
 
-                Artifact[] artifacts = parser.getArtifacts();
-                all.addAll(Arrays.asList(artifacts));
+                ArtifactDownloadReport[] aReports = parser.getArtifactReports();
+                all.addAll(Arrays.asList(aReports));
             }
         }
         return all;
-    }
-
-    protected RepositoryCacheManager getCacheManager() {
-        return getIvyInstance().getCacheManager(getCache());
     }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyDeliver.java Thu Dec 27 16:11:39 2007
@@ -187,8 +187,6 @@
 
     private String pubRevision;
 
-    private File cache;
-
     private String deliverpattern;
 
     private String status;
@@ -205,12 +203,8 @@
 
     private String conf;
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getDeliverpattern() {
@@ -309,9 +303,6 @@
         module = getProperty(module, settings, "ivy.module", resolveId);
         revision = getProperty(revision, settings, "ivy.revision", resolveId);
         pubRevision = getProperty(pubRevision, settings, "ivy.deliver.revision");
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         deliverpattern = getProperty(deliverpattern, settings, "ivy.deliver.ivy.pattern");
         status = getProperty(status, settings, "ivy.status");
         if (deliveryList == null) {
@@ -379,7 +370,6 @@
             }
 
             DeliverOptions options = new DeliverOptions(status, pubdate, 
-                ivy.getCacheManager(cache),
                 drResolver, doValidate(settings), replacedynamicrev,
                     splitConfs(conf)).setResolveId(resolveId);
             if (mrid == null) {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInstall.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInstall.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInstall.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyInstall.java Thu Dec 27 16:11:39 2007
@@ -37,8 +37,6 @@
 
     private String revision;
 
-    private File cache;
-
     private boolean overwrite = false;
 
     private String from;
@@ -56,9 +54,6 @@
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         if (organisation == null) {
             throw new BuildException(
                     "no organisation provided for ivy publish task: "
@@ -93,7 +88,7 @@
         ResolveReport report;
         try {
             report = ivy.install(mrid, from, to, transitive, doValidate(settings), overwrite,
-                FilterHelper.getArtifactTypeFilter(type), cache, matcher);
+                FilterHelper.getArtifactTypeFilter(type), matcher);
         } catch (Exception e) {
             throw new BuildException("impossible to install " + mrid + ": " + e, e);
         }
@@ -112,12 +107,8 @@
         this.haltOnFailure = haltOnFailure;
     }
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getModule() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPostResolveTask.java Thu Dec 27 16:11:39 2007
@@ -45,8 +45,6 @@
 
     private boolean inline = false;
 
-    private File cache;
-
     private String organisation;
 
     private String module;
@@ -82,10 +80,6 @@
         organisation = getProperty(organisation, settings, "ivy.organisation");
         module = getProperty(module, settings, "ivy.module");
 
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
-
         if (file == null) {
             String fileName = getProperty(settings, "ivy.resolved.file", resolveId);
             if (fileName != null) {
@@ -125,7 +119,6 @@
                 resolve.setRevision(getRevision());
                 resolve.setInline(true);
                 resolve.setConf(conf);
-                resolve.setCache(cache);
                 resolve.setResolveId(resolveId);
                 resolve.execute();
             } else {
@@ -194,7 +187,6 @@
         if (confs.length > 0) {
             IvyResolve resolve = createResolve(isHaltonfailure(), isUseOrigin());
             resolve.setFile(getFile());
-            resolve.setCache(getCache());
             resolve.setTransitive(isTransitive());
             resolve.setConf(StringUtils.join(confs, ", "));
             resolve.setResolveId(getResolveId());
@@ -323,12 +315,8 @@
         this.haltOnFailure = haltOnFailure;
     }
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getRevision() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyPublish.java Thu Dec 27 16:11:39 2007
@@ -49,8 +49,6 @@
 
     private String pubRevision;
 
-    private File cache;
-
     private String srcivypattern;
 
     private String status;
@@ -83,12 +81,8 @@
 
     private Collection artifacts = new ArrayList();
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getSrcivypattern() {
@@ -214,9 +208,6 @@
         module = getProperty(module, settings, "ivy.module");
         revision = getProperty(revision, settings, "ivy.revision");
         pubRevision = getProperty(pubRevision, settings, "ivy.deliver.revision");
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         if (artifactspattern.isEmpty()) {
             String p = getProperty(null, settings, "ivy.publish.src.artifacts.pattern");
             if (p != null) {
@@ -279,7 +270,6 @@
                 deliver.setSettingsRef(getSettingsRef());
                 deliver.setTaskName(getTaskName());
                 deliver.setProject(getProject());
-                deliver.setCache(getCache());
                 deliver.setDeliverpattern(getSrcivypattern());
                 deliver.setDelivertarget(deliverTarget);
                 deliver.setDeliveryList(deliveryList);
@@ -299,7 +289,6 @@
             Collection missing = ivy.publish(mrid, artifactspattern, publishResolverName,
                 new PublishOptions()
                     .setPubrevision(getPubrevision())
-                    .setCache(ivy.getCacheManager(cache))
                     .setSrcIvyPattern(publishivy ? srcivypattern : null)
                     .setStatus(getStatus())
                     .setPubdate(pubdate)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java Thu Dec 27 16:11:39 2007
@@ -62,8 +62,6 @@
 
     private String conf;
 
-    private File cache;
-
     private boolean graph = true;
 
     private boolean dot = false;
@@ -90,12 +88,8 @@
         this.todir = todir;
     }
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getConf() {
@@ -160,9 +154,6 @@
 
         organisation = getProperty(organisation, settings, "ivy.organisation", resolveId);
         module = getProperty(module, settings, "ivy.module", resolveId);
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         conf = getProperty(conf, settings, "ivy.resolved.configurations", resolveId);
         if ("*".equals(conf)) {
             conf = getProperty(settings, "ivy.resolved.configurations", resolveId);
@@ -209,27 +200,27 @@
         try {
             String[] confs = splitConfs(conf);
             if (xsl) {
-                genreport(cache, organisation, module, confs);
+                genreport(organisation, module, confs);
             }
             if (xml) {
-                genxml(cache, organisation, module, confs);
+                genxml(organisation, module, confs);
             }
             if (graph) {
-                genStyled(cache, organisation, module, confs, getStylePath(cache,
-                    "ivy-report-graph.xsl"), "graphml");
+                genStyled(organisation, module, confs, 
+                    getStylePath("ivy-report-graph.xsl"), "graphml");
             }
             if (dot) {
-                genStyled(cache, organisation, module, confs, getStylePath(cache,
-                    "ivy-report-dot.xsl"), "dot");
+                genStyled(organisation, module, confs, 
+                    getStylePath("ivy-report-dot.xsl"), "dot");
             }
         } catch (IOException e) {
             throw new BuildException("impossible to generate report: " + e, e);
         }
     }
 
-    private void genxml(File cache, String organisation, String module, String[] confs)
+    private void genxml(String organisation, String module, String[] confs)
             throws IOException {
-        ResolutionCacheManager cacheMgr = getIvyInstance().getCacheManager(cache);
+        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
         for (int i = 0; i < confs.length; i++) {
             File xml = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
 
@@ -246,9 +237,9 @@
         }
     }
 
-    private void genreport(File cache, String organisation, String module, String[] confs)
+    private void genreport(String organisation, String module, String[] confs)
             throws IOException {
-        genStyled(cache, organisation, module, confs, getReportStylePath(cache), xslext);
+        genStyled(organisation, module, confs, getReportStylePath(), xslext);
 
         // copy the css if required
         if (todir != null && xslFile == null) {
@@ -258,25 +249,24 @@
                 FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), css,
                     null);
             }
-            FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), new File(
-                    cache, "ivy-report.css"), null);
         }
     }
 
-    private File getReportStylePath(File cache) throws IOException {
+    private File getReportStylePath() throws IOException {
         if (xslFile != null) {
             return xslFile;
         }
         // style should be a file (and not an url)
         // so we have to copy it from classpath to cache
-        File style = new File(cache, "ivy-report.xsl");
+        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
+        File style = new File(cacheMgr.getResolutionCacheRoot(), "ivy-report.xsl");
         FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.xsl"), style, null);
         return style;
     }
 
-    private void genStyled(File cache, String organisation, String module, String[] confs,
+    private void genStyled(String organisation, String module, String[] confs,
             File style, String ext) throws IOException {
-        ResolutionCacheManager cacheMgr = getIvyInstance().getCacheManager(cache);
+        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
 
         // process the report with xslt to generate dot file
         File out;
@@ -365,10 +355,11 @@
         }
     }
 
-    private File getStylePath(File cache, String styleResourceName) throws IOException {
+    private File getStylePath(String styleResourceName) throws IOException {
         // style should be a file (and not an url)
         // so we have to copy it from classpath to cache
-        File style = new File(cache, styleResourceName);
+        ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
+        File style = new File(cacheMgr.getResolutionCacheRoot(), styleResourceName);
         FileUtil.copy(XmlReportOutputter.class.getResourceAsStream(styleResourceName), style, null);
         return style;
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java Thu Dec 27 16:11:39 2007
@@ -50,8 +50,6 @@
 
     private String revision = "latest.integration";
 
-    private File cache;
-
     private String matcher = PatternMatcher.EXACT_OR_REGEXP;
 
     private File todir = new File(".");
@@ -75,9 +73,6 @@
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         if (xsl && xslFile == null) {
             throw new BuildException("xsl file is mandatory when using xsl generation");
         }
@@ -108,10 +103,9 @@
             ResolveReport report = ivy.resolve(md, 
                 new ResolveOptions()
                     .setResolveId(resolveId)
-                    .setCache(ivy.getCacheManager(cache))
                     .setValidate(doValidate(settings)));
 
-            ResolutionCacheManager cacheMgr = getIvyInstance().getCacheManager(cache);
+            ResolutionCacheManager cacheMgr = getIvyInstance().getResolutionCacheManager();
             new XmlReportOutputter().output(report, cacheMgr);
             if (graph) {
                 gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
@@ -270,12 +264,8 @@
         outputname = outputpattern;
     }
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getMatcher() {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Thu Dec 27 16:11:39 2007
@@ -41,8 +41,6 @@
 
     private String conf = null;
 
-    private File cache = null;
-
     private String organisation = null;
 
     private String module = null;
@@ -95,12 +93,8 @@
         this.revision = revision;
     }
 
-    public File getCache() {
-        return cache;
-    }
-
     public void setCache(File cache) {
-        this.cache = cache;
+        cacheAttributeNotSupported();
     }
 
     public String getConf() {
@@ -170,9 +164,6 @@
         try {
             conf = getProperty(conf, settings, "ivy.configurations");
             type = getProperty(type, settings, "ivy.resolve.default.type.filter");
-            if (cache == null) {
-                cache = settings.getDefaultCache();
-            }
             String[] confs = splitConfs(conf);
 
             ResolveReport report;
@@ -304,7 +295,6 @@
                 .setValidate(doValidate(settings))
                 .setArtifactFilter(FilterHelper.getArtifactTypeFilter(type))
                 .setRevision(revision)
-                .setCache(ivy.getCacheManager(cache))
                 .setDate(getPubDate(pubdate, null))
                 .setUseCacheOnly(useCacheOnly)
                 .setUseOrigin(useOrigin)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java Thu Dec 27 16:11:39 2007
@@ -52,7 +52,6 @@
                 pattern,
                 new RetrieveOptions()
                     .setConfs(splitConfs(getConf()))
-                    .setCache(getIvyInstance().getCacheManager(getCache()))
                     .setDestIvyPattern(ivypattern)
                     .setArtifactFilter(artifactFilter)
                     .setSync(sync)

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java Thu Dec 27 16:11:39 2007
@@ -289,4 +289,14 @@
     public String toString() {
         return getClass().getName() + ":" + getTaskName();
     }
+    
+
+    /**
+     * Informs the user that the cache attribute is not supported any more.
+     */
+    protected void cacheAttributeNotSupported() {
+        throw new BuildException(
+            "cache attribute is not supported any more. See IVY-685 for details.");
+    }
+
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java Thu Dec 27 16:11:39 2007
@@ -367,18 +367,6 @@
         return getIvy().getEventManager();
     }
     
-    public void setCacheManager(CacheManager cacheManager) {
-        this.cacheManager = cacheManager;
-    }
-
-    public CacheManager getCacheManager() {
-        CacheManager result = cacheManager;
-        if (result == null) {
-            result = CacheManager.getInstance(getSettings());
-        }
-        return result;
-    }
-
     public void checkInterrupted() {
         getIvy().checkInterrupted();
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/IvyPatternHelper.java Thu Dec 27 16:11:39 2007
@@ -31,6 +31,7 @@
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DefaultArtifact;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.ivy.util.Message;
 
 /**
@@ -428,7 +429,10 @@
                 Artifact artifact = new DefaultArtifact(revId, null, artifactName, artifactType,
                         artifactExt);
 
-                RepositoryCacheManager cacheManager = IvyContext.getContext().getCacheManager();
+                // TODO cache: see how we could know which actual cache manager to use, since this 
+                // will fail when using a resolver in a chain with a specific cache manager
+                RepositoryCacheManager cacheManager = IvyContext.getContext().getSettings()
+                        .getResolver(revId.getModuleId()).getRepositoryCacheManager(); 
 
                 origin = cacheManager.getSavedArtifactOrigin(artifact);
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheManager.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheManager.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheManager.java Thu Dec 27 16:11:39 2007
@@ -420,7 +420,7 @@
                 adr.setDownloadStatus(DownloadStatus.NO);
                 adr.setSize(archiveFile.length());
                 adr.setArtifactOrigin(origin);
-                adr.setDownloadedFile(archiveFile);
+                adr.setLocalFile(archiveFile);
             } else {
                 long start = System.currentTimeMillis();
                 try {
@@ -435,7 +435,7 @@
                             adr.setDownloadStatus(DownloadStatus.NO);
                             adr.setSize(archiveFile.length());
                             adr.setArtifactOrigin(origin);
-                            adr.setDownloadedFile(archiveFile);
+                            adr.setLocalFile(archiveFile);
                         } else {
                             // refresh archive file now that we better now its origin
                             archiveFile = getArchiveFileInCache(artifact,
@@ -456,7 +456,7 @@
                             adr.setDownloadTimeMillis(System.currentTimeMillis() - start);
                             adr.setDownloadStatus(DownloadStatus.SUCCESSFUL);
                             adr.setArtifactOrigin(origin);
-                            adr.setDownloadedFile(archiveFile);
+                            adr.setLocalFile(archiveFile);
                         }
                     } else {
                         adr.setDownloadStatus(DownloadStatus.FAILED);
@@ -576,10 +576,10 @@
 
             URL cachedMDURL = null;
             try {
-                cachedMDURL = report.getDownloadedFile().toURL();
+                cachedMDURL = report.getLocalFile().toURL();
             } catch (MalformedURLException ex) {
                 Message.warn("malformed url exception for original in cache file: " 
-                    + report.getDownloadedFile() + ": " + ex.getMessage());
+                    + report.getLocalFile() + ": " + ex.getMessage());
                 return null;
             }
             try {

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheSettings.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/CacheSettings.java Thu Dec 27 16:11:39 2007
@@ -26,6 +26,10 @@
 import org.apache.ivy.plugins.version.VersionMatcher;
 
 public interface CacheSettings extends ParserSettings {
+    RepositoryCacheManager getDefaultRepositoryCacheManager();
+    
+    ResolutionCacheManager getResolutionCacheManager();
+    
     File getDefaultCache();
     
     File getResolutionCacheRoot(File cache);

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java Thu Dec 27 16:11:39 2007
@@ -31,8 +31,6 @@
 import org.apache.ivy.plugins.resolver.util.ResolvedResource;
 
 public interface RepositoryCacheManager {
-    public abstract File getRepositoryCacheRoot();
-    
     public abstract File getIvyFileInCache(ModuleRevisionId mrid);
 
     /**

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java Thu Dec 27 16:11:39 2007
@@ -80,8 +80,7 @@
 
             // check dependencies
             DependencyDescriptor[] dds = md.getDependencies();
-            ResolveData data = new ResolveData(resolveEngine, new ResolveOptions()
-                    .setCache(CacheManager.getInstance(settings)));
+            ResolveData data = new ResolveData(resolveEngine, new ResolveOptions());
             for (int i = 0; i < dds.length; i++) {
                 // check master confs
                 String[] masterConfs = dds[i].getModuleConfigurations();

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngine.java Thu Dec 27 16:11:39 2007
@@ -32,6 +32,7 @@
 import java.util.Set;
 
 import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.cache.ResolutionCacheManager;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
@@ -67,7 +68,7 @@
         if (resolveId == null) {
             throw new IllegalArgumentException("A resolveId must be specified for delivering.");
         }
-        File[] files = options.getCache().getConfigurationResolveReportsInCache(resolveId);
+        File[] files = getCache().getConfigurationResolveReportsInCache(resolveId);
         if (files.length == 0) {
             throw new IllegalStateException("No previous resolve found for id '" + resolveId
                     + "' Please resolve dependencies before delivering.");
@@ -78,6 +79,10 @@
         deliver(mrid, revision, destIvyPattern, options);
     }
 
+    private ResolutionCacheManager getCache() {
+        return settings.getResolutionCacheManager();
+    }
+
     /**
      * Delivers a resolved ivy file based upon last resolve call status. If resolve report file
      * cannot be found in cache, then it throws an IllegalStateException (maybe resolve has not been
@@ -101,7 +106,7 @@
         destIvyPattern = settings.substitute(destIvyPattern);
 
         // 1) find the resolved module descriptor in cache
-        File ivyFile = options.getCache().getResolvedIvyFileInCache(mrid);
+        File ivyFile = getCache().getResolvedIvyFileInCache(mrid);
         if (!ivyFile.exists()) {
             throw new IllegalStateException("ivy file not found in cache for " + mrid
                     + ": please resolve dependencies before delivering (" + ivyFile + ")");
@@ -124,7 +129,7 @@
         // 2) parse resolvedRevisions From properties file
         Map resolvedRevisions = new HashMap(); // Map (ModuleId -> String revision)
         Map dependenciesStatus = new HashMap(); // Map (ModuleId -> String status)
-        File ivyProperties = options.getCache().getResolvedIvyPropertiesInCache(mrid);
+        File ivyProperties = getCache().getResolvedIvyPropertiesInCache(mrid);
         if (!ivyProperties.exists()) {
             throw new IllegalStateException("ivy properties not found in cache for " + mrid
                     + ": please resolve dependencies before delivering (" + ivyFile + ")");

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngineSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngineSettings.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngineSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverEngineSettings.java Thu Dec 27 16:11:39 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.ivy.core.deliver;
 
-import org.apache.ivy.plugins.parser.ParserSettings;
+import org.apache.ivy.core.cache.CacheSettings;
 
-public interface DeliverEngineSettings extends ParserSettings {
+public interface DeliverEngineSettings extends CacheSettings {
 
     String substitute(String destIvyPattern);
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/deliver/DeliverOptions.java Thu Dec 27 16:11:39 2007
@@ -19,7 +19,6 @@
 
 import java.util.Date;
 
-import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.settings.IvySettings;
 
 /**
@@ -30,8 +29,6 @@
 
     private Date pubdate;
 
-    private CacheManager cache;
-
     private PublishingDependencyRevisionResolver pdrResolver = new DefaultPublishingDRResolver();
 
     private boolean validate = true;
@@ -51,7 +48,7 @@
      * @return a DeliverOptions instance ready to be used or customized
      */
     public static DeliverOptions newInstance(IvySettings settings) {
-        return new DeliverOptions(null, new Date(), CacheManager.getInstance(settings),
+        return new DeliverOptions(null, new Date(), 
                 new DefaultPublishingDRResolver(), settings.doValidate(), true, null);
     }
 
@@ -65,27 +62,17 @@
     /**
      * Creates an instance of DeliverOptions with all options explicitly set.
      */
-    public DeliverOptions(String status, Date pubDate, CacheManager cache,
+    public DeliverOptions(String status, Date pubDate, 
             PublishingDependencyRevisionResolver pdrResolver, boolean validate,
             boolean resolveDynamicRevisions, String[] confs) {
         this.status = status;
         this.pubdate = pubDate;
-        this.cache = cache;
         this.pdrResolver = pdrResolver;
         this.validate = validate;
         this.resolveDynamicRevisions = resolveDynamicRevisions;
         this.confs = confs;
     }
 
-    public CacheManager getCache() {
-        return cache;
-    }
-
-    public DeliverOptions setCache(CacheManager cache) {
-        this.cache = cache;
-        return this;
-    }
-
     /**
      * Return the pdrResolver that will be used during deliver for each dependency to get its
      * published information. This can particularly useful when the deliver is made for a release,
@@ -212,7 +199,7 @@
 
     public String toString() {
         return "status=" + status + " pubdate=" + pubdate + " validate=" + validate
-                + " resolveDynamicRevisions=" + resolveDynamicRevisions + " cache=" + cache
+                + " resolveDynamicRevisions=" + resolveDynamicRevisions
                 + " resolveId=" + resolveId;
 
     }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java Thu Dec 27 16:11:39 2007
@@ -26,6 +26,7 @@
 import java.util.Iterator;
 
 import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.core.cache.RepositoryCacheManager;
 import org.apache.ivy.core.module.descriptor.Configuration;
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
@@ -34,6 +35,7 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.publish.PublishEngine;
 import org.apache.ivy.core.publish.PublishOptions;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.core.resolve.ResolveEngine;
@@ -66,11 +68,8 @@
     }
 
     public ResolveReport install(ModuleRevisionId mrid, String from, String to, boolean transitive,
-            boolean validate, boolean overwrite, Filter artifactFilter, File cache,
+            boolean validate, boolean overwrite, Filter artifactFilter, 
             String matcherName) throws IOException {
-        if (cache == null) {
-            cache = settings.getDefaultCache();
-        }
         if (artifactFilter == null) {
             artifactFilter = FilterHelper.NO_FILTER;
         }
@@ -130,41 +129,62 @@
 
             Message.info(":: resolving dependencies ::");
             IvyNode[] dependencies = resolveEngine.getDependencies(md, new ResolveOptions()
-                    .setResolveId(resolveId).setConfs(new String[] {"default"}).setCache(
-                        getCacheManager(cache)), report);
+                    .setResolveId(resolveId).setConfs(new String[] {"default"}), report);
             report.setDependencies(Arrays.asList(dependencies), artifactFilter);
 
             Message.info(":: downloading artifacts to cache ::");
-            resolveEngine.downloadArtifacts(report, getCacheManager(cache), false, artifactFilter);
+            resolveEngine.downloadArtifacts(report, false, artifactFilter);
 
             // now that everything is in cache, we can publish all these modules
             Message.info(":: installing in " + to + " ::");
             for (int i = 0; i < dependencies.length; i++) {
                 ModuleDescriptor depmd = dependencies[i].getDescriptor();
                 if (depmd != null) {
-                    Message.verbose("installing " + depmd.getModuleRevisionId());
-                    publishEngine.publish(depmd, Collections.singleton(cache.getAbsolutePath()
-                            + "/" + settings.getCacheArtifactPattern()), toResolver,
-                        new PublishOptions().setSrcIvyPattern(
-                            cache.getAbsolutePath() + "/" + settings.getCacheIvyPattern())
-                                .setOverwrite(overwrite));
+                    ModuleRevisionId depMrid = depmd.getModuleRevisionId();
+                    Message.verbose("installing " + depMrid);
+                    boolean successfullyPublished = false;
+                    try {
+                        toResolver.beginPublishTransaction(depMrid, overwrite);
+                        
+                        // publish artifacts
+                        ArtifactDownloadReport[] artifacts = 
+                                report.getArtifactsReports(depMrid);
+                        for (int j = 0; j < artifacts.length; j++) {
+                            if (artifacts[j].getLocalFile() != null) {
+                                toResolver.publish(artifacts[j].getArtifact(), 
+                                    artifacts[j].getLocalFile(), overwrite);
+                            }
+                        }
+                        
+                        // publish metadata
+                        // TODO cache: store metadata cache info in report and reuse it
+                        RepositoryCacheManager cacheManager = 
+                            dependencies[i].getModuleRevision().getResolver()
+                                .getRepositoryCacheManager();
+                        File localIvyFile = cacheManager.getIvyFileInCache(depMrid);
+                        toResolver.publish(depmd.getMetadataArtifact(), localIvyFile, overwrite);
+                        
+                        // end module publish
+                        toResolver.commitPublishTransaction();
+                        successfullyPublished  = true;
+                    } finally {
+                        if (!successfullyPublished) {
+                            toResolver.abortPublishTransaction();
+                        }
+                    }
                 }
             }
 
             Message.info(":: install resolution report ::");
 
             // output report
-            resolveEngine.outputReport(report, getCacheManager(cache));
+            resolveEngine.outputReport(report, settings.getResolutionCacheManager());
 
             return report;
         } finally {
             resolveEngine.setDictatorResolver(oldDicator);
             settings.setLogNotConvertedExclusionRule(log);
         }
-    }
-
-    private CacheManager getCacheManager(File cache) {
-        return CacheManager.getInstance(settings, cache);
     }
 
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngine.java Thu Dec 27 16:11:39 2007
@@ -91,7 +91,7 @@
                         + ": call deliver before (" + ivyFile + ")");
             }
         } else {
-            ResolutionCacheManager cacheManager = getCacheManager(options);
+            ResolutionCacheManager cacheManager = settings.getResolutionCacheManager();
             ivyFile = cacheManager.getResolvedIvyFileInCache(mrid);
             if (!ivyFile.exists()) {
                 throw new IllegalStateException("ivy file not found in cache for " + mrid
@@ -187,7 +187,7 @@
             // for each declared published artifact in this descriptor, do:
             for (Iterator iter = artifactsSet.iterator(); iter.hasNext();) {
                 Artifact artifact = (Artifact) iter.next();
-                // 1) copy the artifact using src patterns and resolver
+                // copy the artifact using src patterns and resolver
                 boolean published = false;
                 for (Iterator iterator = srcArtifactPattern.iterator(); iterator.hasNext()
                         && !published;) {
@@ -230,9 +230,9 @@
 
     private boolean publish(Artifact artifact, String srcArtifactPattern,
             DependencyResolver resolver, boolean overwrite) throws IOException {
-        IvyContext.getContext().checkInterrupted();
         File src = new File(IvyPatternHelper.substitute(srcArtifactPattern, artifact));
         
+        IvyContext.getContext().checkInterrupted();
         //notify triggers that an artifact is about to be published
         eventManager.fireIvyEvent(
             new StartArtifactPublishEvent(resolver, artifact, src, overwrite));
@@ -248,14 +248,5 @@
             eventManager.fireIvyEvent(
                 new EndArtifactPublishEvent(resolver, artifact, src, overwrite, successful));
         }
-    }
-
-    private ResolutionCacheManager getCacheManager(PublishOptions options) {
-        ResolutionCacheManager cacheManager = options.getCache();
-        if (cacheManager == null) { // ensure that a cache is configured
-            cacheManager = IvyContext.getContext().getCacheManager();
-            options.setCache(cacheManager);
-        }
-        return cacheManager;
     }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngineSettings.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngineSettings.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngineSettings.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishEngineSettings.java Thu Dec 27 16:11:39 2007
@@ -17,13 +17,13 @@
  */
 package org.apache.ivy.core.publish;
 
-import org.apache.ivy.plugins.parser.ParserSettings;
+import org.apache.ivy.core.cache.CacheSettings;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
 
 /** 
  * Settings specific to the publish engine
  */
-public interface PublishEngineSettings extends ParserSettings {
+public interface PublishEngineSettings extends CacheSettings {
 
     String substitute(String srcIvyPattern);
 

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/publish/PublishOptions.java Thu Dec 27 16:11:39 2007
@@ -19,7 +19,6 @@
 
 import java.util.Date;
 
-import org.apache.ivy.core.cache.ResolutionCacheManager;
 import org.apache.ivy.core.module.descriptor.Artifact;
 
 /**
@@ -38,8 +37,6 @@
  * @see PublishEngine
  */
 public class PublishOptions {
-    private ResolutionCacheManager cache;
-
     private String srcIvyPattern;
 
     private String pubrevision;
@@ -57,15 +54,6 @@
     private boolean update;
 
     private String[] confs;
-
-    public ResolutionCacheManager getCache() {
-        return cache;
-    }
-
-    public PublishOptions setCache(ResolutionCacheManager cacheManager) {
-        this.cache = cacheManager;
-        return this;
-    }
 
     public String[] getConfs() {
         return confs;

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java?rev=607146&r1=607145&r2=607146&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/core/report/ArtifactDownloadReport.java Thu Dec 27 16:11:39 2007
@@ -45,7 +45,7 @@
 
     private ArtifactOrigin origin;
     
-    private File downloadedFile;
+    private File localFile;
 
     private DownloadStatus downloadStatus;
 
@@ -134,16 +134,16 @@
     }
 
     /**
-     * Returns the file where the artifact has been downloaded, or <code>null</code> if and only
-     * if the download failed.
+     * Returns the File where the artifact is available on the local filesystem, 
+     * or <code>null</code> if and only if the artifact caching failed.
      * 
-     * @return the file where the artifact has been downloaded
+     * @return the file where the artifact is now available on the local filesystem.
      */
-    public File getDownloadedFile() {
-        return downloadedFile;
+    public File getLocalFile() {
+        return localFile;
     }
 
-    public void setDownloadedFile(File downloadedFile) {
-        this.downloadedFile = downloadedFile;
+    public void setLocalFile(File localFile) {
+        this.localFile = localFile;
     }
 }