On 2012/10/19 17:56, Sai Nadh wrote:
hi, 

if i have package with name my package in drools guvnor

 In that i have some rules(business rule assets), with name testrule1, testrule2

if i want to access those rules to my java application

i have written resource url in changeset like

<resource source='http://localhost:8080/drools-guvnor/rest/packages/mypackage/source' type='BRL'/>


<resource source='http://localhost:8080/drools-guvnor/rest/packages/mypackage/assets/testrule1/source' type='BRL'/>

Check the doc for details: http://docs.jboss.org/drools/release/5.5.0.Beta1/drools-guvnor-docs/html/ch09.html#d0e3153


but i am getting exceptions..

Exception in thread "main" java.lang.RuntimeException: org.drools.compiler.DroolsParserException: java.lang.IllegalArgumentException: Unable to instantiate service for Class 'org.drools.compiler.BusinessRuleProvider'


please help me.. to write correct url in changeset.xml to access those BRL's

thanks
sai


On Fri, Oct 19, 2012 at 2:25 PM, Jervis Liu <jliu@redhat.com> wrote:
On 2012/10/16 19:47, Ravikiran wrote:
Hi Jarvis,

Thanks for your reply. Looks like i have posted my intension unclearly. To
elaborate bit more, currently i am using Rest API to create KnowledgeBase
from my java client. I have changeset-loans.xml, where my guvnor package
with drl is defined. My java client will this to fire all rules of that
package. In such a case, when i have more one version created for the
package and the rule assets within it, how i can i call specific version
based package along with the drl file to fire all the rule assets belongs to
it? In the same passion, is there any way i can mentioned the rule asset
name in the changeset xml file to fire specific version of rule asset from
java?
Yes, it is possible to specify a specific version of asset in changeset. though this is not supported by Change-set editor at the moment, you have to edit the content of change-set xml file manually. For example, below is generated by change-set editor:          <resource   source='http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/sss/source' type='DRL' />
    </add>
</change-set>

If you want to use a specific version of asset "sss", what you need to do is to modify the source URL, make it pointing to the specific version of the asset source. eg:

         <resource   source='http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/sss/versions/2/source' type='DRL' />

This is to get version 2 of asset "sss" source.


Cheers,
Jervis


I can only get the package or rule asset's metadata using the urls that you
have mentioned in your post. But i can't fire the rules...please suggest if
i am doing something wrong.

changeset-loans.xml
-------------------------
<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/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'
   <add>
      <resource
     
source='http://localhost:9080/guvnor-5.2.0.Final-tomcat-6.0/org.drools.guvnor.Guvnor/package/loans/loans_demo.drl'
      type='DRL' basicAuthentication="enabled" username="admin"
password="admin" />
   </add>
</change-set>

Thanks
Ravi



--
View this message in context: http://drools.46999.n3.nabble.com/How-to-access-Guvnor-Rules-based-on-versions-from-Java-tp4020285p4020301.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




--
Regards
SAI BABA NADH

+91 7411680125

 





_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users