[rules-users] Application Guvnor integration

Senthil K kris.senthilkumar at gmail.com
Fri Jan 13 01:44:54 EST 2012


Hi,

I am trying to do integration between application and guvnor. I am unable to
build knowledge base using the change_set provided for the package in
Guvnor. Following is the snipet of code i am using. When i try to print
number of packages from knowledgebase, it shows 0.

Can you help me please.


        	System.out.println("Before rule engine start ");
        	
        	String
urlstr="http://192.168.2.247:8080/guvnor-5.3.0.Final-jboss-as-5.1/org.drools.guvnor.Guvnor/package/sample/LATEST/ChangeSet.xml";
        	URL url = new URL(urlstr);

        	KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
			aconf.setProperty("drools.agent.newInstance", "false");
 			_kagent = KnowledgeAgentFactory.newKnowledgeAgent( "MyAgent",aconf );

            System.out.println("after creating kagent");
            _kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
            System.out.println("after apply change set");

			ResourceChangeScannerConfiguration sconf= 
		
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
			sconf.setProperty("drools.resource.scanner.interval", "30");
			ResourceFactory.getResourceChangeScannerService().configure(sconf);
			
			ResourceFactory.getResourceChangeNotifierService().start();
			ResourceFactory.getResourceChangeScannerService().start(); 

			System.out.println("After starting Notification service");

				_kagent.applyChangeSet(ResourceFactory.newUrlResource(url));
	    		_kbase = _kagent.getKnowledgeBase();

        		Collection<KnowledgePackage> kpackages =
_kbase.getKnowledgePackages();
	            
	            System.out.println("no of packages"+kpackages.size());


--
View this message in context: http://drools.46999.n3.nabble.com/Application-Guvnor-integration-tp3655924p3655924.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list