Hi,<br><br>You should be able to use the URL syntax with KnowledgeBuilder as follows:-<br><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">final String STANDARD_URL = &quot;<a href="http://your-guvnor-instance-host/org.drools.guvnor.Guvnor/package/standard/LATEST.drl">http://your-guvnor-instance-host/org.drools.guvnor.Guvnor/package/standard/LATEST.drl</a>&quot;;<br>
final String CUSTOMER_URL=&quot;<a href="http://your-guvnor-instance-host/org.drools.guvnor.Guvnor/package/customer/LATEST.drl">http://your-guvnor-instance-host/org.drools.guvnor.Guvnor/package/customer/LATEST.drl</a>&quot;;</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">UrlResource standardUrlResource = (UrlResource)ResourceFactory.newUrlResource(STANDARD_URL);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">standardUrlResource.setBasicAuthentication(&quot;enabled&quot;);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">standardUrlResource.setUsername(&quot;xyz&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">standardUrlResource.setPassword(&quot;abc&quot;);</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">UrlResource customerUrlResource = (UrlResource)ResourceFactory.newUrlResource(CUSTOMER_URL);</span><br style="font-family: courier new,monospace;">

<span style="font-family: courier new,monospace;">customerUrlResource.setBasicAuthentication(&quot;enabled&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">customerUrlResource.setUsername(&quot;xyz&quot;);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">customerUrlResource.setPassword(&quot;abc&quot;);</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">kbuilder.add( standardUrlResource, ResourceType.DRL);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">kbuilder.add( customerUrlResource, ResourceType.DRL);</span><br style="font-family: courier new,monospace;">

<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">assertFalse( kbuilder.hasErrors() );</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();</span><br style="font-family: courier new,monospace;">
<br>I don&#39;t think you&#39;d need to (or want to) create two KnowledgeBases: You could ensure &quot;standard&quot; rules are applied first by any of Drools&#39; agenda controls; i.e. salience, agenda-group or ruleflow; plus sharing a single KnowledgeBase ensures rules in both packages that share patterns are optimissed in the RETE network.<br>
<br>Use of ChangeSet could make things a little simpler too (rather than the individual UrlResources).<br><br>Cheers,<br><br>Mike<br><br><div class="gmail_quote">On 3 January 2011 20:03, Dean Whisnant <span dir="ltr">&lt;<a href="mailto:dean@basys.com">dean@basys.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi all, thank you for all the help in the past.<br>
<br>
I&#39;m to a point in my project of implementing Guvnor built packages into my java code that calls drools.<br>
<br>
In the past I used the simple solution of building the knowledge agent on a .drl file as follows:<br>
<br>
        //Setup the knowledge session for drools<br>
        private static KnowledgeBase readKnowledgeBase() throws Exception {<br>
                KnowledgeBuilder kbuilder = KnowledgeBuilderFactory<br>
                                .newKnowledgeBuilder();<br>
                kbuilder.add(ResourceFactory.newClassPathResource(&quot;Standard837P.drl&quot;),<br>
                                ResourceType.DRL);<br>
                KnowledgeBuilderErrors errors = kbuilder.getErrors();<br>
                if (errors.size() &gt; 0) {<br>
                        for (KnowledgeBuilderError error : errors) {<br>
                                System.err.println(error);<br>
                        }<br>
                        throw new IllegalArgumentException(&quot;Could not parse knowledge.&quot;);<br>
                }<br>
                KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();<br>
                kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());<br>
                return kbase;<br>
        }<br>
<br>
A little background before the question.  My project includes one set of rules that are standard business logic, we&#39;ll call that STANDARD for now and one set of rules that any one of my 45 customers could have created, we&#39;ll call CUSTOMER, on our common guvnor server.  My java code knows which customer is running the app, so determining which two packages I want to fire is simple.  The part that is not as straight forward for me is how I then I migrate using the guvnor urls in my above code.<br>

<br>
I thought it would be as easy as to replace &quot;Standard837P.drl&quot; above with the STANDARD url and create a second add that would use the CUSTOMER url.<br>
<br>
I also want all of my STANDARD rules applied before my CUSTOMER rules are applied.  This got me thinking that I need to have two independent knowledge bases running so that I fire all in the first and then fire all in the second.<br>

<br>
Backing up a bit again, my application looks through an incoming file inserting facts into the knowledge base for one medical claim line item, fires rules, writes out results to a database, and then moves on to the next claim line item in the file.<br>

<br>
1) What would the syntax need to be to implement the STANDARD and CUSTOMER urls?<br>
2) Would I need to create two independent knowledge bases?<br>
3) DO you see any performance issues in this arrangement?<br>
<br>
Thank you!<br>
<br>
Dean<br>
<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>
</blockquote></div><br>