* @param mediatorName
* name of the <code>Mediator</code> instance to be removed.
*/
public IMediator removeMediator(String mediatorName) {
// Retrieve the named mediator
IMediator mediator = mediatorMap.get(mediatorName);
if(mediator != null) {
// for every notification this mediator is interested in...
String[] interests = mediator.listNotificationInterests();
for (int i=0; i<interests.length; i++) {
// remove the observer linking the mediator
// to the notification interest
removeObserver(interests[i], mediator);
}
// remove the mediator from the map
mediatorMap.remove(mediatorName);
// alert the mediator that it has been removed
mediator.onRemove();
}
return mediator;
}