incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r508504 [1/3] - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/install/ src/java/org/apache/ivy/core/resolve/ test/java/org/apache/ivy/cor...
Date Fri, 16 Feb 2007 17:28:13 GMT
Author: xavier
Date: Fri Feb 16 09:28:12 2007
New Revision: 508504

URL: http://svn.apache.org/viewvc?view=rev&rev=508504
Log:
REFACTOR: simplify API for resolve: group parameters in an object: ResolveOptions

Added:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
Modified:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/RegexpConflictManagerTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/conflict/StrictConflictManagerTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/report/XmlReportOutputterTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/DualResolverTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/FileSystemResolverTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/IvyRepResolverTest.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/plugins/resolver/URLResolverTest.java

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy.java Fri Feb 16 09:28:12 2007
@@ -45,6 +45,7 @@
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.resolve.ResolvedModuleRevision;
 import org.apache.ivy.core.retrieve.RetrieveEngine;
 import org.apache.ivy.core.search.ModuleEntry;
@@ -222,85 +223,24 @@
     //                         RESOLVE
     /////////////////////////////////////////////////////////////////////////
 
-
-    public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
-		return _resolveEngine.download(artifact, cache, useOrigin);
-	}
-
-	public void downloadArtifacts(ResolveReport report, CacheManager cacheManager, boolean useOrigin, Filter artifactFilter) {
-		_resolveEngine.downloadArtifacts(report, cacheManager, useOrigin, artifactFilter);
-	}
-
-	public ResolvedModuleRevision findModule(ModuleRevisionId id) {
-		return _resolveEngine.findModule(id);
-	}
-
-	public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate, boolean transitive) {
-		return _resolveEngine.getDependencies(md, confs, cache, date, report, validate, transitive);
-	}
-
-	public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate) {
-		return _resolveEngine.getDependencies(md, confs, cache, date, report, validate);
-	}
-
-	public IvyNode[] getDependencies(URL ivySource, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-		return _resolveEngine.getDependencies(ivySource, confs, cache, date, validate);
-	}
-
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _resolveEngine.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, useOrigin, download, outputReport, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _resolveEngine.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, download, outputReport, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _resolveEngine.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _resolveEngine.resolve(md, confs, cache, date, validate, useCacheOnly, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-		return _resolveEngine.resolve(mrid, confs, transitive, changing, cache, date, validate, useCacheOnly, useOrigin, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-		return _resolveEngine.resolve(mrid, confs, transitive, changing, cache, date, validate, useCacheOnly, artifactFilter);
-	}
-
-	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs) throws ParseException, IOException {
-		return _resolveEngine.resolve(mrid, confs);
-	}
-
-	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, transitive, useOrigin, artifactFilter);
-	}
-
-	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, transitive, artifactFilter);
-	}
-
-	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, artifactFilter);
+	public ResolveReport resolve(File ivySource) throws ParseException, IOException {
+		return _resolveEngine.resolve(ivySource);
 	}
 
-	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly);
+	public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
+		return _resolveEngine.resolve(ivySource);
 	}
 
-	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource, revision, confs, cache, date, validate);
+	public ResolveReport resolve(ModuleRevisionId mrid, ResolveOptions options, boolean changing) throws ParseException, IOException {
+		return _resolveEngine.resolve(mrid, options, changing);
 	}
 
-	public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource);
+	public ResolveReport resolve(URL ivySource, ResolveOptions options) throws ParseException, IOException {
+		return _resolveEngine.resolve(ivySource, options);
 	}
 
-	public ResolveReport resolve(File ivySource) throws ParseException, IOException {
-		return _resolveEngine.resolve(ivySource);
+	public ResolveReport resolve(ModuleDescriptor md, ResolveOptions options) throws ParseException, IOException, FileNotFoundException {
+		return _resolveEngine.resolve(md, options);
 	}
 
     /////////////////////////////////////////////////////////////////////////
@@ -419,6 +359,10 @@
     /////////////////////////////////////////////////////////////////////////
     //                         SEARCH
     /////////////////////////////////////////////////////////////////////////
+    
+    public ResolvedModuleRevision findModule(ModuleRevisionId mrid) {
+    	return _resolveEngine.findModule(mrid);
+    }
     
 	public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
 		return _searchEngine.listModuleEntries(org);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java Fri Feb 16 09:28:12 2007
@@ -37,6 +37,7 @@
 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.ResolveOptions;
 import org.apache.ivy.core.resolve.ResolvedModuleRevision;
 import org.apache.ivy.core.search.ModuleEntry;
 import org.apache.ivy.core.search.OrganisationEntry;
@@ -44,6 +45,7 @@
 import org.apache.ivy.plugins.matcher.PatternMatcher;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.ivy.util.filter.Filter;
+import org.apache.ivy.util.filter.FilterHelper;
 
 
 
@@ -108,27 +110,27 @@
 	}
 
 	public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
