[rules-users] Cant seem to fire a dynamically added rule
Edson Tirelli
tirelli at post.com
Sun Mar 9 13:46:55 EDT 2008
Samir,
I had a look at the code you sent me and the problem is that you are not
adding the rule to the rulebase. In your ConnectionHandler.testDynamicRules()
method, you need to do:
ruleBase.addPackage( builder.getPackage() );
You probably incurred in this error because you are misusing the Package
objects. You should either remove the whole package from the rule base
before doing your merge or, what I think is best, create a package with the
"delta" rules you want to add.
So, instead of doing:
Package defaultPackage = pkg[0];
Do:
Package defaultPackage = new Package( pkg[0].getName() );
So, you are effectively creating a new Package object, but when you add
it to the rule base, it will be correctly merged into the existing one.
This also allows you to AVOID the lock you are doing here:
ruleBase.lock(); // no need for that if you use a new package
with the same name
packageDescr.addRule( ruleDescr );
builder.addPackage(packageDescr);
ruleBase.unlock(); // no need for that if you use a new
package with the same name
Hope it helps.
Edson
2008/3/8, Mark Proctor <mproctor at codehaus.org>:
>
> samirsss wrote:
>
> Hi Edson,
>
> I just saw Mark Proctor's message about filing bugs so that they get
> addressed in 4.0.5 and was wondering if the fix for this issue is also going
> to be in the same release? Thanks for being so proactive about the issues
> and having a quick turnaround time.
>
> yes it is, please try 4.0.x to be sure your bug is fixed.
>
> regards
> Samir
>
> samirsss wrote:
>
> Hi Edson,
>
> I did send you an email with the sample of how to recreate this issue and
> hopefully you can also find the issue and get a fix out. Meanwhile I am
> planning to write the new rule back to the rule file and re-initialize the
> Rulebase with the updated drl file, which works fine.
>
> -Samir
>
>
> Edson Tirelli-3 wrote:
>
> Can you please provide an executable, self contained test case? I will
> take a look.
>
> []s
> Edson
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080309/40775a98/attachment.html
More information about the rules-users
mailing list