當前位置: 首頁>>代碼示例>>Java>>正文


Java KieServices.newKieClasspathContainer方法代碼示例

本文整理匯總了Java中org.kie.api.KieServices.newKieClasspathContainer方法的典型用法代碼示例。如果您正苦於以下問題:Java KieServices.newKieClasspathContainer方法的具體用法?Java KieServices.newKieClasspathContainer怎麽用?Java KieServices.newKieClasspathContainer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kie.api.KieServices的用法示例。


在下文中一共展示了KieServices.newKieClasspathContainer方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: helloDroolsTest

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Test
public void helloDroolsTest() {

    System.out.println( "Bootstrapping the Rule Engine ..." );
    // Bootstrapping a Rule Engine Session
    KieServices ks = KieServices.Factory.get();
    KieContainer kContainer = ks.newKieClasspathContainer();
    KieBase kBase = kContainer.getKieBase( "confKBase" );

    KieSession kSession = kBase.newKieSession();
    ArrayList<String> errors = new ArrayList<String>();
    kSession.setGlobal( "errors", errors );
    House house = new House( "Maniac Mansion" );
    kSession.insert( house );

    int fired = kSession.fireAllRules();
    assertEquals( 1, fired );
    assertEquals( 1, errors.size() );
    assertThat( errors, Matchers.contains( "Warn: Your House ( " + house.getName() + " ) has no Rooms" ) );

    kSession.dispose();

}
 
開發者ID:Salaboy,項目名稱:drools-game-engine,代碼行數:24,代碼來源:E_NoCDIRulesTest.java

示例2: start

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Override
public void start(BundleContext context) throws Exception {
    KieServices ks = KieServices.Factory.get();
    KieContainer kcont = ks.newKieClasspathContainer(getClass()
            .getClassLoader());
    KieBase kbase = kcont.getKieBase("SimpleRuleKBase");

    logger.info("KieSession newKieSession.");
    ksession = kbase.newKieSession();

    ksession.addEventListener(new DebugAgendaEventListener());
    ksession.addEventListener(new DebugRuleRuntimeEventListener());

    Customer customer = customerPoor();

    logger.info("KieSession fireAllRules. {}", customer);
    FactHandle fh = ksession.insert(customer);
    ksession.fireAllRules();
    ksession.delete(fh);
    logger.info("After rule {}", customer);

    customer = customerNormal();
    logger.info("KieSession fireAllRules. {}", customer);
    fh = ksession.insert(customer);
    ksession.fireAllRules();
    ksession.delete(fh);
    logger.info("After rule {}", customer);

    customer = customerVip();
    logger.info("KieSession fireAllRules. {}", customer);
    fh = ksession.insert(customer);
    ksession.fireAllRules();
    ksession.delete(fh);

    logger.info("After rule {}", customer);
}
 
開發者ID:apache,項目名稱:servicemix,代碼行數:37,代碼來源:SimpleRuleActivator.java

示例3: beforeClass

import org.kie.api.KieServices; //導入方法依賴的package包/類
/**
 * beforeClass.
 */
@BeforeClass
public static void beforeClass() {
    KieServices ks = KieServices.Factory.get();
    KieContainer kcont = ks.newKieClasspathContainer();
    KieBase kbase = kcont.getKieBase("SimpleRuleKBase");
    ksession = kbase.newKieSession();
    ksession.addEventListener(new DebugAgendaEventListener());
    ksession.addEventListener(new DebugRuleRuntimeEventListener());
}
 
開發者ID:apache,項目名稱:servicemix,代碼行數:13,代碼來源:SimpleTest.java

示例4: init

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Override
public void init(ServletConfig config) throws ServletException {

    tempDir = new File(System.getProperty("java.io.tmpdir"));

    CamelHandler handler = CamelHandlerFactory.fileHandler();

    KieServices kieServices = KieServices.Factory.get();
    KieContainer kieContainer = kieServices.newKieClasspathContainer(this.getClass().getClassLoader());
    kieSession = kieContainer.newKieSession("camel-workitem-ksession");
    kieSession.getWorkItemManager().registerWorkItemHandler("CamelFile", handler);

}
 
開發者ID:jboss-integration,項目名稱:fuse-bxms-integ,代碼行數:14,代碼來源:ApplicationServlet.java


注:本文中的org.kie.api.KieServices.newKieClasspathContainer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。