-		return _ivy.download(artifact, cache, useOrigin);
+		return _ivy.getResolveEngine().download(artifact, _ivy.getCacheManager(cache), useOrigin);
 	}
 
 	public void downloadArtifacts(ResolveReport report, CacheManager cacheManager, boolean useOrigin, Filter artifactFilter) {
-		_ivy.downloadArtifacts(report, cacheManager, useOrigin, artifactFilter);
+		_ivy.getResolveEngine().downloadArtifacts(report, cacheManager, useOrigin, artifactFilter);
 	}
 
 	public ResolvedModuleRevision findModule(ModuleRevisionId id) {
-		return _ivy.findModule(id);
+		return _ivy.getResolveEngine().findModule(id);
 	}
 
 	public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate, boolean transitive) {
-		return _ivy.getDependencies(md, confs, cache, date, report, validate, transitive);
+		return _ivy.getResolveEngine().getDependencies(md, newResolveOptions(confs, null, cache, date, validate, false, transitive, false, true, true, FilterHelper.NO_FILTER), report);
 	}
 
 	public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate) {
-		return _ivy.getDependencies(md, confs, cache, date, report, validate);
+		return _ivy.getResolveEngine().getDependencies(md, newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER), report);
 	}
 
 	public IvyNode[] getDependencies(URL ivySource, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-		return _ivy.getDependencies(ivySource, confs, cache, date, validate);
+		return _ivy.getResolveEngine().getDependencies(ivySource, newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER));
 	}
 
 	public String getVariable(String name) {
@@ -212,51 +214,66 @@
 	}
 
 	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _ivy.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, useOrigin, download, outputReport, artifactFilter);
+		return _ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, useOrigin, download, outputReport, artifactFilter));
+	}
+
+	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))
+					.setValidate(validate)
+					.setUseCacheOnly(useCacheOnly)
+					.setTransitive(transitive)
+					.setUseOrigin(useOrigin)
+					.setDownload(download)
+					.setOutputReport(outputReport)
+					.setArtifactFilter(artifactFilter);
 	}
 
 	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _ivy.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, download, outputReport, artifactFilter);
+		return _ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false, download, outputReport, artifactFilter));
 	}
 
 	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _ivy.resolve(md, confs, cache, date, validate, useCacheOnly, transitive, artifactFilter);
+		return _ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false, true, true, artifactFilter));
 	}
 
 	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return _ivy.resolve(md, confs, cache, date, validate, useCacheOnly, artifactFilter);
+		return _ivy.resolve(md, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, true, false, true, true, artifactFilter));
 	}
 
 	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.resolve(mrid, confs, transitive, changing, cache, date, validate, useCacheOnly, useOrigin, artifactFilter);
+		return _ivy.resolve(mrid, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, useOrigin, true, true, artifactFilter), changing);
 	}
 
 	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.resolve(mrid, confs, transitive, changing, cache, date, validate, useCacheOnly, artifactFilter);
+		return _ivy.resolve(mrid, newResolveOptions(confs, null, cache, date, validate, useCacheOnly, transitive, false, true, true, artifactFilter), changing);
 	}
 
 	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs) throws ParseException, IOException {
-		return _ivy.resolve(mrid, confs);
+		return _ivy.resolve(mrid, newResolveOptions(confs, null, _ivy.getSettings().getDefaultCache(), null, true, false, true, false, true, true, FilterHelper.NO_FILTER), false);
 	}
 
 	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, transitive, useOrigin, artifactFilter);
+		return _ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive, useOrigin, true, true, artifactFilter));
 	}
 
 	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, transitive, artifactFilter);
+		return _ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, transitive, false, true, true, artifactFilter));
 	}
 
 	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, artifactFilter);
+		return _ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false, true, true, artifactFilter));
 	}
 
 	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly) throws ParseException, IOException {
-		return _ivy.resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly);
+		return _ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate, useCacheOnly, true, false, true, true, FilterHelper.NO_FILTER));
 	}
 
 	public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-		return _ivy.resolve(ivySource, revision, confs, cache, date, validate);
+		return _ivy.resolve(ivySource, newResolveOptions(confs, revision, cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER));
 	}
 
 	public ResolveReport resolve(URL ivySource) throws ParseException, IOException {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java Fri Feb 16 09:28:12 2007
@@ -47,6 +47,7 @@
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.ivy.plugins.report.XmlReportParser;
 import org.apache.ivy.util.DefaultMessageImpl;
@@ -272,18 +273,14 @@
                 }
             }
 
