felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil Bartlett <njbartl...@gmail.com>
Subject Re: @Reference multi binding & dynamics
Date Wed, 07 Oct 2015 16:01:42 GMT

> On 7 Oct 2015, at 13:56, Ferry Huberts <mailings@hupie.com> wrote:
> 
> Hi,
> 
> Cross-posting because I don't know if the situation/problem below is by design, a bug
in bnd, or a bug in SCR
> 
> 
> I have a R6 component that does
>  @Reference(cardinality = ReferenceCardinality.AT_LEAST_ONE)
> 
> This appears to not bind new matching services, because the policy appears to be STATIC
by default.

Yes, static policy has always been the default in DS. You can see this right back in the very
first DS specification found in OSGi Compendium R4.0, section 112.3.3: "The static policy
is the most simple policy and is the default policy”. Also section 112.10 that gives the
XML schema, where the reference element has the policy attribute defined as:

    <attribute name="policy" type="scr:Tpolicy" default="static" use="optional"/>


> 
> I did expect the ReferenceCardinality.AT_LEAST_ONE to imply ReferencePolicy.DYNAMIC,
just like the bnd annotations did.

Nope. These are new annotations in a new namespace. There is no reason to expect them to have
the same behaviour as the bnd annotations.


> 
> Changing it to
>  @Reference(policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.AT_LEAST_ONE)
> 
> appears to make it work like I expected.
> 
> 
> Is this by design?
> 
> Coming from bnd annotations this - to me - seems like another (breaking) subtlety.

It’s a subtlety perhaps because the standard annotations are just a direct, literal transformation
to the XML, whereas the bnd ones tried to be “smart”. Yes, this is by design.

It’s certainly not breaking because, again, these are new annotations and there is no reason
to expect them to do the same thing…


> 
> -- 
> Ferry Huberts
> 
> -- 
> You received this message because you are subscribed to the Google Groups "bndtools-users"
group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bndtools-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message