/**
*
*/
package fr.dto;
import java.io.*;
import javax.swing.Box.Filler;
import org.apache.commons.io.FileUtils;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.brms.server.util.BRDRLPersistence;
import org.drools.brms.server.util.BRXMLPersistence;
import org.drools.compiler.PackageBuilder;
import org.drools.event.DebugWorkingMemoryEventListener;
import org.drools.rule.Package;
/**
* @author mazzaz
*
*/
public class RulesEngine {
private RuleBase rules;
private Reader source;
private boolean debug = false;
public RulesEngine(String rulesFile) throws RulesEngineException {
super();
try {
try
{
File file = null;
String brl =null;
file = new File(rulesFile);
BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();
BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();
System.out.println("read && write instance ok \n");
brl = FileUtils.readFileToString(file,"UTF-8");
System.out.println("le fichier contient"+ brl);
String outputDRL = write.marshal(read.unmarshal(brl));// code blocked here
String drlFilePath = "src/main/rules/Test_brl_to_drl.drl";
File drlFile = new File(drlFilePath);
FileUtils.writeStringToFile(drlFile,outputDRL,"");