You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-commits@incubator.apache.org by xa...@apache.org on 2007/06/05 12:02:43 UTC

svn commit: r544459 [2/36] - in /incubator/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/...

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=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Ivy14.java Tue Jun  5 05:02:27 2007
@@ -50,399 +50,418 @@
 import org.apache.ivy.util.filter.Filter;
 import org.apache.ivy.util.filter.FilterHelper;
 
-
-
 /**
- * This class can be used for easy migration from Ivy 1.4 API.
- * 
- * Indeed, Ivy 2.0 API has changed substantially, so it can take time to
- * migrate existing code using Ivy 1.4 API to the new API.
- * 
- * Using this class it's really easy: replace your instance of Ivy by an 
- * instance of this class. For instance, where you were doing:
- * Ivy ivy = new Ivy();
- * 
- * do instead:
- * Ivy14 ivy = new Ivy14();
- * 
- * And that should be enough in most cases!
- *  
+ * This class can be used for easy migration from Ivy 1.4 API. Indeed, Ivy 2.0 API has changed
+ * substantially, so it can take time to migrate existing code using Ivy 1.4 API to the new API.
+ * Using this class it's really easy: replace your instance of Ivy by an instance of this class. For
+ * instance, where you were doing: Ivy ivy = new Ivy(); do instead: Ivy14 ivy = new Ivy14(); And
+ * that should be enough in most cases!
  */
 public class Ivy14 {
-	private Ivy _ivy;
-    
+    private Ivy _ivy;
+
     public Ivy14() {
-    	this(Ivy.newInstance());
+        this(Ivy.newInstance());
+    }
+
+    public Ivy14(Ivy ivy) {
+        _ivy = ivy;
+    }
+
+    public boolean check(URL ivyFile, String resolvername) {
+        return _ivy.check(ivyFile, resolvername);
+    }
+
+    public void configure(File settingsFile) throws ParseException, IOException {
+        _ivy.configure(settingsFile);
+    }
+
+    public void configure(URL settingsURL) throws ParseException, IOException {
+        _ivy.configure(settingsURL);
+    }
+
+    public void configureDefault() throws ParseException, IOException {
+        _ivy.configureDefault();
+    }
+
+    public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern,
+            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,
+                resolveDynamicRevisions, null));
+    }
+
+    public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern,
+            String status, Date pubdate, PublishingDependencyRevisionResolver pdrResolver,
+            boolean validate) throws IOException, ParseException {
+        deliver(mrid, revision, cache, destIvyPattern, status, pubdate, pdrResolver, validate, true);
+    }
+
+    public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache,
+            String destFilePattern, String destIvyPattern, Filter artifactFilter)
+            throws ParseException, IOException {
+        return _ivy.getRetrieveEngine().determineArtifactsToCopy(
+            new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
+            destFilePattern,
+            new RetrieveOptions().setConfs(confs).setCache(
+                CacheManager.getInstance(_ivy.getSettings(), cache)).setDestIvyPattern(
+                destIvyPattern).setArtifactFilter(artifactFilter));
+    }
+
+    public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache,
+            String destFilePattern, String destIvyPattern) throws ParseException, IOException {
+        return _ivy.getRetrieveEngine().determineArtifactsToCopy(
+            new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
+            destFilePattern,
+            new RetrieveOptions().setConfs(confs).setCache(
+                CacheManager.getInstance(_ivy.getSettings(), cache)).setDestIvyPattern(
+                destIvyPattern));
+    }
+
+    public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
+        return _ivy.getResolveEngine().download(artifact, _ivy.getCacheManager(cache), useOrigin);
+    }
+
+    public void downloadArtifacts(ResolveReport report, CacheManager cacheManager,
+            boolean useOrigin, Filter artifactFilter) {
+        _ivy.getResolveEngine().downloadArtifacts(report, cacheManager, 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);
+    }
+
+    public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date,
+            ResolveReport report, boolean validate, boolean 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.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.getResolveEngine().getDependencies(
+            ivySource,
+            newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true,
+                FilterHelper.NO_FILTER));
+    }
+
+    public String getVariable(String name) {
+        return _ivy.getVariable(name);
+    }
+
+    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,
+            matcherName);
+    }
+
+    public void interrupt() {
+        _ivy.interrupt();
+    }
+
+    public void interrupt(Thread operatingThread) {
+        _ivy.interrupt(operatingThread);
+    }
+
+    public boolean isInterrupted() {
+        return _ivy.isInterrupted();
+    }
+
+    public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
+        return _ivy.listModuleEntries(org);
+    }
+
+    public ModuleId[] listModules(ModuleId criteria, PatternMatcher matcher) {
+        return _ivy.listModules(criteria, matcher);
+    }
+
+    public ModuleRevisionId[] listModules(ModuleRevisionId criteria, PatternMatcher matcher) {
+        return _ivy.listModules(criteria, matcher);
+    }
+
+    public String[] listModules(String org) {
+        return _ivy.listModules(org);
+    }
+
+    public OrganisationEntry[] listOrganisationEntries() {
+        return _ivy.listOrganisationEntries();
+    }
+
+    public String[] listOrganisations() {
+        return _ivy.listOrganisations();
+    }
+
+    public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
+        return _ivy.listRevisionEntries(module);
+    }
+
+    public String[] listRevisions(String org, String module) {
+        return _ivy.listRevisions(org, module);
+    }
+
+    public String[] listTokenValues(String token, Map otherTokenValues) {
+        return _ivy.listTokenValues(token, otherTokenValues);
+    }
+
+    public Collection publish(ModuleDescriptor md, DependencyResolver resolver,
+            Collection srcArtifactPattern, String srcIvyPattern, Artifact[] extraArtifacts,
+            boolean overwrite, String conf) throws IOException {
+        return _ivy.getPublishEngine().publish(
+            md,
+            srcArtifactPattern,
+            resolver,
+            new PublishOptions().setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
+                    .setOverwrite(overwrite).setConfs(splitConfs(conf)));
     }
 
