You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Tom Pantelis (JIRA)" <ji...@apache.org> on 2016/03/21 04:08:33 UTC
[jira] [Commented] (ARIES-1507) Extended filter is not included in
OSGi service filter
[ https://issues.apache.org/jira/browse/ARIES-1507?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15203664#comment-15203664 ]
Tom Pantelis commented on ARIES-1507:
-------------------------------------
In looking at the code some more, it is correct. I originally missed the WaitForInitialReferences2 phase after initial references and the processors have been invoked.
Previously, using karaf's service:list command I thought the bundle in question was using the wrong service impl but I'm not seeing that now.
> Extended filter is not included in OSGi service filter
> ------------------------------------------------------
>
> Key: ARIES-1507
> URL: https://issues.apache.org/jira/browse/ARIES-1507
> Project: Aries
> Issue Type: Bug
> Components: Blueprint
> Affects Versions: blueprint-core-1.4.2
> Reporter: Tom Pantelis
>
> I'm using the extended filter, eg
> <reference id="foo" interface="org.foo.Bar" ext:filter="type=one"/>
> but it isn't getting included in the service filter and thus the correct service isn't (always) getting imported.
> In AbstractServiceReferenceRecipe.getOsgiFilter:
> public String getOsgiFilter() {
> if (filterRecipe != null && blueprintContainer instanceof BlueprintContainerImpl) {
> BlueprintContainerImpl.State state = ((BlueprintContainerImpl) blueprintContainer).getState();
> switch (state) {
> case InitialReferencesSatisfied:
> case WaitForInitialReferences2:
> case Create:
> case Created:
> return createOsgiFilter(metadata, getExtendedOsgiFilter());
> }
> }
> return filter;
> }
> it doesn't include a case for the Populated state which is when the BlueprintContainerImpl calls trackServiceReferences. So when init calls
> getBundleContextForServiceLookup().addServiceListener(this, getOsgiFilter());
> the extended filter isn't included. Sometimes it does get the right service but it's timing and luck.
> I can use the regular filter attribute but there are cases when I need to dynamically substitute it via cm-property-placeholder. I'm unclear as to why AbstractPropertyPlaceholder substitutes the extended filter but not the regular one but that's another topic.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)