Examples of newKieSession()


Examples of org.drools.core.impl.InternalKnowledgeBase.newKieSession()

                      ResourceType.DRL );

        InternalKnowledgeBase kbase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

        KieSession ksession = kbase.newKieSession();
        checkKieSession(ksession);

        // Create a 2nd KieSession (that will use segment memory prototype) and check that it works as the former one
        KieSession ksession2 = kbase.newKieSession();
        checkKieSession(ksession2);
View Full Code Here

Examples of org.drools.simulation.fluent.simulation.SimulationFluent.newKieSession()

                     "rule updateAge no-loop when  $p : Person() then modify( $p ) { setAge( $p.getAge() + 10 ) }; end\n";
       
        ReleaseId releaseId = createKJar( "org.test.KBase1", str );
       
        // @formatter:off       
        f.newKieSession( releaseId, "org.test.KBase1.KSession1" )
            .insert( new Person( "yoda", 150 ) ).set( "y" )
            .fireAllRules()
            // show testing inside of ksession execution
            .test( "y.name == 'yoda'" )
            .test( "y.age == 160" )
View Full Code Here

Examples of org.drools.simulation.fluent.simulation.impl.DefaultSimulationFluent.newKieSession()

                     "rule updateAge no-loop when  $p : Person() then modify( $p ) { setAge( $p.getAge() + 10 ) }; end\n";
       
        ReleaseId releaseId = createKJar( "org.test.KBase1", str );
       
        // @formatter:off       
        f.newKieSession( releaseId, "org.test.KBase1.KSession1" )
            .insert( new Person( "yoda", 150 ) ).set( "y" )
            .fireAllRules()
            // show testing inside of ksession execution
            .test( "y.name == 'yoda'" )
            .test( "y.age == 160" )
View Full Code Here

Examples of org.kie.KieBase.newKieSession()

        if ( kSessionModel == null ) {
            return null;
        }
        KieBase kBase = getKieBase( kSessionModel.getKieBaseModel().getName() );
        if ( kBase != null ) {
            return kBase.newKieSession();
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()

        KieBase kBase = getKieBase( kSessionModel.getKieBaseModel().getName() );
        if ( kBase == null ) {
            log.error("Unknown KieBase name: " + kSessionModel.getKieBaseModel().getName());
            return null;
        }
        KieSession kSession = kBase.newKieSession( conf != null ? conf : getKnowledgeSessionConfiguration(kSessionModel), environment );
        wireListnersAndWIHs(kSessionModel, kSession);

        registerLoggers(kSessionModel, kSession);

        kSessions.put(kSessionName, kSession);
View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()

        KieBase kBase = getKieBase( kSessionModel.getKieBaseModel().getName() );
        if ( kBase == null ) {
            log.error("Unknown KieBase name: " + kSessionModel.getKieBaseModel().getName());
            return null;
        }
        KieSession kSession = kBase.newKieSession( conf != null ? conf : getKnowledgeSessionConfiguration(kSessionModel), environment );
        wireListnersAndWIHs(kSessionModel, kSession);

        registerLoggers(kSessionModel, kSession);

        kSessions.put(kSessionName, kSession);
View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()

        KieBase kBase = getKieBase( kSessionModel.getKieBaseModel().getName() );
        if ( kBase == null ) {
            log.error("Unknown KieBase name: " + kSessionModel.getKieBaseModel().getName());
            return null;
        }
        KieSession kSession = kBase.newKieSession( conf != null ? conf : getKnowledgeSessionConfiguration(kSessionModel), environment );
        wireListnersAndWIHs(kSessionModel, kSession);

        KieSession oldSession = kSessions.remove(kSessionName);
        if (oldSession != null) {
            oldSession.dispose();
View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()

        }

        KieContainer kContainer = ks.newKieContainer( kr.getDefaultReleaseId() );

        KieBase kieBase = kContainer.getKieBase();
        return kieBase.newKieSession();
    }



View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()



    protected KieSession getSession(String theory) {
        KieBase kbase = readKnowledgeBase( new ByteArrayInputStream( theory.getBytes() ) );
        return kbase != null ? kbase.newKieSession() : null;
    }

    protected void refreshKSession() {
        if ( getKSession() != null ) {
            getKSession().dispose();
View Full Code Here

Examples of org.kie.api.KieBase.newKieSession()

        assertEquals(0, kbuilder.getResults().getMessages().size());

        KieBaseConfiguration conf = ks.newKieBaseConfiguration();
        conf.setOption(RuleEngineOption.RETEOO);
        KieBase kbase = ks.newKieContainer(kbuilder.getKieModule().getReleaseId()).newKieBase(conf);
        KieSession ksession = kbase.newKieSession();
        ksession.fireAllRules();
    }

    @Test
    public void testListnersOnStatlessKieSession() {
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.