-	public Ivy14(Ivy ivy) {
-		_ivy = ivy;
-	}
-
-	public boolean check(URL ivyFile, String resolvername) {
-		return _ivy.check(ivyFile, resolvername);
-	}
-
-	public void configure(File settingsFile) throws ParseException, IOException {
-		_ivy.configure(settingsFile);
-	}
-
-	public void configure(URL settingsURL) throws ParseException, IOException {
-		_ivy.configure(settingsURL);
-	}
-
-	public void configureDefault() throws ParseException, IOException {
-		_ivy.configureDefault();
-	}
-
-	public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern, 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, resolveDynamicRevisions, null));
-	}
-
-	public void deliver(ModuleRevisionId mrid, String revision, File cache, String destIvyPattern, String status, Date pubdate, PublishingDependencyRevisionResolver pdrResolver, boolean validate) throws IOException, ParseException {
-		deliver(mrid, revision, cache, destIvyPattern, status, pubdate, pdrResolver, validate, true);
-	}
-
-	public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern, Filter artifactFilter) throws ParseException, IOException {
-		return _ivy.getRetrieveEngine().determineArtifactsToCopy(
-				new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), 
-				destFilePattern, 
-				new RetrieveOptions()
-					.setConfs(confs)
-					.setCache(CacheManager.getInstance(_ivy.getSettings(), cache))
-					.setDestIvyPattern(destIvyPattern)
-					.setArtifactFilter(artifactFilter));
-	}
-
-	public Map determineArtifactsToCopy(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern) throws ParseException, IOException {
-		return _ivy.getRetrieveEngine().determineArtifactsToCopy(
-				new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), 
-				destFilePattern, 
-				new RetrieveOptions()
-					.setConfs(confs)
-					.setCache(CacheManager.getInstance(_ivy.getSettings(), cache))
-					.setDestIvyPattern(destIvyPattern));
-	}
-
-	public ArtifactDownloadReport download(Artifact artifact, File cache, boolean useOrigin) {
-		return _ivy.getResolveEngine().download(artifact, _ivy.getCacheManager(cache), useOrigin);
-	}
-
-	public void downloadArtifacts(ResolveReport report, CacheManager cacheManager, boolean useOrigin, Filter artifactFilter) {
-		_ivy.getResolveEngine().downloadArtifacts(report, cacheManager, 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);
-	}
-
-	public IvyNode[] getDependencies(ModuleDescriptor md, String[] confs, File cache, Date date, ResolveReport report, boolean validate, boolean 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.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.getResolveEngine().getDependencies(ivySource, newResolveOptions(confs, null, cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER));
-	}
-
-	public String getVariable(String name) {
-		return _ivy.getVariable(name);
-	}
-
-	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, matcherName);
-	}
-
-	public void interrupt() {
-		_ivy.interrupt();
-	}
-
-	public void interrupt(Thread operatingThread) {
-		_ivy.interrupt(operatingThread);
-	}
-
-	public boolean isInterrupted() {
-		return _ivy.isInterrupted();
-	}
-
-	public ModuleEntry[] listModuleEntries(OrganisationEntry org) {
-		return _ivy.listModuleEntries(org);
-	}
-
-	public ModuleId[] listModules(ModuleId criteria, PatternMatcher matcher) {
-		return _ivy.listModules(criteria, matcher);
-	}
-
-	public ModuleRevisionId[] listModules(ModuleRevisionId criteria, PatternMatcher matcher) {
-		return _ivy.listModules(criteria, matcher);
-	}
-
-	public String[] listModules(String org) {
-		return _ivy.listModules(org);
-	}
-
-	public OrganisationEntry[] listOrganisationEntries() {
-		return _ivy.listOrganisationEntries();
-	}
-
-	public String[] listOrganisations() {
-		return _ivy.listOrganisations();
-	}
-
-	public RevisionEntry[] listRevisionEntries(ModuleEntry module) {
-		return _ivy.listRevisionEntries(module);
-	}
-
-	public String[] listRevisions(String org, String module) {
-		return _ivy.listRevisions(org, module);
-	}
-
-	public String[] listTokenValues(String token, Map otherTokenValues) {
-		return _ivy.listTokenValues(token, otherTokenValues);
-	}
-
-	public Collection publish(ModuleDescriptor md, DependencyResolver resolver, Collection srcArtifactPattern, String srcIvyPattern, Artifact[] extraArtifacts, boolean overwrite, String conf) throws IOException {
-		return _ivy.getPublishEngine().publish(md, srcArtifactPattern, resolver, 
-				new PublishOptions()
-					.setSrcIvyPattern(srcIvyPattern)
-					.setExtraArtifacts(extraArtifacts)
-					.setOverwrite(overwrite)
-					.setConfs(splitConfs(conf)));
-	}
-
-	public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, 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))
-					.setStatus(status)
-					.setPubdate(pubdate)
-					.setPubrevision(pubrevision)
-					.setSrcIvyPattern(srcIvyPattern)
-					.setExtraArtifacts(extraArtifacts)
-					.setUpdate(update)
-					.setValidate(validate)
-					.setOverwrite(overwrite)
-					.setConfs(splitConfs(conf))
-				);
-	}
-
-	public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, 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))
-					.setPubrevision(pubrevision)
-					.setSrcIvyPattern(srcIvyPattern)
-					.setValidate(validate)
-					.setOverwrite(overwrite)
-				);
-	}
-
-	public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, 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))
-					.setPubrevision(pubrevision)
-					.setSrcIvyPattern(srcIvyPattern)
-					.setValidate(validate)
-				);
-	}
-
-	public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache, String 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, Collections.singleton(srcArtifactPattern), resolverName, 
-				new PublishOptions()
-					.setCache(_ivy.getCacheManager(cache == null?_ivy.getSettings().getDefaultCache():cache))
-					.setStatus(status)
-					.setPubdate(pubdate)
-					.setPubrevision(pubrevision)
-					.setSrcIvyPattern(srcIvyPattern)
-					.setExtraArtifacts(extraArtifacts)
-					.setUpdate(update)
-					.setValidate(validate)
-					.setOverwrite(overwrite)
-					.setConfs(splitConfs(conf))
-				);
-	}
-
-	public ResolveReport resolve(File ivySource) throws ParseException, IOException {
-		return _ivy.resolve(ivySource);
-	}
-
-	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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, newResolveOptions(confs, revision, cache, date, validate, false, true, false, true, true, FilterHelper.NO_FILTER));
-	}
-
-	public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
-		return _ivy.resolve(ivySource);
-	}
-
-	public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern, Filter artifactFilter, boolean sync, boolean useOrigin, boolean makeSymlinks) {
-		try {
-			return _ivy.retrieve(
-					new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), 
-					destFilePattern, 
-					new RetrieveOptions()
-						.setConfs(confs)
-						.setCache(CacheManager.getInstance(_ivy.getSettings(), cache))
-						.setDestIvyPattern(destIvyPattern)
-						.setArtifactFilter(artifactFilter)
-						.setSync(sync)
-						.setUseOrigin(useOrigin)
-						.setMakeSymlinks(makeSymlinks));
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, 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(destIvyPattern)
-						.setArtifactFilter(artifactFilter)
-						.setSync(sync)
-						.setUseOrigin(useOrigin));
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, 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(destIvyPattern)
-						.setArtifactFilter(artifactFilter));
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern, String destIvyPattern) {
-		try {
-			return _ivy.retrieve(
-					new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()), 
-					destFilePattern, 
-					new RetrieveOptions()
-						.setConfs(confs)
-						.setCache(CacheManager.getInstance(_ivy.getSettings(), cache))
-						.setDestIvyPattern(destIvyPattern));
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	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)));
-		} catch (IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-
-	public void setVariable(String varName, String value) {
-		_ivy.setVariable(varName, value);
-	}
-
-	public List sortModuleDescriptors(Collection moduleDescriptors) {
-		return _ivy.sortModuleDescriptors(moduleDescriptors);
-	}
-
-	public List sortNodes(Collection nodes) {
-		return _ivy.sortNodes(nodes);
-	}
-
-	public String substitute(String str) {
-		return _ivy.substitute(str);
-	}
-    
-
-	private String[] splitConfs(String conf) {
-		if (conf == null || "".equals(conf)) {
-			return null;
-		}
+    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+            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))
+                .setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
+                .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts)
+                .setUpdate(update).setValidate(validate).setOverwrite(overwrite).setConfs(
+                    splitConfs(conf)));
+    }
+
+    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+            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))
+                    .setPubrevision(pubrevision).setSrcIvyPattern(srcIvyPattern).setValidate(
+                        validate).setOverwrite(overwrite));
+    }
+
+    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+            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))
+                    .setPubrevision(pubrevision).setSrcIvyPattern(srcIvyPattern).setValidate(
+                        validate));
+    }
+
+    public Collection publish(ModuleRevisionId mrid, String pubrevision, File cache,
+            String 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, Collections.singleton(srcArtifactPattern), resolverName,
+            new PublishOptions().setCache(
+                _ivy.getCacheManager(cache == null ? _ivy.getSettings().getDefaultCache() : cache))
+                    .setStatus(status).setPubdate(pubdate).setPubrevision(pubrevision)
+                    .setSrcIvyPattern(srcIvyPattern).setExtraArtifacts(extraArtifacts).setUpdate(
+                        update).setValidate(validate).setOverwrite(overwrite).setConfs(
+                        splitConfs(conf)));
+    }
+
+    public ResolveReport resolve(File ivySource) throws ParseException, IOException {
+        return _ivy.resolve(ivySource);
+    }
+
+    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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, newResolveOptions(confs, revision, cache, date, validate,
+            false, true, false, true, true, FilterHelper.NO_FILTER));
+    }
+
+    public ResolveReport resolve(URL ivySource) throws ParseException, IOException {
+        return _ivy.resolve(ivySource);
+    }
+
+    public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
+            String destIvyPattern, Filter artifactFilter, boolean sync, boolean useOrigin,
+            boolean makeSymlinks) {
+        try {
+            return _ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
+                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
+                    CacheManager.getInstance(_ivy.getSettings(), cache)).setDestIvyPattern(
+                    destIvyPattern).setArtifactFilter(artifactFilter).setSync(sync).setUseOrigin(
+                    useOrigin).setMakeSymlinks(makeSymlinks));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
+            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(
+                    destIvyPattern).setArtifactFilter(artifactFilter).setSync(sync).setUseOrigin(
+                    useOrigin));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
+            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(
+                    destIvyPattern).setArtifactFilter(artifactFilter));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public int retrieve(ModuleId moduleId, String[] confs, File cache, String destFilePattern,
+            String destIvyPattern) {
+        try {
+            return _ivy.retrieve(new ModuleRevisionId(moduleId, Ivy.getWorkingRevision()),
+                destFilePattern, new RetrieveOptions().setConfs(confs).setCache(
+                    CacheManager.getInstance(_ivy.getSettings(), cache)).setDestIvyPattern(
+                    destIvyPattern));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    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)));
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    public void setVariable(String varName, String value) {
+        _ivy.setVariable(varName, value);
+    }
+
+    public List sortModuleDescriptors(Collection moduleDescriptors) {
+        return _ivy.sortModuleDescriptors(moduleDescriptors);
+    }
+
+    public List sortNodes(Collection nodes) {
+        return _ivy.sortNodes(nodes);
+    }
+
+    public String substitute(String str) {
+        return _ivy.substitute(str);
+    }
+
+    private String[] splitConfs(String conf) {
+        if (conf == null || "".equals(conf)) {
+            return null;
+        }
         String[] confs = conf.split(",");
         for (int i = 0; i < confs.length; i++) {
             confs[i] = confs[i].trim();
         }
         return confs;
-	}
-	
+    }
+
 }

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=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/Main.java Tue Jun  5 05:02:27 2007
@@ -61,102 +61,66 @@
 import org.apache.ivy.util.url.URLHandlerDispatcher;
 import org.apache.ivy.util.url.URLHandlerRegistry;
 
