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]
> 

Reply via email to