Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » springDM container-managed updates
springDM container-managed updates [message #809967] Wed, 29 February 2012 14:07 Go to next message
eugene rabii is currently offline eugene rabiiFriend
Messages: 13
Registered: February 2012
Junior Member
So, I have springDM managed properties


<beans:bean id="configurationBean" class="com.eugene.PropertiesBean">
<osgix:managed-properties persistent-id="MyPid" update-strategy="container-managed"/>
<beans:property name="host" value="localhost"></beans:property>
<beans:property name="port" value="5698"></beans:property>
</beans:bean>
</beans:beans>
Now, here is what I do. Deploy the bundle to Virgo, everything works great, the default properties (because the MyPid.properties is not deployed) get injected into the bean.

Deploy MyPid.properties where BOTH host and port are changed, they are both re-injected also.

That's great. But here is the thing, can I have one single method that would tell me that the bean has changed? The properties have been re-injected? Something like : afterPropertiesSet or init in XML config? Because right now having an afterPropertiesSet or init works only the first time the properties get injected, not the second, third and so on... Which is somehow logic, being a singleton.

But I thought that people behind spring DM thought about this and I am just missing he obvious here, like implementing some sort on interface...

I do not know (googleed it) if spring DM offers such a thing.

Thx! Eugene.
Re: springDM container-managed updates [message #809982 is a reply to message #809967] Wed, 29 February 2012 14:28 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
Short answer is no. If you need this notification - you should switch to bean-managed or publish your bean as ManagedService.

One way that you can deal with it and I found it useful in some cases:

1. Register a ManagedServiceFactory - you will ne notified on the changes in configuration and you can
2. Use that MSF to publish services (i.e. com.eugene.PropertiesBean)
3. When configuration is updated - remove old service - publish new

You clients will be able to subscribe to com.eugene.PropertiesBean and use that. In the client you can attach listeners and be notified when a new version of service is published.

Hope this helps
Dmitry
Re: springDM container-managed updates [message #810039 is a reply to message #809982] Wed, 29 February 2012 15:57 Go to previous message
Valdas Sevelis is currently offline Valdas SevelisFriend
Messages: 1
Registered: February 2012
Junior Member
Is there a reason (apart from simple 'just not implemented') that ManagedServiceBeanManager does not invoke e.g. Spring's InitializingBean::afterPropertiesSet method (if it's available) for container-managed config updates?

Thanks,
Valdas
Previous Topic:Git Repository broken?
Next Topic:Gemini Web 2.1.0.M02
Goto Forum:
  


Current Time: Fri Mar 29 07:44:22 GMT 2024

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

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

Back to the top