-
 /**
- * class used to launch ivy as a standalone tool
- * arguments are :
- * -settings <settingsfile> : indicates the path to the ivy settings file
- *                  ivysettings.xml is assumed if not given
- * -cache <cachedir> : indicates the path to the cache directory
- *                   cache is assumed if not given
- * -ivy <ivyfile> : indicates the path to the ivy file to use
- *                  ivy.xml is assumed if not given
- * -retrieve <retrievepattern> : when used, retrieve is also done using the given retrievepattern
- * -revision <revision> : the revision with which the module should be published, required to publish
- * -status <status> :   the status with which the module should be published, 
- *                      release is assumed if not given
- * -publish <publishpattern> :  the pattern used to publish the resolved ivy file, 
- *                              ivy-[revision].xml is assumed if not given
+ * class used to launch ivy as a standalone tool arguments are : -settings <settingsfile> :
+ * indicates the path to the ivy settings file ivysettings.xml is assumed if not given -cache
+ * <cachedir> : indicates the path to the cache directory cache is assumed if not given -ivy
+ * <ivyfile> : indicates the path to the ivy file to use ivy.xml is assumed if not given -retrieve
+ * <retrievepattern> : when used, retrieve is also done using the given retrievepattern -revision
+ * <revision> : the revision with which the module should be published, required to publish -status
+ * <status> : the status with which the module should be published, release is assumed if not given
+ * -publish <publishpattern> : the pattern used to publish the resolved ivy file, ivy-[revision].xml
+ * is assumed if not given
  */
 public class Main {
     private static Options getOptions() {
-        Option settings = OptionBuilder.withArgName( "settingsfile" )
-	        .hasArg()
-	        .withDescription(  "use given file for settings" )
-	        .create( "settings" );
-        Option conf = OptionBuilder.withArgName( "settingsfile" )
-	        .hasArg()
-	        .withDescription(  "DEPRECATED - use given file for settings" )
-	        .create( "conf" );
-        Option cache = OptionBuilder.withArgName( "cachedir" )
-            .hasArg()
-            .withDescription(  "use given directory for cache" )
-            .create( "cache" );
-        Option ivyfile = OptionBuilder.withArgName( "ivyfile" )
-            .hasArg()
-            .withDescription(  "use given file as ivy file" )
-            .create( "ivy" );
-        Option dependency = OptionBuilder.withArgName( "organisation module revision" )
-            .hasArgs()
-            .withDescription(  "use this instead of ivy file to do the rest of the work with this as a dependency." )
-            .create( "dependency" );
-        Option confs = OptionBuilder.withArgName( "configurations" )
-            .hasArgs()
-            .withDescription(  "resolve given configurations" )
-            .create( "confs" );
-        Option retrieve = OptionBuilder.withArgName( "retrievepattern" )
-            .hasArg()
-            .withDescription(  "use given pattern as retrieve pattern" )
-            .create( "retrieve" );
-        Option cachepath = OptionBuilder.withArgName( "cachepathfile" )
-            .hasArg()
-            .withDescription(  "outputs a classpath consisting of all dependencies in cache (including transitive ones) of the given ivy file to the given cachepathfile" )
-            .create( "cachepath" );
-        Option revision = OptionBuilder.withArgName( "revision" )
-            .hasArg()
-            .withDescription(  "use given revision to publish the module" )
-            .create( "revision" );
-        Option status = OptionBuilder.withArgName( "status" )
-            .hasArg()
-            .withDescription(  "use given status to publish the module" )
-            .create( "status" );
-        Option deliver = OptionBuilder.withArgName( "ivypattern" )
-            .hasArg()
-            .withDescription(  "use given pattern as resolved ivy file pattern" )
-            .create( "deliverto" );
-        Option publishResolver = OptionBuilder.withArgName( "resolvername" )
-            .hasArg()
-            .withDescription(  "use given resolver to publish to" )
-            .create( "publish" );
-        Option publishPattern = OptionBuilder.withArgName( "artpattern" )
-            .hasArg()
-            .withDescription(  "use given pattern to find artifacts to publish" )
-            .create( "publishpattern" );
-        Option realm = OptionBuilder.withArgName( "realm" )
-            .hasArg()
-            .withDescription(  "use given realm for HTTP AUTH" )
-            .create( "realm" );
-        Option host = OptionBuilder.withArgName( "host" )
-            .hasArg()
-            .withDescription(  "use given host for HTTP AUTH" )
-            .create( "host" );
-        Option username = OptionBuilder.withArgName( "username" )
-            .hasArg()
-            .withDescription(  "use given username for HTTP AUTH" )
-            .create( "username" );
-        Option passwd = OptionBuilder.withArgName( "passwd" )
-            .hasArg()
-            .withDescription(  "use given password for HTTP AUTH" )
-            .create( "passwd" );
-        Option main = OptionBuilder.withArgName("main")
-	    	.hasArg()
-	    	.withDescription("the main class to runtime process")
-	    	.create("main");
-	    Option args = OptionBuilder.withArgName("args")
-	    	.hasArgs()
-	    	.withDescription("the arguments to runtime process")
-	    	.create("args");
-        
+        Option settings = OptionBuilder.withArgName("settingsfile").hasArg().withDescription(
+            "use given file for settings").create("settings");
+        Option conf = OptionBuilder.withArgName("settingsfile").hasArg().withDescription(
+            "DEPRECATED - use given file for settings").create("conf");
+        Option cache = OptionBuilder.withArgName("cachedir").hasArg().withDescription(
+            "use given directory for cache").create("cache");
+        Option ivyfile = OptionBuilder.withArgName("ivyfile").hasArg().withDescription(
+            "use given file as ivy file").create("ivy");
+        Option dependency = OptionBuilder
+                .withArgName("organisation module revision")
+                .hasArgs()
+                .withDescription(
+                    "use this instead of ivy file to do the rest of the work with this as a dependency.")
+                .create("dependency");
+        Option confs = OptionBuilder.withArgName("configurations").hasArgs().withDescription(
+            "resolve given configurations").create("confs");
+        Option retrieve = OptionBuilder.withArgName("retrievepattern").hasArg().withDescription(
+            "use given pattern as retrieve pattern").create("retrieve");
+        Option cachepath = OptionBuilder
+                .withArgName("cachepathfile")
+                .hasArg()
+                .withDescription(
+                    "outputs a classpath consisting of all dependencies in cache (including transitive ones) of the given ivy file to the given cachepathfile")
+                .create("cachepath");
+        Option revision = OptionBuilder.withArgName("revision").hasArg().withDescription(
+            "use given revision to publish the module").create("revision");
+        Option status = OptionBuilder.withArgName("status").hasArg().withDescription(
+            "use given status to publish the module").create("status");
+        Option deliver = OptionBuilder.withArgName("ivypattern").hasArg().withDescription(
+            "use given pattern as resolved ivy file pattern").create("deliverto");
+        Option publishResolver = OptionBuilder.withArgName("resolvername").hasArg()
+                .withDescription("use given resolver to publish to").create("publish");
+        Option publishPattern = OptionBuilder.withArgName("artpattern").hasArg().withDescription(
+            "use given pattern to find artifacts to publish").create("publishpattern");
+        Option realm = OptionBuilder.withArgName("realm").hasArg().withDescription(
+            "use given realm for HTTP AUTH").create("realm");
+        Option host = OptionBuilder.withArgName("host").hasArg().withDescription(
+            "use given host for HTTP AUTH").create("host");
+        Option username = OptionBuilder.withArgName("username").hasArg().withDescription(
+            "use given username for HTTP AUTH").create("username");
+        Option passwd = OptionBuilder.withArgName("passwd").hasArg().withDescription(
+            "use given password for HTTP AUTH").create("passwd");
+        Option main = OptionBuilder.withArgName("main").hasArg().withDescription(
+            "the main class to runtime process").create("main");
+        Option args = OptionBuilder.withArgName("args").hasArgs().withDescription(
+            "the arguments to runtime process").create("args");
+
         Options options = new Options();
 
         options.addOption("debug", false, "set message level to debug");
@@ -164,7 +128,8 @@
         options.addOption("warn", false, "set message level to warn");
         options.addOption("error", false, "set message level to error");
         options.addOption("novalidate", false, "do not validate ivy files against xsd");
-        options.addOption("useOrigin", false, "use original artifact location with local resolvers instead of copying to the cache");
+        options.addOption("useOrigin", false,
+            "use original artifact location with local resolvers instead of copying to the cache");
         options.addOption("sync", false, "in conjonction with -retrieve, does a synced retrieve");
         options.addOption("m2compatible", false, "use maven2 compatibility");
         options.addOption("?", false, "display this help");
@@ -187,22 +152,23 @@
         options.addOption(passwd);
         options.addOption(main);
         options.addOption(args);
-        
+
         return options;
     }
+
     public static void main(String[] args) throws Exception {
         Options options = getOptions();
-        
+
         CommandLineParser parser = new GnuParser();
         try {
             // parse the command line arguments
-            CommandLine line = parser.parse( options, args );
-            
+            CommandLine line = parser.parse(options, args);
+
             if (line.hasOption("?")) {
                 usage(options);
                 return;
             }
-            
+
             if (line.hasOption("debug")) {
                 Message.init(new DefaultMessageImpl(Message.MSG_DEBUG));
             } else if (line.hasOption("verbose")) {
@@ -214,49 +180,47 @@
             } else {
                 Message.init(new DefaultMessageImpl(Message.MSG_INFO));
             }
-            
-            boolean validate = line.hasOption("novalidate")?false:true;
-            
+
+            boolean validate = line.hasOption("novalidate") ? false : true;
+
             Ivy ivy = Ivy.newInstance();
             IvySettings settings = ivy.getSettings();
-			settings.addAllVariables(System.getProperties());
+            settings.addAllVariables(System.getProperties());
             if (line.hasOption("m2compatible")) {
                 settings.setVariable("ivy.default.configuration.m2compatible", "true");
             }
 
-            configureURLHandler(
-                    line.getOptionValue("realm", null), 
-                    line.getOptionValue("host", null), 
-                    line.getOptionValue("username", null), 
-                    line.getOptionValue("passwd", null));
-            
+            configureURLHandler(line.getOptionValue("realm", null), line.getOptionValue("host",
+                null), line.getOptionValue("username", null), line.getOptionValue("passwd", null));
+
             String settingsPath = line.getOptionValue("settings", "");
             if ("".equals(settingsPath)) {
-            	settingsPath = line.getOptionValue("conf", "");
-            	if (!"".equals(settingsPath)) {
-            		Message.deprecated("-conf is deprecated, use -settings instead");
-            	}
+                settingsPath = line.getOptionValue("conf", "");
+                if (!"".equals(settingsPath)) {
+                    Message.deprecated("-conf is deprecated, use -settings instead");
+                }
             }
             if ("".equals(settingsPath)) {
                 ivy.configureDefault();
             } else {
                 File conffile = new File(settingsPath);
                 if (!conffile.exists()) {
-                    error(options, "ivy configuration file not found: "+conffile);
+                    error(options, "ivy configuration file not found: " + conffile);
                 } else if (conffile.isDirectory()) {
-                    error(options, "ivy configuration file is not a file: "+conffile);
+                    error(options, "ivy configuration file is not a file: " + conffile);
                 }
                 ivy.configure(conffile);
             }
-            
-            File cache = new File(settings.substitute(line.getOptionValue("cache", settings.getDefaultCache().getAbsolutePath())));
+
+            File cache = new File(settings.substitute(line.getOptionValue("cache", settings
+                    .getDefaultCache().getAbsolutePath())));
             if (!cache.exists()) {
                 cache.mkdirs();
             } else if (!cache.isDirectory()) {
-                error(options, cache+" is not a directory");
+                error(options, cache + " is not a directory");
             }
             CacheManager cacheManager = CacheManager.getInstance(settings, cache);
-            
+
             String[] confs;
             if (line.hasOption("confs")) {
                 confs = line.getOptionValues("confs");
@@ -268,12 +232,16 @@
             if (line.hasOption("dependency")) {
                 String[] dep = line.getOptionValues("dependency");
                 if (dep.length != 3) {
-                    error(options, "dependency should be expressed with exactly 3 arguments: organisation module revision");
+                    error(options,
+                        "dependency should be expressed with exactly 3 arguments: organisation module revision");
                 }
                 ivyfile = File.createTempFile("ivy", ".xml");
                 ivyfile.deleteOnExit();
-                DefaultModuleDescriptor md = DefaultModuleDescriptor.newDefaultInstance(ModuleRevisionId.newInstance(dep[0], dep[1]+"-caller", "working"));
-                DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md, ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true);
+                DefaultModuleDescriptor md = DefaultModuleDescriptor
+                        .newDefaultInstance(ModuleRevisionId.newInstance(dep[0],
+                            dep[1] + "-caller", "working"));
+                DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
+                        ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true);
                 for (int i = 0; i < confs.length; i++) {
                     dd.addDependencyConfiguration("default", confs[i]);
                 }
@@ -283,21 +251,15 @@
             } else {
                 ivyfile = new File(settings.substitute(line.getOptionValue("ivy", "ivy.xml")));
                 if (!ivyfile.exists()) {
-                    error(options, "ivy file not found: "+ivyfile);
+                    error(options, "ivy file not found: " + ivyfile);
                 } else if (ivyfile.isDirectory()) {
-                    error(options, "ivy file is not a file: "+ivyfile);
+                    error(options, "ivy file is not a file: " + ivyfile);
                 }
             }
 
-            ResolveOptions resolveOptions = new ResolveOptions()
-	            .setConfs(confs)
-	            .setCache(cacheManager)
-	            .setValidate(validate)
-	            .setUseOrigin(line.hasOption("useOrigin"));
-            ResolveReport report = ivy.resolve(
-                    ivyfile.toURL(),
-                    resolveOptions
-                    );
+            ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs).setCache(
+                cacheManager).setValidate(validate).setUseOrigin(line.hasOption("useOrigin"));
+            ResolveReport report = ivy.resolve(ivyfile.toURL(), resolveOptions);
             if (report.hasError()) {
                 System.exit(1);
             }
@@ -311,83 +273,76 @@
                 if (retrievePattern.indexOf("[") == -1) {
                     retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[ext]";
                 }
-                ivy.retrieve(
-                		md.getModuleRevisionId(), 
-                		retrievePattern, 
-                		new RetrieveOptions()
-                			.setConfs(confs)
-                			.setCache(cacheManager)
-							.setSync(line.hasOption("sync"))
-							.setUseOrigin(line.hasOption("useOrigin")));
+                ivy.retrieve(md.getModuleRevisionId(), retrievePattern, new RetrieveOptions()
+                        .setConfs(confs).setCache(cacheManager).setSync(line.hasOption("sync"))
+                        .setUseOrigin(line.hasOption("useOrigin")));
             }
             if (line.hasOption("cachepath")) {
-                outputCachePath(ivy, cache, md, confs, line.getOptionValue("cachepath", "ivycachepath.txt"));
+                outputCachePath(ivy, cache, md, confs, line.getOptionValue("cachepath",
+                    "ivycachepath.txt"));
             }
 
             if (line.hasOption("revision")) {
-				ivy.deliver(
-                    md.getResolvedModuleRevisionId(),
-                    settings.substitute(line.getOptionValue("revision")),
-                    settings.substitute(line.getOptionValue("deliverto", "ivy-[revision].xml")),
-                    DeliverOptions.newInstance(settings)
-                    	.setStatus(settings.substitute(line.getOptionValue("status", "release")))
-                    	.setValidate(validate)
-                    	.setCache(cacheManager)
-                    );
+                ivy.deliver(md.getResolvedModuleRevisionId(), settings.substitute(line
+                        .getOptionValue("revision")), settings.substitute(line.getOptionValue(
+                    "deliverto", "ivy-[revision].xml")), DeliverOptions.newInstance(settings)
+                        .setStatus(settings.substitute(line.getOptionValue("status", "release")))
+                        .setValidate(validate).setCache(cacheManager));
                 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)
