If you have created a .drl file you can

        kBuilder.add( ResourceFactory.newFileResource( "some.drl" ), ResourceType.DRL );
        if( kBuilder.hasErrors() ){ ...}
        OutputStream os = new FileOutputStream( "some.pkg" );
        ObjectOutputStream oos = new ObjectOutputStream( os );
        oos.writeObject( kBuilder.getKnowledgePackages() );
       
That's now a serialized package. And so you can load this package into a Knowledge Base:

        KnowledgeBase kBase = KnowledgeBaseFactory.newKnowledgeBase();
        InputStream is = new FileInputStream( "some.pkg" );
        ObjectInputStream ois = new ObjectInputStream( is );
        @SuppressWarnings("unchecked")
        Collection<KnowledgePackage> kpkgs = (Collection<KnowledgePackage>) ois.readObject();
        ois.close();
        kBase.addKnowledgePackages( kpkgs );

-W


On Wed, Mar 17, 2010 at 6:46 AM, S. McKee <scmckee@i-zoom.net> wrote:
Hello,

I am running a Drools Guvnor server. While it is not an issue to create
rules through the UI, I do have a need to create rules and packages
through a Java program that I am coding that will connect remotely to
the Guvnor server from another box. Does anyone know if this is this
possible? If so, could I get pointed in the right direction for making
this happen?

Thank You,

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