use of org.opennms.netmgt.events.api.annotations.EventHandler in project opennms by OpenNMS.
the class DataSender method handleRtcUnsubscribe.
/**
* Inform the data sender of the listener unsubscribing
*/
@EventHandler(uei = EventConstants.RTC_UNSUBSCRIBE_EVENT_UEI)
public void handleRtcUnsubscribe(Event event) {
List<Parm> list = event.getParmCollection();
if (list == null) {
LOG.warn("{} ignored - info incomplete (null event parms)", event.getUei());
return;
}
String url = null;
String parmName = null;
Value parmValue = null;
String parmContent = null;
for (Parm parm : list) {
parmName = parm.getParmName();
parmValue = parm.getValue();
if (parmValue == null)
continue;
else
parmContent = parmValue.getContent();
if (parmName.equals(EventConstants.PARM_URL)) {
url = parmContent;
}
}
// check that we got the required parameter
if (url == null) {
LOG.warn("{} did not have required information. Value of url: {}", event.getUei(), url);
} else {
unsubscribe(url);
LOG.debug("{} unsubscribed {}", event.getUei(), url);
}
}
use of org.opennms.netmgt.events.api.annotations.EventHandler in project opennms by OpenNMS.
the class SnmpPoller method primarychangeHandler.
/**
* <p>primarychangeHandler</p>
*
* @param event a {@link org.opennms.netmgt.xml.event.Event} object.
*/
@EventHandler(uei = EventConstants.PRIMARY_SNMP_INTERFACE_CHANGED_EVENT_UEI)
public void primarychangeHandler(Event event) {
LOG.debug("primarychangeHandler: managing event: {}", event.getUei());
getNetwork().delete(Long.valueOf(event.getNodeid()).intValue());
for (Parm parm : event.getParmCollection()) {
if (parm.isValid() && parm.getParmName().equals("newPrimarySnmpAddress")) {
scheduleNewSnmpInterface(parm.getValue().getContent());
return;
}
}
}
use of org.opennms.netmgt.events.api.annotations.EventHandler in project opennms by OpenNMS.
the class Statsd method handleReloadConfigEvent.
/**
* <p>handleReloadConfigEvent</p>
*
* @param e a {@link org.opennms.netmgt.xml.event.Event} object.
*/
@EventHandler(uei = EventConstants.RELOAD_DAEMON_CONFIG_UEI)
public void handleReloadConfigEvent(Event e) {
if (isReloadConfigEventTarget(e)) {
LOG.info("handleReloadConfigEvent: reloading configuration...");
EventBuilder ebldr = null;
LOG.debug("handleReloadConfigEvent: acquiring lock...");
synchronized (m_scheduler) {
try {
LOG.debug("handleReloadConfigEvent: lock acquired, unscheduling current reports...");
unscheduleReports();
m_reportDefinitionBuilder.reload();
LOG.debug("handleReloadConfigEvent: config remarshaled, unscheduling current reports...");
LOG.debug("handleReloadConfigEvent: reports unscheduled, rescheduling...");
start();
LOG.debug("handleRelodConfigEvent: reports rescheduled.");
ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_SUCCESSFUL_UEI, "Statsd");
ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "Statsd");
} catch (Throwable exception) {
LOG.error("handleReloadConfigurationEvent: Error reloading configuration", exception);
ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI, "Statsd");
ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "Statsd");
ebldr.addParam(EventConstants.PARM_REASON, exception.getLocalizedMessage().substring(1, 128));
}
if (ebldr != null) {
getEventForwarder().sendNow(ebldr.getEvent());
}
}
LOG.debug("handleReloadConfigEvent: lock released.");
}
}
Aggregations