-                            	.setPubrevision(settings.substitute(line.getOptionValue("revision")))
-                            	.setValidate(validate)
-                            	.setSrcIvyPattern(settings.substitute(line.getOptionValue("deliverto", "ivy-[revision].xml"))));
+                    ivy.publish(md.getResolvedModuleRevisionId(), Collections.singleton(settings
+                            .substitute(line.getOptionValue("publishpattern",
+                                "distrib/[type]s/[artifact]-[revision].[ext]"))), line
+                            .getOptionValue("publish"), new PublishOptions().setCache(cacheManager)
+                            .setPubrevision(settings.substitute(line.getOptionValue("revision")))
+                            .setValidate(validate).setSrcIvyPattern(
+                                settings.substitute(line.getOptionValue("deliverto",
+                                    "ivy-[revision].xml"))));
                 }
             }
             if (line.hasOption("main")) {
-            	// merge -args and left over args 
-            	String[] fargs = line.getOptionValues("args");
-            	if (fargs == null) {
-            	    fargs = new String[0];
-            	}
-            	String[] extra = line.getArgs();
-            	if (extra == null) {
-            	    extra = new String[0];
-            	}
-            	String[] params = new String[fargs.length + extra.length];
-            	System.arraycopy(fargs, 0, params, 0, fargs.length);
-            	System.arraycopy(extra, 0, params, fargs.length, extra.length);
-            	// invoke with given main class and merged params
-            	invoke(ivy, cache, md, confs, line.getOptionValue("main"), params);
+                // merge -args and left over args
+                String[] fargs = line.getOptionValues("args");
+                if (fargs == null) {
+                    fargs = new String[0];
+                }
+                String[] extra = line.getArgs();
+                if (extra == null) {
+                    extra = new String[0];
+                }
+                String[] params = new String[fargs.length + extra.length];
+                System.arraycopy(fargs, 0, params, 0, fargs.length);
+                System.arraycopy(extra, 0, params, fargs.length, extra.length);
+                // invoke with given main class and merged params
+                invoke(ivy, cache, md, confs, line.getOptionValue("main"), params);
             }
