My project uses drools expert means (DRL) file. In the rules file, if the user wants to delete and update the rules, what should be done?
Rule file:
package com.sample;
import com.sample.Tuplebean;
import com.sample.DroolsBolt;
dialect "mvel"
rule "SafetyAlert-Critical"
when
t:Tuplebean(t.getSmoke() == true && t.getSmoke_density() == true && t.getTemperature() > 25.0)
then
DroolsBolt.insertToAlertLog("alert generated");
end
For example, the user wants to change the value of temperature to 30.0.
In my application i gone through same problem i fixed those problem by fallowing way , i am maintaining the all the rule file database.
I am keeping all the rule file in tables and i am loading every rule file based on the IMEI number(in my case i am generating one rule for one adaptor ie adaptor having unique IMEI number).
In below code first load the rule file from datbase and convert that string to the Resource beacuse Resource Factory accept only Resource as constructor argument. and store that in to the ksession and fire the rules.
For edit and delete operation i make one flag in database , if that flag is true again update the rule file to the database table. if it is false load the same old rule file.
Here your generating the rule file and save to the database table and if flag is true and again your re-generate the rule file.
Here your loaing the rule file from database and fire all the rules.