Package org.kie.api.runtime

Examples of org.kie.api.runtime.KieContainer.newKieSession()


        KieSessionConfiguration ksConf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
        ((SessionConfiguration) ksConf).setBeliefSystemType( BeliefSystemType.DEFEASIBLE );

        KieContainer kc = ks.newKieContainer( kieBuilder.getKieModule().getReleaseId() );
        return kbConf != null ? kc.newKieBase( kbConf ).newKieSession( ksConf, null ) : kc.newKieSession( ksConf);
    }


    @Test
    public void testAbductiveLogicWithConstructorArgs() {
View Full Code Here


* From http://www.ifitjams.com/start.gif
*/
public class DiagnosticsExample {
    public static void main(final String[] args) {
        KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
        KieSession ksession = kc.newKieSession("DiagnosticsKS");


        ksession.fireAllRules();

        ksession.dispose(); // Stateful rule session must always be disposed when finished
View Full Code Here

        kfs.generateAndWritePomXML( releaseId1 );
        kfs.write( ResourceFactory.newClassPathResource( source1 ).setResourceType( ResourceType.PMML ) );
        kb.buildAll();

        KieContainer kc = ks.newKieContainer( releaseId1 );
        KieSession kSession = kc.newKieSession();
        setKbase( kSession.getKieBase() );
        kSession.fireAllRules();

        kfs.write( ResourceFactory.newClassPathResource( source2 ).setResourceType( ResourceType.PMML ) );
        IncrementalResults results = (( InternalKieBuilder ) kb ).incrementalBuild();
View Full Code Here

        MavenRepository repository = getMavenRepository();
        repository.deployArtifact(releaseId, kJar1, kPom);

        // create a ksesion and check it works as expected
        KieSession ksession = kieContainer.newKieSession("KSession1");
        checkKSession(ksession, "rule1", "rule2");

        KieRepositoryScannerImpl scanner = (KieRepositoryScannerImpl) ks.newKieScanner(kieContainer);
        KieScannerMBeanImpl mBean = (KieScannerMBeanImpl) scanner.getMBean();
        ObjectName mbeanName = mBean.getMBeanName();
View Full Code Here

        repository.deployArtifact(releaseId, kJar2, kPom);
       
        MBeanUtils.invoke(mbeanName, "scanNow", new Object[] {}, new String[] {} );
       
        // create a ksesion and check it works as expected
        KieSession ksession2 = kieContainer.newKieSession("KSession1");
        checkKSession(ksession2, "rule2", "rule3");
       
        MBeanUtils.invoke(mbeanName, "shutdown", new Object[] {}, new String[] {} );
       
        Assert.assertEquals( InternalKieScanner.Status.SHUTDOWN.toString(), MBeanUtils.getAttribute( mbeanName, "Status") );
View Full Code Here

        KieModule kmodule = deployJar(ks, rkjar);
        assertNotNull(kmodule);

        KieContainer kContainer = ks.newKieContainer(kjarID);

        KieSession kSession = kContainer.newKieSession();
        List<?> list = new ArrayList<Object>();
        kSession.setGlobal("list", list);
        kSession.fireAllRules();

        assertEquals(1, list.size());
View Full Code Here

public class HouseOfDoomMain {

    public static void main(String[] args) throws Exception {
        KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
        KieSession ksession = kc.newKieSession( "HouseOfDoomKS");

        ksession.insert( new Location("Office", "House") );
        ksession.insert( new Location("Kitchen", "House") );
        ksession.insert( new Location("Knife", "Kitchen") );
        ksession.insert( new Location("Cheese", "Kitchen") );
View Full Code Here

        // From the kie services, a container is created from the classpath
        KieContainer kc = ks.getKieClasspathContainer();
       
        // From the container, a session is created based on 
        // its definition and configuration in the META-INF/kmodule.xml file
        KieSession ksession = kc.newKieSession("StateSalienceKS");
       
        // To setup a file based audit logger, uncomment the next line
        // KieRuntimeLogger logger = ks.getLoggers().newFileLogger( ksession, "./state" );

        final State a = new State( "A" );
View Full Code Here

        // From the kie services, a container is created from the classpath
        KieContainer kc = ks.getKieClasspathContainer();
       
        // From the container, a session is created based on 
        // its definition and configuration in the META-INF/kmodule.xml file
        KieSession ksession = kc.newKieSession("StateAgendaGroupKS");
       
        // To setup a file based audit logger, uncomment the next line
        // KieRuntimeLogger logger = ks.getLoggers().newFileLogger( ksession, "./state" );

        final State a = new State( "A" );
View Full Code Here

    public WumpusWorldMain() {
    }

    public void init(boolean exitOnClose) {
        KieContainer kc = KieServices.Factory.get().getKieClasspathContainer();
        final KieSession serverKsession = kc.newKieSession( "WumpusMainKS");
        final KieSession clientKsession = kc.newKieSession("WumpusClientKS");

        serverKsession.getChannels().put( "sensors", new Channel() {
            public void send(Object object) {
                clientKsession.insert( object );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.