[rules-users] creating .pkg from .drl
Esteban Aliverti
esteban.aliverti at gmail.com
Wed Aug 4 12:40:40 EDT 2010
Are you experiencing any error? Or it just doesn't work as you expected?
Try doing a test without using kagent. Try to create a new KBase and add the
serialized packages you have.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Esteban Aliverti
- Developer @ http://www.plugtree.com
- Blog @ http://ilesteban.wordpress.com
On Wed, Aug 4, 2010 at 1:07 PM, jrob <josh.roberts at cerner.com> wrote:
>
> Did you actually get this to work? I have tried both ways to create a .PKG
> mentioned here and still haven't got it to work.
>
> FILE CREATION CODE (Commented out portions are for direct serialization):
> public static void createPKG(Collection<KnowledgePackage> kpkgs,
> File file)
> throws IOException, FileNotFoundException
> {
> FileOutputStream fos = null;
> ObjectOutputStream out = null;
>
> fos = new FileOutputStream(file);
> out = new ObjectOutputStream(fos);
>
> try
> {
> //out.writeObject(kpkgs);
> DroolsStreamUtils.streamOut(fos, kpkgs);
> }
> catch (IOException e)
> {
> String error ="Could not serialize object!";
> logger.error(error);
> throw new DroolsPKGCreatorException(error,e);
> }
> finally
> {
> try
> {
> //out.close();
> fos.close();
> }
> catch (IOException e)
> {
> logger.error("Could not close stream during
> serialization!",e);
> }
> }
>
> }
>
> KBASE CREATION FROM PKG
>
> KnowledgeAgent kagent =
> KnowledgeAgentFactory.newKnowledgeAgent(
> "MyKnowledgeAgent" );
>
> kagent.applyChangeSet(ResourceFactory.newClassPathResource(/* file created
> from above method */));
>
> KnowledgeBase kbase = kagent.getKnowledgeBase();
>
> Am I doing something wrong? Thanks for the help!
> --
> View this message in context:
> http://drools-java-rules-engine.46999.n3.nabble.com/creating-pkg-from-drl-tp694012p1023150.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100804/dfe13651/attachment.html
More information about the rules-users
mailing list