Package org.drools

Examples of org.drools.StatefulSession.dispose()


        Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        byte[] serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();

        assertEquals( 1,
                      results.size() );
        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );
View Full Code Here


        marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();

        // 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() );
View Full Code Here

        ksession = new StatefulKnowledgeSessionImpl( (ReteooStatefulSession ) session );
        marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );
        session.dispose();

        // 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() );
View Full Code Here

        session = SerializationHelper.getSerialisedStatefulSession( session,
                                                                    ruleBase );

        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();
    }

    /*
     * I have tried both the scenarios
     * 1. Remove a rule from a pkg.
View Full Code Here

        Marshaller marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        byte[] serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();

        assertEquals( 1,
                      results.size() );
        assertEquals( stilton1.getObject(),
                      results.get( 0 ) );
View Full Code Here

        marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();

        // 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() );
View Full Code Here

        marshaller = MarshallerFactory.newMarshaller( ksession.getKnowledgeBase() );
        marshaller.marshall( baos, ksession );
        baos.close();
        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();
        // Deserialize the rulebase and the session
        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;
View Full Code Here

        session = SerializationHelper.getSerialisedStatefulSession( session,
                                                                    ruleBase );
       
        serializedRulebase = DroolsStreamUtils.streamOut( ruleBase );

        session.dispose();

    }

    /**
     * In this case we are dealing with facts which are not on the systems classpath.
View Full Code Here

        WorkingMemory session2 = getSerialisedStatefulSession( session1,
                                                               true );

        session.dispose();
        session1.dispose();

        builder = new PackageBuilder();
        builder.addPackageFromDrl( new StringReader( rule2 ) );
        pkg = builder.getPackage();
View Full Code Here

        for (Object fact : workingSolution.getFacts()) {
            tmpWorkingMemory.insert(fact);
        }
        tmpWorkingMemory.fireAllRules();
        Score realScore = tmpScoreCalculator.calculateScore();
        tmpWorkingMemory.dispose();
        if (!presumedScore.equals(realScore)) {
            throw new IllegalStateException(
                    "The presumedScore (" + presumedScore + ") is corrupted because it is not the realScore  ("
                            + realScore + ").\n"
                    + "Presumed workingMemory:\n" + buildConstraintOccurrenceSummary(workingMemory)
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.