-            
+            ResolveOptions resolveOptions = new ResolveOptions()
+	            .setConfs(confs)
+	            .setCache(CacheManager.getInstance(ivy.getSettings(), cache))
+	            .setValidate(validate)
+	            .setUseOrigin(line.hasOption("useOrigin"));
             ResolveReport report = ivy.resolve(
                     ivyfile.toURL(),
-                    null,
-                    confs, 
-                    cache, 
-                    null,
-                    validate,
-                    false,
-                    true,
-                    line.hasOption("useOrigin"),
-                    null
+                    resolveOptions
                     );
             if (report.hasError()) {
                 System.exit(1);

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyArtifactReport.java Fri Feb 16 09:28:12 2007
@@ -21,7 +21,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.text.ParseException;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -42,6 +41,7 @@
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -126,7 +126,13 @@
         }
         try {
             String[] confs = splitConfs(_conf);
-            IvyNode[] dependencies = ivy.getDependencies((ModuleDescriptor) getProject().getReference("ivy.resolved.descriptor"), confs, _cache, new Date(), null, doValidate(settings));
+            IvyNode[] dependencies = ivy.getResolveEngine()
+            	.getDependencies((ModuleDescriptor) getProject().getReference("ivy.resolved.descriptor"), 
+            			new ResolveOptions()
+            				.setConfs(confs)
+            				.setCache(CacheManager.getInstance(settings, _cache))
+            				.setValidate(doValidate(settings)),
+            			null);
 
             Map artifactsToCopy = ivy.determineArtifactsToCopy(new ModuleId(_organisation, _module), confs, _cache, _pattern, null);
             Map moduleRevToArtifactsMap = new HashMap();

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRepositoryReport.java Fri Feb 16 09:28:12 2007
@@ -24,15 +24,16 @@
 import java.util.List;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleId;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
 import org.apache.ivy.plugins.report.XmlReportOutputter;
 import org.apache.ivy.util.FileUtil;
-import org.apache.ivy.util.filter.FilterHelper;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.XSLTProcess;
 
@@ -89,7 +90,12 @@
     			}
 			}
     		DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true, false);
-    		ResolveReport report = ivy.resolve(md, new String[] {"*"}, _cache, null, doValidate(settings), false, true, false, false, FilterHelper.NO_FILTER);
+    		ResolveReport report = ivy.resolve(
+    				md, 
+    				new ResolveOptions()
+			    		.setCache(CacheManager.getInstance(settings, _cache))
+			    		.setValidate(doValidate(settings)));
+    		
     		new XmlReportOutputter().output(report, _cache);
     		if (_graph) {
     			gengraph(_cache, md.getModuleRevisionId().getOrganisation(), md.getModuleRevisionId().getName());

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyResolve.java Fri Feb 16 09:28:12 2007
@@ -22,9 +22,11 @@
 import java.text.ParseException;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.filter.FilterHelper;
@@ -157,15 +159,8 @@
             	}
 	            report = ivy.resolve(
 	            		ModuleRevisionId.newInstance(_organisation, _module, _revision),
-	                    confs, 
-	                    _transitive,
-	                    _changing,
-	                    _cache, 
-	                    getPubDate(_pubdate, null), 
-	                    doValidate(settings),
-	                    _useCacheOnly,
-	                    _useOrigin,
-	                    FilterHelper.getArtifactTypeFilter(_type));
+	            		getResolveOptions(confs, settings),
+	            		_changing);
             	
             } else {
             	if (_organisation != null) {
@@ -180,15 +175,7 @@
 	            _revision = getProperty(_revision, settings, "ivy.revision");
 	            report = ivy.resolve(
 	                    _file.toURL(), 
-	                    _revision, 
-	                    confs, 
-	                    _cache, 
-	                    getPubDate(_pubdate, null), 
-	                    doValidate(settings),
-	                    _useCacheOnly,
-	                    _transitive,
-	                    _useOrigin,
-	                    FilterHelper.getArtifactTypeFilter(_type));
+	                    getResolveOptions(confs, settings));
             }
             if (report.hasError()) {
 	            if (_failureProperty != null) {
@@ -230,6 +217,19 @@
             throw new BuildException("impossible to resolve dependencies: "+e, e);
         }
     }
+	private ResolveOptions getResolveOptions(String[] confs, IvySettings settings) {
+		return new ResolveOptions()
+			.setConfs(confs)
+			.setValidate(doValidate(settings))
+			.setArtifactFilter(FilterHelper.getArtifactTypeFilter(_type))
+			.setRevision(_revision)
+			.setCache(CacheManager.getInstance(settings, _cache))
+			.setDate(getPubDate(_pubdate, null))
+			.setUseCacheOnly(_useCacheOnly)
+			.setUseOrigin(_useOrigin)
+			.setTransitive(_transitive);
+	}
+
 	public String getModule() {
 		return _module;
 	}

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/check/CheckEngine.java Fri Feb 16 09:28:12 2007
@@ -21,16 +21,17 @@
 import java.net.URL;
 import java.text.ParseException;
 import java.util.Arrays;
-import java.util.Date;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
+import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.module.descriptor.Artifact;
 import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
 import org.apache.ivy.core.resolve.ResolveData;
 import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.resolve.ResolvedModuleRevision;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
@@ -81,7 +82,7 @@
             
             // check dependencies
             DependencyDescriptor[] dds = md.getDependencies();
