Hi Dan,

yes it is.

first of all you need to make sure you got a cfg file in your etc folder
with a name that matches a "PID" - PersistentID
e.g. my.very.special.resources.cfg
where my.very.special.resources is the pid.
This way the FileInstaller takes this cfg file and tells the config
admin service to provide a configuration for that pid.

Now you just need to replace your property code by the following.

<osgix:cm-properties id="cfg.with.defaults" 
persistent-id="my.very.special.resources">
      <beans:prop key="host">localhost</beans:prop>
      <beans:prop key="port">3306</beans:prop>
</osgix:cm-properties>



It can also be found at [1]


Regards, Achim


[1]  -
http://static.springsource.org/osgi/docs/1.2.1/reference/html/compendium.html#compendium:cm


> Hello,
>
> My jar ( spring bundle ) has a default set of configurations via
>
>   <bean id="propertyConfigurer"
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
>     <property name="systemPropertiesModeName"
> value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
>     <property name="location" value="classpath:com/.../resources.properties" 
> />
>   </bean>
>
> This way I  can override the default properties using system
> properties ( ie pass in -Dxuy=value to JVM )
>
> Now I'd like to deploy my bundle  to Karaf, is there a way for me to
> setup Karaf/osgi's configAdmin to to use a config file under karaf's
> etc directory to override my default properties?
>
> Big thanks ahead.
>
> -Dan

Reply via email to