-        } catch( ParseException exp ) {
+        } catch (ParseException exp) {
             // oops, something went wrong
-            System.err.println( "Parsing failed.  Reason: " + exp.getMessage() );
-            
+            System.err.println("Parsing failed.  Reason: " + exp.getMessage());
+
             usage(options);
-        }        
+        }
     }
 
-    private static void outputCachePath(Ivy ivy, File cache, ModuleDescriptor md, String[] confs, String outFile) {
+    private static void outputCachePath(Ivy ivy, File cache, ModuleDescriptor md, String[] confs,
+            String outFile) {
         try {
             String pathSeparator = System.getProperty("path.separator");
-            StringBuffer buf = new StringBuffer(); 
+            StringBuffer buf = new StringBuffer();
             Collection all = new LinkedHashSet();
             CacheManager cacheMgr = ivy.getCacheManager(cache);
             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);
+                String resolveId = ResolveOptions.getDefaultResolveId(md);
+                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+                parser.parse(report);
 
-            	Artifact[] artifacts = parser.getArtifacts();
+                Artifact[] artifacts = parser.getArtifacts();
                 all.addAll(Arrays.asList(artifacts));
             }
             for (Iterator iter = all.iterator(); iter.hasNext();) {
-                Artifact artifact = (Artifact)iter.next();
-                buf.append(ivy.getCacheManager(cache).getArchiveFileInCache(artifact).getCanonicalPath());
+                Artifact artifact = (Artifact) iter.next();
+                buf.append(ivy.getCacheManager(cache).getArchiveFileInCache(artifact)
+                        .getCanonicalPath());
                 if (iter.hasNext()) {
                     buf.append(pathSeparator);
                 }
@@ -395,70 +350,72 @@
             PrintWriter writer = new PrintWriter(new FileOutputStream(outFile));
             writer.println(buf.toString());
             writer.close();
-            System.out.println("cachepath output to "+outFile);
+            System.out.println("cachepath output to " + outFile);
 
         } catch (Exception ex) {
-            throw new RuntimeException("impossible to build ivy cache path: "+ex.getMessage(), ex);
+            throw new RuntimeException("impossible to build ivy cache path: " + ex.getMessage(), ex);
         }
     }
 
