Configuring Bean Properties

The bean properties file, properties-context.xml, declares all properties that must be retrieved from the OSGi configuration administration service during runtime; properties are stored in the service so they can be configured dynamically at runtime.

You can reconfigure states at runtime, without reloading state bundles or restarting Brand Mobiliser. However, state developers must implement dynamic reconfiguration, by defining state properties in the code.

Edit the properties-context.xml file to configure bean properties:
  1. Set osgix:cm-properties id to the name of the OSGi configuration administration service property that is identified by the value of persistent-id.
    Brand Mobiliser initializes the property, and loads the property file identified by the value of persistent-id.
  2. For each property, enter a <prop key> element and default value.
    Properties are initialized with values from the OSGi configuration administration service. If a property does not exist in the service, the default value is used.
  3. Set the value of ctx:property-placeholder properties-ref to the value of osgix:cm-properties id.
    The value identifies a list of properties that are available for the Spring Framework to use during state initialization.
For example:
<osgix:cm-properties id="sampleState-cfg" persistent-id="service.sampleState">
  <prop key="sample.country">US</prop>
</osgix:cm-properties>    
          
<ctx:property-placeholder properties-ref="sampleState-cfg"/> 
Note: SAP recommends that you store a copy of the properties-context.xml file in the META-INF/sample/conf directory.