Using the Project Dynamic Configuration
The Application Platform runtime allows you to configure project properties dynamically through the ConfigurationAdmin service of Software AG Common Platform.
Before you start using the project dynamic configuration, keep in mind that in traditional Java projects configuration files, such as properties files, are loaded using the class/classloader of the currently executing method or thread. The configuration files are present in the classpath of the running program and they are accessible during runtime either with the project bundle that is published, or globally as part of the runtime container. However, if you are using this approach, you have to republish the project bundle, or restart the runtime container before you can update dynamically the properties file with an external service, for example the ConfigurationAdmin service of Software AG Common Platform.
To support dynamic updates in Application Platform project configuration, ensure the following during project development:
Keep the project’s properties file in the
src/main/config directory of the project.
Add a unique name to the project’s properties file. This name is used as a
persistent identifier (PID) that identifies the properties file.
Ensure that classes that need to dynamically update the properties file implement the
OSGi org.osgi.service.cm.ManagedService interface and the associated updated
Map properties callback method.
Ensure that classes that need to dynamically update the properties file are published as managed services, so that they can receive notifications about configuration file changes. For this purpose, you must use the
@Service annotation, which allows you to publish a class as an OSGi service. In the annotation, specify the following type as one of the exported interfaces:
org.osgi.service.cm.ManagedService.
Note that the project’s properties file is packaged with the published bundle in the container but it is extracted and stored in the following location of the common configuration store of the installed runtime: Software AG_directory \profiles\IS_default\configuration\com.softwareag.platform.config.propsloader.
Related Topics