!--a11y-->
Registering
ConfigurationChangedListener 
The com.sap.engine.frame.core.configuration.ConfigurationChangedListener interface enables a class that implements it to receive notifications when a configuration has been changed. The interface provides a single callback method – configurationChanged (ChangeEvent e), which is invoked when the changes are committed. The change notification is asynchronous.
To register a ConfigurationChangedListener, you must invoke the addConfigurationChangedListener() method on the ApplicationConfigurationHandler that you obtain when you connect to the Configuration Manager. In the configurationChanged() method you can refresh the changed data.

Do not open the notifying configuration in write mode in the implementation of the configurationChanged() method. In such a scenario the changes would not be committed, which would result in an exception because the method can only be called after commit.
The following example illustrates how you can use a ConfigurationChangedListener:

public class someClass implements ConfigurationChangedListener { ...
private void registerListener() { ...
//Obtain ApplicationConfigurationHandler Context ctx = new InitialContext(); ApplicationConfigHandlerFactory appCfgHdl = (ApplicationConfigHandlerFactory)ctx.lookup("ApplicationConfiguration"); ApplicationConfigurationHandler cfgHandler = appCfgHdl.getApplicationConfigurationHandler();
//register the current object as a listener to configuration "data": //[no commit is needed!] cfgHandler.addConfigurationChangedListener(this, "data"); ... }
...
public void configurationChanged(ChangeEvent event) {
//your reaction to the change event: //Get an ApplicationConfigurationHandler and read changed data } } |
