本文整理匯總了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);
}
示例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;
}
示例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 );
}
示例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);
}
示例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");
}
示例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");
}
示例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);
}
示例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.");
}
示例9: createRuleBase
import org.kie.api.KieServices; //導入方法依賴的package包/類
public static KieContainer createRuleBase() {
KieServices ks = KieServices.Factory.get();
KieContainer kieContainer = ks.getKieClasspathContainer();
return kieContainer;
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}