-    private static void invoke(Ivy ivy, File cache, ModuleDescriptor md, String[] confs, String mainclass, String[] args) {
-    	List urls = new ArrayList();
-    	
+    private static void invoke(Ivy ivy, File cache, ModuleDescriptor md, String[] confs,
+            String mainclass, String[] args) {
+        List urls = new ArrayList();
+
         try {
             Collection all = new LinkedHashSet();
             CacheManager cacheMgr = ivy.getCacheManager(cache);
             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);
-            	
+                String resolveId = ResolveOptions.getDefaultResolveId(md);
+                File report = cacheMgr.getConfigurationResolveReportInCache(resolveId, confs[i]);
+                parser.parse(report);
+
                 Artifact[] artifacts = parser.getArtifacts();
                 all.addAll(Arrays.asList(artifacts));
             }
             for (Iterator iter = all.iterator(); iter.hasNext();) {
-                Artifact artifact = (Artifact)iter.next();
-                
+                Artifact artifact = (Artifact) iter.next();
+
                 urls.add(cacheMgr.getArchiveFileInCache(artifact).toURL());
             }
         } catch (Exception ex) {
-            throw new RuntimeException("impossible to build ivy cache path: "+ex.getMessage(), ex);
+            throw new RuntimeException("impossible to build ivy cache path: " + ex.getMessage(), ex);
         }
