If you want to go this route you'll have to learn how the system works. First write some basic DRLS, then use the DrlParser to build a PackageDescr. PackageDescr is an intermediate AST that represent your rules with String for all the values. PackageBuilder can then build those PackageDescr. However I would still recommend you generate drls at runtime, with reflection on field names you can still achieve some level of refactoring.

Aeinehchi Nader wrote:
I would very much like to wire my application with the rule engine.  By doing this, I would benefit from compiler, refactoring,....  Let me an example:

Car car = new Car();

Fact requirement = new Fact(car.getSpeed() > 120);

if (requirement){
Rule rule = new Rule(car.isOverspeeding(true));

How does the above fit to DRL?  Can this be done in compile-time with DRL?  Or can it be done by using Drools API?


Vennlig hilsen/Best regards
Nader Aeinehchi
Sjefsarkitekt /Chief Architect 
EDB Business Partner Norge AS
Telefon: +47 22 52 80 80, Direkte + 47 23 32 02 88, mobil: +47 41 44 29 57
"EDB - En sterk og nær IT-partner"

-----Opprinnelig melding-----
Fra: på vegne av Mark Proctor
Sendt: lø 3/3/2007 2:48
Til: Rules Users List
Emne: Re: [rules-users] Writing rules using java..
Just generate a drl from your model using a template langauge such 
velocity, freemarker or stringtemplate. you can generate and load the 
drl at runtime, this is what the decision table does. You can program 
agains the API yourself, but its quite complex, and certainly not 
recommended for a noobie.

Kolla, Sandeep wrote:
Hi Rahul,

Its not about storing the whole file into the database.

I would have a Table representing the parameteres required to 
construct a rule.

For example.




Now while loading the rules the application basically should read from 
the DB, and construct the rules, as everything required to construct 
the rules is avaliable in the tables.

This requirement had come up because as the rules keep changing quite 
frequently, we don't want to bring down the application to load a new 
DRL file.

Hope you understood what I want to achieve.

Thanks much,


rules-users mailing list


_______________________________________________ rules-users mailing list