Project reality updating shortcuts
The last part is to simply call the setter with the value from the config and call refresh after all settings were made. The last step is to register the Config Updater in the Activator.start.We simply use register Service like for every other service.Having trouble finding a particular photo from your family trip four years ago?Finding yourself with multiple copies of the same document and not sure which edits are the latest?The Dictionary is identified by a persistent identifier (pid).This is simply a String that should uniquely identify the configuration.If your bundle can not start without config then it is a good idea to create the pojo class to be configured on the first update received.As we want to implement a clean style of how to work with configuration the class to be configured should be a pure pojo.
In this tutorial we will cover ussing the Config Admin Service with pure OSGi and blueprint and how to automatically deploy config files with your bundles.
Additionally I added a refresh method that should be called after all configuration was changed.
So our goal is to configure the title when the configuration changes and then call refresh. The first practical part in this tutorial shows how to use the config admin service using just OSGi interfaces.
The only special thing is that you have to set the property SERVICE_PID to your config pid so the Config Admin Service knows what config you want to watch. Calling list in the Karaf console you should be able to see that the bundle is indeed started but it will not do create any output as there is no config. Now the fileinstall bundle will detect the new file in etc.
We still need to create the config file and set the title. As the ending is it will consider it to be a config admin resource and create or update the Config Admin Service configuration with the pid determined from the file name.
Search for project reality updating shortcuts:
We simply define a cm:property-placeholder element. This works similar to property place holder with files but works with the Config Admin Service.