-
1. Re: Multiple bundles using same external config
gertv May 4, 2012 7:27 AM (in response to paul.berry)Paul,
One possible solution could be to build a bundle specifically for handling the configuration for all your other application bundles.
That bundle has the property placeholder or managed properties tag to automatically pick up the configuration file contents and inject the values into a bean. You can then export that bean in the OSGi Service Registry and reference it from all your other bundles.
Regards,
Gert Vanthienen
-
2. Re: Multiple bundles using same external config
paul.berry May 4, 2012 10:15 AM (in response to gertv)Hi Gert, thanks for your response.
I've been looking at a couple of possible solutions and the bean idea seems like a good one, however would I be able to access the properties from my camel routes? How would I go abut doing this?
The other idea I came up with is to use a simple camel route with a splitter to monitor a root config file, and copy it to all the required config files when it changes. This seems a bit long winded for such a simple problem though.
-
3. Re: Multiple bundles using same external config
gertv May 7, 2012 5:27 AM (in response to paul.berry)Hi Paul,
If you're using Blueprint, I think you should be able to use <ext:property-placeholder defaults-ref="..."/> to point to a map of key value pairs. You could use this to point to the configuration provided by your shared bean. When using Spring, PropertyPlaceHolderConfigurer should also allow you to inject the map of properties directly instead of reading them from a file.
Regards,
Gert
-
4. Re: Multiple bundles using same external config
paul.berry May 8, 2012 4:15 AM (in response to gertv)Hi Gert,
Again, thanks for taking the time to respond to this. I'm using blueprint, how exactly would I go about setting these propertyplaceholders in my code and then using them in my routes? Are there any examples of doing this?
It seems like a bit of an oversight that there's no easily accessible way of keeping all your configuration in one place for multiple bundles. I imagine most large integration solutions have multiple bundles that require at least some of the same configuration options, unless I'm just missing something.