[rules-users] Error uploading and reading rule files

Fnu Mahalakshmi FMahalakshmi at nyx.com
Mon Jun 14 16:31:29 EDT 2010


Hi Guys,

I have successfully converted my .brl file to a .drl file using the code below and added it to my rulebase.
The file gets created with the required .drl code (which resembles the view source of a guided business rule created in guvnor editor).

But the rule does not seem to be getting fired. I tried setting it to the most basic option which should work - doesn't work.
Please tell me if I am missing something.

My code is below:
  File file = new File("src/main/rules/Rule3.brl");
            String brl = null;
            String outputDRL =null;

                  BRXMLPersistence read = (BRXMLPersistence) BRXMLPersistence.getInstance();
                  BRDRLPersistence write = (BRDRLPersistence) BRDRLPersistence.getInstance();
                  brl = FileUtils.readFileToString(file);
                System.out.println("File content: " + brl);
                outputDRL = write.marshal(read.unmarshal(brl));
                String drlFilePath = "src/main/rules/drlFile.drl";
                String path = "/drlFile.drl";
                System.out.println("drlfile "+drlFilePath);
                File drlFile = new File(drlFilePath);
                FileUtils.writeStringToFile(drlFile, outputDRL);

                Reader source = new InputStreamReader( RuleRunner.class.getResourceAsStream(path) );
                addRulesToThisPackage.addPackageFromDrl(source);


The generated .drl file looks like this:

rule "Rule3"
      dialect "mvel"
      when
            B( name == "xyz" )
      then
            A fact0 = new a();
            fact0.setModified( true );
            insertLogical( fact0 );
end

I have my import statements in a file rule.package in the same directory as the rules files.

Please tell me if you can point out where my mistake is.?? I am clueless!

Thanks
M
</pre>

<P><hr size=1></P>
<P><STRONG><font color=green>Please consider the environment before printing this email.</font></STRONG></P>
<P><STRONG>Visit our website at <a href="http://www.nyse.com">http://www.nyse.com</a> <br>

*****************************************************************************
<br>
Note:  The information contained in this message and any attachment to it is privileged, confidential and protected from disclosure.  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by replying to the message, and please delete it from your system.  Thank you.  NYSE Euronext.

</STRONG></P><pre>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100614/553e7786/attachment.html 


More information about the rules-users mailing list