[rules-users] KnowledgeAgent and OSGI

David Conde dconde at calomtech.com
Wed Aug 4 06:06:53 EDT 2010


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 :)

[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 at 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 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
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
>
>
>
>
> _______________________________________________
> rules-users mailing listrules-users at lists.jboss.orghttps://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/bf037bac/attachment.html 


More information about the rules-users mailing list