[rules-users] APIs to create rules

Mark Proctor mproctor at codehaus.org
Tue Jan 17 21:47:44 EST 2012


Just generate a string with a template. You can use drools-templates 
which is based on MVEL templating.

There is also the descr builder api too that you can use, see release 
notes in documentation.


Mark
On 16/01/2012 09:43, bobbi_80 wrote:
> public static class CpuTracker{
>          private String machinename;
>          private String averageCPU;
> }
>
> Consider the following rule :
>
> rule first_rule
> @ID(“1”)
> 	when
> 		averageCPU>  80
> 	then
> 		syso("do something");
> end
> 			
>
> I have the following requirements to let the user change the rules.
>
> 1)	Create an app that will accept user input for rule Name, LHS , RHS of
> rule.
> 2)	Add/remove rules from the knowledge base at runtime.
> 3)	Display all compiled rules .
>
> For task(1) I am unable to figure out the exact APIs to programmatically
> create rules . Have gone through number of posts in user forums and docs but
> got nothing conclusive.
> For Task(3)  I could get rule name and any other meta data information but
> not LHS,RHS info. Does that mean that rules will have to be persisted and
> there are no APIs to fetch LHS/RHS at run time?
>
> What are my options here?
>
> Many Thanks,
> Dumb programmer!
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/APIs-to-create-rules-tp3662689p3662689.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list