Thanks, I will try that...
2010/11/18 Anderson Rocha <anderson.ufal(a)gmail.com>
You can also use the CHANGE_SET.
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/ht...
A change_set example, where "rules" and "ruleflows" are folders that
must
contain just .drl and .drf files respectively:
<?xml version="1.0" encoding="UTF-8"?>
<change-set
xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='
http://drools.org/drools-5.0/change-set.xsd' >
<add>
<resource source='classpath:rules' type='DRL' />
<resource source='classpath:ruleflows' type='DRF' />
</add>
</change-set>
Also take a look at the Knowledge Agent session.
http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/ht...
Regards,
Anderson
2010/11/18 Wolfgang Laun <wolfgang.laun(a)gmail.com>
// Yesterday: serialize a KP collection
> OutputStream os = new FileOutputStream( pkgPath );
> ObjectOutputStream oos = new ObjectOutputStream( os );
> oos.writeObject( kBuilder.getKnowledgePackages() );
> oos.close();
>
> // Today: load serialized packages
> KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
> InputStream is = new FileInputStream( pkgPath );
> ObjectInputStream ois = new ObjectInputStream( is );
> @SuppressWarnings("unchecked")
> Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>)
> ois.readObject();
> ois.close();
> kBase.addKnowledgePackages( kpkgs );
>
> You may, of course, add more packages, compiled now.
> -W
>
> 2010/11/18 Yaniv Itzhaki <iyaniv(a)gmail.com>
>
>> Hi,
>>
>>
>> I wanted to know if it is possible to precompile rules/flows and load them on
demand?
>>
>>
>> Currently i am using the following code:
>>
>>
>> *KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
>>
>> for (String file : files) {
>> //(missing code) get files from directory and add them to KnowledgeBuilder
(source files - rules and flows)
>>
>> kbuilder.add(ResourceFactory.newFileResource(file), type);
>> }
>> *
>>
>> * private KnowledgeBase kb =
KnowledgeBaseFactory.newKnowledgeBase();
>> kb.addKnowledgePackages(kbuilder.getKnowledgePackages());*
>>
>> *
>> *
>>
>> Is there an option to add already precompiled files into KnowledgeBase and not
compile them only during the initialization phase?
>>
>>
>> Thanks
>>
>>
>> _______________________________________________
>> rules-users mailing list
>> rules-users(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/rules-users
>>
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
>
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users