Author: xavier
Date: Fri Jan 4 07:09:43 2008
New Revision: 608879
URL: http://svn.apache.org/viewvc?rev=608879&view=rev
Log:
review settings syntax for cache management according to recent discussion on
mailing list
Modified:
ant/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
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=608879&r1=608878&r2=608879&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 07:09:43 2008
@@ -36,6 +36,7 @@
import org.apache.ivy.plugins.circular.CircularDependencyStrategy;
import org.apache.ivy.plugins.conflict.ConflictManager;
import org.apache.ivy.plugins.latest.LatestStrategy;
+import org.apache.ivy.plugins.lock.LockStrategy;
import org.apache.ivy.plugins.matcher.PatternMatcher;
import org.apache.ivy.util.Configurator;
import org.apache.ivy.util.Message;
@@ -66,6 +67,8 @@
private String defaultCircular;
+ private String defaultLock;
+
private String currentConfiguratorTag;
private URL settings;
@@ -271,8 +274,8 @@
}
} else if ("settings".equals(qName) || "conf".equals(qName)) {
if ("conf".equals(qName) && !deprecatedMessagePrinted) {
- Message.deprecated("'conf' is deprecated, use 'settings'
instead (" + settings
- + ")");
+ Message.deprecated(
+ "'conf' is deprecated, use 'settings' instead (" +
settings + ")");
}
String cache = (String) attributes.get("defaultCache");
if (cache != null) {
@@ -290,53 +293,54 @@
if (up2d != null) {
ivy.setCheckUpToDate(Boolean.valueOf(ivy.substitute(up2d)).booleanValue());
}
+ String useRemoteConfig = (String)
attributes.get("useRemoteConfig");
+ if (useRemoteConfig != null) {
+
ivy.setUseRemoteConfig(Boolean.valueOf(ivy.substitute(useRemoteConfig))
+ .booleanValue());
+ }
+ String resolutionDir = (String)
attributes.get("resolutionCacheDir");
+ if (resolutionDir != null) {
+
ivy.setDefaultResolutionCacheBasedir(ivy.substitute(resolutionDir));
+ }
String cacheIvyPattern = (String)
attributes.get("cacheIvyPattern");
if (cacheIvyPattern != null) {
+ Message.deprecated(
+ "'cacheIvyPattern' is deprecated, use '[EMAIL
PROTECTED]' instead"
+ + " (" + settings + ")");
ivy.setDefaultCacheIvyPattern(ivy.substitute(cacheIvyPattern));
}
String cacheArtPattern = (String)
attributes.get("cacheArtifactPattern");
if (cacheArtPattern != null) {
+ Message.deprecated(
+ "'cacheArtifactPattern' is deprecated, "
+ + "use '[EMAIL PROTECTED]' instead (" + settings +
")");
ivy.setDefaultCacheArtifactPattern(ivy.substitute(cacheArtPattern));
}
- String useRemoteConfig = (String)
attributes.get("useRemoteConfig");
- if (useRemoteConfig != null) {
-
ivy.setUseRemoteConfig(Boolean.valueOf(ivy.substitute(useRemoteConfig))
- .booleanValue());
- }
// we do not set following defaults here since no instances
has been registered yet
defaultResolver = (String) attributes.get("defaultResolver");
defaultCM = (String) attributes.get("defaultConflictManager");
defaultLatest = (String)
attributes.get("defaultLatestStrategy");
- defaultCacheManager = (String)
attributes.get("defaultCacheManager");
defaultCircular = (String)
attributes.get("circularDependencyStrategy");
- } else if ("cacheDefaults".equals(qName)) {
- String lockingStrategy = (String)
attributes.get("lockStrategy");
- if (lockingStrategy != null) {
- ivy.setDefaultLockStrategy(
- ivy.getLockStrategy(ivy.substitute(lockingStrategy)));
- }
- String cacheIvyPattern = (String)
attributes.get("repositoryIvyPattern");
+ } else if ("caches".equals(qName)) {
+ currentConfiguratorTag = qName;
+ configurator.setRoot(ivy);
+ defaultLock = (String) attributes.get("lockStrategy");
+ defaultCacheManager = (String) attributes.get("default");
+
+ String cacheIvyPattern = (String) attributes.get("ivyPattern");
if (cacheIvyPattern != null) {
ivy.setDefaultCacheIvyPattern(ivy.substitute(cacheIvyPattern));
}
- String cacheArtPattern = (String)
attributes.get("repositoryArtifactPattern");
+ String cacheArtPattern = (String)
attributes.get("artifactPattern");
if (cacheArtPattern != null) {
ivy.setDefaultCacheArtifactPattern(ivy.substitute(cacheArtPattern));
}
- String cache = (String) attributes.get("defaultBasedir");
- if (cache != null) {
- ivy.setDefaultCache(new File(ivy.substitute(cache)));
- }
- String repositoryDir = (String)
attributes.get("repositoryDir");
+ String repositoryDir = (String) attributes.get("basedir");
if (repositoryDir != null) {
ivy.setDefaultRepositoryCacheBasedir(ivy.substitute(repositoryDir));
}
- String resolutionDir = (String)
attributes.get("resolutionDir");
- if (resolutionDir != null) {
-
ivy.setDefaultResolutionCacheBasedir(ivy.substitute(resolutionDir));
- }
} else if ("version-matchers".equals(qName)) {
currentConfiguratorTag = qName;
configurator.setRoot(ivy);
@@ -437,6 +441,14 @@
+ ivy.substitute(defaultCircular));
}
ivy.setCircularDependencyStrategy(strategy);
+ }
+ if (defaultLock != null) {
+ LockStrategy strategy =
ivy.getLockStrategy(ivy.substitute(defaultLock));
+ if (strategy == null) {
+ throw new IllegalArgumentException("unknown lock strategy "
+ + ivy.substitute(defaultLock));
+ }
+ ivy.setDefaultLockStrategy(strategy);
}
}
}
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml?rev=608879&r1=608878&r2=608879&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
(original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/ivysettings-cleancache.xml
Fri Jan 4 07:09:43 2008
@@ -17,11 +17,8 @@
under the License.
-->
<ivysettings>
- <cacheDefaults
- resolutionDir="${cache}/resolution"
- repositoryDir="${cache}/repository"
- />
- <caches>
+ <settings resolutionCacheDir="${cache}/resolution" />
+ <caches basedir="${cache}/repository">
<cache name="mycache" />
<cache name="mycache2"
basedir="${cache}/repository2"
Modified:
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
URL:
http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml?rev=608879&r1=608878&r2=608879&view=diff
==============================================================================
---
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
(original)
+++
ant/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
Fri Jan 4 07:09:43 2008
@@ -17,15 +17,12 @@
under the License.
-->
<ivysettings>
- <settings defaultCacheManager="mycache2" />
- <cacheDefaults
- resolutionDir="resolution"
- repositoryDir="repository"
- repositoryIvyPattern="[module]/ivys/ivy-[revision].xml"
-
repositoryArtifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
- lockStrategy="artifact-lock"
- />
- <caches>
+ <settings resolutionCacheDir="resolution" />
+ <caches default="mycache2"
+ basedir="repository"
+ ivyPattern="[module]/ivys/ivy-[revision].xml"
+ artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
+ lockStrategy="artifact-lock">
<cache name="mycache"
basedir="mycache"
ivyPattern="[module]/ivy-[revision].xml"