[rules-users] KnowledgeAgent and OSGI

Mark Proctor mproctor at codehaus.org
Wed Aug 4 05:37:48 EDT 2010


  The set of OSGi bundles dependencies can be used here:
http://www.jboss.org/drools/downloads.html

We test against spring:
http://fisheye.jboss.org/browse/JBossRules/trunk/osgi-bundles/org.drools.osgi.test/src/test/java/org/drools/osgi/integrationtests/SimpleOsgiTest.java

This is our project that builds osgi-bundles and does some testing of 
Drools against OSGi:
http://fisheye.jboss.org/browse/JBossRules/trunk/osgi-bundles/

I have done some minimal OSGi docs. OSGI is stil la work in progress for 
us and we have only osgi-ified some aspects Drools, although we have 
done extensive work on the classloaders to make it fit better.
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-integration/html/ch05.html

Please do test what we have, maybe help us OSGi-ify other aspects of drools.

Mark
On 04/08/2010 10:25, David Conde wrote:
> Hi,
>
> I'm trying to get drools-core and drools-compiler 5.1 running on 
> spring dm-server. Does anyone have the minimal list of OSGi bundles as 
> maven dependencies handy?
>
> Thanks,
> Dave
>
> On 25 June 2010 13:59, mmarmol <marcelo.marmol at gmail.com 
> <mailto:marcelo.marmol at gmail.com>> wrote:
>
>
>     Hi, I have managed to install Drools-core and Drools-compiler in
>     my Equinox
>     osgi environment, I can compile rules and execute them just fine,
>     I was just
>     wandering how to configure a KnowledgeAgent using
>     KnowledgeBuilderFactoryService and KnowledgeBaseFactoryService. I
>     managed to
>     configure one but i am not able to reload rules when they change
>     at runtime.
>     I have started ResourceChangeScannerService and
>     ResourceChangeNotifierService, changeset related to the rules file
>     gets read
>     but no change gets implemented. An idea?
>
>
>     Here is the code:
>
>                  
>      ResourceFactory.getResourceChangeScannerService().start();
>                  
>      ResourceFactory.getResourceChangeNotifierService().start();
>
>                    ServiceReference serviceRef = bc
>                                  
>      .getServiceReference(ServiceRegistry.class.getName());
>                    ServiceRegistry registry = (ServiceRegistry)
>     bc.getService(serviceRef);
>
>                    KnowledgeBuilderFactoryService
>     knowledgeBuilderFactoryService = registry
>                                  
>      .get(KnowledgeBuilderFactoryService.class);
>
>                    KnowledgeBaseFactoryService
>     knowledgeBaseFactoryService = registry
>                                  
>      .get(KnowledgeBaseFactoryService.class);
>                    ResourceFactoryService resourceFactoryService =
>     registry
>                                    .get(ResourceFactoryService.class);
>
>                    KnowledgeBuilderConfiguration kbConf =
>     knowledgeBuilderFactoryService
>                                  
>      .newKnowledgeBuilderConfiguration(null, getClass()
>                                                    .getClassLoader());
>
>                    KnowledgeBuilder kbuilder =
>     knowledgeBuilderFactoryService
>                                    .newKnowledgeBuilder(kbConf);
>                    ResourceFactoryService resource =
>     resourceFactoryService;
>                    kbuilder.add(resource.newFileSystemResource(filePath),
>                                    ResourceType.CHANGE_SET);
>
>                    if (kbuilder.hasErrors()) {
>                            System.out.println(kbuilder.getErrors());
>                            throw new
>     RuntimeException(kbuilder.getErrors().toString());
>                    }
>
>                    KnowledgeBaseConfiguration kbaseConf =
>     knowledgeBaseFactoryService
>                                  
>      .newKnowledgeBaseConfiguration(null, getClass()
>                                                    .getClassLoader());
>
>                    KnowledgeBase kbase = knowledgeBaseFactoryService
>                                    .newKnowledgeBase(kbaseConf);
>                  
>      kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
>
>                    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));
>
>     Thanks in advance!
>
>     Cheers
>     --
>     View this message in context:
>     http://drools-java-rules-engine.46999.n3.nabble.com/KnowledgeAgent-and-OSGI-tp921989p921989.html
>     Sent from the Drools - User mailing list archive at Nabble.com.
>     _______________________________________________
>     rules-users mailing list
>     rules-users at lists.jboss.org <mailto:rules-users at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/rules-users
>
>
>
>
>
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100804/2f30b802/attachment.html 


More information about the rules-users mailing list