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 [5/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/ant/IvyReport.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyReport.java Tue Jun  5 05:02:27 2007
@@ -38,90 +38,114 @@
 import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.GlobPatternMapper;
 
-
 /**
  * This ant task let users generates reports (html, xml, graphml, ...) from the last resolve done.
- * 
  */
 public class IvyReport extends IvyTask {
     private File _todir;
+
     private String _organisation;
+
     private String _module;
+
     private String _conf;
+
     private File _cache;
+
     private boolean _graph = true;
+
     private boolean _dot = false;
+
     private boolean _xml = false;
+
     private boolean _xsl = true;
+
     private String _xslFile;
+
     private String _outputpattern;
+
     private String _xslext = "html";
+
     private List _params = new ArrayList();
+
     private String _resolveId;
 
     public File getTodir() {
         return _todir;
     }
+
     public void setTodir(File todir) {
         _todir = todir;
     }
+
     public File getCache() {
         return _cache;
     }
+
     public void setCache(File cache) {
         _cache = cache;
     }
+
     public String getConf() {
         return _conf;
     }
+
     public void setConf(String conf) {
         _conf = conf;
     }
+
     public String getModule() {
         return _module;
     }
+
     public void setModule(String module) {
         _module = module;
     }
+
     public String getOrganisation() {
         return _organisation;
     }
+
     public void setOrganisation(String organisation) {
         _organisation = organisation;
     }
-    
+
     public boolean isGraph() {
         return _graph;
     }
-    
+
     public void setGraph(boolean graph) {
         _graph = graph;
     }
+
     public String getXslfile() {
         return _xslFile;
     }
-    
+
     public void setXslfile(String xslFile) {
         _xslFile = xslFile;
     }
+
     public String getOutputpattern() {
         return _outputpattern;
     }
-    
+
     public void setOutputpattern(String outputpattern) {
         _outputpattern = outputpattern;
     }
+
     public String getResolveId() {
-    	return _resolveId;
+        return _resolveId;
     }
+
     public void setResolveId(String resolveId) {
-    	_resolveId = resolveId;
+        _resolveId = resolveId;
     }
 
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
-        
+
         _organisation = getProperty(_organisation, settings, "ivy.organisation", _resolveId);
         _module = getProperty(_module, settings, "ivy.module", _resolveId);
         if (_cache == null) {
@@ -132,7 +156,8 @@
             _conf = getProperty(settings, "ivy.resolved.configurations", _resolveId);
         }
         if (_conf == null) {
-            throw new BuildException("no conf provided for ivy report task: It can either be set explicitely via the attribute 'conf' or via 'ivy.resolved.configurations' property or a prior call to <resolve/>");
+            throw new BuildException(
+                    "no conf provided for ivy report task: It can either be set explicitely via the attribute 'conf' or via 'ivy.resolved.configurations' property or a prior call to <resolve/>");
         }
         if (_todir == null) {
             String t = getProperty(settings, "ivy.report.todir");
@@ -147,20 +172,22 @@
         if (_outputpattern == null) {
             _outputpattern = "[organisation]-[module]-[conf].[ext]";
         }
-        
+
         if (_todir != null && _todir.exists() && !_todir.isDirectory()) {
             throw new BuildException("destination directory should be a directory !");
         }
         if (_organisation == null) {
-            throw new BuildException("no organisation provided for ivy report task: It can either be set explicitely via the attribute 'organisation' or via 'ivy.organisation' property or a prior call to <resolve/>");
+            throw new BuildException(
+                    "no organisation provided for ivy report task: It can either be set explicitely via the attribute 'organisation' or via 'ivy.organisation' property or a prior call to <resolve/>");
         }
         if (_module == null) {
-            throw new BuildException("no module name provided for ivy report task: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");
+            throw new BuildException(
+                    "no module name provided for ivy report task: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");
         }
         if (_resolveId == null) {
-        	_resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(_organisation, _module));
+            _resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(_organisation, _module));
         }
-        
+
         try {
             String[] confs = splitConfs(_conf);
             if (_xsl) {
@@ -170,45 +197,54 @@
                 genxml(_cache, _organisation, _module, confs);
             }
             if (_graph) {
-            	genStyled(_cache, _organisation, _module, confs, getStylePath(_cache, "ivy-report-graph.xsl"), "graphml");
+                genStyled(_cache, _organisation, _module, confs, getStylePath(_cache,
+                    "ivy-report-graph.xsl"), "graphml");
             }
             if (_dot) {
-            	genStyled(_cache, _organisation, _module, confs, getStylePath(_cache, "ivy-report-dot.xsl"), "dot");
+                genStyled(_cache, _organisation, _module, confs, getStylePath(_cache,
+                    "ivy-report-dot.xsl"), "dot");
             }
         } catch (IOException e) {
-            throw new BuildException("impossible to generate report: "+e, e);
+            throw new BuildException("impossible to generate report: " + e, e);
         }
     }
-    
-    private void genxml(File cache, String organisation, String module, String[] confs) throws IOException {
-    	CacheManager cacheMgr = getIvyInstance().getCacheManager(_cache);
-    	for (int i = 0; i < confs.length; i++) {
-	        File xml = cacheMgr.getConfigurationResolveReportInCache(_resolveId, confs[i]);
+
+    private void genxml(File cache, String organisation, String module, String[] confs)
+            throws IOException {
+        CacheManager cacheMgr = getIvyInstance().getCacheManager(_cache);
+        for (int i = 0; i < confs.length; i++) {
+            File xml = cacheMgr.getConfigurationResolveReportInCache(_resolveId, confs[i]);
 
             File out;
             if (_todir != null) {
-	            out = new File(_todir, IvyPatternHelper.substitute(_outputpattern, organisation, module, "", "", "", "xml", confs[i]));
+                out = new File(_todir, IvyPatternHelper.substitute(_outputpattern, organisation,
+                    module, "", "", "", "xml", confs[i]));
             } else {
-	            out = new File(IvyPatternHelper.substitute(_outputpattern, organisation, module, "", "", "", "xml", confs[i]));
+                out = new File(IvyPatternHelper.substitute(_outputpattern, organisation, module,
+                    "", "", "", "xml", confs[i]));
             }
-        
+
             FileUtil.copy(xml, out, null);
         }
     }
-    private void genreport(File cache, String organisation, String module, String[] confs) throws IOException {        
+
+    private void genreport(File cache, String organisation, String module, String[] confs)
+            throws IOException {
         genStyled(cache, organisation, module, confs, getReportStylePath(cache), _xslext);
 
         // copy the css if required
         if (_todir != null && _xslFile == null) {
             File css = new File(_todir, "ivy-report.css");
             if (!css.exists()) {
-                Message.debug("copying report css to "+_todir);
-                FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), css, null);
+                Message.debug("copying report css to " + _todir);
+                FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), css,
+                    null);
             }
-            FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), new File(cache, "ivy-report.css"), null);
+            FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.css"), new File(
+                    cache, "ivy-report.css"), null);
         }
     }
