ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1051053 - in /ant/ivy/core/trunk/src/java/org/apache/ivy: osgi/core/OSGiManifestParser.java plugins/parser/ModuleDescriptorParserRegistry.java
Date Mon, 20 Dec 2010 10:52:08 GMT
Author: hibou
Date: Mon Dec 20 10:52:08 2010
New Revision: 1051053

URL: http://svn.apache.org/viewvc?rev=1051053&view=rev
Log:
Add the OSGi manifest parser part of the default parsers

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java
    ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java?rev=1051053&r1=1051052&r2=1051053&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/core/OSGiManifestParser.java Mon Dec 20
10:52:08 2010
@@ -22,16 +22,27 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.text.ParseException;
+import java.util.Date;
 import java.util.Locale;
 import java.util.jar.Manifest;
 
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DefaultArtifact;
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.plugins.parser.AbstractModuleDescriptorParser;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.ParserSettings;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
 import org.apache.ivy.plugins.repository.Resource;
+import org.apache.ivy.plugins.repository.url.URLResource;
 
-public class OSGiManifestParser extends AbstractModuleDescriptorParser {
+public class OSGiManifestParser implements ModuleDescriptorParser {
+
+    private static final OSGiManifestParser INSTANCE = new OSGiManifestParser();
+
+    public static OSGiManifestParser getInstance() {
+        return INSTANCE;
+    }
 
     private ExecutionEnvironmentProfileProvider profileProvider;
 
@@ -64,4 +75,21 @@ public class OSGiManifestParser extends 
         }
     }
 
+    public ModuleDescriptor parseDescriptor(ParserSettings ivySettings, URL descriptorURL,
+            boolean validate) throws ParseException, IOException {
+        URLResource resource = new URLResource(descriptorURL);
+        return parseDescriptor(ivySettings, descriptorURL, resource, validate);
+    }
+
+    public String getType() {
+        return "manifest";
+    }
+
+    public Artifact getMetadataArtifact(ModuleRevisionId mrid, Resource res) {
+        return DefaultArtifact.newIvyArtifact(mrid, new Date(res.getLastModified()));
+    }
+
+    public String toString() {
+        return "manifest parser";
+    }
 }

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java?rev=1051053&r1=1051052&r2=1051053&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
(original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/ModuleDescriptorParserRegistry.java
Mon Dec 20 10:52:08 2010
@@ -27,6 +27,7 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.osgi.core.OSGiManifestParser;
 import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser;
 import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
 import org.apache.ivy.plugins.repository.Resource;
@@ -44,6 +45,7 @@ public final class ModuleDescriptorParse
 
     private ModuleDescriptorParserRegistry() {
         parsers.add(PomModuleDescriptorParser.getInstance());
+        parsers.add(OSGiManifestParser.getInstance());
         parsers.add(XmlModuleDescriptorParser.getInstance());
     }
 



Mime
View raw message