[rules-users] issue with .drl file to .brl file conversion

Amninder amninder_kaur at infosys.com
Mon Aug 4 03:30:26 EDT 2008


i am trying to do the same thing but shows 
		String fileName = "D:/DROOLS/test/BRLtest/src/main/rules/myname.brl"; 
        File file = new File(fileName); 
        String empty="";
        String fileAsString=""; 
        fileAsString = FileUtils.readFileToString(file, empty); --->i need
to pass 2 parameters 
                                
        BRXMLPersistence read = (BRXMLPersistence)
BRXMLPersistence.getInstance(); 
        BRDRLPersistence write = (BRDRLPersistence)
BRDRLPersistence.getInstance(); 
                      
        String outputDRL = write.marshal(read.unmarshal(fileAsString)); 

        System.out.println(outputDRL); 

thus is there some error with the readfiletostring() methid being used.
ALso can you help me with the deployment of Drools  BRMS.war .



JigarP wrote:
> 
> Hi,
> 
>   I am using  below code to convert .brl to .drl. but i do not know that
> how it will put import statement and package name in our new .drl file
> which we define in rule.package file. which will be input for processing
> all rules.
> 
> Below is my code snippet. 
> 
> String fileName = "SampleTest.brl"; 
> 		File file = new File(fileName); 
> 		String fileAsString="";
> 			fileAsString = FileUtils.readFileToString(file);
> 		                        
> 		BRXMLPersistence read = (BRXMLPersistence)
> BRXMLPersistence.getInstance(); 
> 		BRDRLPersistence write = (BRDRLPersistence)
> BRDRLPersistence.getInstance(); 
> 		              
> 		String outputDRL = write.marshal(read.unmarshal(fileAsString)); 
> 
> System.out.println(outputDRL);
> String packagefile = resolvePackageFile(); 
> 
> final PackageBuilder builder = new PackageBuilder(); 
> try {
> 	builder.addPackageFromDrl( new StringReader(packagefile),new
> StringReader(fileName));
> } catch (DroolsParserException e) {
> 	e.printStackTrace();
> } catch (IOException e) {
> 	e.printStackTrace();
> } 
> 
> I have below questions.
> 
> 1) can we just write single rule using GUI Editor?(once it convert into
> .brl file ) or we can write multiple rules in same file using brl.
> 
> 2) How can we get actual .brl file from .drl file ( as it should have
> import, package and lots of rules). what is the procedure to achieve this.
> 
> Please reply so we can get real usage of Drool GUI Rule plug-in.
> 
> Regards,
> Jigar
> 
> 

-- 
View this message in context: http://www.nabble.com/issue-with-.drl-file-to-.brl-file-conversion-tp18684542p18806825.html
Sent from the drools - user mailing list archive at Nabble.com.




More information about the rules-users mailing list