<!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.3132" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>Hi Felipe,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>I recall Edson saying that "Event" classes need to be
ascertained at (RETE) compilation time - which, I think, rules out the
API addition. </FONT></SPAN><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>I was hoping Edson, time permitting, would explain how
declarative (fact-centric class) imports currently work to generate an
ObjectTypeNode and therefore to understand how his proposal to create cached
ObjectTypeConf instances for Event-centric classes compares. My reasoning being
that if the process is similar the new event stuff should be no different;
simply having two ObjectTypeNodes - one for Events and another for Facts. See
attached.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>It's quite possible our exchanges have given Edson time to
come to his own conclusion and the solution is now being
coded!</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>With kind regards,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=184282714-12112007><FONT face=Arial
color=#0000ff size=2>Mike</FONT></SPAN></DIV><BR>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-dev-bounces@lists.jboss.org
[mailto:rules-dev-bounces@lists.jboss.org] <B>On Behalf Of </B>Felipe
Piccolini<BR><B>Sent:</B> 12 November 2007 13:25<BR><B>To:</B> Rules Dev
List<BR><B>Subject:</B> Re: [rules-dev] Determining if a class is an event or
not<BR></FONT><BR></DIV>
<DIV></DIV>Well,
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV> IMHO for the experience I have I suggest to implement both
solutions:</DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>-an API
insertEvet() so the user can implement the mechanism to manage</DIV>
<DIV>their rules knowing when a fact is an event or not.</DIV>
<DIV><SPAN class=Apple-tab-span style="WHITE-SPACE: pre"></SPAN>-an Interface
Event so when the user cant manage the flow asserting facts, when</DIV>
<DIV>he cant know when a fact is or not an event, then maybe he can wrap some
facts on this</DIV>
<DIV>interface and the API insert() internaly can check if the fact is an
event or not and call insertEvent if</DIV>
<DIV>necesary.</DIV>
<DIV><BR class=khtml-block-placeholder></DIV>
<DIV>:)</DIV>
<DIV><BR>
<DIV>
<DIV>On 08-11-2007, at 11:27, Anstis, Michael ((M.)) wrote:</DIV><BR
class=Apple-interchange-newline>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px">Here's my 2 cents - as a non-contributor to Drools
codebase ;-)</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">You could add insertEventFactTypeThingie to the
API? Then you need just</DIV>
<DIV style="MARGIN: 0px">check that the class has been declared as an event
in the DRL similar to</DIV>
<DIV style="MARGIN: 0px">what must already happen for normal DRL imports. I
personally don't have</DIV>
<DIV style="MARGIN: 0px">issue with implementing a marker interface (this is
what frameworks like</DIV>
<DIV style="MARGIN: 0px">Hibernate, EJB3 and Spring etc have been imposing
for years). What "wiring"</DIV>
<DIV style="MARGIN: 0px">does the POJO need to become an Event for use in
Drools? Are you trying to</DIV>
<DIV style="MARGIN: 0px">internalise too much at the risk of making the
event mechanism inflexible?</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Cheers,</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Mike</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">-----Original Message-----</DIV>
<DIV style="MARGIN: 0px">From: <A
href="mailto:rules-dev-bounces@lists.jboss.org">rules-dev-bounces@lists.jboss.org</A></DIV>
<DIV style="MARGIN: 0px">[<A
href="mailto:rules-dev-bounces@lists.jboss.org">mailto:rules-dev-bounces@lists.jboss.org</A>]
On Behalf Of Matthias</DIV>
<DIV style="MARGIN: 0px">Sent: 08 November 2007 13:09</DIV>
<DIV style="MARGIN: 0px">To: <A
href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</A></DIV>
<DIV style="MARGIN: 0px">Subject: Re: [rules-dev] Determining if a class is
an event or not</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Edson Tirelli <tirelli <at> post.com>
writes:</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<BLOCKQUOTE type="cite">
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>All, <SPAN class=Apple-converted-space> </SPAN>I reached a
point where I need to make a design decision and</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">would</DIV>
<DIV style="MARGIN: 0px">like your opinion about it. <SPAN
class=Apple-converted-space> </SPAN>Imagine the following scenario:
<SPAN class=Apple-converted-space> </SPAN>A user has a</DIV>
<DIV style="MARGIN: 0px">domain model like this:package a.b.c</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px">;public interface Event { ... }package
x.y.z;public class MyEvent</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">implements</DIV>
<DIV style="MARGIN: 0px">a.b.c.Event {...} <SPAN
class=Apple-converted-space> </SPAN>Then, in his DRL file he
writes:package p.q.r;import</DIV>
<DIV style="MARGIN: 0px">event</DIV>
<DIV style="MARGIN: 0px">a.b.c.*;<SPAN class=Apple-converted-space>
</SPAN>rule Xwhen</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>Event( ... )then<SPAN class=Apple-converted-space>
</SPAN>...end <SPAN class=Apple-converted-space> </SPAN>So, it is
clear that a.b.c.Event should</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">be</DIV>
<DIV style="MARGIN: 0px">handled as an event by the engine. <SPAN
class=Apple-converted-space> </SPAN>At runtime, the user asserts an
object</DIV>
<DIV style="MARGIN: 0px">of</DIV>
<DIV style="MARGIN: 0px">the class x.y.z.MyEvent into the working memory.
Seems clear to me (and</DIV>
<DIV style="MARGIN: 0px">probably</DIV>
<DIV style="MARGIN: 0px">to the user) that MyEvent should be handled as an
event, since by DRL</DIV>
<DIV style="MARGIN: 0px">semantics,<SPAN
class=Apple-converted-space> </SPAN></DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px">a.b.c.* are all events, and by OO class hierarchy
concept, since</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">a.b.c.Event</DIV>
<DIV style="MARGIN: 0px">is an event, x.y.z.MyEvent is an event too. <SPAN
class=Apple-converted-space> </SPAN>My question is: how the
engine</DIV>
<DIV style="MARGIN: 0px">knows that MyEvent is an event, since it only has
the x.y.z.MyEvent</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN
class=Apple-converted-space> </SPAN>class as input? <SPAN
class=Apple-converted-space> </SPAN>The only answer I have is that
when the first MyEvent</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">instance is asserted into the working memory, we
must get the class name and</DIV>
<DIV style="MARGIN: 0px">iterate over all event import declarations checking
for a match. In case no</DIV>
<DIV style="MARGIN: 0px">one</DIV>
<DIV style="MARGIN: 0px">is found, we need to repeat the process for each
interface and each class up</DIV>
<DIV style="MARGIN: 0px">in</DIV>
<DIV style="MARGIN: 0px">the MyEvent hierarchy. Once this process is
complete, we cache the results</DIV>
<DIV style="MARGIN: 0px">in</DIV>
<DIV style="MARGIN: 0px">the ObjectTypeConf.<SPAN
class=Apple-converted-space> </SPAN></DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>This may be a quite heavy process to be executed each time a fact
of a</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">different class is asserted in the working memory
for the first time, but I</DIV>
<DIV style="MARGIN: 0px">can't think a different user-friendly way to solve
the question.</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>The alternatives would be intrusive, IMO, breaking the drools
premise</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">to</DIV>
<DIV style="MARGIN: 0px">work with user-defined POJOs as facts: use
anotations to annotate classes</DIV>
<DIV style="MARGIN: 0px">that</DIV>
<DIV style="MARGIN: 0px">are events, or mandate users implement a specific
interface for events.</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>Any better idea?<SPAN class=Apple-converted-space>
</SPAN>[]s<SPAN class=Apple-converted-space>
</SPAN>Edson<SPAN class=Apple-converted-space> </SPAN>--
<SPAN class=Apple-converted-space> </SPAN>Edson Tirelli<SPAN
class=Apple-converted-space> </SPAN>Software</DIV></BLOCKQUOTE>
<DIV style="MARGIN: 0px">Engineer</DIV>
<DIV style="MARGIN: 0px">- JBoss Rules Core Developer<SPAN
class=Apple-converted-space> </SPAN>Office: +55 11 3529-6000<SPAN
class=Apple-converted-space> </SPAN>Mobile: +55 11</DIV>
<DIV style="MARGIN: 0px">9287-5646</DIV>
<BLOCKQUOTE type="cite">
<DIV style="MARGIN: 0px"><SPAN class=Apple-converted-space>
</SPAN>JBoss, a division of Red Hat<SPAN
class=Apple-converted-space> </SPAN><at><SPAN
class=Apple-converted-space> </SPAN>www.jboss.com</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV
style="MARGIN: 0px">_______________________________________________</DIV>
<DIV style="MARGIN: 0px">rules-dev mailing list</DIV>
<DIV style="MARGIN: 0px">rules-dev <at> lists.jboss.org</DIV>
<DIV style="MARGIN: 0px"><A
href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</A></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV></BLOCKQUOTE>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Edson,</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">I got your striving not to mandate users implement
a specific interface for</DIV>
<DIV style="MARGIN: 0px">events. However, why not at least introducing an
empty event interface (i.e.</DIV>
<DIV style="MARGIN: 0px">a</DIV>
<DIV style="MARGIN: 0px">marker interface, similar to the Serializable
interface in Java) the</DIV>
<DIV style="MARGIN: 0px">user-defined event class(es) have to implement?
This way, when inserting a</DIV>
<DIV style="MARGIN: 0px">MyEvent instance, you can simply check whether it
implements the event</DIV>
<DIV style="MARGIN: 0px">interface</DIV>
<DIV style="MARGIN: 0px">(by means of 'instanceof'). Moreover, while parsing
the import statements of</DIV>
<DIV style="MARGIN: 0px">a</DIV>
<DIV style="MARGIN: 0px">rule file, it enables you to double-check whether
all the "event imports"</DIV>
<DIV style="MARGIN: 0px">really</DIV>
<DIV style="MARGIN: 0px">refer to classes implementing the (empty) event
interface.</DIV>
<DIV style="MARGIN: 0px">In this regard, for me another question raises:
Without making any</DIV>
<DIV style="MARGIN: 0px">restrictions</DIV>
<DIV style="MARGIN: 0px">on the structure for a user defined event class,
how do you make sure it has</DIV>
<DIV style="MARGIN: 0px">all</DIV>
<DIV style="MARGIN: 0px">the<SPAN class=Apple-converted-space>
</SPAN>required attributes of an event (which in my opinion must be a</DIV>
<DIV style="MARGIN: 0px">timestamp,</DIV>
<DIV style="MARGIN: 0px">at least) and how do you access them (necessary for
temporal relationships)?</DIV>
<DIV style="MARGIN: 0px">Having said this, in my opinion defining an empty
event interface may not be</DIV>
<DIV style="MARGIN: 0px">sufficient; in addition, it must force the user to
implement a method</DIV>
<DIV style="MARGIN: 0px">returning</DIV>
<DIV style="MARGIN: 0px">the event's occurrence date (i.e. the timestamp) at
least... Or how would</DIV>
<DIV style="MARGIN: 0px">you</DIV>
<DIV style="MARGIN: 0px">handle this issue?</DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV style="MARGIN: 0px">Matthias<SPAN
class=Apple-converted-space> </SPAN></DIV>
<DIV style="MIN-HEIGHT: 14px; MARGIN: 0px"><BR></DIV>
<DIV
style="MARGIN: 0px">_______________________________________________</DIV>
<DIV style="MARGIN: 0px">rules-dev mailing list</DIV>
<DIV style="MARGIN: 0px"><A
href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</A></DIV>
<DIV style="MARGIN: 0px"><A
href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</A></DIV>
<DIV
style="MARGIN: 0px">_______________________________________________</DIV>
<DIV style="MARGIN: 0px">rules-dev mailing list</DIV>
<DIV style="MARGIN: 0px"><A
href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</A></DIV>
<DIV style="MARGIN: 0px"><A
href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</A></DIV></BLOCKQUOTE></DIV><BR>
<DIV><SPAN class=Apple-style-span
style="WORD-SPACING: 0px; FONT: 12px Helvetica; TEXT-TRANSFORM: none; COLOR: rgb(0,0,0); TEXT-INDENT: 0px; WHITE-SPACE: normal; LETTER-SPACING: normal; BORDER-COLLAPSE: separate; border-spacing: 0px 0px; khtml-text-decorations-in-effect: none; apple-text-size-adjust: auto; orphans: 2; widows: 2">
<DIV><SPAN class=Apple-style-span
style="TEXT-DECORATION: underline; khtml-text-decorations-in-effect: underline"><SPAN
class=Apple-style-span
style="khtml-text-decorations-in-effect: underline">
</SPAN></SPAN>
<DIV><FONT class=Apple-style-span size=3><SPAN class=Apple-style-span
style="FONT-SIZE: 13px"><B style="FONT-WEIGHT: bold; FONT-SIZE: 13px"><SPAN
class=Apple-style-span style="FONT-WEIGHT: bold; FONT-SIZE: 13px">Felipe
Piccolini M.</SPAN></B></SPAN></FONT></DIV>
<DIV><A href="mailto:felipe.piccolini@bluesoft.cl"><SPAN
class=Apple-style-span
style="COLOR: rgb(0,0,238); khtml-text-decorations-in-effect: underline">felipe.piccolini@bluesoft.cl</SPAN></A></DIV><BR
class=khtml-block-placeholder></DIV>
<DIV><BR class=khtml-block-placeholder></DIV><BR
class=Apple-interchange-newline></SPAN></DIV><BR></DIV></BLOCKQUOTE></BODY></HTML>