felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kuffner <daniel.kuff...@googlemail.com>
Subject Felix SCR Annotations - Reference Binding with Map parameter
Date Thu, 17 May 2012 10:18:16 GMT
Hi All,

I have a question regarding the Felix SCR annotations regarding
bind/unbind references.

The Declarative Services specification defines the following method
signatures for binding methods:
1. void <method-name>(ServiceReference);
2. void <method-name>(<parameter-type>);
3. void <method-name>(<parameter-type>, Map);

I have tried all variants and it seem to be that variant 3 doesn't work.
I get following error message:

@Reference: Missing method setServiceB for reference serviceB
@Reference: Missing method unsetServiceB for reference serviceB

Is that a known limitation or do I miss something.
I use SCR Generator 1.1.4

Here is the example code:

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;

import java.util.Map;

@Component(immediate = true)
public class ReferenceMapProblem {

    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY,
            bind = "setServiceB",
            unbind = "unsetServiceB")
    private IServiceB service;

    protected void setServiceB(IServiceB s, Map map) {
        // ...

    protected void unsetServiceB(IServiceB s, Map map) {
        // ...

View raw message