[rules-users] creating .pkg from .drl

Ansgar Konermann ansgar.konermann at googlemail.com
Fri Apr 2 18:48:03 EDT 2010


On 03.04.2010 00:40, Amit Kumar wrote:
> Hi Folks,
>
> I am trying to create a .pkg file (for probably faster loading) from a 
> .drl file
>
> Does anybody has a code snippet which I can use. Am unable to find it 
> in javadocs.

Hi,

from what we figured out at work, they're just plain serialized 
knowledge packages (or rather, collections thereof). IIRC, this is also 
described somewhere in the docs.

So all you need to do is:
- create the knowledge packages in-memory using the normal 
KnowledgeBuilder api calls (loads of documentation available for this)
- use java object serialization to write a Collection<KnowledgePackage> 
into a file.

Upon loading these packages, make sure all the classes used/imported in 
the *.drl files are available on the classpath, otherwise you probably 
won't be able to deserialize the packages.

Kind regards

Ansgar





More information about the rules-users mailing list