|Re: [p2-dev] p2, dependency injection exploration|
On Sep 18, 2009, at 10:56 PM, John Arthorne wrote:
Yes, I started with eagerly activated bundle that started the first default context.
I have instead tried an approach where rather than registering the services directly (engine, director, repository manager, etc), I register a factory as a service (engine factory, director factory, etc). This allows me to pass a context in at the time the service is created. Also, if it needs to obtain any other services when it starts it can grab them from this context. I mocked this up using Pascal's DI experiment bundle (org.eclipse.equinox.p2.di.experiment in the equinox incubator, and org.eclipse.equinox.p2.di.client as an example client bundle). I think this satisfies all our requirements (modular, lazy, dynamic, extensible) and the code for clients is still relatively clean. Feel free to check it out and provide comments here.
Sounds promising, I will try the same approach in b3.