On 04/08/2010 11:06, David Conde wrote:
Thanks Mark,

Cheers for the info. 

I've seen the OSGi bundle zip (and the boot bundle list [1]) but it seemed to have quite a large amount of dependencies for just drools-core and drools-compiler. Do you know if all these bundles are required for this subset? If not would you happen to have the list of what is?

If you don't have this handy I'll send it on so that you have it once I have figured it out :)
The spring testing framework makes you list all the dependencies manually, which it resolves against that osgi-bundles.zip contents. This is the file:
http://fisheye.jboss.org/browse/JBossRules/trunk/osgi-bundles/org.drools.osgi.test/src/test/resources/boot-bundles.properties?r=HEAD

It does contain a lot more than normal, mostly I just kept adding stuff intil OSGi would resolve and the unit tests pass. It may be possible not to include things like jaxb (especially if you are on  jdk6) and some of the other peripheral jars. We have used the spring repository and sometimes the transitivie dependencies are not left optional which means they are dragged in, and even if we don't us them OSGi will not resolve without them there. Maybe check out trunk and help us work on this and improve it?

The problem with OSGi is so few dependencies are are published as OSGi bundles, which means we have to rely on things like the spring osgi repository. That automates the building of the bundles and doesn't always handle optional dependencies that well.

Mark

[1] http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/osgi-bundles/org.drools.osgi.test/src/test/resources/boot-bundles.properties

- Dave

2010/8/4 Mark Proctor <mproctor@codehaus.org>
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@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@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


_______________________________________________
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