Thanks, and this should get me started.
I find that most of the documentation is eclipse-centric, and probably it would help for the newbies like me, if the documentation also includes more material on usage with other IDEs.

Thanks again
Regards,
kp

2009/5/3 Wolfgang Laun <wolfgang.laun@gmail.com>
This is what you might do:


        KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
        KnowledgeBuilder kBuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
        kBuilder.add( ResourceFactory.newFileResource( "Movie.drl" ),
                      ResourceType.DRL );
        if( kBuilder.hasErrors() ){
            for( KnowledgeBuilderError err: kBuilder.getErrors() ){
                System.out.println( err.toString() );
            }
            throw new IllegalStateException( "DRL errors" );
        }

        OutputStream os = new FileOutputStream( "Movie.pkg" );
        ObjectOutputStream oos = new ObjectOutputStream( os );

        oos.writeObject( kBuilder.getKnowledgePackages() );
       
// And now, from the file containing the binary knowlewdge packages:

        InputStream is = new FileInputStream( "Movie.pkg" );
        ObjectInputStream ois = new ObjectInputStream( is );
        @SuppressWarnings("unchecked")
        Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) ois.readObject();
        ois.close();

        kBase.addKnowledgePackages( kpkgs );

-W


2009/5/2 Perumaal Krishnaraj <perumaal.k@gmail.com>
Hello Everybody,
I'm a newbie to Drools, so please excuse me, if question is very fundamental.
I'm not using drools with eclipse or brms.
I would like to convert the drl file which I had created using a text editor to the binary form ie. in pkg format (serialized), which can be used im my Java application.

Is there a tool, or a code snippet which gives me an idea as to how this is done.

Regards,
kp




_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users