-        
-        URLClassLoader classLoader = new URLClassLoader(
-        		(URL[]) urls.toArray(new URL[urls.size()]), 
-        		Main.class.getClassLoader());
-        
+
+        URLClassLoader classLoader = new URLClassLoader((URL[]) urls.toArray(new URL[urls.size()]),
+                Main.class.getClassLoader());
+
         try {
-        	Class c = classLoader.loadClass(mainclass);
-        	
-        	Method mainMethod = c.getMethod("main", new Class[] { String[].class });
-        	
-        	Thread.currentThread().setContextClassLoader(classLoader);
-        	mainMethod.invoke(null, new Object[] { (args == null ? new String[0] : args) });
+            Class c = classLoader.loadClass(mainclass);
+
+            Method mainMethod = c.getMethod("main", new Class[] {String[].class});
+
+            Thread.currentThread().setContextClassLoader(classLoader);
+            mainMethod.invoke(null, new Object[] {(args == null ? new String[0] : args)});
         } catch (ClassNotFoundException cnfe) {
-        	throw new RuntimeException("Could not find class: " + mainclass, cnfe);
+            throw new RuntimeException("Could not find class: " + mainclass, cnfe);
         } catch (SecurityException e) {
-        	throw new RuntimeException("Could not find main method: " + mainclass, e);
-		} catch (NoSuchMethodException e) {
-        	throw new RuntimeException("Could not find main method: " + mainclass, e);
-		} catch (IllegalAccessException e) {
-			throw new RuntimeException("No permissions to invoke main method: " + mainclass, e);
-		} catch (InvocationTargetException e) {
-			throw new RuntimeException("Unexpected exception invoking main method: " + mainclass, e);
-		}
+            throw new RuntimeException("Could not find main method: " + mainclass, e);
+        } catch (NoSuchMethodException e) {
+            throw new RuntimeException("Could not find main method: " + mainclass, e);
+        } catch (IllegalAccessException e) {
+            throw new RuntimeException("No permissions to invoke main method: " + mainclass, e);
+        } catch (InvocationTargetException e) {
+            throw new RuntimeException("Unexpected exception invoking main method: " + mainclass, e);
+        }
     }
