incubator-ivy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xav...@apache.org
Subject svn commit: r552883 - in /incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml: XmlModuleDescriptorParser.java XmlModuleDescriptorUpdater.java
Date Tue, 03 Jul 2007 15:39:33 GMT
Author: xavier
Date: Tue Jul  3 08:39:30 2007
New Revision: 552883

URL: http://svn.apache.org/viewvc?view=rev&rev=552883
Log:
fix problems related to recent changes in relative URL handling. Still requires some refactoring.

Modified:
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
    incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java?view=diff&rev=552883&r1=552882&r2=552883
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParser.java
Tue Jul  3 08:39:30 2007
@@ -31,6 +31,7 @@
 import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.ivy.Ivy;
+import org.apache.ivy.core.IvyContext;
 import org.apache.ivy.core.module.descriptor.Configuration;
 import org.apache.ivy.core.module.descriptor.ConfigurationAware;
 import org.apache.ivy.core.module.descriptor.DefaultDependencyArtifactDescriptor;
@@ -118,9 +119,10 @@
                 DefaultModuleDescriptor dmd = (DefaultModuleDescriptor) md;
                 ns = dmd.getNamespace();
             }
-            XmlModuleDescriptorUpdater.update(null, is, destFile, Collections.EMPTY_MAP,
md
-                    .getStatus(), md.getResolvedModuleRevisionId().getRevision(), md
-                    .getResolvedPublicationDate(), ns, false, null);
+            XmlModuleDescriptorUpdater.update(IvyContext.getContext().getSettings(), is,
res, 
+                    destFile, Collections.EMPTY_MAP, md.getStatus(), 
+                    md.getResolvedModuleRevisionId().getRevision(), 
+                    md.getResolvedPublicationDate(), ns, true, null);
         } catch (SAXException e) {
             ParseException ex = new ParseException("exception occured while parsing " + res,
0);
             ex.initCause(e);
@@ -134,8 +136,8 @@
 
     private static class Parser extends AbstractParser {
 
-        private static final List ALLOWED_VERSIONS = Arrays.asList(new String[] {"1.0", "1.1",
-                "1.2", "1.3", "1.4", "2.0"});
+        private static final List ALLOWED_VERSIONS = Arrays.asList(
+            new String[] {"1.0", "1.1", "1.2", "1.3", "1.4", "2.0"});
 
         private DefaultDependencyDescriptor _dd;
 

Modified: incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
URL: http://svn.apache.org/viewvc/incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java?view=diff&rev=552883&r1=552882&r2=552883
==============================================================================
--- incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
(original)
+++ incubator/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorUpdater.java
Tue Jul  3 08:39:30 2007
@@ -45,6 +45,9 @@
 import org.apache.ivy.core.module.id.ModuleRevisionId;
 import org.apache.ivy.core.settings.IvySettings;
 import org.apache.ivy.plugins.namespace.Namespace;
+import org.apache.ivy.plugins.repository.Resource;
+import org.apache.ivy.plugins.repository.file.FileResource;
+import org.apache.ivy.plugins.repository.url.URLResource;
 import org.apache.ivy.util.Message;
 import org.apache.ivy.util.XMLHelper;
 import org.apache.ivy.util.extendable.ExtendableItemHelper;
@@ -128,8 +131,9 @@
     }
 
     
-    public static void update(final IvySettings settings, InputStream in, File destFile,
-            final Map resolvedRevisions, final String status, final String revision,
+    public static void update(
+            final IvySettings settings, InputStream in, Resource res, 
+            File destFile, final Map resolvedRevisions, final String status, final String
revision,
             final Date pubdate, final Namespace ns, final boolean replaceInclude,
             String[] confsToExclude) throws IOException, SAXException {
         if (destFile.getParentFile() != null) {
@@ -137,9 +141,15 @@
         }
         OutputStream fos = new FileOutputStream(destFile);
         try {
-            //TODO : the inputStream context should be given.
-            update(settings, null, in, fos, resolvedRevisions, status, revision, pubdate,
ns,
-                replaceInclude, confsToExclude);
+            //TODO: use resource as input stream context?
+            URL inputStreamContext = null;
+            if (res instanceof URLResource) {
+                inputStreamContext = ((URLResource) res).getURL();
+            } else if (res instanceof FileResource) {
+                inputStreamContext = ((FileResource) res).getFile().toURL();
+            }
+            update(settings, inputStreamContext, in, fos, resolvedRevisions, status, revision,

+                pubdate, ns, replaceInclude, confsToExclude);
         } finally {
             try {
                 in.close();



Mime
View raw message