-    
+
     private String getReportStylePath(File cache) throws IOException {
         if (_xslFile != null) {
             return _xslFile;
@@ -219,8 +255,9 @@
         FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report.xsl"), style, null);
         return style.getAbsolutePath();
     }
-    
-    private void genStyled(File cache, String organisation, String module, String[] confs, String style, String ext) throws IOException {        
+
+    private void genStyled(File cache, String organisation, String module, String[] confs,
+            String style, String ext) throws IOException {
         // process the report with xslt to generate dot file
         File out;
         if (_todir != null) {
@@ -233,25 +270,26 @@
         xslt.setTaskName(getTaskName());
         xslt.setProject(getProject());
         xslt.init();
-        
+
         xslt.setDestdir(out);
         xslt.setBasedir(cache);
 
         Mapper mapper = new Mapper(getProject());
-    	xslt.addMapper(mapper);
-        
-    	CacheManager cacheMgr = getIvyInstance().getCacheManager(cache);
+        xslt.addMapper(mapper);
+
+        CacheManager cacheMgr = getIvyInstance().getCacheManager(cache);
         for (int i = 0; i < confs.length; i++) {
-        	File reportFile = cacheMgr.getConfigurationResolveReportInCache(_resolveId, confs[i]);
-        	xslt.setIncludes(reportFile.getName());
-        	
-        	FileNameMapper reportMapper = new GlobPatternMapper();
-			reportMapper.setFrom(reportFile.getName());
-        	reportMapper.setTo(IvyPatternHelper.substitute(_outputpattern, organisation, module, "", "", "", ext, confs[i]));
-        	mapper.add(reportMapper);
+            File reportFile = cacheMgr.getConfigurationResolveReportInCache(_resolveId, confs[i]);
+            xslt.setIncludes(reportFile.getName());
+
+            FileNameMapper reportMapper = new GlobPatternMapper();
+            reportMapper.setFrom(reportFile.getName());
+            reportMapper.setTo(IvyPatternHelper.substitute(_outputpattern, organisation, module,
+                "", "", "", ext, confs[i]));
+            mapper.add(reportMapper);
         }
         xslt.setStyle(style);
-        
+
         XSLTProcess.Param param = xslt.createParam();
         param.setName("confs");
         param.setExpression(_conf);
@@ -260,16 +298,16 @@
         param.setExpression(_xslext);
 
         // add the provided XSLT parameters
-        for (Iterator it = _params.iterator(); it.hasNext(); ) {
+        for (Iterator it = _params.iterator(); it.hasNext();) {
             param = (XSLTProcess.Param) it.next();
             XSLTProcess.Param realParam = xslt.createParam();
             realParam.setName(param.getName());
             realParam.setExpression(param.getExpression());
         }
-        
+
         xslt.execute();
     }
-    
+
     private String getStylePath(File cache, String styleResourceName) throws IOException {
         // style should be a file (and not an url)
         // so we have to copy it from classpath to cache
@@ -277,36 +315,43 @@
         FileUtil.copy(XmlReportOutputter.class.getResourceAsStream(styleResourceName), style, null);
         return style.getAbsolutePath();
     }
-    
+
     public boolean isXml() {
         return _xml;
     }
+
     public void setXml(boolean xml) {
         _xml = xml;
     }
+
     public boolean isXsl() {
         return _xsl;
     }
+
     public void setXsl(boolean xsl) {
         _xsl = xsl;
     }
+
     public String getXslext() {
         return _xslext;
     }
+
     public void setXslext(String xslext) {
         _xslext = xslext;
     }
-    
+
     public XSLTProcess.Param createParam() {
         XSLTProcess.Param result = new XSLTProcess.Param();
         _params.add(result);
         return result;
     }
-	public boolean isDot() {
-		return _dot;
-	}
-	public void setDot(boolean dot) {
-		_dot = dot;
-	}
-    
+
+    public boolean isDot() {
+        return _dot;
+    }
+
+    public void setDot(boolean dot) {
+        _dot = dot;
+    }
+
 }

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=544459&r1=544458&r2=544459
==============================================================================
--- 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 Tue Jun  5 05:02:27 2007
@@ -37,32 +37,41 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.XSLTProcess;
 
-
 /**
- * Generates a report of dependencies of a set of modules in the repository.
- * 
- * The set of modules is specified using organisation/module and matcher.
- * 
- *
+ * Generates a report of dependencies of a set of modules in the repository. The set of modules is
+ * specified using organisation/module and matcher.
  */
 public class IvyRepositoryReport extends IvyTask {
-    private String  _organisation = "*";
-    private String  _module;
-	private String _branch;
-    private String  _revision = "latest.integration";
-    private File 	_cache; 
+    private String _organisation = "*";
+
+    private String _module;
+
+    private String _branch;
+
+    private String _revision = "latest.integration";
+
+    private File _cache;
+
     private String _matcher = PatternMatcher.EXACT_OR_REGEXP;
-    
+
     private File _todir = new File(".");
+
     private boolean _graph = false;
+
     private boolean _dot = false;
+
     private boolean _xml = true;
+
     private boolean _xsl = false;
+
     private String _xslFile;
+
     private String _outputname = "ivy-repository-report";
+
     private String _xslext = "html";
+
     private List _params = new ArrayList();
-    
+
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
@@ -73,216 +82,241 @@
             throw new BuildException("xsl file is mandatory when using xsl generation");
         }
         if (_module == null && PatternMatcher.EXACT.equals(_matcher)) {
-            throw new BuildException("no module name provided for ivy repository graph task: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");
+            throw new BuildException(
+                    "no module name provided for ivy repository graph task: It can either be set explicitely via the attribute 'module' or via 'ivy.module' property or a prior call to <resolve/>");
         } else if (_module == null && !PatternMatcher.EXACT.equals(_matcher)) {
-        	_module = PatternMatcher.ANY_EXPRESSION;
+            _module = PatternMatcher.ANY_EXPRESSION;
         }
         ModuleRevisionId mrid = ModuleRevisionId.newInstance(_organisation, _module, _revision);
-        
+
         try {
-    		ModuleId[] mids = ivy.listModules(new ModuleId(_organisation, _module), settings.getMatcher(_matcher));
-    		ModuleRevisionId[] mrids = new ModuleRevisionId[mids.length];
-    		for (int i = 0; i < mrids.length; i++) {
-    			if (_branch != null) {
-    				mrids[i] = new ModuleRevisionId(mids[i], _branch, _revision);
-    			} else {
-    				mrids[i] = new ModuleRevisionId(mids[i], _revision);
-    			}
-			}
-    		DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true, false);
-    		String resolveId = ResolveOptions.getDefaultResolveId(md);
-    		ResolveReport report = ivy.resolve(
-    				md, 
-    				new ResolveOptions()
-    					.setResolveId(resolveId)
-			    		.setCache(CacheManager.getInstance(settings, _cache))
-			    		.setValidate(doValidate(settings)));
-    		
-    		CacheManager cacheMgr = getIvyInstance().getCacheManager(_cache);
-    		new XmlReportOutputter().output(report, _cache);
-    		if (_graph) {
-    			gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(), md.getModuleRevisionId().getName());
-    		}
-    		if (_dot) {
-    			gendot(cacheMgr, md.getModuleRevisionId().getOrganisation(), md.getModuleRevisionId().getName());
-    		}
-    		if (_xml) {
-    			
-    			FileUtil.copy(cacheMgr.getConfigurationResolveReportInCache(resolveId, "default"), new File(_todir, _outputname+".xml"), null);
-    		}
-    		if (_xsl) {
-    			genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(), md.getModuleRevisionId().getName());
-    		}
+            ModuleId[] mids = ivy.listModules(new ModuleId(_organisation, _module), settings
+                    .getMatcher(_matcher));
+            ModuleRevisionId[] mrids = new ModuleRevisionId[mids.length];
+            for (int i = 0; i < mrids.length; i++) {
+                if (_branch != null) {
+                    mrids[i] = new ModuleRevisionId(mids[i], _branch, _revision);
+                } else {
+                    mrids[i] = new ModuleRevisionId(mids[i], _revision);
+                }
+            }
+            DefaultModuleDescriptor md = DefaultModuleDescriptor.newCallerInstance(mrids, true,
+                false);
+            String resolveId = ResolveOptions.getDefaultResolveId(md);
+            ResolveReport report = ivy.resolve(md, new ResolveOptions().setResolveId(resolveId)
+                    .setCache(CacheManager.getInstance(settings, _cache)).setValidate(
+                        doValidate(settings)));
+
+            CacheManager cacheMgr = getIvyInstance().getCacheManager(_cache);
+            new XmlReportOutputter().output(report, _cache);
+            if (_graph) {
+                gengraph(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
+                        .getModuleRevisionId().getName());
+            }
+            if (_dot) {
+                gendot(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
+                        .getModuleRevisionId().getName());
+            }
+            if (_xml) {
+
+                FileUtil.copy(cacheMgr.getConfigurationResolveReportInCache(resolveId, "default"),
+                    new File(_todir, _outputname + ".xml"), null);
+            }
+            if (_xsl) {
+                genreport(cacheMgr, md.getModuleRevisionId().getOrganisation(), md
+                        .getModuleRevisionId().getName());
+            }
         } catch (Exception e) {
-            throw new BuildException("impossible to generate graph for "+ mrid +": "+e, e);
+            throw new BuildException("impossible to generate graph for " + mrid + ": " + e, e);
         }
     }
