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


Java KieServices.newReleaseId方法代碼示例

本文整理匯總了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");
}
 
開發者ID:CodeGerm,項目名稱:Pathogen,代碼行數:33,代碼來源:StatefulKieSession.java

示例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");
}
 
開發者ID:CodeGerm,項目名稱:Pathogen,代碼行數:34,代碼來源:StatelessKieSession.java

示例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();*/
 }
 
開發者ID:anurag-saran,項目名稱:sla-mgmt-brms,代碼行數:19,代碼來源:BRMSUtil.java

示例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();
    	
    }
 
開發者ID:anurag-saran,項目名稱:sla-mgmt-brms,代碼行數:63,代碼來源:BRMSUtil.java


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