Service Activation (Bundle-ActivationPolicy: lazy) [message #127030] |
Fri, 06 March 2009 10:02  |
Eclipse User |
|
|
|
Hi,
Let's suppose I have a bundle that MANIFEST attribute
"Bundle-ActivationPolicy" is set as lazy.
Bundle-ActivationPolicy: lazy
Is this bundle supposed to be activated when I get this service through
context.getServiceReference method?
ServiceReference reference =
context.getServiceReference(ServicosCliente.class.getName()) ;
ServicosCliente service = (ServicosCliente) context
.getService(reference);
My problem is if I do not set this bundle as "Eclipse-AutoStart: true", it
is not being found.
Thanks
|
|
|
|
|
Re: Service Activation (Bundle-ActivationPolicy: lazy) [message #127143 is a reply to message #127093] |
Fri, 06 March 2009 13:44   |
Eclipse User |
|
|
|
> To make it possible, I will register bundle/service implementation on its
> activation class, referencing by interface name (in another bundle).
>
> Is this a good idea?
That sounds fine however in that case you shouldn't bother with a lazy
bundle-activation policy and just ensure that your bundles are properly
started. Another approach worth looking at is to use Declarative Services.
"Emilio Numazaki" <mediasonic.l@gmail.com> wrote in message
news:5da98ede646ea6bd18944e5853986c56$1@www.eclipse.org...
> Hi Simon, first of all, thank you for your help
>
> I've tested what you told and it worked.
>
> But now I have another issue.
>
> My service interface and its implementation is in a separete bundle.
>
> In this case, what really matter is just its implementation, not the
> interface itself.
>
> How do I workaround this?
>
> My idea is to have a service interface bundle and many service
> implementation bundles for that set of interfaces, doing this, I can have
> multiple implementations that can be replaced without code change. I'll
> have just one implementation per solution but it can be switched easilly.
>
> To make it possible, I will register bundle/service implementation on its
> activation class, referencing by interface name (in another bundle).
>
> Is this a good idea?
>
> Thanks!
>
>
>
|
|
|
|
Re: Service Activation (Bundle-ActivationPolicy: lazy) [message #127535 is a reply to message #127454] |
Fri, 13 March 2009 08:35  |
Eclipse User |
|
|
|
Oh, I found the problem.
Declarative Service bundle must be started before everything, so I've
changed config.ini to make it possible.
Now setter method is being called but injected service is not available
for my ViewPart.
I added some logs into ViewPart code and realized that it is being
instantiated at least twice, what makes injected service invalid in second
instance.
Do you know what is the best way to inject services into ViewPart through
DS?
|
|
|
Powered by
FUDForum. Page generated in 0.04752 seconds