Author: jlboudart
Date: Thu Jan 16 08:18:47 2014
New Revision: 1558715

URL: http://svn.apache.org/r1558715
Log:
Add a new method on DefaultRepositoryCacheManager and 
DefaultResolutionCacheManager to easily changeon subclass the 
ModuleDescriptorParser used

Modified:
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
    
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java?rev=1558715&r1=1558714&r2=1558715&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultRepositoryCacheManager.java
 Thu Jan 16 08:18:47 2014
@@ -722,7 +722,7 @@ public class DefaultRepositoryCacheManag
             if (ivyFile.exists()) {
                 // found in cache !
                 try {
-                    XmlModuleDescriptorParser parser = 
XmlModuleDescriptorParser.getInstance();
+                    ModuleDescriptorParser parser = 
getModuleDescriptorParser();
                     ModuleDescriptor depMD = getMdFromCache(parser, options, 
ivyFile);
                     String resolverName = getSavedResolverName(depMD);
                     String artResolverName = getSavedArtResolverName(depMD);
@@ -790,6 +790,10 @@ public class DefaultRepositoryCacheManag
         return null;
     }
 
+    protected ModuleDescriptorParser getModuleDescriptorParser() {
+        return XmlModuleDescriptorParser.getInstance();
+    }
+
     private class MyModuleDescriptorProvider implements 
ModuleDescriptorProvider {
 
         private final ModuleDescriptorParser mdParser;
@@ -807,7 +811,7 @@ public class DefaultRepositoryCacheManag
         }
     }
 
-    private ModuleDescriptor getMdFromCache(XmlModuleDescriptorParser mdParser,
+    private ModuleDescriptor getMdFromCache(ModuleDescriptorParser mdParser,
             CacheMetadataOptions options, File ivyFile) throws ParseException, 
IOException {
         ModuleDescriptorMemoryCache cache = getMemoryCache();
         ModuleDescriptorProvider mdProvider = new 
MyModuleDescriptorProvider(mdParser, settings);

Modified: 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
URL: 
http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java?rev=1558715&r1=1558714&r2=1558715&view=diff
==============================================================================
--- 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
 (original)
+++ 
ant/ivy/core/trunk/src/java/org/apache/ivy/core/cache/DefaultResolutionCacheManager.java
 Thu Jan 16 08:18:47 2014
@@ -40,6 +40,7 @@ import org.apache.ivy.plugins.IvySetting
 import org.apache.ivy.plugins.conflict.ConflictManager;
 import org.apache.ivy.plugins.matcher.PatternMatcher;
 import org.apache.ivy.plugins.namespace.Namespace;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.ParserSettings;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.resolver.DependencyResolver;
@@ -154,8 +155,11 @@ public class DefaultResolutionCacheManag
         ParserSettings pSettings = new CacheParserSettings(settings, paths);
 
         URL ivyFileURL = ivyFile.toURI().toURL();
-        return XmlModuleDescriptorParser.getInstance()
-                .parseDescriptor(pSettings, ivyFileURL, false);
+        return getModuleDescriptorParser().parseDescriptor(pSettings, 
ivyFileURL, false);
+    }
+
+    protected ModuleDescriptorParser getModuleDescriptorParser() {
+        return XmlModuleDescriptorParser.getInstance();
     }
 
     public void saveResolvedModuleDescriptor(ModuleDescriptor md) throws 
ParseException,


Reply via email to