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


Java KieServices.getKieClasspathContainer方法代碼示例

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


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

示例1: setup

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Before
public void setup() {
    KieServices kieServices = KieServices.Factory.get();

    KieContainer kContainer = kieServices.getKieClasspathContainer();
    Results verifyResults = kContainer.verify();
    for (Message m : verifyResults.getMessages()) {
        LOG.debug("Kie container message: {}", m);
    }

    KieBase kieBase = kContainer.getKieBase();
    LOG.debug("Created kieBase");

    for ( KiePackage kp : kieBase.getKiePackages() ) {
        for (Rule rule : kp.getRules()) {
            LOG.debug("kp " + kp + " rule " + rule.getName());
        }
    }

    session = kieBase.newKieSession();
    LOG.info(session.getGlobals().toString());
    Logger kieLogger = LoggerFactory.getLogger(this.getClass());
   // session.setGlobal("logger",kieLogger);
}
 
開發者ID:sabre1041,項目名稱:iot-ocp,代碼行數:25,代碼來源:BaseTest.java

示例2: executeAllRules

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public List<SocialActivitiesEvent> executeAllRules() {

    List<SocialActivitiesEvent> events = new ArrayList<>();
    try {

        KieServices ks = KieServices.Factory.get();
        KieContainer kContainer = ks.getKieClasspathContainer();

        KieSession kSession = kContainer.newKieSession("social-session");
        List<SocialActivitiesEvent> socialEvents = new ArrayList<>();
        kSession.setGlobal("socialEvents",
                           socialEvents);
        kSession.setGlobal("maxResults",
                           Integer.MAX_VALUE);
        kSession.setGlobal("queryAPI",
                           this);
        kSession.fireAllRules();

        events = (List<SocialActivitiesEvent>) kSession.getGlobal("socialEvents");
    } catch (Exception e) {
        throw new RulesExecutionQueryException(e);
    }
    return events;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:27,代碼來源:SocialTimelineRulesQuery.java

示例3: main

import org.kie.api.KieServices; //導入方法依賴的package包/類
public static final void main(final String[] args) {
    // KieServices is the factory for all KIE services 
    KieServices ks = KieServices.Factory.get();
    
    // From the kie services, a container is created from the classpath
    KieContainer kc = ks.getKieClasspathContainer();

    execute( kc );
}
 
開發者ID:ityouknow,項目名稱:drools-examples,代碼行數:10,代碼來源:HelloWorldExample.java

示例4: RulesProcessor

import org.kie.api.KieServices; //導入方法依賴的package包/類
public RulesProcessor(ActorRef destination, String kieSessionName) {
	final KieServices ks = KieServices.Factory.get();
	final KieContainer kc = ks.getKieClasspathContainer();
	kSession = kc.newKieSession(kieSessionName);
	kSession.addEventListener(new ReactionEventListener(destination));
	ex = Executors.newSingleThreadExecutor();
	ex.submit((Runnable) kSession::fireUntilHalt);
}
 
開發者ID:UniCreditDnA,項目名稱:reactive-rule-engine,代碼行數:9,代碼來源:RulesProcessor.java

示例5: setUp

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    // KieSession creation
    KieServices kieServices = KieServices.Factory.get();
    KieContainer kieContainer = kieServices.getKieClasspathContainer();
    kieSession = kieContainer.newStatelessKieSession("ksession1");
}
 
開發者ID:jSquirrel,項目名稱:nutforms,代碼行數:8,代碼來源:UserEntityRulesTest.java

示例6: setUp

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    // KieSession creation
    KieServices kieServices = KieServices.Factory.get();
    KieContainer kieContainer = kieServices.getKieClasspathContainer();
    // Specific session will be created here
    kieSession = kieContainer.newStatelessKieSession("accountsession");
    kieSession.setGlobal("status", "verified");
}
 
開發者ID:jSquirrel,項目名稱:nutforms,代碼行數:10,代碼來源:RulesInspectionTest.java

示例7: initializeRuntimeManager

