Is there a better way to handle Decision Table (XSL files) with Drools
version 4.0.7?
In Drools 2.1, I can do the following;
file = new File(dir, XSL_filename);
InputStream stream = null;
RuleBase ruleBase = null;
WorkingMemory wm = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = DecisionTableLoader.loadFromInputStream(stream);
WorkingMemory wm = ruleBase.newWorkingMemory();
} catch{ ...
}
In Drool 4.0.7, I tried the following
file = new File(dir, XSL_filename);
InputStream stream = null;
RuleBase ruleBase = null;
try {
stream = new FileInputStream(file);
} catch{...
}
try{
ruleBase = RuleBaseFactory.newRuleBase();
PackageBuilder builder = new PackageBuilder();
SpreadsheetCompiler sCompiler = new SpreadsheetCompiler();
String drl = sCompiler.compile(stream, InputType.XLS);
builder.addPackageFromDrl(new StringReader(drl));
ruleBase.addPackage(builder.getPackage());
WorkingMemory wm = ruleBase.newStatefulSession();
} catch{ ...
}
Thanks,
Hong