...
When a bundle or class required APPC configuration information (properties) it would request the configuration through the org.onap.appc ConfigurationFactory.getConfiguration method provided by appc-common. The first time this method is called a configuration is built from the system properties, default properties and appc.properties file and returned. Subsequent calls return the same configuration. While a mechanism exists allowing for the configuration to be updated, it has never been used. The end result is all APPC bundles use a static set of properties. In order to update a bundles configuration the appc.properties file would have to be modified and the bundle/s restarted. In some instances the entire ODL instance to would need to be shutdown and started in order for property changes to take effect.
New APPC configuration:
With the ODL and Karaf4 upgrades appc-common has been replaced with appc-common-bundle and all APPC projects should import (not embed) the appc-common-bundle.
...
The AppcConfigurationManager uses a file backed configuration registered with OSGI Configuration Admin. The configuration file used is {ODL-HOME}/etc/org.onap.appc.cfg. This file replaces the appc.properties file used previously. On Feature install of the onap-appc-common feature, if the org.onap.appc.cfg file does NOT exist it will be created with default properties.
The AppcConfigurationManager is started with appc-common-bundle. It registers as a managed service with OSGI Configuration Admin to listen for updates from Configuration Admin. The configuration can be modified in three ways.
- Modifying the org.onap.appc.cfg file: The org.onap.appc.cfg file is a tracked file, any modification to the configuration file by editing or replacing notifies Configuration Admin of the changes which in turn notifies AppcConfigurationManager.
- Through the Karaf console: configurations can be viewed and updated in the karaf console
- config:edit org.onap.appc.cfg – begins editing the APPC configuration
- config:property-list – list the current properties
- config:property-set {prop} {value} – sets the property prop to the value
- config:update – applies the changes notifying Configuration Admin to update
- Programmatically: it is possible to get and update the configuration through the ConfigurationAdmin API however that is beyond the scope of this document.
When the AppcConfigurationManager is updated by ConfigurationAdmin it creates an updated instance of the APPC Configuration and updates all AppcConfigurationListener instances registered as an OSGI service with the new configuration.
...