After further testing, here's what I am seeing.
GOAL: Serialize a KnowledgePackage object (or Collection of them) to a File,
read that file in as a PKG to create a KnowledgeBase
I have not gotten basic Java Serialization to work. I get the exception from
the previous post every time I try to create the KnowledgeAgent/Builder
using the PKG file.
When using the DroolsStreamUtils class to do the serialization, the only way
I get it to work is when I serialize a SINGLE KnowledgePackage (Collection
doesn't work, this also limits to using a single resource, so building a PKG
manually to represent a DSL + DSLR won't work) and use a KnowledgeAgent
(with a changeset.xml that references the single PKG file). When I try to
use Collections of KnowledgePackages (with KnowledgeBuilder or
KnowledgeAgent), I get a classcastexception only this time it recognizes it
as an ArrayList. When I try to use the single package with a
KnowledgeBuilder, I get a classcastexception to KnowledgePackageImp.
After seeing in the code for Package.readExternal() (which is executed as
soon as the resource trying to be added is of type 'PKG' is:
this.dialectRuntimeRegistry = (DialectRuntimeRegistry) in.readObject()
I am assuming it is not possible to truly create your own PKG resources
unless you want to create a PKG per resource, is this correct?
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl...
Sent from the Drools - User mailing list archive at
Nabble.com.