Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-users] Problem with the Sisu Extender

On 5 Sep 2013, at 14:04, gian.maria.romanato@xxxxxxxxxxxx wrote:

> Example: Bundle B1 declares class Bean which uses interface I1 as
> one of its fields, but B1 has no implementation for I1. Bundle B2
> provides Impl1 which is an implementation of I1. B2 may depend on B1
> (e.g. I1 is declared by B1 itself) or not (e.g. I1 is declared in
> bundle B0 known to both B1 and B2). I would like code in B1 to be
> able to instantiate class Bean and have its field of type I1
> injected with the implementation provided by B2.

Stuart, if you still want to have a look at what I am doing,
and possibly give me a hint about what is wrong, with respect to the desired behaviour that I described in my previous email, I just pushed my sample workspace to github: https://github.com/giamma/sisu-test

To be used with Eclipse and the PDE.
B1 and B2 are PDE plug-in projects and the repo contains a folder named target-platform whose content must be used to define the PDE target platform.
B1 declares an explicit dependency toward the Sisu extender bundle to ensure that the extender bundle is started first.
B2 contains an activator that registers a service listener observing Provider<Injector> in order to:
  • obtain the injector created by the Sisu extender for B2
  • ensure that the code is executed only after the Sisu extender has registered B2 in the bean locator
The sample code in the service listener shows that:
  1. B1 injector cannot locate the implementation class provided by B2
  2. B2 injector can locate the implementation class provided by B2
  3. The locator obtained from B1 injector via injection in the B1 activator cannot instantiate the implementation class
  4. The locator obtained from B2 injector via injection can instantiate the implementation class
  5. The two locators are not the same, nor equal in the Java sense.
Thanks, I'll take a look this evening - having two locator instances is odd and is probably causing the other issues

GianMaria.

_______________________________________________
sisu-users mailing list
sisu-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/sisu-users


Back to the top