incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r600194 - in /incubator/ivy/core/trunk: src/java/org/apache/ivy/core/settings/ test/java/org/apache/ivy/core/settings/
Date Sat, 01 Dec 2007 21:06:49 GMT
Author: xavier
Date: Sat Dec  1 13:06:48 2007
New Revision: 600194

URL: http://svn.apache.org/viewvc?rev=600194&view=rev
Log:
add settings parsing implementation for cache: locking (IVY-654) and split (IVY-628)
still need documentation update

Added:
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
  (with props)
Modified:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
    incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java?rev=600194&r1=600193&r2=600194&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java (original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/IvySettings.java Sat Dec
 1 13:06:48 2007
@@ -65,6 +65,7 @@
 import org.apache.ivy.plugins.latest.LatestRevisionStrategy;
 import org.apache.ivy.plugins.latest.LatestStrategy;
 import org.apache.ivy.plugins.latest.LatestTimeStrategy;
+import org.apache.ivy.plugins.lock.ArtifactLockStrategy;
 import org.apache.ivy.plugins.lock.LockStrategy;
 import org.apache.ivy.plugins.lock.NoLockStrategy;
 import org.apache.ivy.plugins.matcher.ExactOrRegexpPatternMatcher;
@@ -240,6 +241,9 @@
         addLatestStrategy("latest-revision", latestRevisionStrategy);
         addLatestStrategy("latest-lexico", latestLexicographicStrategy);
         addLatestStrategy("latest-time", latestTimeStrategy);
+        
+        addLockStrategy("no-lock", new NoLockStrategy());
+        addLockStrategy("artifact-lock", new ArtifactLockStrategy());
 
         addConflictManager("latest-revision", new LatestConflictManager("latest-revision",
             latestRevisionStrategy));

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java?rev=600194&r1=600193&r2=600194&view=diff
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/core/settings/XmlSettingsParser.java
Sat Dec  1 13:06:48 2007
@@ -307,6 +307,32 @@
                 defaultLatest = (String) attributes.get("defaultLatestStrategy");
                 defaultCircular = (String) attributes.get("circularDependencyStrategy");
 
+            } else if ("cache".equals(qName)) {
+                String lockingStrategy = (String) attributes.get("lockingStrategy");
+                if (lockingStrategy != null) {
+                    ivy.setDefaultLockStrategy(
+                        ivy.getLockStrategy(ivy.substitute(lockingStrategy)));
+                }
+                String cacheIvyPattern = (String) attributes.get("repositoryIvyPattern");
+                if (cacheIvyPattern != null) {
+                    ivy.setCacheIvyPattern(ivy.substitute(cacheIvyPattern));
+                }
+                String cacheArtPattern = (String) attributes.get("repositoryArtifactPattern");
+                if (cacheArtPattern != null) {
+                    ivy.setCacheArtifactPattern(ivy.substitute(cacheArtPattern));
+                }
+                String cache = (String) attributes.get("basedir");
+                if (cache != null) {
+                    ivy.setDefaultCache(new File(ivy.substitute(cache)));
+                }
+                String repositoryDir = (String) attributes.get("repositoryDir");
+                if (repositoryDir != null) {
+                    ivy.setVariable("ivy.cache.repository", ivy.substitute(repositoryDir),
true); 
+                }
+                String resolutionDir = (String) attributes.get("resolutionDir");
+                if (resolutionDir != null) {
+                    ivy.setVariable("ivy.cache.resolution", ivy.substitute(resolutionDir),
true); 
+                }
             } else if ("version-matchers".equals(qName)) {
                 currentConfiguratorTag = qName;
                 configurator.setRoot(ivy);

Modified: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java?rev=600194&r1=600193&r2=600194&view=diff
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
(original)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java
Sat Dec  1 13:06:48 2007
@@ -177,6 +177,23 @@
         assertEquals("all", settings.getConflictManager(new ModuleId("apache", "ant")).getName());
     }
 
+    public void testCache() throws Exception {
+        IvySettings settings = new IvySettings();
+        XmlSettingsParser parser = new XmlSettingsParser(settings);
+        parser.parse(XmlSettingsParserTest.class.getResource("ivysettings-cache.xml"));
+
+        File defaultCache = settings.getDefaultCache();
+        assertNotNull(defaultCache);
+        assertEquals("mycache", defaultCache.getName());
+        assertEquals(new File(defaultCache, "repository"), settings.getRepositoryCacheRoot(defaultCache));
+        assertEquals(new File(defaultCache, "resolution"), settings.getResolutionCacheRoot(defaultCache));
+        assertEquals("artifact-lock", settings.getDefaultLockStrategy().getName());
+
+        assertEquals("[module]/ivys/ivy-[revision].xml", settings.getCacheIvyPattern());
+        assertEquals("[module]/[type]s/[artifact]-[revision].[ext]", settings
+                .getCacheArtifactPattern());
+    }
+
     public void testVersionMatchers1() throws Exception {
         IvySettings settings = new IvySettings();
         XmlSettingsParser parser = new XmlSettingsParser(settings);

Added: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml?rev=600194&view=auto
==============================================================================
--- incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
(added)
+++ incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
Sat Dec  1 13:06:48 2007
@@ -0,0 +1,27 @@
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.    
+-->
+<ivysettings>
+	<cache basedir="mycache"
+			resolutionDir="resolution"
+			repositoryDir="repository"
+			repositoryIvyPattern="[module]/ivys/ivy-[revision].xml" 
+			repositoryArtifactPattern="[module]/[type]s/[artifact]-[revision].[ext]"
+			lockingStrategy="artifact-lock"
+	/>
+</ivysettings>

Propchange: incubator/ivy/core/trunk/test/java/org/apache/ivy/core/settings/ivysettings-cache.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message