Hi guys,
I am converting a .brl file to a .drl file for loading to my rule base.
using following code:
File file = new File(rulesFiles);
String brl = null;
try{
BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();
BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();
brl = FileUtils.readFileToString(file);
System.out.println("File content: " + brl);
String outputDRL = write.marshal(read.unmarshal(brl));
String drlFilePath = "drlFile.drl";
File drlFile = new File(drlFilePath);
FileUtils.writeStringToFile(drlFile, outputDRL);
addRulesToThisPackage.addPackageFromDrl(new
InputStreamReader(RuleRunner.class.getResourceAsStream(drlFilePath)));
}catch (IOException e) {
e.printStackTrace();
}
I have downloaded org.apache.commons.io package from http://commons.apache.org/io/download_io.cgi site.
It does not contain .jar file for org.apache.commons.io.FileUtils. But contains .java file for the same.
I add it to my classpath and add import org.apache.commons.io.FileUtils to my import statements.
But I get this error:
xception in thread "main" java.lang.Error: Unresolved compilation problem:
FileUtils cannot be resolved
at com.org.RuleRunner.loadRuleFile(RuleRunner.java:70)//
at com.org.RuleRunner.loadRules(RuleRunner.java:45)
at com.org.RuleRunner.runStatelessRules(RuleRunner.java:102)
at com.org.RulesTest.main(RulesTest.java:40)
Could some one please tell me if there is an alternative way for converting/loading .brl files (business guided rule) to my knowledge base ?