You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Daniel Bimschas <da...@bimschas.com> on 2009/08/25 10:27:03 UTC
Unsupported use case for maven-scr-plugin
Hi there!
I just found an unsupported use case that I'm "stuck" with. Consider a
class A that implements the interfaces B, C and EventHandler. For B
and C class A wants to be registered as service declaratively.
Therefore I use the scr annotations. For interface EventHandler I want
to register my service programmatically, as it needs to specify a
filter expression). Based on the available annotations I'm not able to
do it.
@Service
@Component(...)
public class A implements B, C, EventHandler {
public void activate(ComponentContext context) {
Dictionary d = new Hashtable();
d.put(EventConstants.EVENT_TOPIC, "...");
d.put(EventConstants.EVENT_FILTER, "(...)");
context.registerService( EventHandler.class.getName(), this, d);
// ...
}
// ...
}
I think there's no way to do it, as I cannot specify multiple @Service
annotations and the value-param of @Service only takes exactly one
Class<?> parameter, not an array or sth. Another possibility would be
a list of excluded interfaces, if auto-detection was used.
Is there a way to do somehow else? Or is this in fact an unsupported
use case?
Kind regards,
Daniel Bimschas
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Unsupported use case for maven-scr-plugin
Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,
you can use the @Services annotation which allows you to embed several
@Service annotations.
Regards
Carsten
Daniel Bimschas wrote:
> Hi there!
>
> I just found an unsupported use case that I'm "stuck" with. Consider a
> class A that implements the interfaces B, C and EventHandler. For B and
> C class A wants to be registered as service declaratively. Therefore I
> use the scr annotations. For interface EventHandler I want to register
> my service programmatically, as it needs to specify a filter
> expression). Based on the available annotations I'm not able to do it.
>
> @Service
> @Component(...)
> public class A implements B, C, EventHandler {
>
> public void activate(ComponentContext context) {
> Dictionary d = new Hashtable();
> d.put(EventConstants.EVENT_TOPIC, "...");
> d.put(EventConstants.EVENT_FILTER, "(...)");
> context.registerService( EventHandler.class.getName(), this, d);
> // ...
> }
>
> // ...
>
> }
>
> I think there's no way to do it, as I cannot specify multiple @Service
> annotations and the value-param of @Service only takes exactly one
> Class<?> parameter, not an array or sth. Another possibility would be a
> list of excluded interfaces, if auto-detection was used.
>
> Is there a way to do somehow else? Or is this in fact an unsupported use
> case?
>
> Kind regards,
> Daniel Bimschas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
--
Carsten Ziegeler
cziegeler@apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org