Am 01.07.2010 19:40, schrieb Clement Escoffier:
> Hi,
>
> On 01.07.2010, at 18:39, Henrik Niehaus wrote:
>
>> Hi,
>>
>> I'm wondering, if there is a way to detect, when all services of a
>> component are registered. E.g. I have a component, which provides the
>> service ResourceBundleProvider
>>
>> <snip>
>> @Component
>> @Provides
>> public class DmaxParser implements IWebParser, ResourceBundleProvider {
>>
>> @Requires
>> private Messages i18n;
>> </snap>
>>
>> ResourceBundleProvider is consumed by another bundle, which aggregates
>> all ResourceBundleProviders and creates one big i18n registry. This
>> registry is also a service called Messages. As you can see, this service
>> is injected DmaxParser.
>>
>> In the start method of DmaxParser I now want to use the messages service
>> for i18n. But it may happen, that the start method is called before the
>> ResourceBundleProvider service has been added to the Messages service.
>> That results in missing translations in the start method. It would be
>> great, if could get a callback or something, which tells me, that all
>> services have been registered. Is there a way to realize that or do I
>> have to rethink my design?
>
> iPOJO 1.6.2 supports a post registration callback called when the service
> registration is done.
> @PostRegistration
> public void registered(ServiceReference ref) {
> System.out.println("Registered");
> }
> More details available here :
> http://felix.apache.org/site/providing-osgi-services.html#ProvidingOSGiservices-Beingnotifiedoftheserviceregistrationandunregistration
>
> Regards,
>
> Clement
>
>>
>> Cheers
>> Henrik
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>
>
Thanks for the hint. I didn't find it on the website. I have had a look
at the reference card, but the PostRegistration annotation is not
mentioned there. Probably because it's too young to make it there ;)
Thanks,
Henrik
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]