[rules-users] KnowledgeAgent and OSGI

mmarmol marcelo.marmol at gmail.com
Fri Jun 25 16:33:07 EDT 2010


Ok, I was indeed doing things wrong, i removed the creation of the package
and now everything is working just fine. I will live here the code, may be
some one might find it useful. Thanks for the tip.


		ResourceFactory.getResourceChangeScannerService().start();
		ResourceFactory.getResourceChangeNotifierService().start();

		ServiceReference serviceRef = bc
				.getServiceReference(ServiceRegistry.class.getName());
		ServiceRegistry registry = (ServiceRegistry) bc.getService(serviceRef);

		KnowledgeBaseFactoryService knowledgeBaseFactoryService = registry
				.get(KnowledgeBaseFactoryService.class);
		ResourceFactoryService resourceFactoryService = registry
				.get(ResourceFactoryService.class);

		ResourceFactoryService resource = resourceFactoryService;

		KnowledgeBaseConfiguration kbaseConf = knowledgeBaseFactoryService
				.newKnowledgeBaseConfiguration(null, getClass()
						.getClassLoader());

		KnowledgeBase kbase = knowledgeBaseFactoryService
				.newKnowledgeBase(kbaseConf);

		KnowledgeAgentConfiguration aconf =
		KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
		aconf.setProperty("drools.agent.scanDirectories", "true");
		aconf.setProperty("drools.agent.scanResources", "true");
		aconf.setProperty("drools.agent.newInstance", "false");
		
		kagent = KnowledgeAgentFactory.newKnowledgeAgent( "CoreDroolsAgent",kbase,
aconf);
		kagent.applyChangeSet(resource.newFileSystemResource(filePath));
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-and-OSGI-tp921989p923030.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list