<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 &quot;run your API calls before parsing/compiling the content of the DRL editor&quot;. 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<br><br><div class="gmail_quote">
2009/7/15 Asif Iqbal <span dir="ltr">&lt;<a href="mailto:Asif.Iqbal@infor.com">Asif.Iqbal@infor.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">










<div link="blue" vlink="blue" lang="EN-US">

<div>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Edson,</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for your replies they have really
helped. </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p style="margin-left: 0.5in; text-indent: -0.25in;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"><span>1)<font face="Times New Roman" size="1"><span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></font></span></span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">I am still not sure about creating a new operator, since the ‘&gt;=’
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></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p style="margin-left: 0.5in; text-indent: -0.25in;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"><span>2)<font face="Times New Roman" size="1"><span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></font></span></span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; 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 ‘&gt;=’ evaluator or created a new evaluator so that ‘&gt;=’
 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></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p style="margin-left: 0.5in; text-indent: -0.25in;"><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"><span>3)<font face="Times New Roman" size="1"><span style="font-family: &quot;Times New Roman&quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;">       </span></font></span></span></font><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Wouldn’t the following also add the evaluator definition by
replacing the existing one.. </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  <u>PackageBuilderConfiguration</u>
pkgb = </span></font><b><u><font color="#7f0055" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85); font-weight: bold;">new</span></font></u></b><u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">
PackageBuilderConfiguration()</span></font></u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">;               </span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  <u>pkgb.getEvaluatorRegistry()</u>.<u>addEvaluatorDefinition</u>(</span></font><b><font color="#7f0055" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85); font-weight: bold;">new </span></font></b><font color="black" face="Courier New" size="2"><span style="background: silver none repeat scroll 0% 0%; font-size: 10pt; font-family: &quot;Courier New&quot;; color: black; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">ComparableEvaluatorsDefinition</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">());</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  <u><span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">PackageBuilder</span></u> builder = </span></font><b><u><font color="#7f0055" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(127, 0, 85); font-weight: bold;">new</span></font></u></b><u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> <span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;">PackageBuilder</span>(pkgb)</span></font></u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">;</span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> </span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  <u>builder.addPackageFromDrl(source)</u>;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  <u>Package</u>
pkg = <u>builder.getPackage()</u>;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  </span></font><font color="#3f7f5f" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(63, 127, 95);">// Add the package to a <u>rulebase</u>
(deploy the rule package).</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>

<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  </span></font><font color="#0000c0" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 192);">rules</span></font><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;"> = <u>RuleBaseFactory.<i><span style="font-style: italic;">newRuleBase</span></i>()</u>;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>


<p style=""><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">                  </span></font><u><font color="#0000c0" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: rgb(0, 0, 192);">rules</span></font></u><u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">.addPackage(pkg)</span></font></u><font color="black" face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;; color: black;">;</span></font><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font></p>


<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;">Thanks for your help…</span></font></p>

<p><font color="navy" face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial; color: navy;"> </span></font></p>

<div>

<div style="text-align: center;" align="center"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">

<hr align="center" size="2" width="100%">

</span></font></div>

<p><b><font face="Tahoma" size="2"><span style="font-size: 10pt; font-family: Tahoma; font-weight: bold;">From:</span></font></b><font face="Tahoma" size="2"><span style="font-size: 10pt; 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></p>

</div><div><div></div><div class="h5">

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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</span></font></p>

<div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">2009/7/14 Edson Tirelli &lt;<a href="mailto:tirelli@post.com" target="_blank">tirelli@post.com</a>&gt;</span></font></p>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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</span></font></p>

<div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;">2009/7/14 Asif Iqbal &lt;<a href="mailto:Asif.Iqbal@infor.com" target="_blank">Asif.Iqbal@infor.com</a>&gt;</span></font></p>

<div>

<div>

<div link="blue" vlink="purple">

<div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">Hi,</span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB"> </span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">What
I need to do is modify one of the evaluator classes specifically
‘&lt;=’, 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></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB"> </span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">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></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB"> </span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">Cheers</span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB"> </span></font></p>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">I</span></font></p>

</div>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"> </span></font></p>

</div>

</div>

<p style="margin-bottom: 12pt;"><font face="Times New Roman" size="3"><span style="font-size: 12pt;">_______________________________________________<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></span></font></p>

</div>

<p><font color="#888888" face="Times New Roman" size="3"><span style="font-size: 12pt; color: rgb(136, 136, 136);"><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></p>

</div>

<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;"><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></p>

</div></div></div>

</div>


<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>
<br></blockquote></div><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><br>