felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard S. Hall (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (FELIX-1754) Usage of BundleContext.getServiceReferences results in failure to activate components
Date Tue, 13 Oct 2009 22:07:31 GMT

    [ https://issues.apache.org/jira/browse/FELIX-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12765273#action_12765273
] 

Richard S. Hall edited comment on FELIX-1754 at 10/13/09 3:06 PM:
------------------------------------------------------------------

I am not so sure if that is accurate, since it depends on how SCR is implemented. If SCR uses
the bundle context of the component bundles to register services and service listeners, then
it should work fine using a normal service listener.

If SCR uses a single service listener for all components and registers it on its own context,
then it would need to use an AllServiceListener as you suggest. However, it would also need
to use ServiceReference.isAssignableTo() to filter them before injecting them into components
to make sure they are actually compatible with the component being injected. Since your patch
doesn't do this, I am a little suspicious that it is completely correct.

FYI, there was a bug in service filtering that was fixed in the new Felix framework 2.0.1
and that could be related, so you should test with 2.0.1 to see how that impacts your scenario.
Thanks!

      was (Author: rickhall):
    I am not so sure if that is accurate, since it depends on how SCR is implemented. If SCR
uses the bundle context of the component bundles to register services and service listeners,
then it should work fine using a normal service listener.

If SCR uses a single service listener for all components and registers it on its own context,
then it would need to use an AllServiceListener as you suggest. However, it would also need
to use ServiceReference.isAssignableTo() to filter them before injecting them into components
to make sure they are actually compatible with the component being injected. Since your patch
doesn't do this, I am a little suspicious that it is completely correct.

FYI, there was a bug in service filter that was fixed in the new Felix framework 2.0.1 that
could be related, so you should test with 2.0.1 to see how that impacts your scenario. Thanks!
  
> Usage of BundleContext.getServiceReferences results in failure to activate components
> -------------------------------------------------------------------------------------
>
>                 Key: FELIX-1754
>                 URL: https://issues.apache.org/jira/browse/FELIX-1754
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.2.0
>            Reporter: Matthew Sykes
>         Attachments: felix-1754.diff
>
>
> I'm attempting to move some code from Equinox to Felix that makes use of the declarative
services 1.1 runtime.  Many of the components in our bundles declare multiple 'provide' elements
in the service declaration .  In general these services consist of a standardized interface
in one package and extensions to that interface in another.  Depending on the requirements
of the code using the component, other bundles will declare their components with references
to either the standardized interface or the extended interface.
> The issue I'm seeing is that the Felix SCR fails to activate some components because
it's failing to resolve references to the service provided by another component.  It turns
out that the SCR is using BundleContext.getServiceReferences instead of BundleContext.getAllServiceReferences
to locate candidate services when resolving references.  Unfortunately, the getServiceReference
flavor requires that the using bundle have access to all class names under which the target
service was registered - not just the interface associated with the reference.
> Given the use-case I've described and the behavior of Equinox, I believe the Felix SCR
should be using BundleContext.getAllServiceReferences(..) to resolve references and rely on
the bundle creator to define the correct imports.

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


Mime
View raw message