2012/3/2 Jian Feng Ng <span dir="ltr"><<a href="mailto:jng42@csc.com">jng42@csc.com</a>></span><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif">I tried but it doesn't seem to work. I am using UrlResource for the KnowledgeAgent.<br><br>kagent.getKnowledgeBase().addEventListener(new foo());<br>ResourceFactory.getResourceChangeNotifierService().start();<br>
ResourceFactory.getResourceChangeScannerService().start();<br><br>But when the package is rescan, foo seems to be gone as kagent rebuilds knowledgebase?<br><br></font></blockquote><div><br></div><div>The Knowledge Agent builds a new Knowledge Base when resources change. You should set up a listener for the Agent to detect KnowledgeBaseUpdatedEvent and other Agent events.</div>
<div>-W</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif"><br><br><font color="#990099">-----<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> wrote: -----</font><div>
<blockquote style="padding-right:0px;padding-left:5px;margin-left:5px;border-left:solid black 2px;margin-right:0px">To: Rules Users List <a href="mailto:rules-users@lists.jboss.org" target="_blank"><rules-users@lists.jboss.org></a><br>
From: Wolfgang Laun <u></u><br>Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a><br>Date: 03/01/2012 05:21PM<br>Subject: Re: [rules-users] Adding change/event listener to package<br>
<br>As with all Listeners in Java, you write a class implementing the methods defined by the interface. The parameter types tell you about what is passed to the respective call.<br><br>class Foo implements KnowledgeBaseEventListener {<div>
<div> public void afterRuleAdded(AfterRuleAddedEvent event){</div></div><div> if( "WatchedPackage".equals( event.getRule().getPackageName() ){</div><div><br></div><div> }</div><div> }</div><div>
<br></div><div> //...</div><div>}</div><div><br></div><div>A new Foo is attached to the kSession object - that's all.</div><div><div><br></div><div>-W</div><div><br>2012/3/1 Jian Feng Ng <<a href="mailto:jng42@csc.com" target="_blank">jng42@csc.com</a>>:<br>
> I saw many interfaces, but the problem is I do not know how to 'use' them.<br>> Is there a tutorial or example codes somewhere?<br>><br>><br>><br>> -----<a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a> wrote: -----<br>
><br>> To: Rules Users List <<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>><br>> From: Wolfgang Laun<br>> Sent by: <a href="mailto:rules-users-bounces@lists.jboss.org" target="_blank">rules-users-bounces@lists.jboss.org</a><br>
> Date: 03/01/2012 04:38PM<br>> Subject: Re: [rules-users] Adding change/event listener to package<br>><br>> See the javadoc on a lot of interfaces in org.drools.event.knowledgebase.<br>> The expert manual has a section on the "Event Model" showing how to attach a<br>
> listener to the knowledge session (not a package).<br>> -W<br>><br>><br>><br>> 2012/3/1 Jian Feng Ng <<a href="mailto:jng42@csc.com" target="_blank">jng42@csc.com</a>><br>>><br>>> I wish to add a listener to a package, so that my application can do<br>
>> something else when there is any creation or deletion of rules in the<br>>> package. May I know how can I do this?<br>>><br>>> _______________________________________________<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><br>
>><br>><br>> _______________________________________________<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><br>
><br>><br>><br>> CSC • Please consider the environment before printing this e-mail.<br>><br>> This is a PRIVATE message. If you are not the intended recipient, please<br>> delete without copying and kindly advise us by e-mail of the mistake in<br>
> delivery. NOTE: Regardless of content, this e-mail shall not operate to bind<br>> CSC to any order or other contract unless pursuant to explicit written<br>> agreement or government initiative expressly permitting the use of e-mail<br>
> for such purpose • CSC Technology Singapore Pte. Ltd. • Registered Office:<br>> 20 Anson Road, #11-01 Twenty Anson Singapore 079912 • Registered in<br>> Singapore No: 198400958N<br>> _______________________________________________<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><br>
><br><br></div></div>
<font face="Courier New,Courier,monospace">_______________________________________________<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><br>
</font><u></u></blockquote></div><span><br><br><span style="font-size:13px;font-weight:bold">CSC</span><span style="font-size:10px"> • </span><span style="font-size:10px">Please consider the environment before printing this e-mail.<br>
<br>This is a PRIVATE message. If you are not the intended recipient, please delete without copying and kindly advise us by e-mail of the mistake in delivery. NOTE: Regardless of content, this e-mail shall not operate to bind CSC to any order or other contract unless pursuant to explicit written agreement or government initiative expressly permitting the use of e-mail for such purpose</span><span style="font-size:10px"> • </span><span style="font-size:10px;font-style:italic">CSC Technology Singapore Pte. Ltd. • Registered Office: 20 Anson Road, #11-01 Twenty Anson Singapore 079912 • Registered in Singapore No: 198400958N</span></span></font><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>