Entering content frame

Procedure documentation Adding and Removing Listeners

Use

To 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.

Procedure

Adding a Listener

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:

Example

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.

Removing a Listener

When an application is released, it has to remove any listeners of the IConfigEventService:

Example

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();

}

 

 

Leaving content frame