-    
-    private void genreport(CacheManager cache, String organisation, String module) throws IOException {  
+
+    private void genreport(CacheManager cache, String organisation, String module)
+            throws IOException {
         // first process the report with xslt
         XSLTProcess xslt = new XSLTProcess();
         xslt.setTaskName(getTaskName());
         xslt.setProject(getProject());
         xslt.init();
-        
+
         String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
         xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
-        xslt.setOut(new File(_todir, _outputname+"."+_xslext));
-        
+        xslt.setOut(new File(_todir, _outputname + "." + _xslext));
+
         xslt.setStyle(_xslFile);
-        
+
         XSLTProcess.Param param = xslt.createParam();
         param.setName("extension");
         param.setExpression(_xslext);
 
         // add the provided XSLT parameters
-        for (Iterator it = _params.iterator(); it.hasNext(); ) {
+        for (Iterator it = _params.iterator(); it.hasNext();) {
             param = (XSLTProcess.Param) it.next();
             XSLTProcess.Param realParam = xslt.createParam();
             realParam.setName(param.getName());
             realParam.setExpression(param.getExpression());
         }
-        
+
         xslt.execute();
     }
 
-    private void gengraph(CacheManager cache, String organisation, String module) throws IOException {        
+    private void gengraph(CacheManager cache, String organisation, String module)
+            throws IOException {
         gen(cache, organisation, module, getGraphStylePath(cache.getCache()), "graphml");
     }
-    
+
     private String getGraphStylePath(File cache) throws IOException {
         // style should be a file (and not an url)
         // so we have to copy it from classpath to cache
         File style = new File(cache, "ivy-report-graph-all.xsl");
-        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-graph-all.xsl"), style, null);
+        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-graph-all.xsl"),
+            style, null);
         return style.getAbsolutePath();
     }
-    
-    private void gendot(CacheManager cache, String organisation, String module) throws IOException {        
+
+    private void gendot(CacheManager cache, String organisation, String module) throws IOException {
         gen(cache, organisation, module, getDotStylePath(cache.getCache()), "dot");
     }
-    
+
     private String getDotStylePath(File cache) throws IOException {
         // style should be a file (and not an url)
         // so we have to copy it from classpath to cache
         File style = new File(cache, "ivy-report-dot-all.xsl");
-        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-dot-all.xsl"), style, null);
+        FileUtil.copy(XmlReportOutputter.class.getResourceAsStream("ivy-report-dot-all.xsl"),
+            style, null);
         return style.getAbsolutePath();
     }
-    
-    private void gen(CacheManager cache, String organisation, String module, String style, String ext) throws IOException {        
+
+    private void gen(CacheManager cache, String organisation, String module, String style,
+            String ext) throws IOException {
         XSLTProcess xslt = new XSLTProcess();
         xslt.setTaskName(getTaskName());
         xslt.setProject(getProject());
         xslt.init();
-        
+
         String resolveId = ResolveOptions.getDefaultResolveId(new ModuleId(organisation, module));
         xslt.setIn(cache.getConfigurationResolveReportInCache(resolveId, "default"));
-        xslt.setOut(new File(_todir, _outputname+"."+ext));
+        xslt.setOut(new File(_todir, _outputname + "." + ext));
         xslt.setBasedir(cache.getCache());
         xslt.setStyle(style);
         xslt.execute();
     }
-    
+
     public File getTodir() {
         return _todir;
     }
+
     public void setTodir(File todir) {
         _todir = todir;
     }
+
     public boolean isGraph() {
         return _graph;
     }
-    
+
     public void setGraph(boolean graph) {
         _graph = graph;
     }
+
     public String getXslfile() {
         return _xslFile;
     }
-    
+
     public void setXslfile(String xslFile) {
         _xslFile = xslFile;
     }
+
     public boolean isXml() {
         return _xml;
     }
+
     public void setXml(boolean xml) {
         _xml = xml;
     }
+
     public boolean isXsl() {
         return _xsl;
     }
+
     public void setXsl(boolean xsl) {
         _xsl = xsl;
     }
+
     public String getXslext() {
         return _xslext;
     }
+
     public void setXslext(String xslext) {
         _xslext = xslext;
     }
-    
+
     public XSLTProcess.Param createParam() {
         XSLTProcess.Param result = new XSLTProcess.Param();
         _params.add(result);
         return result;
     }
-    
+
     public String getOutputname() {
         return _outputname;
     }
-    
+
     public void setOutputname(String outputpattern) {
         _outputname = outputpattern;
     }
 
-	public File getCache() {
-		return _cache;
-	}
-	public void setCache(File cache) {
-		_cache = cache;
-	}
-	public String getMatcher() {
-		return _matcher;
-	}
-	public void setMatcher(String matcher) {
-		_matcher = matcher;
-	}
-	public String getModule() {
-		return _module;
-	}
-	public void setModule(String module) {
-		_module = module;
-	}
-	public String getOrganisation() {
-		return _organisation;
-	}
-	public void setOrganisation(String organisation) {
-		_organisation = organisation;
-	}
-	public String getRevision() {
-		return _revision;
-	}
-	public void setRevision(String revision) {
-		_revision = revision;
-	}
-
-
-	public String getBranch() {
-		return _branch;
-	}
-
-
-	public void setBranch(String branch) {
-		_branch = branch;
-	}
-
-	public boolean isDot() {
-		return _dot;
-	}
-
-	public void setDot(boolean dot) {
-		_dot = dot;
-	}
+    public File getCache() {
+        return _cache;
+    }
+
+    public void setCache(File cache) {
+        _cache = cache;
+    }
+
+    public String getMatcher() {
+        return _matcher;
+    }
+
+    public void setMatcher(String matcher) {
+        _matcher = matcher;
+    }
+
+    public String getModule() {
+        return _module;
+    }
+
+    public void setModule(String module) {
+        _module = module;
+    }
+
+    public String getOrganisation() {
+        return _organisation;
+    }
+
+    public void setOrganisation(String organisation) {
+        _organisation = organisation;
+    }
+
+    public String getRevision() {
+        return _revision;
+    }
+
+    public void setRevision(String revision) {
+        _revision = revision;
+    }
+
+    public String getBranch() {
+        return _branch;
+    }
+
+    public void setBranch(String branch) {
+        _branch = branch;
+    }
+
+    public boolean isDot() {
+        return _dot;
+    }
+
+    public void setDot(boolean dot) {
+        _dot = dot;
+    }
 }

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=544459&r1=544458&r2=544459
==============================================================================
--- 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 Tue Jun  5 05:02:27 2007
@@ -33,105 +33,137 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 
-
 /**
  * This task allow to call the Ivy dependency resolution from ant.
- * 
- *
  */
 public class IvyResolve extends IvyTask {
     private File _file = null;
+
     private String _conf = null;
+
     private File _cache = null;
+
     private String _organisation = null;
+
     private String _module = null;
+
     private String _revision = null;
+
     private String _pubdate = null;
+
     private boolean _inline = false;
+
     private boolean _haltOnFailure = true;
+
     private boolean _useCacheOnly = false;
+
     private String _type = null;
-	private boolean _transitive = true;
-	private boolean _changing = false;
-	private Boolean _keep = null;
-	private String _failureProperty = null;
+
+    private boolean _transitive = true;
+
+    private boolean _changing = false;
+
+    private Boolean _keep = null;
+
+    private String _failureProperty = null;
+
     private boolean _useOrigin = false;
+
     private String _resolveId = null;
-    
+
     public boolean isUseOrigin() {
-    	return _useOrigin;
+        return _useOrigin;
     }
-    
+
     public void setUseOrigin(boolean useOrigin) {
-    	_useOrigin = useOrigin;
+        _useOrigin = useOrigin;
     }
-    
+
     public String getDate() {
         return _pubdate;
     }
+
     public void setDate(String pubdate) {
         _pubdate = pubdate;
     }
+
     public String getRevision() {
         return _revision;
     }
+
     public void setRevision(String revision) {
         _revision = revision;
     }
+
     public File getCache() {
         return _cache;
     }
+
     public void setCache(File cache) {
         _cache = cache;
     }
+
     public String getConf() {
         return _conf;
     }
+
     public void setConf(String conf) {
         _conf = conf;
     }
+
     public File getFile() {
         return _file;
     }
+
     public void setFile(File file) {
         _file = file;
     }
+
     public boolean isHaltonfailure() {
         return _haltOnFailure;
     }
+
     public void setHaltonfailure(boolean haltOnFailure) {
         _haltOnFailure = haltOnFailure;
     }
+
     public void setShowprogress(boolean show) {
         Message.setShowProgress(show);
     }
+
     public boolean isUseCacheOnly() {
         return _useCacheOnly;
     }
+
     public void setUseCacheOnly(boolean useCacheOnly) {
         _useCacheOnly = useCacheOnly;
     }
+
     public String getType() {
         return _type;
     }
+
     public void setType(String type) {
         _type = type;
     }
+
     /**
-	 * @deprecated Use {@link #setFailureProperty(String)} instead
-	 */
-	public void setFailurePropery(String failureProperty) {
-		log("The 'failurepropery' attribute is deprecated. " + 
-				"Please use the 'failureproperty' attribute instead", Project.MSG_WARN);
-		setFailureProperty(failureProperty);
-	}
-	public void setFailureProperty(String failureProperty) {
-    	_failureProperty = failureProperty;
+     * @deprecated Use {@link #setFailureProperty(String)} instead
+     */
+    public void setFailurePropery(String failureProperty) {
+        log("The 'failurepropery' attribute is deprecated. "
+                + "Please use the 'failureproperty' attribute instead", Project.MSG_WARN);
+        setFailureProperty(failureProperty);
     }
+
+    public void setFailureProperty(String failureProperty) {
+        _failureProperty = failureProperty;
+    }
+
     public String getFailureProperty() {
-    	return _failureProperty;
+        return _failureProperty;
     }
-    
+
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
@@ -142,157 +174,184 @@
                 _cache = settings.getDefaultCache();
             }
             String[] confs = splitConfs(_conf);
-            
+
             ResolveReport report;
             if (isInline()) {
-            	if (_organisation == null) {
-            		throw new BuildException("'organisation' is required when using inline mode");
-            	}
-            	if (_module == null) {
-            		throw new BuildException("'module' is required when using inline mode");
-            	}
-            	if (_file != null) {
-            		throw new BuildException("'file' not allowed when using inline mode");
-            	}
-            	if (_revision == null) {
-            		_revision = "latest.integration";
-            	}
-	            report = ivy.resolve(
-	            		ModuleRevisionId.newInstance(_organisation, _module, _revision),
-	            		getResolveOptions(confs, settings),
-	            		_changing);
-            	
+                if (_organisation == null) {
+                    throw new BuildException("'organisation' is required when using inline mode");
+                }
+                if (_module == null) {
+                    throw new BuildException("'module' is required when using inline mode");
+                }
+                if (_file != null) {
+                    throw new BuildException("'file' not allowed when using inline mode");
+                }
+                if (_revision == null) {
+                    _revision = "latest.integration";
+                }
+                report = ivy.resolve(ModuleRevisionId
+                        .newInstance(_organisation, _module, _revision), getResolveOptions(confs,
+                    settings), _changing);
+
             } else {
-            	if (_organisation != null) {
-            		throw new BuildException("'organisation' not allowed when not using 'org' attribute");
-            	}
-            	if (_module != null) {
-            		throw new BuildException("'module' not allowed when not using 'org' attribute");
-            	}
-	            if (_file == null) {
-	                _file = getProject().resolveFile(getProperty(settings, "ivy.dep.file"));
-	            }
-	            report = ivy.resolve(
-	                    _file.toURL(), 
-	                    getResolveOptions(confs, settings));
+                if (_organisation != null) {
+                    throw new BuildException(
+                            "'organisation' not allowed when not using 'org' attribute");
+                }
+                if (_module != null) {
+                    throw new BuildException("'module' not allowed when not using 'org' attribute");
+                }
+                if (_file == null) {
+                    _file = getProject().resolveFile(getProperty(settings, "ivy.dep.file"));
+                }
+                report = ivy.resolve(_file.toURL(), getResolveOptions(confs, settings));
             }
             if (report.hasError()) {
-	            if (_failureProperty != null) {
-	            	getProject().setProperty(_failureProperty, "true");
-	            }
-	            if (isHaltonfailure()) {
-	                throw new BuildException("resolve failed - see output for details");
-	            }
-            }            
+                if (_failureProperty != null) {
+                    getProject().setProperty(_failureProperty, "true");
+                }
+                if (isHaltonfailure()) {
+                    throw new BuildException("resolve failed - see output for details");
+                }
+            }
             setResolved(report, _resolveId, isKeep());
-            
+
             if (isKeep()) {
-            	ModuleDescriptor md = report.getModuleDescriptor();
-	            // put resolved infos in ant properties and ivy variables
-	            // putting them in ivy variables is important to be able to change from one resolve call to the other
-	            getProject().setProperty("ivy.organisation", md.getModuleRevisionId().getOrganisation());
-	            settings.setVariable("ivy.organisation", md.getModuleRevisionId().getOrganisation());
-	            getProject().setProperty("ivy.module", md.getModuleRevisionId().getName());
-	            settings.setVariable("ivy.module", md.getModuleRevisionId().getName());
-	            getProject().setProperty("ivy.revision", md.getResolvedModuleRevisionId().getRevision());
-	            settings.setVariable("ivy.revision", md.getResolvedModuleRevisionId().getRevision());
-	            boolean hasChanged = report.hasChanged();
-	            getProject().setProperty("ivy.deps.changed", String.valueOf(hasChanged));
-	            settings.setVariable("ivy.deps.changed", String.valueOf(hasChanged));
-	            if (_conf.trim().equals("*")) {
-	                getProject().setProperty("ivy.resolved.configurations", mergeConfs(md.getConfigurationsNames()));
-	                settings.setVariable("ivy.resolved.configurations", mergeConfs(md.getConfigurationsNames()));
-	            } else {
-	                getProject().setProperty("ivy.resolved.configurations", _conf);
-	                settings.setVariable("ivy.resolved.configurations", _conf);
-	            }
-	            if (_file != null) {
-		            getProject().setProperty("ivy.resolved.file", _file.getAbsolutePath());
-		            settings.setVariable("ivy.resolved.file", _file.getAbsolutePath());
-	            }
-	            if (_resolveId != null) {
-		            getProject().setProperty("ivy.organisation." + _resolveId, md.getModuleRevisionId().getOrganisation());
-		            settings.setVariable("ivy.organisation." + _resolveId, md.getModuleRevisionId().getOrganisation());
-		            getProject().setProperty("ivy.module." + _resolveId, md.getModuleRevisionId().getName());
-		            settings.setVariable("ivy.module." + _resolveId, md.getModuleRevisionId().getName());
-		            getProject().setProperty("ivy.revision." + _resolveId, md.getResolvedModuleRevisionId().getRevision());
-		            settings.setVariable("ivy.revision." + _resolveId, md.getResolvedModuleRevisionId().getRevision());
-		            getProject().setProperty("ivy.deps.changed." + _resolveId, String.valueOf(hasChanged));
-		            settings.setVariable("ivy.deps.changed." + _resolveId, String.valueOf(hasChanged));
-		            if (_conf.trim().equals("*")) {
-		                getProject().setProperty("ivy.resolved.configurations." + _resolveId, mergeConfs(md.getConfigurationsNames()));
-		                settings.setVariable("ivy.resolved.configurations." + _resolveId, mergeConfs(md.getConfigurationsNames()));
-		            } else {
-		                getProject().setProperty("ivy.resolved.configurations." + _resolveId, _conf);
-		                settings.setVariable("ivy.resolved.configurations." + _resolveId, _conf);
-		            }
-		            getProject().setProperty("ivy.resolved.file." + _resolveId, _file.getAbsolutePath());
-		            settings.setVariable("ivy.resolved.file." + _resolveId, _file.getAbsolutePath());
-	            }
+                ModuleDescriptor md = report.getModuleDescriptor();
+                // put resolved infos in ant properties and ivy variables
+                // putting them in ivy variables is important to be able to change from one resolve
+                // call to the other
+                getProject().setProperty("ivy.organisation",
+                    md.getModuleRevisionId().getOrganisation());
+                settings
+                        .setVariable("ivy.organisation", md.getModuleRevisionId().getOrganisation());
+                getProject().setProperty("ivy.module", md.getModuleRevisionId().getName());
+                settings.setVariable("ivy.module", md.getModuleRevisionId().getName());
+                getProject().setProperty("ivy.revision",
+                    md.getResolvedModuleRevisionId().getRevision());
+                settings
+                        .setVariable("ivy.revision", md.getResolvedModuleRevisionId().getRevision());
+                boolean hasChanged = report.hasChanged();
+                getProject().setProperty("ivy.deps.changed", String.valueOf(hasChanged));
+                settings.setVariable("ivy.deps.changed", String.valueOf(hasChanged));
+                if (_conf.trim().equals("*")) {
+                    getProject().setProperty("ivy.resolved.configurations",
+                        mergeConfs(md.getConfigurationsNames()));
+                    settings.setVariable("ivy.resolved.configurations", mergeConfs(md
+                            .getConfigurationsNames()));
+                } else {
+                    getProject().setProperty("ivy.resolved.configurations", _conf);
+                    settings.setVariable("ivy.resolved.configurations", _conf);
+                }
+                if (_file != null) {
+                    getProject().setProperty("ivy.resolved.file", _file.getAbsolutePath());
+                    settings.setVariable("ivy.resolved.file", _file.getAbsolutePath());
+                }
+                if (_resolveId != null) {
+                    getProject().setProperty("ivy.organisation." + _resolveId,
+                        md.getModuleRevisionId().getOrganisation());
+                    settings.setVariable("ivy.organisation." + _resolveId, md.getModuleRevisionId()
+                            .getOrganisation());
+                    getProject().setProperty("ivy.module." + _resolveId,
+                        md.getModuleRevisionId().getName());
+                    settings.setVariable("ivy.module." + _resolveId, md.getModuleRevisionId()
+                            .getName());
+                    getProject().setProperty("ivy.revision." + _resolveId,
+                        md.getResolvedModuleRevisionId().getRevision());
+                    settings.setVariable("ivy.revision." + _resolveId, md
+                            .getResolvedModuleRevisionId().getRevision());
+                    getProject().setProperty("ivy.deps.changed." + _resolveId,
+                        String.valueOf(hasChanged));
+                    settings.setVariable("ivy.deps.changed." + _resolveId, String
+                            .valueOf(hasChanged));
+                    if (_conf.trim().equals("*")) {
+                        getProject().setProperty("ivy.resolved.configurations." + _resolveId,
+                            mergeConfs(md.getConfigurationsNames()));
+                        settings.setVariable("ivy.resolved.configurations." + _resolveId,
+                            mergeConfs(md.getConfigurationsNames()));
+                    } else {
+                        getProject()
+                                .setProperty("ivy.resolved.configurations." + _resolveId, _conf);
+                        settings.setVariable("ivy.resolved.configurations." + _resolveId, _conf);
+                    }
+                    getProject().setProperty("ivy.resolved.file." + _resolveId,
+                        _file.getAbsolutePath());
+                    settings
+                            .setVariable("ivy.resolved.file." + _resolveId, _file.getAbsolutePath());
+                }
             }
         } catch (MalformedURLException e) {
-            throw new BuildException("unable to convert given ivy file to url: "+_file+": "+e, e);
+            throw new BuildException(
+                    "unable to convert given ivy file to url: " + _file + ": " + e, e);
         } catch (ParseException e) {
             log(e.getMessage(), Project.MSG_ERR);
-            throw new BuildException("syntax errors in ivy file: "+e, e);
+            throw new BuildException("syntax errors in ivy file: " + e, e);
         } catch (Exception e) {
-            throw new BuildException("impossible to resolve dependencies: "+e, e);
+            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)
-			.setResolveId(_resolveId);
-	}
-
-	public String getModule() {
-		return _module;
-	}
-	public void setModule(String module) {
-		_module = module;
-	}
-	public String getOrganisation() {
-		return _organisation;
-	}
-	public void setOrganisation(String organisation) {
-		_organisation = organisation;
-	}
-	public boolean isTransitive() {
-		return _transitive;
-	}
-	public void setTransitive(boolean transitive) {
-		_transitive = transitive;
-	}
-	public boolean isChanging() {
-		return _changing;
-	}
-	public void setChanging(boolean changing) {
-		_changing = changing;
-	}
-	public boolean isKeep() {
-		return _keep == null ? _organisation == null : _keep.booleanValue();
-	}
-	public void setKeep(boolean keep) {
-		_keep = Boolean.valueOf(keep);
-	}
-	public boolean isInline() {
-		return _inline;
-	}
-	public void setInline(boolean inline) {
-		_inline = inline;
-	}
-	public String getResolveId() {
-		return _resolveId;
-	}
-	public void setResolveId(String resolveId) {
-		_resolveId = resolveId;
-	}
+
+    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).setResolveId(_resolveId);
+    }
+
+    public String getModule() {
+        return _module;
+    }
+
+    public void setModule(String module) {
+        _module = module;
+    }
+
+    public String getOrganisation() {
+        return _organisation;
+    }
+
+    public void setOrganisation(String organisation) {
+        _organisation = organisation;
+    }
+
+    public boolean isTransitive() {
+        return _transitive;
+    }
+
+    public void setTransitive(boolean transitive) {
+        _transitive = transitive;
+    }
+
+    public boolean isChanging() {
+        return _changing;
+    }
+
+    public void setChanging(boolean changing) {
+        _changing = changing;
+    }
+
+    public boolean isKeep() {
+        return _keep == null ? _organisation == null : _keep.booleanValue();
+    }
+
+    public void setKeep(boolean keep) {
+        _keep = Boolean.valueOf(keep);
+    }
+
+    public boolean isInline() {
+        return _inline;
+    }
+
+    public void setInline(boolean inline) {
+        _inline = inline;
+    }
+
+    public String getResolveId() {
+        return _resolveId;
+    }
+
+    public void setResolveId(String resolveId) {
+        _resolveId = resolveId;
+    }
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyRetrieve.java Tue Jun  5 05:02:27 2007
@@ -22,61 +22,62 @@
 import org.apache.ivy.util.filter.Filter;
 import org.apache.tools.ant.BuildException;
 
