aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Pantelis (JIRA)" <>
Subject [jira] [Commented] (ARIES-1507) Extended filter is not included in OSGi service filter
Date Mon, 21 Mar 2016 03:08:33 GMT


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:
>             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="" 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

View raw message