felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre De Rop (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-5337) Filter-based dependencies working differently for annotations
Date Fri, 26 Aug 2016 23:07:20 GMT

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

Pierre De Rop commented on FELIX-5337:

thanks for reporting.

I have reproduce the issue in https://github.com/pderop/dm.felix5337

In the project above, the two service.v1 and service.v2  bundles provides two versions of
the same service.
Now, the catchall.withapi bundle uses the DM api and is able to lookup all services, including
service.v1, and service.v2.

the catchall.withapi does this:


this is working fine. But the catchall.withannotation bundle does not work. It only catches
one service, not all the others.
It does this:

	@ServiceDependency(filter="(objectClass=*)", required = false) 
	void addService(Object service, Map<String, String> properties) {
		System.out.println("Got service " + service + " with properties: " + properties);

After investigating, it turns out that the issue is the following: the runtime infers the
service type using the signature of the addService method. So, it internally uses the DM api
and does this:

setService(Object.class, "(objectClass=*)")

and this does not work: we don't catch all services, only one.

So, to summarize, the following works (and this is what catchall.withapi does):


but the following does not work (this is what the runtime internally does):

createServiceDependency().setService(Object.class, "(objectClass=*)").setRequired(false).setCallbacks(...)

I will continue to investigate this WE.

> Filter-based dependencies working differently for annotations
> -------------------------------------------------------------
>                 Key: FELIX-5337
>                 URL: https://issues.apache.org/jira/browse/FELIX-5337
>             Project: Felix
>          Issue Type: Bug
>    Affects Versions: dependencymanager-4.3.0
>            Reporter: J.W. Janssen
> I've got a "catch all" service dependency that simply wants to see *all* services being
registered. In the activator based implementation I simply express my dependency as {{createServiceDependency().setService("(objectClass=*)").setRequired(false).setCallbacks("addService",
"removeService")}} and I get all services I'm interested in (I mean: each and every registered
> However, if I rewrite my code to use annotations using {{@ServiceDependency(filter="(objectClass=*)",
required = false, removed = ...)}}, I suddenly do not see all services I expect: only services
that seem to be compatible with the class-space of the bundle my code lives in.

This message was sent by Atlassian JIRA

View raw message