import org.kie.api.KieServices; //導入方法依賴的package包/類
@PostConstruct
public void initializeRuntimeManager() {
	KieServices ks = KieServices.Factory.get();
	KieContainer kContainer = ks.getKieClasspathContainer();
	KieBase kbase = kContainer.getKieBase(KBNAME);
	manager = createRuntimeManager(kbase);
}
 
開發者ID:jesuino,項目名稱:bpms6-examples,代碼行數:8,代碼來源:ProcessBean.java

示例8: init

import org.kie.api.KieServices; //導入方法依賴的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

示例9: createRuleBase

import org.kie.api.KieServices; //導入方法依賴的package包/類
public static KieContainer createRuleBase() {

        KieServices ks = KieServices.Factory.get();
        KieContainer kieContainer = ks.getKieClasspathContainer();
        return kieContainer;
    }
 
開發者ID:nheron,項目名稱:droolscourse,代碼行數:7,代碼來源:KnowledgeSessionHelper.java

示例10: setupKieContainer

import org.kie.api.KieServices; //導入方法依賴的package包/類
private static KieContainer setupKieContainer() throws Exception {
    KieServices ks = KieServices.Factory.get();
    KieContainer kieContainer = ks.getKieClasspathContainer();
    return kieContainer;
}
 
開發者ID:redhat-italy,項目名稱:hacep,代碼行數:6,代碼來源:GameplayRuleTest.java

示例11: executeSpecificRule

import org.kie.api.KieServices; //導入方法依賴的package包/類
@Override
@SuppressWarnings("unchecked")
public List<SocialActivitiesEvent> executeSpecificRule(Map<String, String> globals,
                                                       final String drlName,
                                                       String maxResults) {

    List<SocialActivitiesEvent> events = new ArrayList<>();
    try {

        KieServices ks = KieServices.Factory.get();
        KieContainer kContainer = ks.getKieClasspathContainer();

        KieSession kSession = kContainer.newKieSession("social-session");
        List<SocialActivitiesEvent> socialEvents = new ArrayList<>();
        kSession.setGlobal("socialEvents",
                           socialEvents);
        kSession.setGlobal("queryAPI",
                           this);
        kSession.setGlobal("maxResults",
                           new Integer(maxResults));
        for (String key : globals.keySet()) {
            kSession.setGlobal(key,
                               globals.get(key));
        }
        kSession.fireAllRules(new AgendaFilter() {
            @Override
            public boolean accept(Match match) {
                String rulename = match.getRule().getName();

                if (rulename.equals(drlName)) {
                    return true;
                }

                return false;
            }
        });

        events = (List<SocialActivitiesEvent>) kSession.getGlobal("socialEvents");
    } catch (Exception e) {
        throw new RulesExecutionQueryException(e);
    }
    return events;
}
 
開發者ID:kiegroup,項目名稱:kie-wb-common,代碼行數:44,代碼來源:SocialTimelineRulesQuery.java

示例12: main

import org.kie.api.KieServices; //導入方法依賴的package包/類
/**
 * 計算額外積分金額 規則如下: 訂單原價金額
 * 100以下, 不加分
 * 100-500 加100分
 * 500-1000 加500分
 * 1000 以上 加1000分
 *
 * @param args
 * @throws Exception
 */
public static final void main(final String[] args) throws Exception{
    // KieServices is the factory for all KIE services
    KieServices ks = KieServices.Factory.get();

    // From the kie services, a container is created from the classpath
    KieContainer kc = ks.getKieClasspathContainer();

    execute( kc );
}
 
開發者ID:ityouknow,項目名稱:drools-examples,代碼行數:20,代碼來源:DroolsScoreExample.java

示例13: createContainer

import org.kie.api.KieServices; //導入方法依賴的package包/類
private KieContainer createContainer() {

        KieServices ks = KieServices.Factory.get();
        KieContainer kContainer = ks.getKieClasspathContainer();

        this.assertBuildResults(kContainer.verify());

        return kContainer;
    }
 
開發者ID:Salaboy,項目名稱:drools-workshop,代碼行數:10,代碼來源:PhreakInspector.java


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