[rules-users] Question About Programmatically Creating Drools Rules Remotely
Wolfgang Laun
wolfgang.laun at gmail.com
Wed Mar 17 01:55:03 EDT 2010
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 at 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 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/20100317/9fb37616/attachment.html
More information about the rules-users
mailing list