use of com.iplanet.services.ldap.event.IDSEventListener in project OpenAM by OpenRock.
the class EventManager method addListeners.
/**
* This method starts the EventService of the UMS and registers two
* listeners EntryEventListener and ACIEventListener to the EventService
* inorder to receive notifications. Both the above listeners implement the
* <code>com.iplanet.services.ldap.event.
* IDSListener</code> interface.
* <p>
*
* NOTE: This method should be invoked only once.
*
* @throws AMEventManagerException
* when encounters errors in starting the underlying
* EventService.
*/
protected void addListeners(Map listeners) throws AMEventManagerException {
// Get a handle to the (singleton object) Event Manager
EventService eventService = null;
try {
if (debug.messageEnabled()) {
debug.message("EventManager.start() - Getting EventService" + " instance");
}
eventService = EventService.getEventService();
synchronized (eventService) {
if (!EventService.isStarted()) {
eventService.restartPSearches();
}
}
} catch (Exception e) {
debug.error("EventManager.start() Unable to get EventService ", e);
throw new AMEventManagerException(AMSDKBundle.getString("501"), "501");
}
// Initialize the listeners
if (eventService != null) {
// If "null" then disabled!!
for (Class<? extends IDSEventListener> listenerClass : PSEARCH_LISTENERS) {
IDSEventListener pSearchListener = eventService.getListener(listenerClass);
if (pSearchListener != null) {
pSearchListener.setListeners(listeners);
debug.message("EventManager.start() - Added listeners to " + "pSearch Listener: " + listenerClass.getSimpleName());
}
}
}
}
Aggregations