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/09 17:13:16 UTC

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

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


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.


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

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12899905#action_12899905 ] 

Richard S. Hall commented on FELIX-2532:
----------------------------------------

There are a couple issues here:

1. I believe that OBR doesn't handle implicit attributes (i.e., bundle-symbolic-name and bundle-version) on exported packages at all. The proposed patch is only a partial solution for this limitation, e.g., it doesn't address bundle-version.

2. The proposed patch is not really correct either, since it simply replaces the implementation-specific system bundle name with the generic one (i.e., system.bundle), but what happens if someone is importing it with the implementation name? For system bundle, there actually needs to be a special case where this attribute is multi-valued.

> 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.


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

Posted by "Emily Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-2532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12923034#action_12923034 ] 

Emily Jiang commented on FELIX-2532:
------------------------------------

The workaround for this is to add the bundle-symbolic-name and bundle-version in the capability of the xml when you generae for the exported packages. Below is an example:
<capability name="package">
<p n="package" v="test.b2"></p>
<p n="version" t="version" v="1.0.2"></p>
<p n="bundle-symbolic-name" v="test.b2"></p>
<p n="bundle-version" t="version" v="1.0.2"></p>
<p n="mandatory" v=""></p>
</capability>


> 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.


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

Posted by "Arjun Panday (JIRA)" <ji...@apache.org>.
     [ 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.