Hi
Unfortunately everything is the other way around. The services in OSGi
are not really "instantiated", but "registered". Your bundle needs to
be activated, and then it registers the services in the framework.
When another bundle requests the services, they need to be published
into the framework first.
It should be impossible for the scenario where a bundle to requests a
service, and as a result, causes a bundle to be activated. This is
because the services model doesn't tie bundles to services - any
bundle can have code implements and publishes the same service
interface, so it is impossible for the framework to know which bundle
it should activate (especially if there is more than one).
Declarative services is an OSGi spec that covers an extension which
allows your bundle's "components" to be published as services when it
is activated. You can register "delayed" components which are
registered in the framework, but not "configured" (see DS
specification) until they are requested, however your bundle must be
activated of course.
Cheers
Chris
On 29/04/2009, at 6:39 AM, Luc Dewavrin wrote:
Hi,
I have a newbie question regarding bundle lifecycle and declarative
services
lifecycle : are they linked together ?
I would like the services of my bundle to be singletons and my
bundle should
be activated only when services are instantiated. Is it possible to
do that
by configuration ?
Can a service by declaration become a singleton in my bundle ( a la
Spring
container) ? i mean all the services dependent on that service
should be
bound with the same implementation (for a given bundle).
Considering that my service is a singleton. If i instantiate it in the
bundle activator, can i force my bundle to be activated only when the
service is loaded ?
Thanks for your help,
Luc
--------
Christopher Armstrong
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]