use of org.opennms.netmgt.correlation.drools.config.EngineConfiguration in project opennms by OpenNMS.
the class DroolsCorrelationEngine method reloadConfig.
@Override
public void reloadConfig() {
EventBuilder ebldr = new EventBuilder(EventConstants.RELOAD_DAEMON_CONFIG_SUCCESSFUL_UEI, getName());
ebldr.addParam(EventConstants.PARM_DAEMON_NAME, "DroolsCorrelationEngine-" + m_name);
try {
LOG.info("Reloading configuration for engine {}", m_name);
EngineConfiguration cfg = JaxbUtils.unmarshal(EngineConfiguration.class, m_configPath);
Optional<RuleSet> opt = cfg.getRuleSetCollection().stream().filter(rs -> rs.getName().equals(getName())).findFirst();
if (opt.isPresent()) {
marshallStateToDisk(true);
opt.get().updateEngine(this);
initialize();
} else {
ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI);
ebldr.addParam(EventConstants.PARM_REASON, "RuleSet not found on " + m_configPath);
}
} catch (Exception e) {
ebldr.setUei(EventConstants.RELOAD_DAEMON_CONFIG_FAILED_UEI);
ebldr.addParam(EventConstants.PARM_REASON, e.getMessage());
} finally {
sendEvent(ebldr.getEvent());
}
}
Aggregations