-
 /**
  * This task allow to retrieve dependencies from the cache to a local directory like a lib dir.
- * 
- *
  */
 public class IvyRetrieve extends IvyPostResolveTask {
     private String _pattern;
+
     private String _ivypattern = null;
+
     private boolean _sync = false;
+
     private boolean _symlink = false;
-    
+
     public String getPattern() {
         return _pattern;
     }
+
     public void setPattern(String pattern) {
         _pattern = pattern;
     }
-    
+
     public void doExecute() throws BuildException {
-    	prepareAndCheck();
+        prepareAndCheck();
 
         _pattern = getProperty(_pattern, getSettings(), "ivy.retrieve.pattern");
         try {
-        	Filter artifactFilter = getArtifactFilter();
+            Filter artifactFilter = getArtifactFilter();
             int targetsCopied = getIvyInstance().retrieve(
-            		getResolvedMrid(), 
-            		_pattern, 
-            		new RetrieveOptions()
-            			.setConfs(splitConfs(getConf()))
-            			.setCache(CacheManager.getInstance(getIvyInstance().getSettings(), getCache()))
-            			.setDestIvyPattern(_ivypattern)
-            			.setArtifactFilter(artifactFilter)
-            			.setSync(_sync)
-            			.setUseOrigin(isUseOrigin())
-            			.setMakeSymlinks(_symlink));
+                getResolvedMrid(),
+                _pattern,
+                new RetrieveOptions().setConfs(splitConfs(getConf())).setCache(
+                    CacheManager.getInstance(getIvyInstance().getSettings(), getCache()))
+                        .setDestIvyPattern(_ivypattern).setArtifactFilter(artifactFilter).setSync(
+                            _sync).setUseOrigin(isUseOrigin()).setMakeSymlinks(_symlink));
             boolean haveTargetsBeenCopied = targetsCopied > 0;
             getProject().setProperty("ivy.nb.targets.copied", String.valueOf(targetsCopied));
             getProject().setProperty("ivy.targets.copied", String.valueOf(haveTargetsBeenCopied));
         } catch (Exception ex) {
-            throw new BuildException("impossible to ivy retrieve: "+ex, ex);
+            throw new BuildException("impossible to ivy retrieve: " + ex, ex);
         }
     }