-            ResolveData data = new ResolveData(_resolveEngine, _settings.getDefaultCache(), new Date(), null, true);
+            ResolveData data = new ResolveData(_resolveEngine, new ResolveOptions().setCache(CacheManager.getInstance(_settings)));
             for (int i = 0; i < dds.length; i++) {
                 // check master confs
                 String[] masterConfs = dds[i].getModuleConfigurations();

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/install/InstallEngine.java Fri Feb 16 09:28:12 2007
@@ -36,6 +36,7 @@
 import org.apache.ivy.core.report.ResolveReport;
 import org.apache.ivy.core.resolve.IvyNode;
 import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.core.search.SearchEngine;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.conflict.NoConflictManager;
@@ -112,7 +113,12 @@
             ResolveReport report = new ResolveReport(md);
             
             Message.info(":: resolving dependencies ::");
-            IvyNode[] dependencies = _resolveEngine.getDependencies(md, new String[] {"default"}, cache, null, report, validate);
+            IvyNode[] dependencies = _resolveEngine.getDependencies(
+            		md, 
+            		new ResolveOptions()
+            			.setConfs(new String[] {"default"})
+            			.setCache(CacheManager.getInstance(_settings, cache)), 
+            		report);
             report.setDependencies(Arrays.asList(dependencies), artifactFilter);
             
             Message.info(":: downloading artifacts to cache ::");

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveData.java Fri Feb 16 09:28:12 2007
@@ -17,7 +17,6 @@
  */
 package org.apache.ivy.core.resolve;
 
-import java.io.File;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -33,46 +32,29 @@
 
 
 public class ResolveData {
+	private ResolveEngine _engine;
     private Map _visitData; // shared map of all visit data: Map (ModuleRevisionId -> VisitData)
-    private Date _date;
-    private boolean _validate;
-    private boolean _transitive;
     private ConfigurationResolveReport _report;
-	private CacheManager _cacheManager;
-	private ResolveEngine _engine;
+
+    private ResolveOptions _options;
 
     public ResolveData(ResolveData data, boolean validate) {
-        this(data._engine, data._cacheManager, data._date, data._report, validate, data._transitive, data._visitData);
+        this(data._engine, new ResolveOptions(data._options).setValidate(validate), data._report, data._visitData);
     }
 
-    public ResolveData(ResolveEngine engine, File cache, Date date, ConfigurationResolveReport report, boolean validate) {
-        this(engine, cache, date, report, validate, true, new LinkedHashMap());
+    public ResolveData(ResolveEngine engine, ResolveOptions options) {
+        this(engine, options, null, new LinkedHashMap());
     }
 
-    public ResolveData(ResolveEngine engine, File cache, Date date, ConfigurationResolveReport report, boolean validate, Map nodes) {
-    	this(engine, cache, date, report, validate, true, nodes);
-    }
-    public ResolveData(ResolveEngine engine, File cache, Date date, ConfigurationResolveReport report, boolean validate, boolean transitive, Map nodes) {
-    	this(engine, new CacheManager(engine.getSettings(), cache), date, report, validate, transitive, nodes);
+    public ResolveData(ResolveEngine engine, ResolveOptions options, ConfigurationResolveReport report) {
+        this(engine, options, report, new LinkedHashMap());
     }
 
-    public ResolveData(ResolveEngine engine, File cache, Date date, ConfigurationResolveReport report, boolean validate, boolean transitive) {
-		this(engine, cache, date, report, validate, transitive, new LinkedHashMap());
-	}
-    public ResolveData(ResolveEngine engine, CacheManager cacheManager, Date date, ConfigurationResolveReport report, boolean validate, boolean transitive, Map visitData) {
+    public ResolveData(ResolveEngine engine, ResolveOptions options, ConfigurationResolveReport report, Map visitData) {
     	_engine = engine;
-        _date = date;
         _report = report;
-        _validate = validate;
-        _transitive = transitive;
         _visitData = visitData;
-        _cacheManager = cacheManager;
-    }
-
-    
-
-	public Date getDate() {
-        return _date;
+        _options = options;
     }
     
 
@@ -91,9 +73,6 @@
     }
     
 
-    public boolean isValidate() {
-        return _validate;
-    }
 
     public IvyNode getNode(ModuleRevisionId mrid) {
         VisitData visitData = getVisitData(mrid);
@@ -160,16 +139,29 @@
         _report = report;
     }
 
+
+	public Date getDate() {
+        return _options.getDate();
+    }
+	
+    public boolean isValidate() {
+        return _options.isValidate();
+    }
+    
 	public boolean isTransitive() {
-		return _transitive;
+		return _options.isTransitive();
 	}
-
-	public IvySettings getSettings() {
-		return _engine.getSettings();
+	
+	public ResolveOptions getOptions() {
+		return _options;
 	}
 
 	public CacheManager getCacheManager() {
-		return _cacheManager;
+		return _options.getCache();
+	}
+
+	public IvySettings getSettings() {
+		return _engine.getSettings();
 	}
 
 	public EventManager getEventManager() {

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveEngine.java Fri Feb 16 09:28:12 2007
@@ -66,7 +66,6 @@
 import org.apache.ivy.util.HostUtil;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.filter.Filter;
-import org.apache.ivy.util.filter.FilterHelper;
 
 public class ResolveEngine {
 	private IvySettings _settings;
@@ -96,49 +95,19 @@
     	return resolve(ivySource.toURL());
     }
     public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
-    	return resolve(ivySource, null, new String[] {"*"}, null, null, true);
+    	return resolve(ivySource, new ResolveOptions());
     }
-    /**
-     * 
-     * @param ivySource the url to the descriptor of the module for which dependencies should be resolved
-     * @param revision the revision of the module for which dependencies should be resolved.
-     * This revision is considered as the resolved revision of the module, unless it is null.
-     * If it is null, then a default revision is given if necessary (no revision found in ivy file)
-     * @param confs the configurations for which dependencies should be resolved
-     * @param cache the directory where to place resolved dependencies
-     * @param date the date for which the dependencies should be resolved. All obtained artifacts 
-     * should have a publication date which is before or equal to the given date
-     * @throws ParseException
-     * @throws IOException
-     * @throws NullPointerException if any parameter is null except cache or date
-     */
-    public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-        return resolve(ivySource, revision, confs, cache, date, validate, false);
-    }
-    public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly) throws ParseException, IOException {
-        return resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, FilterHelper.NO_FILTER);
-    }
-
-    /**
-     * Resolves the module identified by the given mrid with its dependencies. 
-     */
-	public ResolveReport resolve(ModuleRevisionId mrid, String[] confs) throws ParseException, IOException {
-        return resolve(mrid, confs, true, false, null, null, true, false, FilterHelper.NO_FILTER);
-	}
-
-	public ResolveReport resolve(final ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-		return resolve(mrid, confs, transitive, changing, cache, date, validate, useCacheOnly, false, artifactFilter);
-	}
 
     /**
      * Resolves the module identified by the given mrid with its dependencies if transitive is set to true. 
      */
-	public ResolveReport resolve(final ModuleRevisionId mrid, String[] confs, boolean transitive, boolean changing, File cache, Date date, boolean validate, boolean useCacheOnly, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
+	public ResolveReport resolve(final ModuleRevisionId mrid, ResolveOptions options, boolean changing) throws ParseException, IOException {
 		DefaultModuleDescriptor md;
+		String[] confs = options.getConfs();
 		if (confs.length == 1 && confs[0].equals("*")) {
 			ResolvedModuleRevision rmr = findModule(mrid);
 			if (rmr == null) {
-				md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, transitive, changing);
+				md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, options.isTransitive(), changing);
 				return new ResolveReport(md){
 					public boolean hasError() {
 						return true;
@@ -149,31 +118,26 @@
 				};
 			} else {
 				confs = rmr.getDescriptor().getConfigurationsNames();
-				md = DefaultModuleDescriptor.newCallerInstance(ModuleRevisionId.newInstance(mrid, rmr.getId().getRevision()), confs, transitive, changing);
+				md = DefaultModuleDescriptor.newCallerInstance(ModuleRevisionId.newInstance(mrid, rmr.getId().getRevision()), confs, options.isTransitive(), changing);
 			}
 		} else {
-			md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, transitive, changing);
+			md = DefaultModuleDescriptor.newCallerInstance(mrid, confs, options.isTransitive(), changing);
 		}
 		
-		return resolve(md, new String[] {"*"}, cache, date, validate, useCacheOnly, true, useOrigin, true, true, artifactFilter);
+		return resolve(md, options);
 	}
 	
-    public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException {
-    	return resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, true, artifactFilter);
-    }
-    public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException {
-    	return resolve(ivySource, revision, confs, cache, date, validate, useCacheOnly, transitive, false, artifactFilter);
-    }
     /**
      * Resolve dependencies of a module described by an ivy file.
      * 
      * Note: the method signature is way too long, we should use a class to store the settings of the resolve.
      */