-    private static void configureURLHandler(String realm, String host, String username, String passwd) {
-    	CredentialsStore.INSTANCE.addCredentials(realm, host, username, passwd);
 
-    	URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
+    private static void configureURLHandler(String realm, String host, String username,
+            String passwd) {
+        CredentialsStore.INSTANCE.addCredentials(realm, host, username, passwd);
+
+        URLHandlerDispatcher dispatcher = new URLHandlerDispatcher();
         URLHandler httpHandler = URLHandlerRegistry.getHttp();
         dispatcher.setDownloader("http", httpHandler);
         dispatcher.setDownloader("https", httpHandler);
         URLHandlerRegistry.setDefault(dispatcher);
     }
-    
+
     private static void error(Options options, String msg) {
         System.err.println(msg);
         usage(options);
@@ -468,7 +425,7 @@
     private static void usage(Options options) {
         // automatically generate the help statement
         HelpFormatter formatter = new HelpFormatter();
-        formatter.printHelp( "ivy", options );
+        formatter.printHelp("ivy", options);
     }
 
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AddPathTask.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AddPathTask.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AddPathTask.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AddPathTask.java Tue Jun  5 05:02:27 2007
@@ -27,78 +27,77 @@
 import org.apache.tools.ant.types.Path.PathElement;
 
 /**
- * This task is not directly related to ivy, but is useful in some modular build systems.
- * 
- * The idea is to be able to contribute new sub path elements to an existing path.
- * 
+ * This task is not directly related to ivy, but is useful in some modular build systems. The idea
+ * is to be able to contribute new sub path elements to an existing path.
  */
 public class AddPathTask extends Task {
-	private String _topath;
-	private boolean _first = false;
-	private Path _toadd;
-
-	public String getTopath() {
-		return _topath;
-	}
-
-	public void setTopath(String topath) {
-		_topath = topath;
-	}
-	
-	public void setProject(Project project) {
-		super.setProject(project);
-		_toadd = new Path(project);
-	}
-	
-    
-	public void execute() throws BuildException {
-		Object element = getProject().getReference(_topath);
-		if (element == null) {
-			throw new BuildException("destination path not found: "+_topath);
-		}
-		if (! (element instanceof Path)) {
-			throw new BuildException("destination path is not a path: "+element.getClass());
-		}
-		Path dest = (Path) element;
-		if (_first) {
-			// now way to add path elements at te beginning of the existing path: we do the opposite
-			// and replace the reference
-			_toadd.append(dest);
-			getProject().addReference(_topath, _toadd);
-		} else {
-			dest.append(_toadd);
-		}
-	}
-
-	public void add(Path path) throws BuildException {
-		_toadd.add(path);
-	}
-
-	public void addDirset(DirSet dset) throws BuildException {
-		_toadd.addDirset(dset);
-	}
-
-	public void addFilelist(FileList fl) throws BuildException {
-		_toadd.addFilelist(fl);
-	}
-
-	public void addFileset(FileSet fs) throws BuildException {
-		_toadd.addFileset(fs);
-	}
-
-	public Path createPath() throws BuildException {
-		return _toadd.createPath();
-	}
-
-	public PathElement createPathElement() throws BuildException {
-		return _toadd.createPathElement();
-	}
-
-	public boolean isFirst() {
-		return _first;
-	}
-
-	public void setFirst(boolean first) {
-		_first = first;
-	}
+    private String _topath;
+
+    private boolean _first = false;
+
+    private Path _toadd;
+
+    public String getTopath() {
+        return _topath;
+    }
+
+    public void setTopath(String topath) {
+        _topath = topath;
+    }
+
+    public void setProject(Project project) {
+        super.setProject(project);
+        _toadd = new Path(project);
+    }
+
+    public void execute() throws BuildException {
+        Object element = getProject().getReference(_topath);
+        if (element == null) {
+            throw new BuildException("destination path not found: " + _topath);
+        }
+        if (!(element instanceof Path)) {
+            throw new BuildException("destination path is not a path: " + element.getClass());
+        }
+        Path dest = (Path) element;
+        if (_first) {
+            // now way to add path elements at te beginning of the existing path: we do the opposite
+            // and replace the reference
+            _toadd.append(dest);
+            getProject().addReference(_topath, _toadd);
+        } else {
+            dest.append(_toadd);
+        }
+    }
+
+    public void add(Path path) throws BuildException {
+        _toadd.add(path);
+    }
+
+    public void addDirset(DirSet dset) throws BuildException {
+        _toadd.addDirset(dset);
+    }
+
+    public void addFilelist(FileList fl) throws BuildException {
+        _toadd.addFilelist(fl);
+    }
+
+    public void addFileset(FileSet fs) throws BuildException {
+        _toadd.addFileset(fs);
+    }
+
+    public Path createPath() throws BuildException {
+        return _toadd.createPath();
+    }
+
+    public PathElement createPathElement() throws BuildException {
+        return _toadd.createPathElement();
+    }
+
+    public boolean isFirst() {
+        return _first;
+    }
+
+    public void setFirst(boolean first) {
+        _first = first;
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/AntBuildTrigger.java Tue Jun  5 05:02:27 2007
@@ -35,125 +35,127 @@
 import org.apache.tools.ant.taskdefs.Ant;
 import org.apache.tools.ant.taskdefs.Property;
 
-
 /**
- * Triggers an ant build on an event occurence.
- * 
- * Example of use:
- * <ant-build-trigger event="pre-resolve-dependency" filter="revision=latest.integration"
- *                    antfile="/path/to/[module]/build.xml" target="compile"/>
- * Triggers an ant build for any dependency in asked in latest.integration, just before resolving the 
- * dependency.
+ * Triggers an ant build on an event occurence. Example of use: <ant-build-trigger
+ * event="pre-resolve-dependency" filter="revision=latest.integration"
+ * antfile="/path/to/[module]/build.xml" target="compile"/> Triggers an ant build for any dependency
+ * in asked in latest.integration, just before resolving the dependency.
  * 
  * @see AntCallTrigger
  * @since 1.4
- *
  */
 public class AntBuildTrigger extends AbstractTrigger implements Trigger {
-	private boolean _onlyonce = true;
-	private String _target = null;
-	private Collection _builds = new ArrayList();
-	private String _buildFilePattern;
-	private String _prefix;
-
-	public void progress(IvyEvent event) {
-		File f = getBuildFile(event);
-		if (f.exists()) {
-			if (_onlyonce && isBuilt(f)) {
-				Message.verbose("target build file already built, skipping: "+f);
-			} else {
-				Ant ant = new Ant();
-				Project project = (Project)IvyContext.getContext().peek(IvyTask.ANT_PROJECT_CONTEXT_KEY);
-				if (project == null) {
-					project = new Project();
-					project.init();
-				}
-				
-				ant.setProject(project);
-				ant.setTaskName("ant");
-				
-				ant.setAntfile(f.getAbsolutePath());
-				ant.setInheritAll(false);
-				String target = getTarget();
-				if (target != null) {
-					ant.setTarget(target);
-				}
-				Map atts = event.getAttributes();
-				for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
-					String key = (String) iter.next();
-					String value = (String) atts.get(key);
-					Property p = ant.createProperty();
-					p.setName(_prefix == null?key:_prefix+key);
-					p.setValue(value);
-				}
-				
-				Message.verbose("triggering build: "+f+" target="+target+" for "+event);
+    private boolean _onlyonce = true;
+
+    private String _target = null;
+
+    private Collection _builds = new ArrayList();
+
+    private String _buildFilePattern;
+
+    private String _prefix;
+
+    public void progress(IvyEvent event) {
+        File f = getBuildFile(event);
+        if (f.exists()) {
+            if (_onlyonce && isBuilt(f)) {
+                Message.verbose("target build file already built, skipping: " + f);
+            } else {
+                Ant ant = new Ant();
+                Project project = (Project) IvyContext.getContext().peek(
+                    IvyTask.ANT_PROJECT_CONTEXT_KEY);
+                if (project == null) {
+                    project = new Project();
+                    project.init();
+                }
+
+                ant.setProject(project);
+                ant.setTaskName("ant");
+
+                ant.setAntfile(f.getAbsolutePath());
+                ant.setInheritAll(false);
+                String target = getTarget();
+                if (target != null) {
+                    ant.setTarget(target);
+                }
+                Map atts = event.getAttributes();
+                for (Iterator iter = atts.keySet().iterator(); iter.hasNext();) {
+                    String key = (String) iter.next();
+                    String value = (String) atts.get(key);
+                    Property p = ant.createProperty();
+                    p.setName(_prefix == null ? key : _prefix + key);
+                    p.setValue(value);
+                }
+
+                Message.verbose("triggering build: " + f + " target=" + target + " for " + event);
                 MessageImpl impl = IvyContext.getContext().getMessageImpl();
                 try {
-                	IvyContext.getContext().setMessageImpl(null);
-                	try {
-                		ant.execute();
-                	} catch (BuildException e) {
-                		Message.verbose("Exception occurred while executing target " + target);
-                		e.printStackTrace(); // TODO: remove when finished debugging
-                		throw e;
-                	}
-                	markBuilt(f);
+                    IvyContext.getContext().setMessageImpl(null);
+                    try {
+                        ant.execute();
+                    } catch (BuildException e) {
+                        Message.verbose("Exception occurred while executing target " + target);
+                        e.printStackTrace(); // TODO: remove when finished debugging
+                        throw e;
+                    }
+                    markBuilt(f);
                 } finally {
-                	IvyContext.getContext().setMessageImpl(impl);
+                    IvyContext.getContext().setMessageImpl(impl);
                 }
 
-				Message.debug("triggered build finished: "+f+" target="+target+" for "+event);
-			}
-		} else {
-			Message.verbose("no build file found for dependency, skipping: "+f);
-		}
-	}
-
-	private void markBuilt(File f) {
-		_builds.add(f.getAbsolutePath());
-	}
-
-	private boolean isBuilt(File f) {
-		return _builds.contains(f.getAbsolutePath());
-	}
-
-	private File getBuildFile(IvyEvent event) {
-		return new File(IvyPatternHelper.substituteTokens(getBuildFilePattern(), event.getAttributes()));
-	}
-
-	public String getBuildFilePattern() {
-		return _buildFilePattern;
-	}
-	
-	public void setAntfile(String pattern) {
-		_buildFilePattern = pattern;
-	}
-
-	public String getTarget() {
-		return _target;
-	}
-
-	public void setTarget(String target) {
-		_target = target;
-	}
-
-	public boolean isOnlyonce() {
-		return _onlyonce;
-	}
-
-	public void setOnlyonce(boolean onlyonce) {
-		_onlyonce = onlyonce;
-	}
-
-	public String getPrefix() {
-		return _prefix;
-	}
+                Message.debug("triggered build finished: " + f + " target=" + target + " for "
+                        + event);
+            }
+        } else {
+            Message.verbose("no build file found for dependency, skipping: " + f);
+        }
+    }
+
+    private void markBuilt(File f) {
+        _builds.add(f.getAbsolutePath());
+    }
+
+    private boolean isBuilt(File f) {
+        return _builds.contains(f.getAbsolutePath());
+    }
+
+    private File getBuildFile(IvyEvent event) {
+        return new File(IvyPatternHelper.substituteTokens(getBuildFilePattern(), event
+                .getAttributes()));
+    }
+
+    public String getBuildFilePattern() {
+        return _buildFilePattern;
+    }
+
+    public void setAntfile(String pattern) {
+        _buildFilePattern = pattern;
+    }
+
+    public String getTarget() {
+        return _target;
+    }
+
+    public void setTarget(String target) {
+        _target = target;
+    }
+
+    public boolean isOnlyonce() {
+        return _onlyonce;
+    }
+
+    public void setOnlyonce(boolean onlyonce) {
+        _onlyonce = onlyonce;
+    }
+
+    public String getPrefix() {
+        return _prefix;
+    }
 
-	public void setPrefix(String prefix) {
-		_prefix = prefix;
+    public void setPrefix(String prefix) {
+        _prefix = prefix;
         if (!prefix.endsWith(".")) {
             _prefix += ".";
         }
-	}
+    }
 }