if(descriptor == null)
throw new IllegalArgumentException("descriptor is null");
if(descriptor.eventID == null)
throw new UnknownEventException("Event ID is null");
EventHandler eHandler = eventTable.get(descriptor.eventID);
if(eHandler == null)
throw new UnknownEventException("Unknown event ID "+descriptor.eventID);
/* Prepare the RemoteEventListener */
RemoteEventListener preparedListener = (RemoteEventListener)listenerPreparer.prepareProxy(listener);
if(logger.isDebugEnabled())
logger.debug("Register listener {} for Event {}", preparedListener.toString(), descriptor.toString());
Object o = getServiceProxy();
if(!(o instanceof EventProducer)) {
String reason = "Proxy returned from getServiceProxy() does " +
"not implement "+EventProducer.class.getName();
logger.warn(reason);
throw new ClassCastException(reason);
}
return (eHandler.register(o, preparedListener, handback, duration));
}