+
     public String getIvypattern() {
         return _ivypattern;
     }
+
     public void setIvypattern(String ivypattern) {
         _ivypattern = ivypattern;
     }
-	public boolean isSync() {
-		return _sync;
-	}
-	public void setSync(boolean sync) {
-		_sync = sync;
-	}
+
+    public boolean isSync() {
+        return _sync;
+    }
+
+    public void setSync(boolean sync) {
+        _sync = sync;
+    }
 
     /**
      * Option to create symlinks instead of copying.

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyTask.java Tue Jun  5 05:02:27 2007
@@ -32,16 +32,15 @@
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.types.Reference;
 
-
 /**
  * Base class for all ivy ant tasks, deal particularly with ivy instance storage in ant project.
- * 
- *
  */
 public abstract class IvyTask extends Task {
     public static final String ANT_PROJECT_CONTEXT_KEY = "ant-project";
-	private Boolean _validate = null; 
-	private Reference _antIvyEngineRef = null; 
+
+    private Boolean _validate = null;
+
+    private Reference _antIvyEngineRef = null;
 
     protected boolean doValidate(IvySettings ivy) {
         if (_validate != null) {
@@ -49,127 +48,137 @@
         }
         return ivy.doValidate();
     }
+
     public boolean isValidate() {
         return _validate == null ? true : _validate.booleanValue();
     }
+
     public void setValidate(boolean validate) {
         _validate = Boolean.valueOf(validate);
     }
-    
-    
+
     public void setSettingsRef(Reference ref) {
-    	_antIvyEngineRef = ref;
+        _antIvyEngineRef = ref;
     }
-    
+
     public Reference getSettingsRef() {
-    	return _antIvyEngineRef;
+        return _antIvyEngineRef;
     }
-    
+
     protected IvySettings getSettings() {
-    	return getIvyInstance().getSettings();
+        return getIvyInstance().getSettings();
     }
-    
+
     protected Ivy getIvyInstance() {
-    	ensureMessageInitialised();
-    	Object antIvyEngine;
-    	if (_antIvyEngineRef!=null) {
-    		antIvyEngine = _antIvyEngineRef.getReferencedObject();
-    		if (! antIvyEngine.getClass().getName().equals(IvyAntSettings.class.getName())) {
-    			throw new BuildException(_antIvyEngineRef.getRefId() + " doesn't reference an ivy:settings" , getLocation());
-    		}
-    		if (! (antIvyEngine instanceof IvyAntSettings)) {
-    			throw new BuildException(_antIvyEngineRef.getRefId() + " has been defined in a different classloader.  Please use the same loader when defining your task, or redeclare your ivy:settings in this classloader" , getLocation());
-    		}
-    	} else {
-    		antIvyEngine = IvyAntSettings.getDefaultInstance(getProject()); 
-    	}
-    	return ((IvyAntSettings)antIvyEngine).getConfiguredIvyInstance();
-    }
-
-    /** 
-     * Every task MUST call ensureMessageInitialised when the execution method
-     * starts (at least before doing any log in order to set the correct task
-     * in the log.
+        ensureMessageInitialised();
+        Object antIvyEngine;
+        if (_antIvyEngineRef != null) {
+            antIvyEngine = _antIvyEngineRef.getReferencedObject();
+            if (!antIvyEngine.getClass().getName().equals(IvyAntSettings.class.getName())) {
+                throw new BuildException(_antIvyEngineRef.getRefId()
+                        + " doesn't reference an ivy:settings", getLocation());
+            }
+            if (!(antIvyEngine instanceof IvyAntSettings)) {
+                throw new BuildException(
+                        _antIvyEngineRef.getRefId()
+                                + " has been defined in a different classloader.  Please use the same loader when defining your task, or redeclare your ivy:settings in this classloader",
+                        getLocation());
+            }
+        } else {
+            antIvyEngine = IvyAntSettings.getDefaultInstance(getProject());
+        }
+        return ((IvyAntSettings) antIvyEngine).getConfiguredIvyInstance();
+    }
+
+    /**
+     * Every task MUST call ensureMessageInitialised when the execution method starts (at least
+     * before doing any log in order to set the correct task in the log.
      */
     protected void ensureMessageInitialised() {
-        if (!Message.isInitialised()) { 
+        if (!Message.isInitialised()) {
             Message.init(new AntMessageImpl(this));
         }
     }
-    
+
     protected void setResolved(ResolveReport report, boolean keep) {
-    	ModuleDescriptor md = report.getModuleDescriptor();
-    	String[] confs = report.getConfigurations();
-    	if (keep) {
-	        getProject().addReference("ivy.resolved.report", report);
-	        getProject().addReference("ivy.resolved.configurations.ref", confs);
-	        getProject().addReference("ivy.resolved.descriptor", md);
-    	}
-    	String suffix = md.getModuleRevisionId().getModuleId().getOrganisation()+"."+md.getModuleRevisionId().getModuleId().getName();
-        getProject().addReference("ivy.resolved.report."+suffix, report);
-        getProject().addReference("ivy.resolved.descriptor."+suffix, md);
-        getProject().addReference("ivy.resolved.configurations.ref."+suffix, confs);
+        ModuleDescriptor md = report.getModuleDescriptor();
+        String[] confs = report.getConfigurations();
+        if (keep) {
+            getProject().addReference("ivy.resolved.report", report);
+            getProject().addReference("ivy.resolved.configurations.ref", confs);
+            getProject().addReference("ivy.resolved.descriptor", md);
+        }
+        String suffix = md.getModuleRevisionId().getModuleId().getOrganisation() + "."
+                + md.getModuleRevisionId().getModuleId().getName();
+        getProject().addReference("ivy.resolved.report." + suffix, report);
+        getProject().addReference("ivy.resolved.descriptor." + suffix, md);
+        getProject().addReference("ivy.resolved.configurations.ref." + suffix, confs);
     }
+
     protected void setResolved(ResolveReport report, String resolveId, boolean keep) {
-    	setResolved(report, keep);
-    	if (resolveId != null) {
-	    	ModuleDescriptor md = report.getModuleDescriptor();
-	    	String[] confs = report.getConfigurations();
-	        getProject().addReference("ivy.resolved.report."+resolveId, report);
-	        getProject().addReference("ivy.resolved.descriptor."+resolveId, md);
-	        getProject().addReference("ivy.resolved.configurations.ref."+resolveId, confs);
-    	}
+        setResolved(report, keep);
+        if (resolveId != null) {
+            ModuleDescriptor md = report.getModuleDescriptor();
+            String[] confs = report.getConfigurations();
+            getProject().addReference("ivy.resolved.report." + resolveId, report);
+            getProject().addReference("ivy.resolved.descriptor." + resolveId, md);
+            getProject().addReference("ivy.resolved.configurations.ref." + resolveId, confs);
+        }
     }
-    
+
     protected String[] getResolvedConfigurations(String org, String module, boolean strict) {
-		return (String[]) getReference("ivy.resolved.configurations.ref", org, module, strict);
-	}
-    
+        return (String[]) getReference("ivy.resolved.configurations.ref", org, module, strict);
+    }
+
     protected Object getResolvedDescriptor(String resolveId) {
-    	return getResolvedDescriptor(resolveId, true);
+        return getResolvedDescriptor(resolveId, true);
     }
-    
+
     protected Object getResolvedDescriptor(String resolveId, boolean strict) {
-    	Object result = getProject().getReference("ivy.resolved.descriptor." + resolveId);
+        Object result = getProject().getReference("ivy.resolved.descriptor." + resolveId);
         if (strict && (result == null)) {
-        	throw new BuildException("ModuleDescriptor for resolve with id '" + resolveId + "' not found.");
+            throw new BuildException("ModuleDescriptor for resolve with id '" + resolveId
+                    + "' not found.");
         }
         return result;
     }
-	protected Object getResolvedDescriptor(String org, String module) {
-		return getResolvedDescriptor(org, module, false);
-	}
-    
-	protected Object getResolvedDescriptor(String org, String module, boolean strict) {
-		return getReference("ivy.resolved.descriptor", org, module, strict);
-	}
-	private Object getReference(String prefix, String org, String module, boolean strict) {
-		Object reference = null;
-		if (org != null && module != null) {
-			reference = getProject().getReference(prefix+"."+org+"."+module);
-		}
+
+    protected Object getResolvedDescriptor(String org, String module) {
+        return getResolvedDescriptor(org, module, false);
+    }
+
+    protected Object getResolvedDescriptor(String org, String module, boolean strict) {
+        return getReference("ivy.resolved.descriptor", org, module, strict);
+    }
+
+    private Object getReference(String prefix, String org, String module, boolean strict) {
+        Object reference = null;
+        if (org != null && module != null) {
+            reference = getProject().getReference(prefix + "." + org + "." + module);
+        }
         if (!strict && reference == null) {
-        	reference = getProject().getReference(prefix);
+            reference = getProject().getReference(prefix);
         }
-		return reference;
-	}
-    
-	protected ResolveReport getResolvedReport(String org, String module, String resolveId) {
-		ResolveReport result = null;
-		
-		if (resolveId == null) {
-			result = (ResolveReport) getReference("ivy.resolved.report", org, module, false);
-		} else {
-			result = (ResolveReport) getReference("ivy.resolved.report." + resolveId, null, null, false);
-		}
-		
-		return result;
-	}
-    
+        return reference;
+    }
+
+    protected ResolveReport getResolvedReport(String org, String module, String resolveId) {
+        ResolveReport result = null;
+
+        if (resolveId == null) {
+            result = (ResolveReport) getReference("ivy.resolved.report", org, module, false);
+        } else {
+            result = (ResolveReport) getReference("ivy.resolved.report." + resolveId, null, null,
+                false);
+        }
+
+        return result;
+    }
+
     protected String[] splitConfs(String conf) {
-    	if (conf == null) {
-    		return null;
-    	}
+        if (conf == null) {
+            return null;
+        }
         String[] confs = conf.split(",");
         for (int i = 0; i < confs.length; i++) {
             confs[i] = confs[i].trim();
@@ -191,7 +200,9 @@
             try {
                 return DATE_FORMAT.parse(date);
             } catch (Exception ex) {
-                throw new BuildException("publication date provided in bad format. should be yyyyMMddHHmmss and not "+date);
+                throw new BuildException(
+                        "publication date provided in bad format. should be yyyyMMddHHmmss and not "
+                                + date);
             }
         } else {
             return def;
@@ -203,79 +214,79 @@
             return getProperty(ivy, name);
         } else {
             value = ivy.substitute(value);
-            Message.debug("parameter found as attribute value: "+name+"="+value);
+            Message.debug("parameter found as attribute value: " + name + "=" + value);
             return value;
         }
     }
-    
+
     protected String getProperty(String value, IvySettings ivy, String name, String resolveId) {
-    	if (resolveId == null) {
-    		return getProperty(value, ivy, name);
-    	} else {
-    		return getProperty(value, ivy, name + "." + resolveId);
-    	}
+        if (resolveId == null) {
+            return getProperty(value, ivy, name);
+        } else {
+            return getProperty(value, ivy, name + "." + resolveId);
+        }
     }
-    
+
     protected String getProperty(IvySettings ivy, String name, String resolveId) {
-    	if (resolveId == null) {
-    		return getProperty(ivy, name);
-    	} else {
-    		return getProperty(ivy, name + "." + resolveId);
-    	}
+        if (resolveId == null) {
+            return getProperty(ivy, name);
+        } else {
+            return getProperty(ivy, name + "." + resolveId);
+        }
     }
 
-    protected String getProperty(IvySettings ivy, String name) {        
-        String val =  ivy.getVariable(name);        
+    protected String getProperty(IvySettings ivy, String name) {
+        String val = ivy.getVariable(name);
         if (val == null) {
             val = ivy.substitute(getProject().getProperty(name));
             if (val != null) {
-                Message.debug("parameter found as ant project property: "+name+"="+val);
+                Message.debug("parameter found as ant project property: " + name + "=" + val);
             } else {
-                Message.debug("parameter not found: "+name);
+                Message.debug("parameter not found: " + name);
             }
         } else {
             val = ivy.substitute(val);
-            Message.debug("parameter found as ivy variable: "+name+"="+val);
+            Message.debug("parameter found as ivy variable: " + name + "=" + val);
         }
         return val;
     }
-    
+
     /**
      * Called when task starts its execution.
      */
-    protected void prepareTask(){
-    	//push current project on the stack in context
-		IvyContext.getContext().push(ANT_PROJECT_CONTEXT_KEY, getProject());
+    protected void prepareTask() {
+        // push current project on the stack in context
+        IvyContext.getContext().push(ANT_PROJECT_CONTEXT_KEY, getProject());
     }
-    
+
     /**
-     * Called when task is about to finish
-     * Should clean up all state related information (stacks for example)
+     * Called when task is about to finish Should clean up all state related information (stacks for
+     * example)
      */
-    protected void finalizeTask(){
-		if(!IvyContext.getContext().pop(ANT_PROJECT_CONTEXT_KEY,getProject())){
-			Message.error("ANT project poped from stack not equals current !. Ignoring");
-		}
+    protected void finalizeTask() {
+        if (!IvyContext.getContext().pop(ANT_PROJECT_CONTEXT_KEY, getProject())) {
+            Message.error("ANT project poped from stack not equals current !. Ignoring");
+        }
     }
-    
+
     /**
-     * Ant task execute. 
-     * Calls prepareTask, doExecute, finalzeTask
+     * Ant task execute. Calls prepareTask, doExecute, finalzeTask
      */
-    public final void execute() throws BuildException{
-    	try{
-    		prepareTask();
-    		doExecute();
-    	} finally {
-    		finalizeTask();
-    	}
+    public final void execute() throws BuildException {
+        try {
+            prepareTask();
+            doExecute();
+        } finally {
+            finalizeTask();
+        }
     }
 
     /**
-     * The real logic of task execution after project has been set in the context.
-     * MUST be implemented by subclasses
+     * The real logic of task execution after project has been set in the context. MUST be
+     * implemented by subclasses
+     * 
      * @throws BuildException
      */
     public abstract void doExecute() throws BuildException;
-    
+
 }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyVar.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyVar.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyVar.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/IvyVar.java Tue Jun  5 05:02:27 2007
@@ -28,69 +28,60 @@
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.tools.ant.BuildException;
 
-
 /**
  * This task let user set ivy variables from ant.
- * 
  */
 public class IvyVar extends IvyTask {
     private String _name;
+
     private String _value;
-    
+
     private File _file;
+
     private String _url;
-    
+
     private String _prefix;
 
     public File getFile() {
         return _file;
     }
-    
 
     public void setFile(File file) {
         _file = file;
     }
-    
 
     public String getName() {
         return _name;
     }
-    
 
     public void setName(String name) {
         _name = name;
     }
-    
 
     public String getPrefix() {
         return _prefix;
     }
-    
 
     public void setPrefix(String prefix) {
         _prefix = prefix;
     }
-    
 
     public String getUrl() {
         return _url;
     }
-    
 
     public void setUrl(String url) {
         _url = url;
     }
-    
 
     public String getValue() {
         return _value;
     }
-    
 
     public void setValue(String value) {
         _value = value;
     }
-    
+
     public void doExecute() throws BuildException {
         Ivy ivy = getIvyInstance();
         IvySettings settings = ivy.getSettings();
@@ -109,20 +100,22 @@
                 }
                 props.load(is);
             } catch (Exception ex) {
-                throw new BuildException("impossible to load variables from file: "+ex, ex);
+                throw new BuildException("impossible to load variables from file: " + ex, ex);
             } finally {
                 if (is != null) {
-                    try {is.close();} catch (Exception e) {}
+                    try {
+                        is.close();
+                    } catch (Exception e) {
+                    }
                 }
             }
             for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
-                String name = (String)iter.next();
-                String value = (String)props.get(name);
+                String name = (String) iter.next();
+                String value = (String) props.get(name);
                 settings.setVariable(getVarName(name), value);
             }
         }
     }
-
 
     private String getVarName(String name) {
         String prefix = getPrefix();

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/PackageMapping.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/PackageMapping.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/PackageMapping.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/ant/PackageMapping.java Tue Jun  5 05:02:27 2007
@@ -19,42 +19,50 @@
 
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 
-
 /**
  * Describes a mapping between a package name and an org name revision uple
- * 
- *
  */
 public class PackageMapping {
     private String _package;
+
     private String _organisation;
+
     private String _module;
+
     private String _revision;
-    
+
     public String getModule() {
         return _module;
     }
+
     public void setModule(String module) {
         _module = module;
     }
+
     public String getOrganisation() {
         return _organisation;
     }
+
     public void setOrganisation(String organisation) {
         _organisation = organisation;
     }
+
     public String getRevision() {
         return _revision;
     }
+
     public void setRevision(String revision) {
         _revision = revision;
     }
+
     public String getPackage() {
         return _package;
     }
+
     public void setPackage(String package1) {
         _package = package1;
     }
+
     public ModuleRevisionId getModuleRevisionId() {
         return ModuleRevisionId.newInstance(_organisation, _module, _revision);
     }

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java?view=diff&rev=544459&r1=544458&r2=544459
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/IvyContext.java Tue Jun  5 05:02:27 2007
@@ -33,62 +33,61 @@
 import org.apache.ivy.plugins.resolver.DependencyResolver;
 import org.apache.ivy.util.MessageImpl;
 
-
-
 /**
- * This class represents an execution context of an Ivy action.
- * It contains several getters to retrieve information, like the used Ivy instance, the
- * cache location... 
+ * This class represents an execution context of an Ivy action. It contains several getters to
+ * retrieve information, like the used Ivy instance, the cache location...
  * 
  * @see IvyThread
- * 
  */
 public class IvyContext {
 
     private static ThreadLocal current = new ThreadLocal();
-    
+
     private Ivy defaultIvy;
+
     private WeakReference ivy = new WeakReference(null);
+
     private File cache;
+
     private MessageImpl messageImpl;
+
     private Stack resolver = new Stack(); // Stack(DependencyResolver)
-    
-    private Map contextMap = new HashMap();
 
-	private Thread operatingThread;
+    private Map contextMap = new HashMap();
 
+    private Thread operatingThread;
 
-    
     public static IvyContext getContext() {
-    	IvyContext cur = (IvyContext) current.get();
+        IvyContext cur = (IvyContext) current.get();
         if (cur == null) {
             cur = new IvyContext();
             current.set(cur);
         }
         return cur;
     }
-    
+
     /**
-     * Changes the context associated with this thread.
-     * This is especially useful when launching a new thread, to associate it with the same context as the initial one.
+     * Changes the context associated with this thread. This is especially useful when launching a
+     * new thread, to associate it with the same context as the initial one.
      * 
-     * @param context the new context to use in this thread.
+     * @param context
+     *            the new context to use in this thread.
      */
     public static void setContext(IvyContext context) {
-    	current.set(context);
+        current.set(context);
     }
-    
+
     /**
-     * Returns the current ivy instance.
-     * When calling any public ivy method on an ivy instance, a reference to this instance is 
-     * put in this context, and thus accessible using this method, until no code reference
-     * this instance and the garbage collector collects it.
-     * Then, or if no ivy method has been called, a default ivy instance is returned
-     * by this method, so that it never returns null. 
+     * Returns the current ivy instance. When calling any public ivy method on an ivy instance, a
+     * reference to this instance is put in this context, and thus accessible using this method,
+     * until no code reference this instance and the garbage collector collects it. Then, or if no
+     * ivy method has been called, a default ivy instance is returned by this method, so that it
+     * never returns null.
+     * 
      * @return the current ivy instance
      */
     public Ivy getIvy() {
-    	Ivy ivy = (Ivy) this.ivy.get();
+        Ivy ivy = (Ivy) this.ivy.get();
         return ivy == null ? getDefaultIvy() : ivy;
     }
 
@@ -96,182 +95,202 @@
         if (defaultIvy == null) {
             defaultIvy = Ivy.newInstance();
             try {
-            	defaultIvy.configureDefault();
+                defaultIvy.configureDefault();
             } catch (Exception e) {
-            }            
+            }
         }
         return defaultIvy;
     }
+
     public void setIvy(Ivy ivy) {
-    	this.ivy = new WeakReference(ivy);
-    	operatingThread = Thread.currentThread();
+        this.ivy = new WeakReference(ivy);
+        operatingThread = Thread.currentThread();
     }
+
     public File getCache() {
-    	return cache == null ? getSettings().getDefaultCache() : cache;
+        return cache == null ? getSettings().getDefaultCache() : cache;
     }
+
     public void setCache(File cache) {
-    	this.cache = cache;
+        this.cache = cache;
     }
-    
+
     public IvySettings getSettings() {
-    	return getIvy().getSettings();
+        return getIvy().getSettings();
     }
 
-	public CircularDependencyStrategy getCircularDependencyStrategy() {
-		return getSettings().getCircularDependencyStrategy();
-	}
-
-	public Object get(String key) {
-		WeakReference ref = (WeakReference) contextMap.get(key);
-		return ref == null ? null : ref.get();
-	}
-
-	public void set(String key, Object value) {
-		contextMap.put(key, new WeakReference(value));
-	}
-	
-	/**
-	 * Reads the first object from the list saved under given key in the context.
-	 * If value under key represents non List object then a RuntimeException is thrown.
-	 * @param key context key for the string
-	 * @return top object from the list (index 0) or null if no key or list empty
-	 */
-	public Object peek(String key){
-		synchronized(contextMap){
-			Object o= contextMap.get(key);
-			if(o==null) return null;
-			if(o instanceof List){
-				if(((List)o).size()==0) return null;
-				Object ret=((List)o).get(0);
-				return ret;
-			} else {
-				throw new RuntimeException("Cannot top from non List object "+o);
-			}
-		}
-	}
-	
-	/**
-	 * Removes and returns first object from the list saved under given key in the context.
-	 * If value under key represents non List object then a RuntimeException is thrown.
-	 * @param key context key for the string
-	 * @return top object from the list (index 0) or null if no key or list empty
-	 */
-	public Object pop(String key){
-		synchronized(contextMap){
-			Object o= contextMap.get(key);
-			if(o==null) return null;
-			if(o instanceof List){
-				if(((List)o).size()==0) return null;
-				Object ret=((List)o).remove(0);
-				return ret;
-			} else {
-				throw new RuntimeException("Cannot pop from non List object "+o);
-			}
-		}
-	}
-
-	/**
-	 * Removes and returns first object from the list saved under given key in the context
-	 * but only if it equals the given expectedValue - if not a false value is returned.
-	 * If value under key represents non List object then a RuntimeException is thrown.
-	 * @param key context key for the string
-	 * @return true if the r
-	 */
-	public boolean pop(String key, Object expectedValue){
-		synchronized(contextMap){
-			Object o= contextMap.get(key);
-			if(o==null) return false;
-			if(o instanceof List){
-				if(((List)o).size()==0) return false;
-				Object top=((List)o).get(0);
-				if(!top.equals(expectedValue)) return false;				
-				((List)o).remove(0);
-				return true;
-			} else {
-				throw new RuntimeException("Cannot pop from non List object "+o);
-			}
-		}
-	}
-
-	/**
-	 * Puts a new object at the start of the list saved under given key in the context.
-	 * If value under key represents non List object then a RuntimeException is thrown.
-	 * If no list exists under given key a new LinkedList is created. This is kept
-	 * without WeakReference in opposite to the put() results.
-	 * @param key key context key for the string
-	 * @param value value to be saved under the key
-	 */
-	public void push(String key, Object value){
-		synchronized(contextMap){
-			if(!contextMap.containsKey(key)) contextMap.put(key, new LinkedList());
-			Object o= contextMap.get(key);
-			if(o instanceof List){
-				((List)o).add(0,value);
-			} else {
-				throw new RuntimeException("Cannot push to non List object "+o);
-			}
-		}
-	}
-	
-	public Thread getOperatingThread() {
-		return operatingThread;
-	}
-
-	
-	/* NB : The messageImpl is only used by Message.  It should be better to place it there.
-	 * Alternatively, the Message itself could be placed here, bu this is has a major impact
-	 * because Message is used at a lot of place.
-	 */ 
-	public MessageImpl getMessageImpl() {
-		return messageImpl;
-	}
-	
-	public void setMessageImpl(MessageImpl impl) {
-		messageImpl = impl;
-	}
-
-	public EventManager getEventManager() {
-		return getIvy().getEventManager();
-	}
-
-	public CacheManager getCacheManager() {
-		return CacheManager.getInstance(getSettings(), getCache());
-	}
-
-	public void checkInterrupted() {
-		getIvy().checkInterrupted();
-	}
-
-	public DependencyResolver getResolver() {
-		return (DependencyResolver) resolver.peek();
-	}
-	
-	public void pushResolver(DependencyResolver resolver) {
-		this.resolver.push(resolver);
-	}
-	
-	public void popResolver() {
-		resolver.pop();
-	}
-	
-	// should be better to use context to store this kind of information, but not yet ready to do so...
-//    private WeakReference _root = new WeakReference(null); 
-//    private String _rootModuleConf = null;
-//	public IvyNode getRoot() {
-//		return (IvyNode) _root.get();
-//	}
-//	
-//	public void setRoot(IvyNode root) {
-//		_root = new WeakReference(root);
-//	}
-//
-//	public String getRootModuleConf() {
-//		return _rootModuleConf;
-//	}
-//
-//	public void setRootModuleConf(String rootModuleConf) {
-//		_rootModuleConf = rootModuleConf;
-//	}
-	
-	
+    public CircularDependencyStrategy getCircularDependencyStrategy() {
+        return getSettings().getCircularDependencyStrategy();
+    }
+
+    public Object get(String key) {
+        WeakReference ref = (WeakReference) contextMap.get(key);
+        return ref == null ? null : ref.get();
+    }
+
+    public void set(String key, Object value) {
+        contextMap.put(key, new WeakReference(value));
+    }
+
+    /**
+     * Reads the first object from the list saved under given key in the context. If value under key
+     * represents non List object then a RuntimeException is thrown.
+     * 
+     * @param key
+     *            context key for the string
+     * @return top object from the list (index 0) or null if no key or list empty
+     */
+    public Object peek(String key) {
+        synchronized (contextMap) {
+            Object o = contextMap.get(key);
+            if (o == null)
+                return null;
+            if (o instanceof List) {
+                if (((List) o).size() == 0)
+                    return null;
+                Object ret = ((List) o).get(0);
+                return ret;
+            } else {
+                throw new RuntimeException("Cannot top from non List object " + o);
+            }
+        }
+    }
+
+    /**
+     * Removes and returns first object from the list saved under given key in the context. If value
+     * under key represents non List object then a RuntimeException is thrown.
+     * 
+     * @param key
+     *            context key for the string
+     * @return top object from the list (index 0) or null if no key or list empty
+     */
+    public Object pop(String key) {
+        synchronized (contextMap) {
+            Object o = contextMap.get(key);
+            if (o == null)
+                return null;
+            if (o instanceof List) {
+                if (((List) o).size() == 0)
+                    return null;
+                Object ret = ((List) o).remove(0);
+                return ret;
+            } else {
+                throw new RuntimeException("Cannot pop from non List object " + o);
+            }
+        }
+    }
+
+    /**
+     * Removes and returns first object from the list saved under given key in the context but only
+     * if it equals the given expectedValue - if not a false value is returned. If value under key
+     * represents non List object then a RuntimeException is thrown.
+     * 
+     * @param key
+     *            context key for the string
+     * @return true if the r
+     */
+    public boolean pop(String key, Object expectedValue) {
+        synchronized (contextMap) {
+            Object o = contextMap.get(key);
+            if (o == null)
+                return false;
+            if (o instanceof List) {
+                if (((List) o).size() == 0)
+                    return false;
+                Object top = ((List) o).get(0);
+                if (!top.equals(expectedValue))
+                    return false;
+                ((List) o).remove(0);
+                return true;
+            } else {
+                throw new RuntimeException("Cannot pop from non List object " + o);
+            }
+        }
+    }
+
+    /**
+     * Puts a new object at the start of the list saved under given key in the context. If value
+     * under key represents non List object then a RuntimeException is thrown. If no list exists
+     * under given key a new LinkedList is created. This is kept without WeakReference in opposite
+     * to the put() results.
+     * 
+     * @param key
+     *            key context key for the string
+     * @param value
+     *            value to be saved under the key
+     */
+    public void push(String key, Object value) {
+        synchronized (contextMap) {
+            if (!contextMap.containsKey(key))
+                contextMap.put(key, new LinkedList());
+            Object o = contextMap.get(key);
+            if (o instanceof List) {
+                ((List) o).add(0, value);
+            } else {
+                throw new RuntimeException("Cannot push to non List object " + o);
+            }
+        }
+    }
+
+    public Thread getOperatingThread() {
+        return operatingThread;
+    }
+
+    /*
+     * NB : The messageImpl is only used by Message. It should be better to place it there.
+     * Alternatively, the Message itself could be placed here, bu this is has a major impact because
+     * Message is used at a lot of place.
+     */
+    public MessageImpl getMessageImpl() {
+        return messageImpl;
+    }
+
+    public void setMessageImpl(MessageImpl impl) {
+        messageImpl = impl;
+    }
+
+    public EventManager getEventManager() {
+        return getIvy().getEventManager();
+    }
+
+    public CacheManager getCacheManager() {
+        return CacheManager.getInstance(getSettings(), getCache());
+    }
+
+    public void checkInterrupted() {
+        getIvy().checkInterrupted();
+    }
+
+    public DependencyResolver getResolver() {
+        return (DependencyResolver) resolver.peek();
+    }
+
+    public void pushResolver(DependencyResolver resolver) {
+        this.resolver.push(resolver);
+    }
+
+    public void popResolver() {
+        resolver.pop();
+    }
+
+    // should be better to use context to store this kind of information, but not yet ready to do
+    // so...
+    // private WeakReference _root = new WeakReference(null);
+    // private String _rootModuleConf = null;
+    // public IvyNode getRoot() {
+    // return (IvyNode) _root.get();
+    // }
+    //	
+    // public void setRoot(IvyNode root) {
+    // _root = new WeakReference(root);
+    // }
+    //
+    // public String getRootModuleConf() {
+    // return _rootModuleConf;
+    // }
+    //
+    // public void setRootModuleConf(String rootModuleConf) {
+    // _rootModuleConf = rootModuleConf;
+    // }
+
 }