当前位置: 首页>>代码示例>>Java>>正文


Java KieBaseConfiguration类代码示例

本文整理汇总了Java中org.kie.api.KieBaseConfiguration的典型用法代码示例。如果您正苦于以下问题:Java KieBaseConfiguration类的具体用法?Java KieBaseConfiguration怎么用?Java KieBaseConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


KieBaseConfiguration类属于org.kie.api包,在下文中一共展示了KieBaseConfiguration类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initKie

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
private void initKie() {
  KieServices ks = KieServices.Factory.get();
  kfs = ks.newKieFileSystem();
  uploadDroolFiles();
  KieBuilder kbuilder = ks.newKieBuilder(kfs);
  kbuilder.buildAll();
  if (kbuilder.getResults().hasMessages(Level.ERROR)) {
    throw new IllegalArgumentException(kbuilder.getResults().toString());
  }
  KieContainer kcontainer = ks.newKieContainer(kbuilder.getKieModule().getReleaseId());
  KieBaseConfiguration kbConfig = KieServices.Factory.get().newKieBaseConfiguration();
  kbConfig.setOption(ConstraintJittingThresholdOption.get(-1));
  kbase = kcontainer.newKieBase(kbConfig);
}
 
开发者ID:edgexfoundry,项目名称:support-rulesengine,代码行数:15,代码来源:RuleEngine.java

示例2: setupKieBase

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
public static KieBase setupKieBase(String... resources) throws Exception {
    ReleaseId releaseId = ks.newReleaseId("it.redhat.jdg", "rules", "1.0.0");
    KieContainer kieContainer = setupKieContainerFromTemplates(releaseId, resources);

    KieBaseConfiguration config = KieServices.Factory.get().newKieBaseConfiguration();
    config.setOption(EventProcessingOption.STREAM);

    return kieContainer.getKieBase();
}
 
开发者ID:redhat-italy,项目名称:hacep,代码行数:10,代码来源:KieAPITestUtils.java

示例3: updateConditions

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
public void updateConditions(String expiration, Collection<FullTrigger> activeTriggers) {
    expression = new Expression(expiration, activeTriggers);
    log.debugf("Rules: \n  %s", expression);
    stop();
    KieBaseConfiguration kieBaseConfiguration = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
    kieBaseConfiguration.setOption( EventProcessingOption.STREAM );
    KieBase kieBase = new KieHelper().addContent(expression.getDrl(), ResourceType.DRL).build(kieBaseConfiguration);
    KieSessionConfiguration kieSessionConf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    kieSessionConf.setOption( ClockTypeOption.get( "realtime" ) );

    kieSession = kieBase.newKieSession(kieSessionConf, null);
    results = new ArrayList<>();
    kieSession.setGlobal("results", this);
    kieSession.setGlobal("log", log);
    if (log.isDebugEnabled()) {
        kieSession.addEventListener(new CepAgendaEventListener());
        kieSession.addEventListener(new CepRuleRuntimeEventListener());
    }
    log.debugf("Clock time [%s] ", kieSession.getSessionClock().getCurrentTime());

    kieSession.getKieBase().getKiePackages().stream().forEach(p -> log.debugf("Rules: %s", p.getRules()));

    executor.submit(() -> {
        log.info("Starting fireUntilHalt()");
        kieSession.fireUntilHalt();
        log.info("Stopping fireUntilHalt()");
    });
}
 
开发者ID:hawkular,项目名称:hawkular-alerts,代码行数:29,代码来源:CepEngineImpl.java

示例4: init

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
@PostConstruct
public void init() {
	KieServices kieServices = KieServices.Factory.get();
	KieContainer kContainer = kieServices.getKieClasspathContainer();
       KieBaseConfiguration kieBaseConf = kieServices.newKieBaseConfiguration();
	kieBaseConf.setOption( EventProcessingOption.STREAM );
       kieBase = kContainer.newKieBase(kieBaseConf);
       
       for ( KiePackage kp : kieBase.getKiePackages() ) {
       	for (Rule rule : kp.getRules()) {
       		LOG.info("kp " + kp + " rule " + rule.getName());
       	}
       }
       
       LOG.info("Creating kieSession");
       KieSessionConfiguration config = kieServices.newKieSessionConfiguration();
	config.setOption( ClockTypeOption.get("pseudo") );
       kieSession = kieBase.newKieSession(config, null);
       
       LOG.info("Pupulating globals");
       kieSession.setGlobal("LOG", RE_LOG);
       
       sessionClock = kieSession.getSessionClock();
       LOG.info("init() sessionClock: {}", sessionClock.getCurrentTime());
       
       final long nowMS = System.currentTimeMillis();
       sessionClock.advanceTime(nowMS, TimeUnit.MILLISECONDS);
       LOG.info("init() sessionClock advanced, sessionClock: {}", sessionClock.getCurrentTime());
       
       kieSession.fireAllRules(MAX_RULES_THRESHOLD);
       LOG.info("init() onetime fireAllRules");
       
       LOG.info("init() end.");
}
 
开发者ID:tarilabs,项目名称:reex2014,代码行数:35,代码来源:PseudoRealtimeRuleEngine.java

示例5: sharedSetup

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
private void sharedSetup()
{
	logger.debug("Configuring KnowledgeBase Configuration for " + name_);
	KieBaseConfiguration kBaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
	Class<? extends ConsequenceExceptionHandler> c = DroolsExceptionHandler.class;
	ConsequenceExceptionHandlerOption cehOption = ConsequenceExceptionHandlerOption.get(c);

	kBaseConfig.setOption(cehOption);
	if (drools_dialect_java_compiler != null)
	{
		kBaseConfig.setProperty("drools.dialect.java.compiler", drools_dialect_java_compiler);
	}

	kbase_ = KnowledgeBaseFactory.newKnowledgeBase(kBaseConfig);
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:16,代码来源:DroolsExecutor.java

示例6: testCompareInstances

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
@Test
public void testCompareInstances() throws Exception {

    KieBaseConfiguration config = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
    config.setOption(EventProcessingOption.STREAM);
    KnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(config);
    KieSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    ksconf.setOption(ClockTypeOption.get("pseudo"));
    ksconf.setOption(TimerJobFactoryOption.get("trackable"));
    
    StatefulKnowledgeSession ksessionA = knowledgeBase.newStatefulKnowledgeSession(ksconf, null);
    StatefulKnowledgeSession ksessionB = knowledgeBase.newStatefulKnowledgeSession(ksconf, null);

    Assert.assertTrue(KieGimcrack.class.getSimpleName() + " is broken!", kieGimcrack.compareInstances(ksessionA, ksessionB));
}
 
开发者ID:mrietveld,项目名称:gimcrack,代码行数:16,代码来源:TestMarshallingUtilsTest.java

示例7: newKieBaseConfiguration

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
@Override
public KieBaseConfiguration newKieBaseConfiguration() {
	return kieServices.newKieBaseConfiguration();
}
 
开发者ID:deepu105,项目名称:drools-demo,代码行数:5,代码来源:DefaultKieServicesBean.java

示例8: newKieBase

import org.kie.api.KieBaseConfiguration; //导入依赖的package包/类
@Override
public KieBase newKieBase(KieBaseConfiguration conf) {
    return kieContainer.newKieBase(conf);
}
 
开发者ID:deepu105,项目名称:drools-demo,代码行数:5,代码来源:DefaultKieContainerBean.java


注:本文中的org.kie.api.KieBaseConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。