good evening,

thank you for all, giving me good encouragement in drools...

I have created some rules in drools guvnor, which i want to access to my java application
for that, i have created MODEL_CLASS, TEST_CLASS in eclipse.

In the test class i have written the below code to access the guvnor rules.. please check this and suggest me if it has any mistakes


private static KnowledgeBase createKnowledgeBase() {
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent" );
KnowledgeAgentConfiguration kaconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
kaconf.setProperty( "drools.agent.scanDirectories", "false" ); 
kagent.applyChangeSet( ResourceFactory.newUrlResource("http://localhost:8080/guvnor/rest/packages/ProductPositionAlert/assets/
                                                    change-set.xml/source") ); 
return   kbase;
}  




my change-set.xml is like below

<?xml version="1.0" encoding="UTF-8"?>

<change-set xmlns='http://drools.org/drools-5.4/change-set'
    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
    xs:schemaLocation='http://drools.org/drools-5.4/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:8080/guvnor/org.drools.guvnor.Guvnor/package/ProductPositionAlert/ProductPositionAlert_SNAPSHOT"
      type="PKG" />
   </add>
</change-set>



i am providing here the snapshot of my drools guvnor rule package....

Inline image 2



thanks
--
Regards
sainadh