Package org.drools.impl

Examples of org.drools.impl.KnowledgeBaseImpl


    }

    public SingleSessionCommandService(RuleBase ruleBase,
                                       SessionConfiguration conf,
                                       Environment env) {
        this( new KnowledgeBaseImpl( ruleBase ),
              conf,
              env );
    }
View Full Code Here


    public SingleSessionCommandService(Integer sessionId,
                                       RuleBase ruleBase,
                                       SessionConfiguration conf,
                                       Environment env) {
        this( sessionId,
              new KnowledgeBaseImpl( ruleBase ),
              conf,
              env );
    }
View Full Code Here

                // so we read it, but we don't need it, so just ignore.
                ReteooStatefulSession rsession = (ReteooStatefulSession) ois.readObject();
   
                // now unmarshall that byte[]
                ByteArrayInputStream bais = new ByteArrayInputStream( rsession.bytes );
                Marshaller marshaller = MarshallerFactory.newMarshaller( new KnowledgeBaseImpl( this )new ObjectMarshallingStrategy[] { MarshallerFactory.newSerializeMarshallingStrategy() }   );
               
                Environment environment = EnvironmentFactory.newEnvironment();
                KieSession ksession = marshaller.unmarshall( bais,
                                                                           conf,
                                                                           environment );
View Full Code Here

        }
    }

    public static ActivationIterator iterator(InternalWorkingMemory wm) {
        return new ActivationIterator( wm,
                                       new KnowledgeBaseImpl( wm.getRuleBase() ) );
    }
View Full Code Here

        ResourceChangeScannerImpl scanner = (ResourceChangeScannerImpl) ResourceFactory.getResourceChangeScannerService();
        assertEquals( 5,
                      scanner.getInterval() );

        KnowledgeBaseImpl kbase1 = (KnowledgeBaseImpl) context.getBean( "kbase1" );
        KnowledgeBaseImpl kbase2 = (KnowledgeBaseImpl) context.getBean( "kbase2" );

        KnowledgeAgentImpl kagent1 = (KnowledgeAgentImpl) context.getBean( "kagent1" );
        assertSame( kagent1.getKnowledgeBase(),
                    kbase1 );
        assertEquals( 0,
                      kagent1.getResourceDirectories().size() );
        assertFalse( kagent1.isNewInstance() );

        KnowledgeAgentImpl kagent2 = (KnowledgeAgentImpl) context.getBean( "kagent2" );
        assertSame( kagent2.getKnowledgeBase(),
                    kbase2 );
        assertEquals( 1,
                      kagent2.getResourceDirectories().size() );
        assertFalse( kagent2.isNewInstance() );

        KnowledgeAgentImpl kagent3 = (KnowledgeAgentImpl) context.getBean( "kagent3" );
        assertTrue( kagent3.isNewInstance() );

        StatelessKnowledgeSessionImpl ksession1 = (StatelessKnowledgeSessionImpl) context.getBean( "ksession1" );
        assertSame( kbase1.getRuleBase(),
                    ksession1.getRuleBase() );
        assertSame( kagent1,
                    ksession1.getKnowledgeAgent() );

        StatefulKnowledgeSessionImpl ksession2 = (StatefulKnowledgeSessionImpl) context.getBean( "ksession2" );
        assertSame( kbase1.getRuleBase(),
                    ksession2.getRuleBase() );

        StatelessKnowledgeSessionImpl ksession3 = (StatelessKnowledgeSessionImpl) context.getBean( "ksession3" );
        assertSame( kagent2,
                    ksession3.getKnowledgeAgent() );
        assertSame( kbase2.getRuleBase(),
                    ksession3.getRuleBase() );

    }
View Full Code Here

    }

    @Test
    public void testConfiguration() {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( "org/drools/container/spring/session-conf-beans.xml" );
        KnowledgeBaseImpl kbase1 = (KnowledgeBaseImpl) context.getBean( "kbase1" );
        RuleBaseConfiguration rconf = ((InternalRuleBase) kbase1.getRuleBase()).getConfiguration();
        assertTrue( rconf.isAdvancedProcessRuleIntegration() );
        assertTrue( rconf.isMultithreadEvaluation() );
        assertEquals( 5,
                      rconf.getMaxThreads() );
        assertEquals( EventProcessingOption.STREAM,
                      rconf.getEventProcessingMode() );
        assertEquals( AssertBehaviour.IDENTITY,
                      rconf.getAssertBehaviour() );
        assertEquals( "org.drools.container.spring.MockConsequenceExceptionHandler",
                      rconf.getConsequenceExceptionHandler() );

        KnowledgeBaseImpl kbase2 = (KnowledgeBaseImpl) context.getBean( "kbase2" );
        rconf = ((InternalRuleBase) kbase2.getRuleBase()).getConfiguration();
        assertFalse( rconf.isAdvancedProcessRuleIntegration() );
        assertFalse( rconf.isMultithreadEvaluation() );
        assertEquals( 3,
                      rconf.getMaxThreads() );
        assertEquals( EventProcessingOption.CLOUD,
View Full Code Here

                // so we read it, but we don't need it, so just ignore.
                ReteooStatefulSession rsession = (ReteooStatefulSession) ois.readObject();
   
                // now unmarshall that byte[]
                ByteArrayInputStream bais = new ByteArrayInputStream( rsession.bytes );
                Marshaller marshaller = MarshallerFactory.newMarshaller( new KnowledgeBaseImpl( this ) );
                StatefulKnowledgeSession ksession = marshaller.unmarshall( bais,
                                                                           new SessionConfiguration(),
                                                                           EnvironmentFactory.newEnvironment() );
                session = (StatefulSession) ((StatefulKnowledgeSessionImpl) ksession).session;
   
View Full Code Here

    }

    public KnowledgeBase execute(ReteooWorkingMemory session) {
        RuleBase ruleBase = session.getRuleBase();

        return new KnowledgeBaseImpl( ruleBase );
    }
View Full Code Here

        session.dispose();

        // now deserialize the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) DroolsStreamUtils.streamIn( serializedRulebase );

        marshaller = MarshallerFactory.newMarshaller( new KnowledgeBaseImpl( ruleBase ) );
        ksession = (StatefulKnowledgeSessionImpl) marshaller.unmarshall( new ByteArrayInputStream( baos.toByteArray() ),
                                                                         KnowledgeBaseFactory.newKnowledgeSessionConfiguration(),
                                                                         EnvironmentFactory.newEnvironment() );
        session = (ReteooStatefulSession) ksession.session;
        session.setGlobalResolver( resolver );
View Full Code Here

        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );

        // now recreate the rulebase, deserialize the session and test it
        ruleBase = (RuleBase) DroolsStreamUtils.streamIn( serializedRulebase );
        marshaller = MarshallerFactory.newMarshaller( new KnowledgeBaseImpl( ruleBase ) );
        ksession = (StatefulKnowledgeSessionImpl) marshaller.unmarshall( new ByteArrayInputStream( baos.toByteArray() ),
                                                                         KnowledgeBaseFactory.newKnowledgeSessionConfiguration(),
                                                                         EnvironmentFactory.newEnvironment() );
        session = (ReteooStatefulSession) ksession.session;
        session.setGlobalResolver( resolver );
View Full Code Here

TOP

Related Classes of org.drools.impl.KnowledgeBaseImpl

Copyright © 2018 www.massapicom. 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.