[rules-users] Convert .brl to .drl

Michael_S for_bachelor at web.de
Sat Mar 22 10:41:00 EDT 2008


import org.apache.commons.io.*; 
... 
String fileName = "firstGuidedRule.brl"; 
File file = new File(fileName); 
String fileAsString         = FileUtils.readFileToString(file); 
                        
BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance(); 
BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance(); 
              
String outputDRL = write.marshal(read.unmarshal(fileAsString));
...
 String drlFilePath = "drlFile.drl";
 File drlFile = new File(drlFilePath);
 FileUtils.writeStringToFile(drlFile, outputDRL);
 builder.addPackageFromDrl(new
InputStreamReader(RuleRunner.class.getResourceAsStream(drlFilePath)));
...

;-)



Michael_S wrote:
> 
> Hello!
> 
> I have found this:
> 
> ....you can use the following snippet of code to convert the brl to a drl
> rule:
> 
> BRXMLPersitence read = BRXMLPersitence.getInstance();
> BRDRLPersistence write = BRDRLPersistence.getInstance();
> String brl = ... read from the .brl file as needed...
> String outputDRL = write.marshall(read.unmarshal(brl));
> //then pass the outputDRL to the PackageBuilder as normal
> 
> Can you explain please: "String brl = ... read from the .brl file as
> needed..."
> for example if I have  "first.brl" and I want "first.drl"
> 
> Thank you... =)
> 
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 

-- 
View this message in context: http://www.nabble.com/Convert-.brl-to-.drl-tp16188505p16222258.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list