本文整理匯總了Java中org.kie.api.KieServices.newReleaseId方法的典型用法代碼示例。如果您正苦於以下問題:Java KieServices.newReleaseId方法的具體用法?Java KieServices.newReleaseId怎麽用?Java KieServices.newReleaseId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.kie.api.KieServices
的用法示例。
在下文中一共展示了KieServices.newReleaseId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import org.kie.api.KieServices; //導入方法依賴的package包/類
public void init () {
LOG.info("[init]preparing stateful session...");
KieServices ks = KieServices.Factory.get();
String path = "";
try {
//OSGi support
BundleContext bc = Activator.getBundleContext();
if ( bc != null ) {
Preconditions.checkNotNull(bc, "bundle not activated");
URL url = bc.getBundle().getEntry(settingPath);
path = FileLocator.toFileURL(url).getPath();
} else {
path = settingPath;
}
} catch (Exception e) {
LOG.error("Failed to locate file:");
LOG.error(Throwables.getStackTraceAsString(e));
}
System.setProperty("kie.maven.settings.custom", path);
ReleaseId releaseId = ks.newReleaseId(groupId, artifactId, version);
LOG.info(String.format("[init]initializing kie container with releaseId %s", releaseId));
KieContainer kieContainer = ks.newKieContainer(releaseId);
KieScanner kieScanner = ks.newKieScanner(kieContainer);
kieScanner.scanNow();
ksession = kieContainer.newKieSession(session);
ksession.setGlobal("LOG", LOG);
LOG.info("[init]stateful rule engine prepared");
}
示例2: init
import org.kie.api.KieServices; //導入方法依賴的package包/類
public void init () {
LOG.info("[init]preparing stateless session...");
KieServices ks = KieServices.Factory.get();
String path = "";
try {
//OSGi support
BundleContext bc = Activator.getBundleContext();
if ( bc != null ) {
Preconditions.checkNotNull(bc, "bundle not activated");
URL url = bc.getBundle().getEntry(settingPath);
path = FileLocator.toFileURL(url).getPath();
} else {
path = settingPath;
}
} catch (Exception e) {
LOG.error("Failed to locate file:");
LOG.error(Throwables.getStackTraceAsString(e));
}
System.setProperty("kie.maven.settings.custom", path);
ReleaseId releaseId = ks.newReleaseId(groupId, artifactId, version);
LOG.info(String.format("[init]initializing kie container with releaseId %s", releaseId));
KieContainer kieContainer = ks.newKieContainer(releaseId);
KieScanner kieScanner = ks.newKieScanner(kieContainer);
kieScanner.scanNow();
ksession = kieContainer.newStatelessKieSession(session);
ksession.setGlobal("LOG", LOG);
LOG.info("[init]stateless rule engine prepared");
}
示例3: BRMSUtil
import org.kie.api.KieServices; //導入方法依賴的package包/類
public BRMSUtil() {
KieServices kServices = KieServices.Factory.get();
ReleaseId releaseId = kServices.newReleaseId( "com.redhat.poc.banking", "SLAMgmtRules", "LATEST" );
kContainer = kServices.newKieContainer( releaseId );
/*KieScanner kScanner = kServices.newKieScanner( kContainer );
// Start the KieScanner polling the maven repository every 10 seconds
System.out.println("Starting KieScanner...");
System.out.println();
kScanner.start( 10000L );
System.out.println("Started KieScanner sucessfully...");
System.out.println();*/
}
示例4: main
import org.kie.api.KieServices; //導入方法依賴的package包/類
public static void main(String[] args) {
BRMSUtil bUtil = new BRMSUtil();
/*KieSessionConfiguration conf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
conf.setOption( ClockTypeOption.get( "pseudo" ) );
*/
KieServices kServices = KieServices.Factory.get();
ReleaseId releaseId = kServices.newReleaseId( "com.redhat.poc.banking", "SLAMgmtRules", "LATEST" );
KieContainer kContainer = kServices.newKieContainer( releaseId );
//KieSession kSession = kContainer.newKieSession(conf);
KieSession kSession = kContainer.newKieSession();
BatchJobInfo info = new BatchJobInfo();
info.setTotalTransactions(100);
info.setNoOfTransProcessed(0);
info.setTransactionType("TX1");
info.setPctTransComplete(0.0);
kSession.insert(info);
BatchJobUpdate update1 = new BatchJobUpdate();
update1.setTransactionType("TX1");
update1.setNoOfTransProcessed(50);
kSession.insert(update1);
kSession.fireAllRules();
//kSession.fireUntilHalt();
System.out.println(info.getTransactionType());
System.out.println(info.getNoOfTransProcessed());
System.out.println(info.getPctTransComplete());
/* try {
Thread.sleep(25000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
kSession.fireAllRules();*/
kSession.fireUntilHalt();
/*
PseudoClockScheduler timeService = ( PseudoClockScheduler ) kSession.<SessionClock>getSessionClock();
timeService.advanceTime( new Date().getTime(), TimeUnit.MILLISECONDS );
*/
/*
timeService.advanceTime( 30, TimeUnit.SECONDS );
kSession.fireAllRules();*/
kSession.dispose();
}