osgi-dev-boun...@mail.osgi.org wrote on 2015/03/18 13:50:40:

> From: Florian Pirchner <florian.pirch...@gmail.com>
> i got an idea for a nice DS enhancement. I am using DS a lot. And 
> sometimes google.Guice too. And indeed there are some usecases where
> these features can be combined.
> 
> Using DS i sometimes a miss a method, that injects (wires) all 
> references according the component definition xml for classes 
> instantiated by "new".
> 
> Like this:
> class Service {
> 
>      @Reference(...)
>      protected void bindTransactionManager(TransactionManager tm) {
>       .....
>       }
> }
> 
> A different piece of code:
> Service s = new Service();
> bundleContext.injectMembers(s);

DS is a specification separate from the Core specification. BundleContext 
comes from the Core specification. So what you suggest would require DS to 
be made part of the Core framework. 

Also part of DS is the life cycle management of the component instances. 
In your code snippet, DS is uninvolved in the object life cycle which is 
large departure from DS.

> 
> The call #injectMembers(s) will use the component definition (there 
> is generated xml file based on the annotations of Service.java) to 
> wire up all references for the given instance.
> 
> Usecase:
> There are usecases where you can not use DS. And for these ones a 
> possibility to inject required services based on the component 
> definition would be great.
> 
> Are there any plans for such a specification change?

There is no work on this at the moment. I think there would not be general 
consensus on this as it would make the framework quite a bit larger and 
more complex.

> 
> Thanks
> Florian

-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to