Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 84247 invoked from network); 5 Jan 2008 00:45:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2008 00:45:56 -0000 Received: (qmail 54283 invoked by uid 500); 5 Jan 2008 00:45:44 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 54241 invoked by uid 500); 5 Jan 2008 00:45:44 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 54230 invoked by uid 99); 5 Jan 2008 00:45:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2008 16:45:44 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of xavier.hanin@gmail.com designates 72.14.252.157 as permitted sender) Received: from [72.14.252.157] (HELO po-out-1718.google.com) (72.14.252.157) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jan 2008 00:45:20 +0000 Received: by po-out-1718.google.com with SMTP id c31so5620073poi.0 for ; Fri, 04 Jan 2008 16:45:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=ITHrk7FDJ3cIcS1eL+AcAlLVCSaOFQm4KgCg+26LvXA=; b=KeBT+M4oj559Fe+ay0FH0tXwMY6gTpZSimBJXTPIUU244ZghbF9LjPWl7OBsI+4Vevj6HnxKN4bm/f22VjmPuZH0zrtFugr+AVS7a7ZYrw7nf1ZnsZvsx42WPApGOMRn+/ROrm3i1RF0JJHIHTkxPM/UJfYOPO0eYekjNUf/Yt8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=cO47X4cqBWqKZSJ+khvSSd5Wo7gPXl5ciwejRTrqtKJc6Pv41wAdRKqr2J4XlraKqM1ldPsyAYHbs+0Df0UX13b2cohmYBXQgsCpSjKngFWOkdT/NXQ8gbgLRY9MbgR0wq1V4640CPJMhEWD0rttKHNoAGdcvoq+Z2xWIyKOc+s= Received: by 10.140.173.15 with SMTP id v15mr9262186rve.218.1199493924565; Fri, 04 Jan 2008 16:45:24 -0800 (PST) Received: by 10.140.225.10 with HTTP; Fri, 4 Jan 2008 16:45:24 -0800 (PST) Message-ID: <635a05060801041645lbad4d77pfcdd849f6222f274@mail.gmail.com> Date: Sat, 5 Jan 2008 01:45:24 +0100 From: "Xavier Hanin" To: "Ant Developers List" Subject: Re: svn commit: r608922 - in /ant/ivy/core/trunk: ./ doc/configuration/ 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/repository/ src/java/org/apache/ivy/core/resolv MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11925_15622365.1199493924566" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_11925_15622365.1199493924566 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On Jan 4, 2008 11:42 PM, Maarten Coene wrote: > Xavier, > > why did you change the way the attributes are processed in the > XmlSettingsParser class? > > For instance, before your commit, it was like this: > String propFilePath = ivy.substitute((String) attributes.get("file")); > After your commit, it is like this: > String propFilePath = (String) attributes.get("file"); > > I might have missed something, but doesn't this give problems when you use > variables in your settings file, for instance: > > I've also changed the way the attributes map is filled in: Map attributes = new HashMap(); for (int i = 0; i < att.getLength(); i++) { - attributes.put(att.getQName(i), att.getValue(i)); + attributes.put(att.getQName(i), ivy.substitute(att.getValue (i))); } So that we don't have to spread variable substitution everywhere. Actually I needed to make such replacement for all attributes for the module rules, since we can now use extra attributes. So I thought it's better to make the change once and for all at the beginning of the method. But if you see any drawback to this approach I'm ok to revert the change. Xavier > > > Maarten > > ----- Original Message ---- > From: "xavier@apache.org" > To: notifications@ant.apache.org > Sent: Friday, January 4, 2008 6:05:57 PM > Subject: svn commit: r608922 - in /ant/ivy/core/trunk: ./ > doc/configuration/ 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/repository/ > src/java/org/apache/ivy/core/resolve/ src... > > Author: xavier > Date: Fri Jan 4 09:05:55 2008 > New Revision: 608922 > > URL: http://svn.apache.org/viewvc?rev=608922&view=rev > Log: > IMPROVEMENT: use ModuleRevisionId instead of ModuleId in > IvySettings#getResolver (IVY-591) > > [...] > > Modified: > > ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java > URL: > > http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=608922&r1=608921&r2=608922&view=diff > > ============================================================================== > --- > ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java > (original) > +++ > ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java > Fri Jan 4 09:05:55 2008 > @@ -30,8 +30,8 @@ > > import javax.xml.parsers.SAXParserFactory; > > +import org.apache.ivy.core.IvyPatternHelper; > import org.apache.ivy.core.cache.RepositoryCacheManager; > -import org.apache.ivy.core.module.id.ModuleId; > import org.apache.ivy.core.module.status.StatusManager; > import org.apache.ivy.plugins.circular.CircularDependencyStrategy; > import org.apache.ivy.plugins.conflict.ConflictManager; > @@ -125,7 +125,7 @@ > // we first copy attributes in a Map to be able to modify them > Map attributes = new HashMap(); > for (int i = 0; i < att.getLength(); i++) { > - attributes.put(att.getQName(i), att.getValue(i)); > + attributes.put(att.getQName(i), > ivy.substitute(att.getValue(i))); > } > > try { > @@ -183,15 +183,15 @@ > configurator.startCreateChild(qName); > for (Iterator iter = > attributes.keySet().iterator(); iter.hasNext();) { > String attName = (String) iter.next(); > - configurator.setAttribute(attName, > ivy.substitute((String) attributes > - .get(attName))); > + configurator.setAttribute(attName, (String) > attributes > + .get(attName)); > } > } > } else if ("classpath".equals(qName)) { > - String urlStr = ivy.substitute((String) > attributes.get("url")); > + String urlStr = (String) attributes.get("url"); > URL url = null; > if (urlStr == null) { > - String file = ivy.substitute((String) > attributes.get("file")); > + String file = (String) attributes.get("file"); > if (file == null) { > throw new IllegalArgumentException( > "either url or file should be given > for classpath element"); > @@ -203,14 +203,14 @@ > } > ivy.addClasspathURL(url); > } else if ("typedef".equals(qName)) { > - String name = ivy.substitute((String) > attributes.get("name")); > - String className = ivy.substitute((String) > attributes.get("classname")); > + String name = (String) attributes.get("name"); > + String className = (String) > attributes.get("classname"); > Class clazz = ivy.typeDef(name, className); > configurator.typeDef(name, clazz); > } else if ("property".equals(qName)) { > - String name = ivy.substitute((String) > attributes.get("name")); > - String value = ivy.substitute((String) > attributes.get("value")); > - String override = ivy.substitute((String) > attributes.get("override")); > + String name = (String) attributes.get("name"); > + String value = (String) attributes.get("value"); > + String override = (String) attributes.get("override"); > if (name == null) { > throw new IllegalArgumentException("missing > attribute name on property tag"); > } > @@ -220,8 +220,8 @@ > ivy.setVariable(name, value, override == null ? true : > Boolean.valueOf(override) > .booleanValue()); > } else if ("properties".equals(qName)) { > - String propFilePath = ivy.substitute((String) > attributes.get("file")); > - String override = ivy.substitute((String) > attributes.get("override")); > + String propFilePath = (String) attributes.get("file"); > + String override = (String) attributes.get("override"); > try { > Message.verbose("loading properties: " + > propFilePath); > ivy.loadProperties(new File(propFilePath), > override == null ? true : Boolean > @@ -244,10 +244,10 @@ > IvyVariableContainer variables = > (IvyVariableContainer) ivy.getVariableContainer() > .clone(); > try { > - String propFilePath = ivy.substitute((String) > attributes.get("file")); > + String propFilePath = (String) > attributes.get("file"); > URL settingsURL = null; > if (propFilePath == null) { > - propFilePath = ivy.substitute((String) > attributes.get("url")); > + propFilePath = (String) attributes.get("url"); > if (propFilePath == null) { > Message.error("bad include tag: specify > file or url to include"); > return; > @@ -279,42 +279,42 @@ > } > String cache = (String) > attributes.get("defaultCache"); > if (cache != null) { > - ivy.setDefaultCache(new > File(ivy.substitute(cache))); > + ivy.setDefaultCache(new File(cache)); > } > String defaultBranch = (String) > attributes.get("defaultBranch"); > if (defaultBranch != null) { > - > ivy.setDefaultBranch(ivy.substitute(defaultBranch)); > + ivy.setDefaultBranch(defaultBranch); > } > String validate = (String) attributes.get("validate"); > if (validate != null) { > - > ivy.setValidate(Boolean.valueOf(ivy.substitute > (validate)).booleanValue()); > + > ivy.setValidate(Boolean.valueOf(validate).booleanValue()); > } > String up2d = (String) > attributes.get("checkUpToDate"); > if (up2d != null) { > - > ivy.setCheckUpToDate(Boolean.valueOf(ivy.substitute > (up2d)).booleanValue()); > + > ivy.setCheckUpToDate(Boolean.valueOf(up2d).booleanValue()); > } > String useRemoteConfig = (String) > attributes.get("useRemoteConfig"); > if (useRemoteConfig != null) { > - > ivy.setUseRemoteConfig(Boolean.valueOf(ivy.substitute(useRemoteConfig)) > + > ivy.setUseRemoteConfig(Boolean.valueOf(useRemoteConfig) > .booleanValue()); > } > String resolutionDir = (String) > attributes.get("resolutionCacheDir"); > if (resolutionDir != null) { > - > ivy.setDefaultResolutionCacheBasedir(ivy.substitute(resolutionDir)); > + > ivy.setDefaultResolutionCacheBasedir(resolutionDir); > } > String cacheIvyPattern = (String) > attributes.get("cacheIvyPattern"); > if (cacheIvyPattern != null) { > Message.deprecated( > "'cacheIvyPattern' is deprecated, use > 'caches[@ivyPattern]' instead" > + " (" + settings + ")"); > - > ivy.setDefaultCacheIvyPattern(ivy.substitute(cacheIvyPattern)); > + ivy.setDefaultCacheIvyPattern(cacheIvyPattern); > } > String cacheArtPattern = (String) > attributes.get("cacheArtifactPattern"); > if (cacheArtPattern != null) { > Message.deprecated( > "'cacheArtifactPattern' is deprecated, " > + "use 'caches[@artifactPattern]' instead (" + > settings + ")"); > - > ivy.setDefaultCacheArtifactPattern(ivy.substitute(cacheArtPattern)); > + > ivy.setDefaultCacheArtifactPattern(cacheArtPattern); > } > > // we do not set following defaults here since no > instances has been registered yet > @@ -331,26 +331,26 @@ > > String cacheIvyPattern = (String) > attributes.get("ivyPattern"); > if (cacheIvyPattern != null) { > - > ivy.setDefaultCacheIvyPattern(ivy.substitute(cacheIvyPattern)); > + ivy.setDefaultCacheIvyPattern(cacheIvyPattern); > } > String cacheArtPattern = (String) > attributes.get("artifactPattern"); > if (cacheArtPattern != null) { > - > ivy.setDefaultCacheArtifactPattern(ivy.substitute(cacheArtPattern)); > + > ivy.setDefaultCacheArtifactPattern(cacheArtPattern); > } > String repositoryDir = (String) > attributes.get("basedir"); > if (repositoryDir != null) { > - > ivy.setDefaultRepositoryCacheBasedir(ivy.substitute(repositoryDir)); > + > ivy.setDefaultRepositoryCacheBasedir(repositoryDir); > } > } else if ("version-matchers".equals(qName)) { > currentConfiguratorTag = qName; > configurator.setRoot(ivy); > - if ("true".equals(ivy.substitute((String) > attributes.get("usedefaults")))) { > + if ("true".equals((String) > attributes.get("usedefaults"))) { > ivy.configureDefaultVersionMatcher(); > } > } else if ("statuses".equals(qName)) { > currentConfiguratorTag = qName; > StatusManager m = new StatusManager(); > - String defaultStatus = ivy.substitute((String) > attributes.get("default")); > + String defaultStatus = (String) > attributes.get("default"); > if (defaultStatus != null) { > m.setDefaultStatus(defaultStatus); > } > @@ -365,22 +365,13 @@ > .get("name")); > macrodef.addAttribute("name", null); > } else if ("module".equals(qName)) { > - String organisation = ivy.substitute((String) > attributes.get("organisation")); > - String module = ivy.substitute((String) > attributes.get("name")); > - String resolver = ivy.substitute((String) > attributes.get("resolver")); > - String branch = ivy.substitute((String) > attributes.get("branch")); > - String cm = ivy.substitute((String) > attributes.get("conflict-manager")); > - String matcher = ivy.substitute((String) > attributes.get("matcher")); > + attributes.put(IvyPatternHelper.MODULE_KEY, > attributes.remove("name")); > + String resolver = (String) > attributes.remove("resolver"); > + String branch = (String) attributes.remove("branch"); > + String cm = (String) > attributes.remove("conflict-manager"); > + String matcher = (String) > attributes.remove("matcher"); > matcher = matcher == null ? > PatternMatcher.EXACT_OR_REGEXP : matcher; > - if (organisation == null) { > - throw new IllegalArgumentException( > - "'organisation' is mandatory in module > element: check your configuration"); > - } > - if (module == null) { > - throw new IllegalArgumentException( > - "'name' is mandatory in module element: > check your configuration"); > - } > - ivy.addModuleConfiguration(new ModuleId(organisation, > module), ivy > + ivy.addModuleConfiguration(attributes, ivy > .getMatcher(matcher), resolver, branch, cm); > } > } catch (ParseException ex) { > @@ -409,7 +400,7 @@ > ivy.setDefaultResolver(ivy.substitute(defaultResolver)); > } > if (defaultCM != null) { > - ConflictManager conflictManager = > ivy.getConflictManager(ivy.substitute(defaultCM)); > + ConflictManager conflictManager = > ivy.getConflictManager(defaultCM); > if (conflictManager == null) { > throw new IllegalArgumentException("unknown conflict > manager " > + ivy.substitute(defaultCM)); > > > > > > > ____________________________________________________________________________________ > Looking for last minute shopping deals? > Find them fast with Yahoo! Search. > http://tools.search.yahoo.com/newsearch/category.php?category=shopping > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org > For additional commands, e-mail: dev-help@ant.apache.org > > -- Xavier Hanin - Independent Java Consultant http://xhab.blogspot.com/ http://ant.apache.org/ivy/ http://www.xoocode.org/ ------=_Part_11925_15622365.1199493924566--