!--a11y-->
Adding and Removing ListenersTo be notified about changes to configuration data, the portal application has to subscribe to the IconfigEventService and specify domains for which the application wants to receive notifications.
Specifying domains enables the configuration framework to perform preliminary filtering on the events that are sent to the listener. In this case, the listener receives only the events that are relevant to the application:

try { // get Configuration Service IConfigurationService configurationService = Configuration.getInstance(); IConfigEventService eventService = configurationService.getConfigEventServiceInstance();
// add listener on domain String[] domains = { "/com.sap.portal.prt.config" }; eventService.addConfigEventListener(this, domains); } catch (InitialConfigException e) { e.printStackTrace(); } catch (InvalidEntryException e) { e.printStackTrace(); } |
Elements of domains can be plug-ins, configurable or config items. Application registers the listener in the method init(IPortalComponentInitContext context) of the portal component.
When an application is released, it has to remove any listeners of the IConfigEventService:

try { // get Configuration Service IConfigurationService configurationService = Configuration.getInstance(); IConfigEventService eventService = configurationService.getConfigEventServiceInstance();
// remove listener eventService.removeConfigEventListener(this); } catch (InvalidEntryException e) { e.printStackTrace(); } catch (InitialConfigException e) { e.printStackTrace(); } |
