[rules-users] Drools and Java EE

Andrew Waterman awaterma at ecosur.mx
Thu Aug 26 16:28:19 EDT 2010


Many thanks, Laird.  Although, I can't seem to find the "KnowledgeBases.xml" in the repository.  Where should it be located? In drools-rar resources?

I just need the knowledge agent to check on a set of runtime changesets, and  be able to update the embedded knowledgebase on change.  Can I script a call into the RAR's configuration through JNDI and get the internal knowledge agent to do an "applyChangeSet"?

The user connection factory concept seems like a good way to go, if a bit of work.

best,

A

On Aug 26, 2010, at 3:15 PM, ljnelson wrote:

> The changeset itself dictates what resources to monitor, if I understand it properly, so if you're just looking for new packages just add them to the changeset.  You probably know that already.
> 
> See the <addResource> line in KnowledgeBases.xml.
> 
> But yes, that's all within one KnowledgeBase (I should rename the default name of that changeset file to KnowledgeBase.xml or something like that.).
> 
> Anyhow, I suspect that it would be useful to allow the resource adapter to create more than one KnowledgeBase.  I'm not entirely sure, frankly, how to set that up.  I think that since a KnowledgeBase maps to the overly latinate and annoying JCA concept of a (deep breath) user connection factory {eyes glaze over}, that there's probably a way to move the KnowledgeAgent creation code out of the resource adapter bootstrap area and into...into...a better area {handwave, handwave} where several KnowledgeAgents might be able to be built.
> 
> Short answer: no.  :-)  Longer answer: yeah, there should be a way to do that.
> 
> Best,
> Laird
> 
> On Thu, Aug 26, 2010 at 4:10 PM, Andrew Waterman-2 [via Drools - Java Rules Engine] <[hidden email]> wrote:
> Just found the configuration in ra.xml:
> 
>     <config-property>
>       <config-property-name>changeSetResourceName</config-property-name>
>       <config-property-type>java.lang.String</config-property-type>
>       <config-property-value>rules/KnowledgeBases.xml</config-property-value>
>     </config-property>
> 
> Can I get it to support more than one changeSet?  It would be nice to pass a list to monitor.
> 
> best,
> 
> A
> 
> On Aug 26, 2010, at 3:04 PM, Andrew Waterman wrote:
> 
>> Hey Laird,
>> 
>> How do I configure the resource adaptor to load a specific resource?   I have two changesets I would like it to monitor.  Is this handled in the ra.xml?  I couldn't seem to find what it was monitoring. :)
>> 
>> best wishes,
>> 
>> Andrew
>> 
>> On Aug 25, 2010, at 4:24 PM, Andrew Waterman wrote:
>> 
>>> Huge thanks!
>>> 
>>> best,
>>> 
>>> A
>>> 
>>> On Aug 25, 2010, at 12:55 PM, ljnelson wrote:
>>> 
>>>> Have a look at http://code.google.com/p/drools-jca/.
>>>> 
>>>> This is not (clearly) released yet; have a look at the source and see what you think.
>>>> 
>>>> To build it: check it out, then, with Maven 2.2.1, run mvn clean install from the root.
>>>> 
>>>> If you have all the right repositories set up in your settings.xml, everything should complete normally.  If you don't, Maven will tell you what artifacts are missing, and a quick Google search will unveil the repositories they're hosted in.
>>>> 
>>>> Best,
>>>> Laird
>>>> 
>>>> On Wed, Aug 25, 2010 at 1:39 PM, Andrew Waterman-2 [via Drools - Java Rules Engine] <[hidden email]> wrote:
>>>> Very useful to the JEE community Laird.  I just recently started working with the KnowledgeAgent and Drools Guvnor; so I really feel the need.  Please do let us all know when your implementation is available in the trunk and/or a standalone version. :) 
>>>> 
>>>> best wishes, 
>>>> 
>>>> Andrew 
>>>> 
>>>> 
>>>> On Aug 24, 2010, at 9:50 PM, ljnelson wrote: 
>>>> 
>>>> > 
>>>> > Hello; I've made a JCA resource adapter for Drools. 
>>>> > 
>>>> > I've had to hack quite a bit to get it so that the KnowledgeAgent- and 
>>>> > resource-scanning-related parts don't use Threads, but, instead, use the 
>>>> > JCA-supplied WorkManager and BootstrapContext#createTimer() for asynchronous 
>>>> > operations (like resource scanning and notifying).   
>>>> > 
>>>> > Here are some changes it would sure be nice to see, that I needed to hack 
>>>> > around in order to make it so that a KnowledgeAgent-produced KnowledgeBase 
>>>> > could be shared by Java EE components in a specification compliant manner: 
>>>> > 
>>>> > 1. ResourceChangeNotifierImpl#ProcessChangetSet is an inner class that is 
>>>> > marked as public static, but which has a package-protected constructor.  I 
>>>> > have to create a new instance of this in order to create a 
>>>> > ResourceChangeNotifierImpl subclass that doesn't use threads.  I hope this 
>>>> > constructor could be made public instead.  Right now I'm calling 
>>>> > setAccessible(true).  Yecch. 
>>>> > 
>>>> > 2. ResourceFactory#setFactoryService(): sure do wish this were public, or 
>>>> > that there were another way to install a ResourceFactoryService.  I need to 
>>>> > do this so that the scanner and notifier are under my control (and don't use 
>>>> > Threads, but instead use Timers as provided by the JCA BootstrapContext 
>>>> > class).  It appears that I do have some control here in Drools 5.1 with the 
>>>> > (undocumented) ServiceRegistry interface (how do I get an instance of it? 
>>>> > what does it do? is it used pervasively?), but I don't know, since it's 
>>>> > undocumented, whether it's the preferred way to do this sort of thing or 
>>>> > not. 
>>>> > 
>>>> > 3. All this indirection is really quite clunky, especially given the 
>>>> > META-INF/services facility.  Was there a good reason this was not used?  I'm 
>>>> > sure there was something, because having to consult a factory for a service 
>>>> > to get a provider to produce an instance of something is a bit much. 
>>>> > 
>>>> > Hacking around those limitations, I was able to produce a Drools resource 
>>>> > adapter that vends KnowledgeBase instances as its user connection factories. 
>>>> > This means to use it in a spec-compliant manner, you do this in your 
>>>> > stateless (or stateful) session bean: 
>>>> > 
>>>> > @Resource 
>>>> > private KnowledgeBase kb; 
>>>> > 
>>>> > ...and you get injected a wrapper KnowledgeBase that uses the Java EE 
>>>> > container's JCA machinery to invoke operations on the shared KnowledgeBase. 
>>>> > 
>>>> > Is this something that would be interesting to other people?  If so I am 
>>>> > happy to open source it. 
>>>> > 
>>>> > Thanks for a great toolkit. 
>>>> > 
>>>> > Best,
>>>> > Laird 
>>>> > -- 
>>>> > View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp1323225p1323225.html
>>>> 
>>>> > Sent from the Drools - User mailing list archive at Nabble.com. 
>>>> > _______________________________________________ 
>>>> > rules-users mailing list 
>>>> > [hidden email] 
>>>> > https://lists.jboss.org/mailman/listinfo/rules-users
>>>> _______________________________________________ 
>>>> rules-users mailing list 
>>>> [hidden email] 
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>>> 
>>>> 
>>>> View message @ http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp1323225p1336588.html 
>>>> To unsubscribe from Drools and Java EE, click here.
>>>> 
>>>> 
>>>> 
>>>> View this message in context: Re: Drools and Java EE
>>>> Sent from the Drools - User mailing list archive at Nabble.com.
>>>> _______________________________________________
>>>> rules-users mailing list
>>>> [hidden email]
>>>> https://lists.jboss.org/mailman/listinfo/rules-users
>>> 
>>> _______________________________________________
>>> rules-users mailing list
>>> [hidden email]
>>> https://lists.jboss.org/mailman/listinfo/rules-users
>> 
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
>> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> _______________________________________________ 
> rules-users mailing list 
> [hidden email] 
> https://lists.jboss.org/mailman/listinfo/rules-users
> 
> 
> View message @ http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp1323225p1360000.html 
> To unsubscribe from Drools and Java EE, click here.
> 
> 
> 
> View this message in context: Re: Drools and Java EE
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100826/0824ea11/attachment.html 


More information about the rules-users mailing list