Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » The osgi service injection and the order dynamic deploy on virgo(inject osgi service dynamically and the order dynamic deploy on virgo)
The osgi service injection and the order dynamic deploy on virgo [message #890089] Thu, 21 June 2012 04:16 Go to next message
Percy Wang is currently offline Percy WangFriend
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 Go to previous messageGo to next message
Glyn Normington is currently offline Glyn NormingtonFriend
Messages: 1222
Registered: July 2009
Senior Member
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.
icon14.gif  Re: The osgi service injection and the order dynamic deploy on virgo [message #892386 is a reply to message #892177] Thu, 28 June 2012 01:22 Go to previous message
Percy Wang is currently offline Percy WangFriend
Messages: 4
Registered: December 2011
Junior Member
Glyn Normington
Thank you very much for your answer. That's really what I want.
Previous Topic:Can I use Virgo with my existing app and felix
Next Topic:Virgo App Profiling/Performance Tuning
Goto Forum:
  


Current Time: Fri Apr 19 09:39:48 GMT 2024

Powered by FUDForum. Page generated in 0.03204 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top