Search in sources :

Example 1 with ConfigFileApplicationContext

use of org.opennms.netmgt.correlation.drools.ConfigFileApplicationContext in project opennms by OpenNMS.

the class RuleSet method constructEngine.

public CorrelationEngine constructEngine(Resource basePath, ApplicationContext appContext, EventIpcManager eventIpcManager, MetricRegistry metricRegistry) {
    final ApplicationContext configContext = new ConfigFileApplicationContext(basePath, getConfigLocation(), appContext);
    final DroolsCorrelationEngine engine = new DroolsCorrelationEngine(getName(), metricRegistry);
    engine.setAssertBehaviour(getAssertBehaviour());
    engine.setEventProcessingMode(getEventProcessingMode());
    engine.setPersistState(getPersistState());
    engine.setEventIpcManager(eventIpcManager);
    engine.setScheduler(new ScheduledThreadPoolExecutor(1));
    engine.setInterestingEvents(getInterestingEvents());
    engine.setRulesResources(getRuleResources(configContext));
    engine.setGlobals(getGlobals(configContext));
    try {
        engine.initialize();
        return engine;
    } catch (final Throwable e) {
        throw new RuntimeException("Unable to initialize Drools engine " + getName(), e);
    }
}
Also used : ConfigFileApplicationContext(org.opennms.netmgt.correlation.drools.ConfigFileApplicationContext) ApplicationContext(org.springframework.context.ApplicationContext) ConfigFileApplicationContext(org.opennms.netmgt.correlation.drools.ConfigFileApplicationContext) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) DroolsCorrelationEngine(org.opennms.netmgt.correlation.drools.DroolsCorrelationEngine)

Aggregations

ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)1 ConfigFileApplicationContext (org.opennms.netmgt.correlation.drools.ConfigFileApplicationContext)1 DroolsCorrelationEngine (org.opennms.netmgt.correlation.drools.DroolsCorrelationEngine)1 ApplicationContext (org.springframework.context.ApplicationContext)1