<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=285001916-15042009><FONT face=Arial color=#0000ff size=2>You 
can use multiple drl files in one KnowledgeBase using KnowledgeBuilder.add. So, 
you can put your common functions in one drl file and reuse it with each of your 
other&nbsp;drl files. This is true for drools 4.x as well.</FONT></SPAN><SPAN 
class=285001916-15042009><FONT size=2></DIV></FONT></SPAN><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> David Sinclair 
[mailto:dsinclair@chariotsolutions.com] <BR><B>Sent:</B> Wednesday, April 15, 
2009 7:01 AM<BR><B>To:</B> Rules Users List<BR><B>Subject:</B> Re: [rules-users] 
How to create global functions?<BR></FONT><BR></DIV>
<DIV></DIV>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<BR><BR><A 
href="https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e4032">https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-expert/html_single/index.html#d0e4032</A><BR><BR><BR>
<DIV class=gmail_quote>On Tue, Apr 14, 2009 at 6:32 PM, dhai <SPAN 
dir=ltr>&lt;<A 
href="mailto:sdhari@hotmail.com">sdhari@hotmail.com</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote 
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid"><BR>Thanks 
  Mark.<BR><BR>What do you mean by package scoped? In my scenario I have all 
  rules with<BR>same package declaration but in various .DRL files. Is it 
  possible I create<BR>common function in one file and use them in others? If 
  yes, please write<BR>some code to explain it.<BR><BR>We do not want to use 
  Java static method as we have 2 different projects,<BR>one for authoring the 
  rules and another business application will use the<BR>rules. By creating 
  faction in Java classes add dependencies for the rules.<BR>We will need to 
  deploy Java classes with the rules.<BR><BR><BR>Mark Proctor 
  wrote:<BR>&gt;<BR>&gt; dhai wrote:<BR>&gt;&gt; Is it possible to create 
  functions global and call them from various .drl<BR>&gt;&gt; files? I have 
  common code that I want to call from various consequences<BR>&gt;&gt; 
  of<BR>&gt;&gt; rules written in separate .drl files. I do not want to write 
  helper Java<BR>&gt;&gt; class.<BR>&gt;&gt;<BR>&gt; functions are currently 
  scoped to their package namespace. You can<BR>&gt; always use static methods 
  on a class in external java code and import<BR>&gt; those from any 
  .drl.<BR>&gt;<BR>&gt; Mark<BR>&gt;<BR>&gt;<BR>&gt; 
  _______________________________________________<BR>&gt; rules-users mailing 
  list<BR>&gt; <A 
  href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR>&gt; 
  <A href="https://lists.jboss.org/mailman/listinfo/rules-users" 
  target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR>&gt;<BR>&gt;<BR><FONT 
  color=#888888><BR>--<BR>View this message in context: <A 
  href="http://www.nabble.com/How-to-create-global-functions--tp23031639p23049316.html" 
  target=_blank>http://www.nabble.com/How-to-create-global-functions--tp23031639p23049316.html</A><BR>Sent 
  from the drools - user mailing list archive at 
  Nabble.com.<BR><BR>_______________________________________________<BR>rules-users 
  mailing list<BR><A 
  href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A><BR><A 
  href="https://lists.jboss.org/mailman/listinfo/rules-users" 
  target=_blank>https://lists.jboss.org/mailman/listinfo/rules-users</A><BR></FONT></BLOCKQUOTE></DIV><BR></BODY></HTML>