[rules-users] Does not execute => builder.addPackageFromDrl(new InputStreamReader(this.getClass().getResourceAsStream(ruleFile)))
mikexr
mike at bigfatnuthin.com
Thu May 6 15:15:08 EDT 2010
Noe using drools 5.
On May 6, 2010 12:08 PM, "salaboy [via Drools - Java Rules Engine]" <
ml-node+781968-2097692314-238069 at n3.nabble.com<ml-node%2B781968-2097692314-238069 at n3.nabble.com>>
wrote:
Are you using Drools 4.x for a particular reason? I suggest you to try with
5.x
On Thu, May 6, 2010 at 2:56 PM, mikexr <[hidden
email]<http://user/SendEmail.jtp?type=node&node=781968&i=0>
> wrote:
>
> I am trying to execute a proof of concept. I have some code that runs a
> rule. It works in Eclipse, but for some reason doesnt in Netbeans. I want
> to get it working within a POJO Service Engine in Glassfish ESB and have is
> execute as part of a BPEL orchestration. It does not throw an exception,
> but it steps over that one piece of code
>
> public void xmlImpl(String is) throws JAXBException,
> FileNotFoundException, Exception {
> try {
> // unmarshal xml file
>
> // JAXBElement<EnrollmentRequest> enrollment =
> jaxbUnmarshalFromInputStream(is);
> EnrollmentRequest enrollment = jaxbUnmarshalFromInputStream(is);
>
> // setup rules engine
> RuleRunner rule = new RuleRunner();
>
> String[] rules = {"../rules/834rules.drl"};
> // execute rules on xml file
>
> try {
>
>
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> PackageBuilder builder = new PackageBuilder();
>
>
> for (String ruleFile : rules) {
> System.out.println("Loading file: " + ruleFile);
> builder.addPackageFromDrl(new
> InputStreamReader(this.getClass().getResourceAsStream(ruleFile)));
> }
>
> Package pkg = builder.getPackage();
> ruleBase.addPackage(pkg);
>
> WorkingMemory workingMemory = ruleBase.newStatefulSession();
> Object fact = new Object();
> fact.equals(enrollment);
> System.out.println("Inserting fact: " + fact);
> workingMemory.insert(fact);
>
> System.out.println("Firing Rules");
> workingMemory.fireAllRules();
>
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> // marshall changes out to xml file
>
> jaxbMarshalToOutputStream(enrollment, new
>
> FileOutputStream("F:/data/workspaces/enrollmentPOC/data/xmlenrollment.xml"));
>
> } catch (JAXBException je) {
> je.printStackTrace();
> } catch (IOException ioe) {
> ioe.printStackTrace();
> } finally {
> try {
> } catch (Exception ex) {
>
>
> java.util.logging.Logger.getLogger("global").log(java.util.logging.Level.SEVERE,
> null, ex);
> }
> return;
> }
>
> }
>
>
> If anyone has any suggestions I would appreciate them. At this point I'm
> stuck
>
> Thanks
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781934.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=781968&i=1>
> https://lists.jboss.org/mailman/listinfo/rules-users
>
--
- http://salaboy.wordpress.com
- http://www.jbug.com.ar
- Salatino "Salaboy" Mauricio -
_______________________________________________
rules-users mailing list
[hidden email] <http://user/SendEmail.jtp?type=node&node=781968&i=2>
https://lists.jboss.org/mailman/listinfo/rules-users
------------------------------
View message @
http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p781968.html
To unsubscribe from Does not execute => builder.addPackageFromDrl(new
InputStreamReader(this.getClass().getResourceAsStream(ruleFile))), click
here<http://drools-java-rules-engine.46999.n3.nabble.com/subscriptions/Unsubscribe.jtp?code=bWlrZUBiaWdmYXRudXRoaW4uY29tfDc4MTkzNHwyMDQzOTAwMDY2>.
--
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Does-not-execute-builder-addPackageFromDrl-new-InputStreamReader-this-getClass-getResourceAsStream-r-tp781934p782001.html
Sent from the Drools - User mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100506/ecc5fa51/attachment.html
More information about the rules-users
mailing list