Hello all,

 

First of all I'd like to say how wonderful iPOJO works. Thanks for all
the hard work going into that project (and all the others at Apache
Felix). (Most of the time) there's good warnings or errors on why a
requirement could not be fulfilled, also the messages when
configurations don't work look nice (Altough one single error rather
than 3 is probably enough for non-applicable configurations.)

 

To the actual problem: Although the documentation on requiring services
[1] is pretty extensive and detailed, there is an important note
missing: namely when a service requirement is declared via callback
methods, how is the actual specification is determined? Which contraints
are exsiting for the method names?

 

I was wondering the whole time why no service was bound for an
implementation like this:

 

Set<MyServiceInterface> myServices;

@Bind(optional=true, aggregate=true)

addMyService(MyServiceInterface newService) {

  myServices.add(newService);

}

 

I thought the specification and binding would be clear through the @Bind
annotation and the method signature. However it turns out that the
method name has to start with 'bind' to get this to work:

 

Set<MyServiceInterface> myServices;

@Bind(optional=true, aggregate=true)

bindMyService(MyServiceInterface newService) {

  myServices.add(newService);

}

 

Maybe it would be good to mention this requirement in the documentation
[1], and document some details on the specification discovery.  I could
not find a note about that.

 

I also post this to the list as others might run into the same issue.

 

Moreover I was wondering why the 'specification' argument of the @Bind
annotation is a String and not a Class object? It would be very helpful
to be able to write @Bind(specification=MyService.class). For the
@Provides class annotation this is possible.

(@Bind(specification=MyService.class.getName()) is not possible either,
because it is not regarded as a constant expression by the compiler)

 

Regards,

Benjamin

 

[1]
http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apa
che-felix-ipojo-userguide/describing-components/service-requirement-hand
ler.html

 


Reply via email to