Return-Path: X-Original-To: apmail-ant-notifications-archive@minotaur.apache.org Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2071ADD55 for ; Mon, 13 Aug 2012 21:12:57 +0000 (UTC) Received: (qmail 16285 invoked by uid 500); 13 Aug 2012 21:12:57 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 16230 invoked by uid 500); 13 Aug 2012 21:12:57 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 16223 invoked by uid 99); 13 Aug 2012 21:12:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Aug 2012 21:12:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Aug 2012 21:12:56 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C97022388860 for ; Mon, 13 Aug 2012 21:12:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: notifications@ant.apache.org From: hibou@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120813211212.C97022388860@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); } }