<font size="2"><font face="courier new,monospace">Hey Luciano, Meanwhile i tries pumping in the rule with a webdav api (Sardine in my case) and that seems to work and trigger ok for me. this is how i did that</font></font><div>
<font size="2"><font face="courier new,monospace"><br></font></font></div><div><font size="2"><font face="courier new,monospace"><div>public class SardineTest {</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public static void main(String[] args) throws SardineException {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>Sardine sardine = SardineFactory.begin(&quot;admin&quot;, &quot;admin&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>List&lt;DavResource&gt; resources = sardine</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>.getResources(&quot;<a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages</a>&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>for (DavResource res : resources) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>System.out.println(res); // calls the .toString() method.</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>addARule();</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>private static void addARule() throws SardineException {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>Sardine sardine = SardineFactory.begin(&quot;username&quot;, &quot;password&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>String ruleDescription = &quot;when Entity(entityName==\&quot;Car1s\&quot;) then System.out.println( \&quot;*************rule executed\&quot;)&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>byte[] data = ruleDescription.getBytes();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>sardine.put(&quot;<a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages/Analytics/SimpleDRLRule.drl">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav/packages/Analytics/SimpleDRLRule.drl</a>&quot;, data);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>System.out.println(&quot;Rule added ...&quot;);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div>}</div><div>
<br></div><div><br></div><div>once i did this, I could see the rule added as a technical rule on the guvnor web app ... the and then triggered to rule with something like this</div><div><br></div><div><br></div><div><div>
public class GuvnorTest {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>@Test</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>public void testDroolsWithGuvnor() throws Exception {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>KnowledgeBase knowledgeBase = createKnowledgeBase();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>try {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>Entity entity = new Entity();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>entity.setEntityName(&quot;Car1s&quot;);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>session.insert(entity);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>Assert.assertTrue(session.getFactCount() == 1);</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>System.out.println(&quot;And the count is  &quot; + session.getFactCount());</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>session.fireAllRules();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>System.out.println(&quot;And the count is  &quot; + session.getFactCount());</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>Assert.assertEquals(1, session.getFactCount());</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>finally {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>session.dispose();</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>private static KnowledgeBase createKnowledgeBase() {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> kaconf.setProperty( &quot;drools.agent.scanDirectories&quot;, &quot;false&quot; );</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( &quot;test agent&quot;, kaconf );</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> kagent.applyChangeSet( ResourceFactory.newClassPathResource(&quot;opal-guvnor.xml&quot;));</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> return kagent.getKnowledgeBase();</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>}</div></div><div><br></div><div>where opal-guvnor.xml is my change set file and goes like this</div>
<div><br></div><div><div>&lt;change-set xmlns=&#39;<a href="http://drools.org/drools-5.0/change-set">http://drools.org/drools-5.0/change-set</a>&#39;</div><div>    xmlns:xs=&#39;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&#39;</div>
<div>    xs:schemaLocation=&#39;<a href="http://drools.org/drools-5.0/change-set">http://drools.org/drools-5.0/change-set</a> <a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd</a>&#39; &gt;</div>
<div>    &lt;add&gt;</div><div>         &lt;resource source=&#39;<a href="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Analytics/LATEST.drl">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/Analytics/LATEST.drl</a>&#39; type=&#39;DRL&#39; basicAuthentication=&quot;enabled&quot; username=&quot;admin&quot; password=&quot;admin&quot;/&gt;</div>
<div>    &lt;/add&gt;</div><div>&lt;/change-set&gt;</div></div><div><br></div><div><br></div><div>not sure if this is the right / best way but at least could add a rule to the repository with this. Ideally, </div><div><br>
</div><div>1) I would like to run a validate / verify to see that the rule has been added correctly, I dont know the api to do that</div><div>2) I would like to rebuild my package and/or create a new snapshot, dont know how to do that either though the rule seems to execute without doing that.</div>
<div>3) Have not given any thoughts about security etc right now ...</div><div><br></div><div><br></div><div>@Drools experts, your thoughts?</div><div><br></div><div>Regards | Vikas</div><div><br></div></font></font><br><div class="gmail_quote">
On Sat, Feb 12, 2011 at 12:20 AM, Luciano A. Andrade <span dir="ltr">&lt;<a href="mailto:andrade.luciano@gmail.com">andrade.luciano@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I think i am in the same situation, i following<br>
<a href="http://www.reverttoconsole.com/blog/java/accessing-drools-5-rules-via-a-restful-api-using-drools-server-and-groovy-restclient/" target="_blank">http://www.reverttoconsole.com/blog/java/accessing-drools-5-rules-via-a-restful-api-using-drools-server-and-groovy-restclient/</a><br>

it recomends<br>
<a href="http://www.amazon.com/JBoss-Drools-Business-Rules-Browne/dp/1847196063/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1259786026&amp;sr=8-1" target="_blank">http://www.amazon.com/JBoss-Drools-Business-Rules-Browne/dp/1847196063/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1259786026&amp;sr=8-1</a><br>

but i found a similar example on the chapter 11 of<br>
<a href="http://www.amazon.com/Drools-JBoss-Rules-Developers-Guide/dp/1847195644/ref=pd_bxgy_b_text_b#reader_1847195644" target="_blank">http://www.amazon.com/Drools-JBoss-Rules-Developers-Guide/dp/1847195644/ref=pd_bxgy_b_text_b#reader_1847195644</a><br>

<br>
i didn&#39;t manage to run properly first and foremost since i didn&#39;t have<br>
the rules in place as the example requires, and since i have to run it<br>
from PHP, i am working on it, so if you make any progress please i am<br>
really interested.<br>
<br>
Also i don&#39;t really understand how it sopuse to run the rules from the<br>
webdav interface.<br>
<div><div></div><div class="h5"><br>
2011/2/11 Vikas Hazrati &lt;<a href="mailto:vhazrati@inphina.com">vhazrati@inphina.com</a>&gt;:<br>
&gt; Hi Luciano,<br>
&gt; Believe me ;) I already did that before posting to the group but the<br>
&gt; information that I found is skeletal or anywhere near it. Do we have the api<br>
&gt; documented somewhere?<br>
&gt; Also i see that people on this group talk about the KnowledgeAgent and<br>
&gt; KBuilder etc. Where is all that documented? I would like to use the api to<br>
&gt; pump rules into the govrnor from my flex UI. Any pointers to the api which I<br>
&gt; can explore to do that are appreciated.<br>
&gt; On the IRC channel i met Rikkola who suggested to use the webdav, I would<br>
&gt; like to explore that but at the same time I would like to see if REST or any<br>
&gt; alternate api suits my need. Again, help appreciated :)<br>
&gt; Regards | Vikas<br>
&gt;<br>
&gt; On Fri, Feb 11, 2011 at 8:01 PM, Luciano A. Andrade<br>
&gt; &lt;<a href="mailto:andrade.luciano@gmail.com">andrade.luciano@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I think you are looking for the &quot;Drools REST API&quot;, google it and you<br>
&gt;&gt; find some documentation.<br>
&gt;&gt;<br>
&gt;&gt; 2011/2/11 Vikas Hazrati &lt;<a href="mailto:vhazrati@inphina.com">vhazrati@inphina.com</a>&gt;:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Hi,<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I am looking at using Guvnor for our project where users would be<br>
&gt;&gt; &gt; creating<br>
&gt;&gt; &gt; rules using our UI. For this i need to add / modify rule or any asset<br>
&gt;&gt; &gt; for<br>
&gt;&gt; &gt; that matter using an api.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Unfortunately, i could not find enough documentation to suggest the best<br>
&gt;&gt; &gt; way<br>
&gt;&gt; &gt; to use the REST api, which I guess is provided by Guvnor. Could someone<br>
&gt;&gt; &gt; let<br>
&gt;&gt; &gt; me know the location of where i can get some information for this api. I<br>
&gt;&gt; &gt; also see that the issue GUVNOR-1080<br>
&gt;&gt; &gt; (<a href="https://issues.jboss.org/browse/GUVNOR-1080" target="_blank">https://issues.jboss.org/browse/GUVNOR-1080</a>) is marked resolved so the<br>
&gt;&gt; &gt; api<br>
&gt;&gt; &gt; should exist right? or that we cannot access it remotely until we have<br>
&gt;&gt; &gt; the<br>
&gt;&gt; &gt; Atom Pub Interface done?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Help appreciated .<br>
&gt;&gt; &gt; --<br>
&gt;&gt; &gt; View this message in context:<br>
&gt;&gt; &gt; <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Guvnor-API-information-tp2471798p2471798.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Drools-Guvnor-API-information-tp2471798p2471798.html</a><br>

&gt;&gt; &gt; Sent from the Drools - User mailing list archive at Nabble.com.<br>
&gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt; rules-users mailing list<br>
&gt;&gt; &gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;&gt; &gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rules-users mailing list<br>
&gt;&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Best Regards | Vikas<br>
&gt;<br>
&gt; Inphina Technologies<br>
&gt; Co-Founder and Technical Architect<br>
&gt; Mobile: +91-9899174194<br>
&gt; Landline: +91-11-25126026<br>
&gt; <a href="http://inphina.com" target="_blank">http://inphina.com</a><br>
&gt; <a href="http://thoughts.inphina.com" target="_blank">http://thoughts.inphina.com</a><br>
&gt; <a href="http://twitter.com/inphina" target="_blank">http://twitter.com/inphina</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
&gt;<br>
&gt;<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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div>Best Regards | Vikas<br><br></div><div>Inphina Technologies<br>Co-Founder and Technical Architect<br>Mobile: +91-9899174194</div><div>Landline: +91-11-25126026 </div>
<div><br></div><div><a href="http://inphina.com" target="_blank">http://inphina.com</a><br><a href="http://thoughts.inphina.com" target="_blank">http://thoughts.inphina.com</a><br><a href="http://twitter.com/inphina" target="_blank">http://twitter.com/inphina</a></div>
<div><br></div><br>
</div>