<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks a lot Edson, you have been a big
help.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>And yeah I figured as much regarding the
Eclipse IDE. Will try the approach you suggested.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Again thanks a lot.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <b><span style='font-weight:bold'>On
Behalf Of </span></b>Edson Tirelli<br>
<b><span style='font-weight:bold'>Sent:</span></b> 15 July 2009 14:47<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Users List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Getting
hold of the Evaluator Registry</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
Hmm, strange, I could swear those operators supported strings...
but looking at the code, it is not there... :( anyway, patch welcome... ;)<br>
<br>
Regarding your questions:<br>
<br>
1. Yes, in this case you could simply override the operators adding the support
to Strings. <br>
<br>
2. In Drools, any configuration can be done in one of 3 ways: system property,
configuration file or API. They all work the same, the only difference being
the Eclipse IDE: the eclipse IDE only picks up configurations on the
configuration file. So, if you configure a custom operator using the API, your
application will run just fine, BUT the eclipse DRL editor will show an error
because it does not "run your API calls before parsing/compiling the
content of the DRL editor". So, the best way to do it when working with
the IDE is simply write configurations like this in the following file in the
classpath of your eclipse project:<br>
<br>
META-INF/drools.packagebuilder.conf<br>
<br>
3. Yes, it will, but that is the old API. The recommended way for Drools 5 is
to use the public APIs in the drools-api module.<br>
<br>
[]s<br>
Edson<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>2009/7/15 Asif Iqbal <<a href="mailto:Asif.Iqbal@infor.com">Asif.Iqbal@infor.com</a>><o:p></o:p></span></font></p>
<div link=blue vlink=blue>
<div>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Edson,</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Thanks for your replies they have really helped. </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p style='margin-left:.5in;text-indent:-.25in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>1)</span></font><font
size=1 color=navy><span style='font-size-adjust: none;font-stretch: normal'><span
style='font-size:7.0pt;color:navy'> </span></span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>I am still not sure about creating a new operator, since the
‘>=’ operator already exists it just does not cater for strings,
which I want to add. So would creating a new operator cause the existing one to
be overrriden when added to the registry? </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p style='margin-left:.5in;text-indent:-.25in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>2)</span></font><font
size=1 color=navy><span style='font-size-adjust: none;font-stretch: normal'><span
style='font-size:7.0pt;color:navy'> </span></span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>Having looked at the examples and tests you emailed, I am still
unsure how to actually wire in the changes, say for example I have replaced the
existing ‘>=’ evaluator or created a new evaluator so that
‘>=’ now handles strings. When writing rules will the
engine pick this up?.. or do I need to create a new jar by building?.. or do I
need to update a configuration file?... im just not sure…</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p style='margin-left:.5in;text-indent:-.25in'><font size=2 color=navy
face=Arial><span style='font-size:10.0pt;font-family:Arial;color:navy'>3)</span></font><font
size=1 color=navy><span style='font-size-adjust: none;font-stretch: normal'><span
style='font-size:7.0pt;color:navy'> </span></span></font><font
size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:Arial;
color:navy'>Wouldn’t the following also add the evaluator definition by replacing
the existing one.. </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
<u>PackageBuilderConfiguration</u> pkgb = </span></font><b><u><font size=2
color="#7f0055" face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055;font-weight:bold'>new</span></font></u></b><u><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> PackageBuilderConfiguration()</span></font></u><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>;
</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
<u>pkgb.getEvaluatorRegistry()</u>.<u>addEvaluatorDefinition</u>(</span></font><b><font
size=2 color="#7f0055" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055;font-weight:bold'>new </span></font></b><font
size=2 color=black face="Courier New"><span style='-moz-background-clip: border;
-moz-background-origin: padding;-moz-background-inline-policy: continuous;
background-attachment:scroll;background-position-x:0%;background-position-y:
0%'><span style='font-size:10.0pt;font-family:"Courier New";color:black;
background:silver'>ComparableEvaluatorsDefinition</span></span></font><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>());</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
<u><span style='-moz-background-clip: border;-moz-background-origin: padding;
-moz-background-inline-policy: continuous;background-attachment:scroll;
background-position-x:0%;background-position-y:0%'><span style='background:
silver'>PackageBuilder</span></span></u> builder = </span></font><b><u><font
size=2 color="#7f0055" face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055;font-weight:bold'>new</span></font></u></b><u><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> <span style='background:silver'><span
style='-moz-background-clip: border;-moz-background-origin: padding;-moz-background-inline-policy: continuous;
background-attachment:scroll;background-position-x:0%;background-position-y:
0%'>PackageBuilder</span></span>(pkgb)</span></font></u><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>;</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
<u>builder.addPackageFromDrl(source)</u>;</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
<u>Package</u> pkg = <u>builder.getPackage()</u>;</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
</span></font><font size=2 color="#3f7f5f" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>// Add the
package to a <u>rulebase</u> (deploy the rule package).</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
</span></font><font size=2 color="#0000c0" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>rules</span></font><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'> = <u>RuleBaseFactory.<i><span style='font-style:
italic'>newRuleBase</span></i>()</u>;</span></font><o:p></o:p></p>
<p><font size=2 color=black face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>
</span></font><u><font size=2 color="#0000c0" face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>rules</span></font></u><u><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt;font-family:
"Courier New";color:black'>.addPackage(pkg)</span></font></u><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New";
color:black'>;</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Thanks for your help…</span></font><o:p></o:p></p>
<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'> </span></font><o:p></o:p></p>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center>
</span></font></div>
<p><b><font size=2 face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
font-weight:bold'>From:</span></font></b><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'> <a
href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>
[mailto:<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Edson Tirelli<br>
<b><span style='font-weight:bold'>Sent:</span></b> 14 July 2009 23:05<br>
<b><span style='font-weight:bold'>To:</span></b> Rules Users List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [rules-users] Getting
hold of the Evaluator Registry</span></font><o:p></o:p></p>
</div>
<div>
<div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
<p style='margin-bottom:12.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><br>
I am working in one example of drools features where I implement a
custom evaluator here:<br>
<br>
<a
href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/lotrc/src/main/java/org/drools/examples/lotrc/evaluators/IsAdjacentToEvaluatorDefinition.java"
target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/lotrc/src/main/java/org/drools/examples/lotrc/evaluators/IsAdjacentToEvaluatorDefinition.java</a><br>
<br>
I use the configuration file instead of API in the example:<br>
<br>
<a
href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/lotrc/src/main/resources/META-INF/drools.packagebuilder.conf"
target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/contrib/lotrc/src/main/resources/META-INF/drools.packagebuilder.conf</a><br>
<br>
[]s<br>
Edson<o:p></o:p></span></font></p>
<div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>2009/7/14
Edson Tirelli <<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>><o:p></o:p></span></font></p>
<p style='margin-bottom:12.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'><br>
Asif,<br>
<br>
My recommendation is create a new operator for you instead of
overriding existing ones. Although if you really want to replace the existing
ones, setting the property or calling the API to register a new operator will
override the default.<br>
<br>
See:<br>
<br>
<a
href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java"
target="_blank">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/builder/KnowledgeBuilderConfigurationTest.java</a><br>
<br>
Test method:<br>
<br>
testEvaluatorConfiguration()<br>
<br>
[]s<br>
Edson<o:p></o:p></span></font></p>
<div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'>2009/7/14
Asif Iqbal <<a href="mailto:Asif.Iqbal@infor.com" target="_blank">Asif.Iqbal@infor.com</a>><o:p></o:p></span></font></p>
<div>
<div>
<div link=blue vlink=purple>
<div>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>Hi,</span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'> </span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>What
I need to do is modify one of the evaluator classes specifically
‘<=’, so that it can handle strings. Now I know I need to create
a class similar to ComparableEvaluatorDefinition. But what I want to do is
replace the existing one in the evaluator registry with my implementation which
will include the additional String capability.</span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'> </span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>From
my understanding that should be all that is required. Unless im missing
something… now all I need to know is how do I get hold of the evaluator
registry?</span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'> </span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>Cheers</span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'> </span><o:p></o:p></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>I</span><o:p></o:p></font></p>
</div>
</div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> <o:p></o:p></span></font></p>
</div>
</div>
<p style='margin-bottom:12.0pt'><font size=3 face="Times New Roman"><span
style='font-size:12.0pt'>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><o:p></o:p></span></font></p>
</div>
<p><font size=3 color="#888888" face="Times New Roman"><span style='font-size:
12.0pt;color:#888888'><br>
<br clear=all>
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a></span></font><o:p></o:p></p>
</div>
<p><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
<br clear=all>
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><o:p></o:p></span></font></p>
</div>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><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><o:p></o:p></span></font></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><br>
<br clear=all>
<br>
-- <br>
Edson Tirelli<br>
JBoss Drools Core Development<br>
JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><o:p></o:p></span></font></p>
</div>
</body>
</html>