<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
Hi Edson,<br>
<br>
Many thanks for you answer!<br>
It is surprising that, on one hand, the
"drools.default.packagebuilder.conf" file contains... :<br>
<br>
<tt>&nbsp;&nbsp;&nbsp; drools.evaluator.soundslike =
org.drools.base.evaluators.SoundslikeEvaluatorsDefinition<br>
</tt><br>
... and on the other hand, EvaluatorRegistry.java contains:<br>
<br>
<tt>&nbsp;&nbsp; this.addEvaluatorDefinition( new
SoundslikeEvaluatorsDefinition() );<br>
</tt><br>
and the source code for the Soundslike operator contains:<br>
<br>
<tt>&nbsp;&nbsp;&nbsp; public static final Operator&nbsp; SOUNDSLIKE =
Operator.addOperatorToRegistry( "soundslike", false );<br>
</tt><br>
All of this, at first sight, let me puzzled on how to really plug a
custom operator. I'll give a try with the property file!<br>
<br>
Any intuition ;-) of how difficult it might be to modify (besides
SuggestionCompletionEngine and HumanReadable) the business rule editor
Eclipse plugin for a "gentle" integration of the operator? <br>
<br>
Best regards,<br>
<br>
Bruno.<br>
<br>
<br>
Edson Tirelli a &eacute;crit&nbsp;:
<blockquote
 cite="mid:AANLkTikUEwnKRsPrcKkFMu6jgdXVf=gdaou9TykZN0NX@mail.gmail.com"
 type="cite">
  <pre wrap="">    The instantiation is done automatically, based on configuration or
API call. More details in here:

<a class="moz-txt-link-freetext" href="http://blog.athico.com/2010/06/creating-pluggable-oprators.html">http://blog.athico.com/2010/06/creating-pluggable-oprators.html</a>

    But basically, for eclipse to pick it up, best to add to a
configuration file:

drools.evaluator.MyIdentifierForMyOperators = my.pkg.MyEvaluatorDefinition

    Please note that all drools operators are implemented like that
and wired through configuration file as seen here:

<a class="moz-txt-link-freetext" href="https://svn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools.default.packagebuilder.conf">https://svn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-compiler/src/main/resources/META-INF/drools.default.packagebuilder.conf</a>

    So, adding your own custom operators is no different. Just define
your own configuration file in the META-INF directory of your
application package and it will work.

    Edson

2010/10/25 Swindells, Thomas <a class="moz-txt-link-rfc2396E" href="mailto:TSwindells@nds.com">&lt;TSwindells@nds.com&gt;</a>:
  </pre>
  <blockquote type="cite">
    <pre wrap="">For that to work the class also needs to be instantiated - ie it would only get created once something in eclipse has touched the class.

Thomas

    </pre>
    <blockquote type="cite">
      <pre wrap="">-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</a> [<a class="moz-txt-link-freetext" href="mailto:rules-users">mailto:rules-users</a>-
<a class="moz-txt-link-abbreviated" href="mailto:bounces@lists.jboss.org">bounces@lists.jboss.org</a>] On Behalf Of Edson Tirelli
Sent: 25 October 2010 14:58
To: Rules Users List
Subject: Re: [rules-users] Custom operator

&nbsp; &nbsp;If you look at the implementation of one of the existing operators
(e.g. MatchesEvaluatorDefinition) you will see this in the beginning
of the class:

public static final Operator &nbsp;MATCHES &nbsp; &nbsp; &nbsp; =
Operator.addOperatorToRegistry( "matches", false );

&nbsp; &nbsp;Do the same on your own implementations and it should be fine.

&nbsp; &nbsp; Edson



2010/10/25 Bruno Freudensprung <a class="moz-txt-link-rfc2396E" href="mailto:bruno.freudensprung@temis.com">&lt;bruno.freudensprung@temis.com&gt;</a>:
      </pre>
      <blockquote type="cite">
        <pre wrap="">Hello,

It seems that the logic behind the "operator" drop-down list comes from
the
"org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine"
and "org.drools.eclipse.rulebuilder.modeldriven.HumanReadable" classes.
That's for the "rule authoring" perspective.
I've also seen that the business rule editor involves the DrlParser
class. So, in a "rule parsing" perspective, I guess I need to find a way
to register my custom operator into the EvaluatorRegistry used by the
Eclipse plugin (and I don't know where this can be done).

Do you think I am on the right track? Is there a risk that code
modifications will involve so many classes that, in the end, adding a
custom operator to the business rule editor will be a difficult task for
someone very new to Drools (like me)?

Thanks in advance,
Best regards,

Bruno.

Bruno Freudensprung a &eacute;crit :
        </pre>
        <blockquote type="cite">
          <pre wrap="">Hello,

I'd like to implement a custom "lucenematches" operator that would
enable writing conditions like:
$d : Doc(text lucenematches "(foo AND bar) OR roam~0.8")

As I've taken a look at the following post on athico
(<a class="moz-txt-link-freetext" href="http://blog.athico.com/2009/05/imperfect-evaluations.html">http://blog.athico.com/2009/05/imperfect-evaluations.html</a>), and seen
that the appendix B of the "Drools JBoss Rules 5.0 Developer's Guide"
book that deals with custom operators, I am rather confident that I will
find my way in implementing my operator (if not, I'll post here again :-)).

However, I wonder if it will be possible to add my "lucenematches"
operator to the "operator" drop-down list of the Eclipse's Business Rule
Editor.
Does anyone have an idea?

Best regards,

Bruno.
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>


          </pre>
        </blockquote>
        <pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>

        </pre>
      </blockquote>
      <pre wrap="">

--
&nbsp; Edson Tirelli
&nbsp; JBoss Drools Core Development
&nbsp; JBoss by Red Hat @ <a class="moz-txt-link-abbreviated" href="http://www.jboss.com">www.jboss.com</a>

_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
      </pre>
    </blockquote>
    <pre wrap="">
**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the <a class="moz-txt-link-abbreviated" href="mailto:postmaster@nds.com">postmaster@nds.com</a> and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************

_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->


  </pre>
</blockquote>
<br>
</body>
</html>