On Thu, Aug 26, 2010 at 4:48 PM, Andrew Waterman-2 [via Drools - Java
Rules Engine] <[hidden email]> wrote:
>
> Okay, cool. So where's the magic location? :)

The magic location...is...unless I'm missing something...specified in ra.xml.

Here's what that part of ra.xml looks like (lines 39-43 from
http://code.google.com/p/drools-jca/source/browse/trunk/drools-rar/src/main/resources/META-INF/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>
<!-- this can be any classpath resource you want -->
</config-property>

So in this example somewhere in the resource adapter's classpath
(which in my case is usually in a jar file in the lib directory of an
.ear file that houses the .rar file), you should have
rules/KnowledgeBases.xml.  This can be named anything you want;
there's nothing special about the name.

That file, as I posted before, is your changeset, and following the
XSD that I didn't write :-) looks like this:

<?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.FINAL/drools-api/src/main/resources/change-set.xsd">
  <add>
    <resource source="classpath:rules/rules.drl" type="DRL"></resource>
  </add>
</change-set>

The <resource source=""/> part is up to you and has to be a URL.  One
of the allowed URL protocols I discovered is classpath:, so that's
what I used in my stuff.  You could use file:, ftp:, http:, whatever;
the URL could (and probably should) point to a Guvnor package as well.
 Then you have the added benefit that if that package ever changes,
the KnowledgeAgent will automatically pick it up.

I hope that helps.

Best,
Laird


View this message in context: Re: Drools and Java EE
Sent from the Drools - User mailing list archive at Nabble.com.