Hi,

On 08.10.2010 23:38, sam lee wrote:
> Hey,
> 
> I can get a Service instance from another Service by using:
>     @Reference
>     private MyService myService;
> 
> But, how can I get a reference to MyService instance from a POJO?
> Since the POJO will be used in some other service, should I get MyService
> reference from the service POJO is being used and pass to it?
> 
> Or, is there some factory POJO can use?

There is no way you can get a reference out of nowherer inside a POJO
(assuming this is Declarative Services/SCR and not iPOJO).

Now, depending on your application there are multiple ways at getting at
a service. Either your POJO is really a Declarative Services component
(nothing requires you to register a service, this can just be a plain
old Java object which gets services bound).

Or you provide the object with some BundleContext from which the service
may be retrieved

Regards
Felix

> 
> Thanks.
> Sam
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to