use of org.opennms.netmgt.events.api.annotations.EventListener in project opennms by OpenNMS.
the class AnnotationBasedEventListenerAdapter method afterPropertiesSet.
/**
* <p>afterPropertiesSet</p>
*/
@Override
public void afterPropertiesSet() {
Assert.state(m_subscriptionService != null, "subscriptionService must be set");
Assert.state(m_annotatedListener != null, "must set the annotatedListener property");
EventListener listenerInfo = findEventListenerAnnotation(m_annotatedListener);
Assert.state(listenerInfo != null, "value of annotatedListener property of class " + m_annotatedListener.getClass() + " must be annotated as " + EventListener.class.getName());
if (m_name == null) {
m_name = listenerInfo.name();
}
if (m_logPrefix == null) {
if (listenerInfo.logPrefix() != null && !"".equals(listenerInfo.logPrefix())) {
m_logPrefix = listenerInfo.logPrefix();
} else {
m_logPrefix = m_name;
}
}
m_threads = listenerInfo.threads();
populatePreProcessorList();
populateUeiToHandlerMap();
populatePostProcessorList();
populateExceptionHandlersSet();
// register this class as an EventListener for all UEIs
if (m_ueiToHandlerMap.size() == 1 && EventHandler.ALL_UEIS.equals(m_ueiToHandlerMap.keySet().toArray()[0])) {
m_subscriptionService.addEventListener(this);
} else {
m_subscriptionService.addEventListener(this, new HashSet<String>(m_ueiToHandlerMap.keySet()));
}
}
Aggregations