The osgi service injection and the order dynamic deploy on virgohttps://www.eclipse.org/forums/index.php/mv/msg/365192/890089/#msg_890089
1.I reference osgi services into my bundle spring application and us @Resource inject it into my bussiness object. but the injection only occured when the spring application context initializing, so if my osgi service is not aviable at this time(it will provided dynamically), my bussiness object can't get it for ever(only have to refresh my bussiness bundle). Is there any way to avoid this, make my service injected dynamically(is the @ServiceReference can fix this? And what is it in virgo?)?
2.I develop with virgo ide for eclipse. It works fine, can deploy dynamically and can define the deploy order to make the server start quickly. But when I publish my application to the test enviroment, there is no way to define the order, only have to deploy as "plan" and put my bundles into the "repository" directory, but this is bad smell, it makes me can't hot deploy one of the bundle. Is there any way to fix this? Or only my way is not right?
Please help me if you know anything. Thank you very much. ]]>Percy Wang2012-06-21T04:16:11-00:00Re: The osgi service injection and the order dynamic deploy on virgohttps://www.eclipse.org/forums/index.php/mv/msg/365192/892177/#msg_892177
Percy Wang wrote on Thu, 21 June 2012 05:16

Hi all, we are using virgo-tomcat as our osgi container.
1.I reference osgi services into my bundle spring application and us @Resource inject it into my bussiness object. but the injection only occured when the spring application context initializing, so if my osgi service is not aviable at this time(it will provided dynamically), my bussiness object can't get it for ever(only have to refresh my bussiness bundle). Is there any way to avoid this, make my service injected dynamically(is the @ServiceReference can fix this? And what is it in virgo?)?

It sounds like you are using Spring DM (or Gemini Blueprint) to obtain the service references. Unfortunately, the service must be present when the application context is initialised. Once that has happened, a proxy to the service is built and the service can go away and come back and the proxy will re-bind. I believe the OSGi Alliance are aware of the requirement on the Blueprint service to build a proxy for services that are initially missing, but even if they address that requirement it won't appear in a specification any time soon.

You could work around this by programmatically obtaining the service reference, but you'd have to handle the injection yourself if you still wanted to use annotations.Quote:

2.I develop with virgo ide for eclipse. It works fine, can deploy dynamically and can define the deploy order to make the server start quickly. But when I publish my application to the test enviroment, there is no way to define the order, only have to deploy as "plan" and put my bundles into the "repository" directory, but this is bad smell, it makes me can't hot deploy one of the bundle. Is there any way to fix this? Or only my way is not right?
Please help me if you know anything. Thank you very much.

If you hot deploy a series of artefacts, Virgo will preserve the order when it restarts (i.e., when the -clean option is not specified). Alternatively, you can use the initialArtifacts property as described in the Virgo User Guide to install some artefacts from the repository in a specified order.
]]>Glyn Normington2012-06-27T10:03:32-00:00Re: The osgi service injection and the order dynamic deploy on virgohttps://www.eclipse.org/forums/index.php/mv/msg/365192/892386/#msg_892386
Thank you very much for your answer. That's really what I want.]]>Percy Wang2012-06-28T01:22:55-00:00