开发者

Drools: Access rules stored in Guvnor in Java web app

开发者 https://www.devze.com 2023-02-09 16:24 出处:网络
Our Business analyst loads rules in Guvnor. How do I access/load that in code in my Java web app ? They wan开发者_JAVA百科t to be able to change the rules independent of the Java web app.

Our Business analyst loads rules in Guvnor. How do I access/load that in code in my Java web app ? They wan开发者_JAVA百科t to be able to change the rules independent of the Java web app.

I have seen code similar to this but I am not sure.

kbuilder.add( ResourceFactory.newInputStreamResource(new StringInputStream(myDrlAsString)), ResourceType.DRL);

kbuilder.add( ResourceFactory.newInputStreamResource(new ByteArrayInputStream(myDrlAsByteArr)), ResourceType.DRL);

Do I have to store the Guvnor rules in some classpath outside the web-app that can then be loaded by the java webapp ?

TIA, Vijay


I found my own answer. java.io.FileInputStream fis =null; fis = new java.io.FileInputStream (new java.io.File( ASSET_FILES[0] ) );

    kbuilder.add(ResourceFactory.newInputStreamResource(fis), ResourceType.DRL);
0

精彩评论

暂无评论...
验证码 换一张
取 消