I'm doing something similar now. The "master" service reads its configuration, then does the property substitution, and finally calls the service factories for the configured services. This means that the "master" configuration needs to include the name of the service factory classes. It all works but just seems like I've reimplemented a lot of Karaf's feature file functionality just to get the variable substitution.
Thanks for the response. Tim On Mon, Sep 26, 2011 at 3:08 AM, David Jencks <[email protected]> wrote: > Sorry, I missed this when you sent it... > > The configuration works through config admin, which is per pid, and bundles > can't share the same pid. > > I think your best bet if you want to configure through osgi is to set up a > service to supply the shared values and reference the service from each > bundle that needs the shared data. Of course with a single service there is > no problem configuring it with a single pid/config file. > > david jencks > > On Sep 25, 2011, at 8:27 AM, Tim Moloney wrote: > >> No comments or suggestions? >> >> >> On Sat, Sep 10, 2011 at 6:24 PM, Tim Moloney <[email protected]> wrote: >> >>> I have a features file that deploys and configures a large modular >>> application. Some of the modules are non-Java code wrapped in OSGi >>> bundles, so part of the configuration is establishing communication >>> between modules. Since each bundle has its own configuration and the >>> communication configuration crosses multiple bundle configurations, >>> there is the possibility of error by changing one configuration but >>> not the other(s). Are there any "cross-configuration variables" in a >>> features file that would eliminate these errors? >>> >>> I read in the documentation[1] that something like this can be done >>> with Spring-DM (which I don't know or use) but I didn't see anything >>> for non-Spring-DM users. I'm thinking of something like the >>> following: >>> >>> <features name="exampleRepo"> >>> >>> <feature name="app" version="1.0.0"> >>> >>> <!-- Define "cross-configuration variables" here. --> >>> <variables> >>> port = 1234 >>> </variables> >>> >>> <bundle>mvn:com.foo.app/com.foo.app.producer/1.0.0</bundle> >>> <config name="com.foo.app.producer"> >>> outputPort = ${port} <!-- Karaf substitutes the value here. --> >>> </config> >>> >>> <bundle>mvn:com.foo.app/com.foo.app.consumer/1.0.0</bundle> >>> <config name="com.foo.app.consumer"> >>> inputPort = ${port} <!-- Karaf substitutes the value here. --> >>> </config> >>> >>> </feature> >>> >>> </features> >>> >>> Thanks, >>> Tim >>> >>> >>> 1. >>> http://karaf.apache.org/manual/latest-2.2.x/users-guide/provisioning.html#Configurations >>> "There may also be cases where ..." >>> >>> >>> -- >>> Tim Moloney >>> ManTech Real-time Systems Laboratory >>> 2015 Cattlemen Road \ / >>> Sarasota, FL 34232 .________\(O)/________. >>> (941) 377-6775 x208 ' ' O(.)O ' ' >>> >> >> >> >> -- >> Tim Moloney >> ManTech Real-time Systems Laboratory >> 2015 Cattlemen Road \ / >> Sarasota, FL 34232 .________\(O)/________. >> (941) 377-6775 x208 ' ' O(.)O ' ' > > -- Tim Moloney ManTech Real-time Systems Laboratory 2015 Cattlemen Road \ / Sarasota, FL 34232 .________\(O)/________. (941) 377-6775 x208 ' ' O(.)O ' '
