ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r1372621 - /ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
Date Mon, 13 Aug 2012 21:12:12 GMT
Author: hibou
Date: Mon Aug 13 21:12:12 2012
New Revision: 1372621

URL: http://svn.apache.org/viewvc?rev=1372621&view=rev
Log:
Support for optional dependencies in a p2 repository

Modified:
    ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java

Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java?rev=1372621&r1=1372620&r2=1372621&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java Mon Aug 13 21:12:12
2012
@@ -503,7 +503,8 @@ public class P2MetadataParser implements
                         Message.debug("Unsupported required capability "
                                 + ((RequiredHandler) child).namespace + " " + name + " "
+ range);
                     } else {
-                        requirements.add(new BundleRequirement(type, name, range, null));
+                        String resolution = ((RequiredHandler) child).optional ? "optional"
: null;
+                        requirements.add(new BundleRequirement(type, name, range, resolution));
                     }
                 }
             });
@@ -536,6 +537,10 @@ public class P2MetadataParser implements
 
         private static final String RANGE = "range";
 
+        private static final String OPTIONAL = "optional";
+
+        private static final String GREEDY = "greedy";
+
         String namespace;
 
         String name;
@@ -544,6 +549,10 @@ public class P2MetadataParser implements
 
         String filter;
 
+        boolean greedy;
+
+        boolean optional;
+
         public RequiredHandler() {
             super(REQUIRED);
             addChild(new FilterHandler(), new ChildElementHandler() {
@@ -553,7 +562,7 @@ public class P2MetadataParser implements
             });
         }
 
-        protected void handleAttributes(Attributes atts) {
+        protected void handleAttributes(Attributes atts) throws SAXParseException {
             namespace = atts.getValue(NAMESPACE);
             name = atts.getValue(NAME);
             try {
@@ -561,6 +570,8 @@ public class P2MetadataParser implements
             } catch (ParseException e) {
                 throw new RuntimeException(e);
             }
+            greedy = getOptionalBooleanAttribute(atts, GREEDY, Boolean.TRUE).booleanValue();
+            optional = getOptionalBooleanAttribute(atts, OPTIONAL, Boolean.FALSE).booleanValue();
         }
 
     }



Mime
View raw message