本文介绍了java代码访问drools guvnor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个项目要求通过Web应用程序访问guvnor。任何人都可以通过java代码告诉我如何访问guvnor吗?

We have a project requirement to access the guvnor through a web application .Can any one let me know how to access guvnor through java code ?

推荐答案

抵押贷款示例已经有一些示例代码。 Drools Expert手册可能会详细解释它。
这是代码:

The mortgage-example already has some example code. And the Drools Expert manual probably explains it in detail.Here's the code:

private static KnowledgeBase readKnowledgeBase() throws Exception {
    KnowledgeAgent kagent = KnowledgeAgentFactory
            .newKnowledgeAgent( "MortgageAgent" );
    kagent.applyChangeSet( ResourceFactory
            .newClassPathResource( "changeset.xml" ) );
    KnowledgeBase kbase = kagent.getKnowledgeBase();
    kagent.dispose();
    return kbase;
}

<?xml version="1.0" encoding="UTF-8"?>
<change-set xmlns='http://drools.org/drools-5.0/change-set'
    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
    xs:schemaLocation='http://drools.org/drools-5.0/change-set drools-change-set-5.0.xsd'>
  <add>
    <resource
  source='http://localhost:8080/guvnor-webapp/org.drools.guvnor.Guvnor/package/mortgages/LATEST'
  type='PKG' basicAuthentication='enabled' username='admin' password='admin' />

  </add>
</change-set>

这篇关于java代码访问drools guvnor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 03:56