Oh, you're right. Oh, I remember what I was thinking. :-) I didn't want
to ship with a default change set, because hey, I don't know what your
changeset is going to be. So I set up a default place that the resource
adapter *looks* for a change set .xml file. If you either (a) put such a
changeset in that (classpath) location or (b) change the resource adapter
configuration to look somewhere else and put a changeset in THAT location,
then everything will be fine.
Here's my changeset:
<?xml version="1.0" encoding="UTF-8"?>
<change-set
xmlns="http://drools.org/drools-5.0/change-set" xmlns:xs="
http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="
http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/tags/5.0.1.26597.FINA...
">
<add>
<resource source="classpath:rules/rules.drl" type="DRL">
</resource>
</add>
</change-set>
So, again, following the bouncing ball:
1. The resource adapter has a config file (META-INF/ra.xml) that tells it
where its changeset is.
2. The changeset specifies potentially many URLs where .drl resources can
be found. This is described in the Drools documentation.
Supplied with the source code is META-INF/ra.xml and nothing else.
Best,
Laird
On Thu, Aug 26, 2010 at 4:30 PM, Andrew Waterman-2 [via Drools - Java Rules
Engine]
<ml-node+1360374-122574974-10124@n3.nabble.com<ml-node%2B1360374-122574974-10124(a)n3.nabble.com>
wrote:
> 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] <#12ab017e7f30316c_>
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] <#12ab017e7f30316c_>
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-tp...
>>>
>>> > Sent from the Drools - User mailing list archive at
Nabble.com.
>>> > _______________________________________________
>>> > rules-users mailing list
>>> > [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1336588&i=0>
>>> >
https://lists.jboss.org/mailman/listinfo/rules-users
>>> _______________________________________________
>>> rules-users mailing list
>>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1336588&i=1>
>>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>>
>>>
>>> ------------------------------
>>> View message @
>>>
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp...
>>> To unsubscribe from Drools and Java EE, click
here<http://drools-java-rules-engine.46999.n3.nabble.com/template/TplS...;.
>>>
>>>
>>>
>>
>> ------------------------------
>> View this message in context: Re: Drools and Java
EE<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java...
>> Sent from the Drools - User mailing list
archive<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Use...
>>
Nabble.com.
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1360000&i=0>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1360000&i=1>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1360000&i=2>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> [hidden email]
<
http://user/SendEmail.jtp?type=node&node=1360000&i=3>
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>> ------------------------------
>> View message @
>>
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp...
>> To unsubscribe from Drools and Java EE, click
here<http://drools-java-rules-engine.46999.n3.nabble.com/template/TplS...;.
>>
>>
>>
>
> ------------------------------
> View this message in context: Re: Drools and Java
EE<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java...
> Sent from the Drools - User mailing list
archive<http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Use...
>
Nabble.com <
http://Nabble.com?by-user=t>.
> _______________________________________________
> rules-users mailing list
> [hidden email] <
http://user/SendEmail.jtp?type=node&node=1360374&i=0>
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
> _______________________________________________
> rules-users mailing list
> [hidden email] <
http://user/SendEmail.jtp?type=node&node=1360374&i=1>
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
> ------------------------------
> View message @
>
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp...
> To unsubscribe from Drools and Java EE, click
here<http://drools-java-rules-engine.46999.n3.nabble.com/template/TplS...;.
>
>
>
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Drools-and-Java-EE-tp...
Sent from the Drools - User mailing list archive at
Nabble.com.