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
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to