Collection<Object> facts, HashMap<String, Object> globals,
ILogger logger) throws DroolsParserException, IOException {
// Create a new stateless session
log.info("Creating new working memory");
StatelessKnowledgeSession workingMemory = preBuiltKnowledgeBase
.newStatelessKnowledgeSession();
log.info("Checking for globals");
if (globals != null) {
for (String o : globals.keySet()) {
log.info("Inserting global name: " + o + " value:"
+ globals.get(o));
workingMemory.setGlobal(o, globals.get(o));
}
}
// Add the logger
log.info("Inserting handle to logger (via global)");
workingMemory.setGlobal("log", logger);
log.info("Using facts:" + facts);
log
.info("==================== Calling Rule Engine ====================");
// Fire using the facts
workingMemory.execute(facts);
log.info("==================== Rules Complete ====================");
}