[rules-users] How to create global functions?

David Sinclair dsinclair at chariotsolutions.com
Wed Apr 15 10:01:03 EDT 2009


Package scoped means that the function can only be used within the same rule
package. The package may be split across multiple DRLs, but as long as in
the same package, all would be able to access the function. See
documentation for more info

https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e4032


On Tue, Apr 14, 2009 at 6:32 PM, dhai <sdhari at hotmail.com> wrote:

>
> Thanks Mark.
>
> What do you mean by package scoped? In my scenario I have all rules with
> same package declaration but in various .DRL files. Is it possible I create
> common function in one file and use them in others? If yes, please write
> some code to explain it.
>
> We do not want to use Java static method as we have 2 different projects,
> one for authoring the rules and another business application will use the
> rules. By creating faction in Java classes add dependencies for the rules.
> We will need to deploy Java classes with the rules.
>
>
> Mark Proctor wrote:
> >
> > dhai wrote:
> >> Is it possible to create functions global and call them from various
> .drl
> >> files? I have common code that I want to call from various consequences
> >> of
> >> rules written in separate .drl files. I do not want to write helper Java
> >> class.
> >>
> > functions are currently scoped to their package namespace. You can
> > always use static methods on a class in external java code and import
> > those from any .drl.
> >
> > Mark
> >
> >
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-create-global-functions--tp23031639p23049316.html
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090415/2ce5e910/attachment.html 


More information about the rules-users mailing list