-    public ResolveReport resolve(URL ivySource, String revision, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, Filter artifactFilter) throws ParseException, IOException {
+    public ResolveReport resolve(URL ivySource, ResolveOptions options) throws ParseException, IOException {
         URLResource res = new URLResource(ivySource);
         ModuleDescriptorParser parser = ModuleDescriptorParserRegistry.getInstance().getParser(res);
         Message.verbose("using "+parser+" to parse "+ivySource);
-        ModuleDescriptor md = parser.parseDescriptor(_settings, ivySource, validate);
+        ModuleDescriptor md = parser.parseDescriptor(_settings, ivySource, options.isValidate());
+        String revision = options.getRevision();
         if (revision == null && md.getResolvedModuleRevisionId().getRevision() == null) {
             revision = "working@"+HostUtil.getLocalHostName();
         }
@@ -181,51 +145,45 @@
             md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(md.getModuleRevisionId(), revision));
         }
 
-        return resolve(md, confs, cache, date, validate, useCacheOnly, transitive, useOrigin, true, true, artifactFilter);
+        return resolve(md, options);
     }
 
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return resolve(md, confs, cache, date, validate, useCacheOnly, true, artifactFilter);
-	}
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return resolve(md, confs, cache, date, validate, useCacheOnly, transitive, true, true, artifactFilter);
-	}
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
-		return resolve(md, confs, cache, date, validate, useCacheOnly, transitive, false, download, outputReport, artifactFilter);
-	}
     /**
      * Resolve dependencies of a module described by a module descriptor
      * 
      * Note: the method signature is way too long, we should use a class to store the settings of the resolve.
      */
