The osgi service injection and the order dynamic deploy on virgo [message #890089] |
Thu, 21 June 2012 04:16 |
Percy Wang Messages: 4 Registered: December 2011 |
Junior Member |
|
|
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?)?
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.
|
|
|
Re: The osgi service injection and the order dynamic deploy on virgo [message #892177 is a reply to message #890089] |
Wed, 27 June 2012 10:03 |
Glyn Normington Messages: 1222 Registered: July 2009 |
Senior Member |
|
|
Percy Wang wrote on Thu, 21 June 2012 05:16Hi 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.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03204 seconds