You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Arjun Panday (JIRA)" <ji...@apache.org> on 2010/08/12 11:55:15 UTC

[jira] Updated: (FELIX-2532) bundle-symbolic-name constraint is not handled by the OBR resolver

     [ https://issues.apache.org/jira/browse/FELIX-2532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Arjun Panday updated FELIX-2532:
--------------------------------

    Attachment: DataModelHelperImpl.java

Please find attached a proposed patch for this issue, based on released version 1.6.4.

Diff below with 1.6.4:

diff --git a/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java b/src/main/java/org/apache/felix/bundlerepository/impl/DataMode
index 7e86c81..db58343 100644
--- a/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java
+++ b/src/main/java/org/apache/felix/bundlerepository/impl/DataModelHelperImpl.java
@@ -61,6 +61,8 @@ public class DataModelHelperImpl implements DataModelHelper
 
     public static final String BUNDLE_LICENSE = "Bundle-License";
     public static final String BUNDLE_SOURCE = "Bundle-Source";
+    static final String SYSTEM_SYMBOLICNAME = "system.bundle";
+    static final String SYMBOLICNAME_ATTRIBUTE = "bundle-symbolic-name";
 
     public Requirement requirement(String name, String filter)
     {
@@ -693,16 +695,17 @@ public class DataModelHelperImpl implements DataModelHelper
         Clause[] clauses = Parser.parseHeader(headers.getHeader(Constants.EXPORT_PACKAGE));
         for (int i = 0; clauses != null && i < clauses.length; i++)
         {
-            CapabilityImpl capability = createCapability(Capability.PACKAGE, clauses[i]);
+            CapabilityImpl capability = createCapability(Capability.PACKAGE, clauses[i], headers);
             resource.addCapability(capability);
         }
     }
 
-    private static CapabilityImpl createCapability(String name, Clause clause)
+    private static CapabilityImpl createCapability(String name, Clause clause, Headers headers)
     {
         CapabilityImpl capability = new CapabilityImpl(name);
         capability.addProperty(name, clause.getName());
         capability.addProperty(Resource.VERSION, Property.VERSION, getVersion(clause));
+       capability.addProperty(SYMBOLICNAME_ATTRIBUTE, getSymbolicName(headers));
         Attribute[] attributes = clause.getAttributes();
         for (int i = 0; attributes != null && i < attributes.length; i++)
         {
@@ -868,6 +871,10 @@ public class DataModelHelperImpl implements DataModelHelper
                 bsn = "Untitled-" + headers.hashCode();
             }
         }
+       if (Activator.getContext().getBundle(0).getSymbolicName().equals(bsn))
+       {
+         bsn = SYSTEM_SYMBOLICNAME;
+       }
         Clause[] clauses = Parser.parseHeader(bsn);
         return clauses[0].getName();
     }


/arjun

> bundle-symbolic-name constraint is not handled by the OBR resolver
> ------------------------------------------------------------------
>
>                 Key: FELIX-2532
>                 URL: https://issues.apache.org/jira/browse/FELIX-2532
>             Project: Felix
>          Issue Type: Bug
>          Components: Bundle Repository (OBR)
>    Affects Versions: bundlerepository-1.6.4
>            Reporter: Arjun Panday
>            Priority: Critical
>         Attachments: DataModelHelperImpl.java
>
>
> I have a bundle importing javax.xml.bind specifically from the system.bundle. The import looks like this:
> Import-Package: javax.xml.bind;bundle-symbolic-name=system.bundle
> Bindex translates the import into the following requirement:
>     <require extend='false' filter='(&amp;(package=javax.xml.bind)(version&gt;=0.0.0)(bundle-symbolic-name=system.bundle)(mandatory:&lt;*bundle-symbolic-name))' multiple='false' name='package' optional='false'>   
>       Import package javax.xml.bind
>     </require>
> This requirement is not resolved by the RepositoryAdmin service.
> When I loop over resolver.getUnsatisfiedRequirements(), I log:
> Unsatisfied OBR requirement (&(package=javax.xml.bind)(bundle-symbolic-name=system.bundle)(mandatory:<*bundle-symbolic-name))
> It seems that the bundle-symbolic-name constraint is not handled by the resolver.
> /arjun

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.