java代码访问drools guvnor

发布于 2024-11-03 11:31:18 字数 62 浏览 2 评论 0原文

我们有一个项目要求通过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 ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉生梦死 2024-11-10 11:31:18

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

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>

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>
千と千尋 2024-11-10 11:31:18

我们应该在 Guvnor 参考手册中记录这一点。这是问题

We should document that in the Guvnor reference manual. Here's the issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文