-	public ResolveReport resolve(ModuleDescriptor md, String[] confs, File cache, Date date, boolean validate, boolean useCacheOnly, boolean transitive, boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) throws ParseException, IOException, FileNotFoundException {
+	public ResolveReport resolve(ModuleDescriptor md, ResolveOptions options) throws ParseException, IOException, FileNotFoundException {
         DependencyResolver oldDictator = getDictatorResolver();
-        if (useCacheOnly) {
+        if (options.isUseCacheOnly()) {
         	setDictatorResolver(new CacheResolver(_settings));
         }
         try {
-            if (cache==null) {  // ensure that a cache exists
-                cache = _settings.getDefaultCache();
-                IvyContext.getContext().setCache(cache);
-            }
-            CacheManager cacheManager = getCacheManager(cache);
-            if (artifactFilter == null) {
-            	artifactFilter = FilterHelper.NO_FILTER;
+            CacheManager cacheManager = options.getCache();
+            if (cacheManager == null) {  // ensure that a cache is configured
+            	cacheManager = IvyContext.getContext().getCacheManager();
+            	options.setCache(cacheManager);
+            } else {
+            	IvyContext.getContext().setCache(cacheManager.getCache());
             }
+            
+            String[] confs = options.getConfs();
             if (confs.length == 1 && confs[0].equals("*")) {
                 confs = md.getConfigurationsNames();
             }
+            options.setConfs(confs);
+            
             _eventManager.fireIvyEvent(new StartResolveEvent(md, confs));
             
             long start = System.currentTimeMillis();
-            Message.info(":: resolving dependencies :: "+md.getResolvedModuleRevisionId()+(transitive?"":" [not transitive]"));
+            Message.info(":: resolving dependencies :: "+md.getResolvedModuleRevisionId()+(options.isTransitive()?"":" [not transitive]"));
             Message.info("\tconfs: "+Arrays.asList(confs));
-            Message.verbose("\tvalidate = "+validate);
+            Message.verbose("\tvalidate = "+options.isValidate());
             ResolveReport report = new ResolveReport(md);
 
             // resolve dependencies
-            IvyNode[] dependencies = getDependencies(md, confs, cache, date, report, validate, transitive);
-            report.setDependencies(Arrays.asList(dependencies), artifactFilter);
+            IvyNode[] dependencies = getDependencies(md, options, report);
+            report.setDependencies(Arrays.asList(dependencies), options.getArtifactFilter());
 
             
             // produce resolved ivy file and ivy properties in cache
@@ -255,15 +213,15 @@
             
             report.setResolveTime(System.currentTimeMillis()-start);
 
-            if (download) {
+            if (options.isDownload()) {
 	            Message.verbose(":: downloading artifacts ::");
 	
-	            downloadArtifacts(report, cacheManager, useOrigin, artifactFilter);
+	            downloadArtifacts(report, cacheManager, options.isUseOrigin(), options.getArtifactFilter());
             }
             
             
-            if (outputReport) {
-            	outputReport(report, cache);
+            if (options.isOutputReport()) {
+            	outputReport(report, cacheManager.getCache());
             }
             
             _eventManager.fireIvyEvent(new EndResolveEvent(md, confs, report));
@@ -273,12 +231,6 @@
         }
 	}
 
-	private CacheManager getCacheManager(File cache) {
-		//TODO : reuse instance
-		CacheManager cacheManager = new CacheManager(_settings, cache);
-		return cacheManager;
-	}
-
 	public void outputReport(ResolveReport report, File cache) {
 		Message.info(":: resolution report ::");
 		report.setProblemMessages(Message.getProblems());
@@ -327,10 +279,6 @@
         report.setDownloadTime(System.currentTimeMillis() - start);
     }
 
-	private void checkInterrupted() {
-		IvyContext.getContext().getIvy().checkInterrupted();
-	}
-
     /**
      * Download an artifact to the cache.
      * Not used internally, useful especially for IDE plugins
@@ -343,15 +291,11 @@
      * progress monitoring feature (see addTransferListener).
      * 
      * @param artifact the artifact to download
-     * @param cache the cache to use. If null, will use default cache
+     * @param cacheManager the cacheManager to use.
      * @return a report concerning the download
      */
-    public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
-        if (cache == null) {
-            cache = _settings.getDefaultCache();
-        }
+    public ArtifactDownloadReport download(Artifact artifact, CacheManager cacheManager, boolean useOrigin) {
         DependencyResolver resolver = _settings.getResolver(artifact.getModuleRevisionId().getModuleId());
-        CacheManager cacheManager = getCacheManager(cache);
         DownloadReport r = resolver.download(new Artifact[] {artifact}, new DownloadOptions(_settings, cacheManager, _eventManager, useOrigin));
         return r.getArtifactReport(artifact);
     }
@@ -369,8 +313,10 @@
      * @throws ParseException if a parsing problem occured in the ivy file
      * @throws IOException if an IO problem was raised during ivy file parsing
      */
-    public IvyNode[] getDependencies(URL ivySource, String[] confs, File cache, Date date, boolean validate) throws ParseException, IOException {
-        return getDependencies(ModuleDescriptorParserRegistry.getInstance().parseDescriptor(_settings, ivySource, validate), confs, cache, date, null, validate);
+    public IvyNode[] getDependencies(URL ivySource, ResolveOptions options) throws ParseException, IOException {
+        return getDependencies(ModuleDescriptorParserRegistry.getInstance()
+        		.parseDescriptor(_settings, ivySource, options.isValidate()), 
+        		options, null);
     }
     
     /**
@@ -379,28 +325,30 @@
      * appropriate configuration of the ivy instance, especially resolvers.
      * 
      * @param md the descriptor of the module for which we want to get dependencies - must not be null
-     * @param confs an array of configuration names to resolve - must not be null nor empty
-     * @param cache the cache to use - default cache is used if null
-     * @param date the date to which resolution must be done - may be null
+     * @param options the resolve options to use to resolve the dependencies
      * @param report a resolve report to fill during resolution - may be null
      * @return an array of the resolved Dependencies
      */
-    public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate) {
-    	return getDependencies(md, confs, cache, date, report, validate, true);
-    }
-    public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate, boolean transitive) {
+    public IvyNode[] getDependencies(ModuleDescriptor md, ResolveOptions options, ResolveReport report) {
         if (md == null) {
             throw new NullPointerException("module descriptor must not be null");
         }
-        if (cache==null) {  // ensure that a cache exists
-            cache = _settings.getDefaultCache();
+        CacheManager cacheManager = options.getCache();
+        if (cacheManager == null) {  // ensure that a cache is configured
+        	cacheManager = IvyContext.getContext().getCacheManager();
+        	options.setCache(cacheManager);
+        } else {
+        	IvyContext.getContext().setCache(cacheManager.getCache());
         }
+        
+        String[] confs = options.getConfs();
         if (confs.length == 1 && confs[0].equals("*")) {
             confs = md.getConfigurationsNames();
         }
+        options.setConfs(confs);
         
         Date reportDate = new Date();
-        ResolveData data = new ResolveData(this, cache, date, null, validate, transitive);
+        ResolveData data = new ResolveData(this, options);
         IvyNode rootNode = new IvyNode(data, md);
         
         for (int i = 0; i < confs.length; i++) {
@@ -415,7 +363,7 @@
                 if (report != null) {
                     confReport = report.getConfigurationReport(confs[i]);
                     if (confReport == null) {
-                        confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate, cache);
+                        confReport = new ConfigurationResolveReport(this, md, confs[i], reportDate, cacheManager.getCache());
                         report.addReport(confs[i], confReport);
                     }
                 }
@@ -782,9 +730,16 @@
 		}
         DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(id, new String[] {"*"}, false, false);
 		try {
-			return r.getDependency(new DefaultDependencyDescriptor(id, true), new ResolveData(this, _settings.getDefaultCache(), null, new ConfigurationResolveReport(this, md, "default", null, _settings.getDefaultCache()), false));
+			return r.getDependency(
+					new DefaultDependencyDescriptor(id, true), 
+					new ResolveData(
+							this, 
+							new ResolveOptions()
+								.setValidate(false)
+								.setCache(CacheManager.getInstance(_settings)), 
+							new ConfigurationResolveReport(this, md, "default", null, _settings.getDefaultCache())));
 		} catch (ParseException e) {
-			throw new RuntimeException("problem whle parsing repository module descriptor for "+id+": "+e, e);
+			throw new RuntimeException("problem while parsing repository module descriptor for "+id+": "+e, e);
 		}
 	}
 
@@ -798,6 +753,10 @@
 
 	public SortEngine getSortEngine() {
 		return _sortEngine;
+	}
+
+	private void checkInterrupted() {
+		IvyContext.getContext().getIvy().checkInterrupted();
 	}
 
     

Added: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java?view=auto&rev=508504
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java (added)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/resolve/ResolveOptions.java Fri Feb 16 09:28:12 2007
@@ -0,0 +1,184 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivy.core.resolve;
+
+import java.util.Date;
+
+import org.apache.ivy.core.cache.CacheManager;
+import org.apache.ivy.util.filter.Filter;
+import org.apache.ivy.util.filter.FilterHelper;
+
+/**
+ * A set of options used during resolve related tasks
+ * 
+ * @see ResolveEngine
+ * @author Xavier Hanin
+ */
+public class ResolveOptions {
+	/**
+	 * an array of configuration names to resolve - must not be null nor empty
+	 */
+	private String[] confs = new String[] {"*"};
+	/**
+	 * the revision of the module for which dependencies should be resolved.
+     * This revision is considered as the resolved revision of the module, unless it is null.
+     * If it is null, then a default revision is given if necessary (no revision found in ivy file)
+	 */
+	private String revision = null;
+	/**
+	 * The cache manager to use during resolve
+	 */
+	private CacheManager cache;
+	/**
+	 * the date for which the dependencies should be resolved. 
+	 * All obtained artifacts should have a publication date which is before 
+	 * or equal to the given date.
+	 * The date can be null, in which case all artifacts will be considered
+	 */
+	private Date date = null;
+	/**
+	 * True if validation of module descriptors should done, false otherwise
+	 */
+	private boolean validate = true;
+	/**
+	 * True if only the cache should be used for resolve, false
+	 * if a real resolve with dependency resolvers should be done
+	 */
+	private boolean useCacheOnly = false;
+	/**
+	 * True if the dependencies should be resolved transitively, false
+	 * if only direct dependencies should be resolved
+	 */
+	private boolean transitive = true;
+	/**
+	 * True if the resolve should also download artifacts, false
+	 * if only dependency resolution with module descriptors should be done
+	 */
+	private boolean download = true;
+	/**
+	 * True if a report of the resolve process should be output at the end of the 
+	 * process, false otherwise
+	 */
+	private boolean outputReport = true;
+	/**
+	 * True if the original files from the repositories should be used instead 
+	 * of downloaded ones, false otherwise.
+	 * This means that artifacts which can be used directory in their original location
+	 * won't be downloaded if this option is set to true 
+	 */
+	private boolean useOrigin = false;
+	/**
+	 * A filter to use to avoid downloading all artifacts.
+	 */
+	private Filter artifactFilter = FilterHelper.NO_FILTER;
+	
+	public ResolveOptions() {
+	}
+	
+	public ResolveOptions(ResolveOptions options) {
+		confs = options.confs;
+		revision = options.revision;
+		cache = options.cache;
+		date = options.date;
+		validate = options.validate;
+		useCacheOnly = options.useCacheOnly;
+		transitive = options.transitive;
+		download = options.download;
+		outputReport = options.outputReport;
+		useOrigin = options.useOrigin;
+		artifactFilter = options.artifactFilter;
+	}
+	
+	public Filter getArtifactFilter() {
+		return artifactFilter;
+	}
+	public ResolveOptions setArtifactFilter(Filter artifactFilter) {
+		this.artifactFilter = artifactFilter;
+		return this;
+	}
+	public CacheManager getCache() {
+		return cache;
+	}
+	public ResolveOptions setCache(CacheManager cache) {
+		this.cache = cache;
+		return this;
+	}
+	public String[] getConfs() {
+		return confs;
+	}
+	public ResolveOptions setConfs(String[] confs) {
+		this.confs = confs;
+		return this;
+	}
+	public Date getDate() {
+		return date;
+	}
+	public ResolveOptions setDate(Date date) {
+		this.date = date;
+		return this;
+	}
+	public boolean isDownload() {
+		return download;
+	}
+	public ResolveOptions setDownload(boolean download) {
+		this.download = download;
+		return this;
+	}
+	public boolean isOutputReport() {
+		return outputReport;
+	}
+	public ResolveOptions setOutputReport(boolean outputReport) {
+		this.outputReport = outputReport;
+		return this;
+	}
+	public boolean isTransitive() {
+		return transitive;
+	}
+	public ResolveOptions setTransitive(boolean transitive) {
+		this.transitive = transitive;
+		return this;
+	}
+	public boolean isUseCacheOnly() {
+		return useCacheOnly;
+	}
+	public ResolveOptions setUseCacheOnly(boolean useCacheOnly) {
+		this.useCacheOnly = useCacheOnly;
+		return this;
+	}
+	public boolean isValidate() {
+		return validate;
+	}
+	public ResolveOptions setValidate(boolean validate) {
+		this.validate = validate;
+		return this;
+	}
+	public String getRevision() {
+		return revision;
+	}
+	public ResolveOptions setRevision(String revision) {
+		this.revision = revision;
+		return this;
+	}
+	public boolean isUseOrigin() {
+		return useOrigin;
+	}
+	public ResolveOptions setUseOrigin(boolean useOrigin) {
+		this.useOrigin = useOrigin;
+		return this;
+	}
+}

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java?view=diff&rev=508504&r1=508503&r2=508504
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java (original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/TestPerformance.java Fri Feb 16 09:28:12 2007
@@ -23,10 +23,12 @@
 import java.util.Random;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.CacheManager;
 import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
 import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.core.resolve.ResolveOptions;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.ivy.plugins.resolver.FileSystemResolver;
 import org.apache.ivy.util.FileUtil;
@@ -130,12 +132,16 @@
         generateModules(70, 2, 5, 2, 15);
         
         long start = System.currentTimeMillis();
-        ResolveReport report = _ivy.resolve(new File("build/test/perf/mod0/ivy-1.0.xml").toURL(), "1.0", new String[] {"*"}, _cache, null, true);        
+        ResolveReport report = _ivy.resolve(new File("build/test/perf/mod0/ivy-1.0.xml").toURL(), getResolveOptions(new String[] {"*"}).setRevision("1.0"));        
         long end = System.currentTimeMillis();
         System.out.println("resolve "+report.getConfigurationReport("default").getNodesNumber()+" modules took "+(end - start)+" ms");
 
         cleanRepo();
     }
+    
+    private ResolveOptions getResolveOptions(String[] confs) {
+		return new ResolveOptions().setConfs(confs).setCache(CacheManager.getInstance(_ivy.getSettings(), _cache));
+	}
     
     public static void main(String[] args) throws Exception {
         TestPerformance t = new TestPerformance();



Mime
View raw message