Package org.drools.core.impl

Examples of org.drools.core.impl.InternalKnowledgeBase



        final MockObjectSource objectSource = new MockObjectSource( 1 );
        final MockTupleSource tupleSource = new MockTupleSource( 1 );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() );
        final JoinNode joinNode = new JoinNode( 2, tupleSource, objectSource,
                                                EmptyBetaConstraints.getInstance(),
                                                buildContext );

        final BetaMemory memory = (BetaMemory) workingMemory
View Full Code Here


        conf.setPhreakEnabled(false);
        conf.setSequential( true );

        this.workingMemory = new StatefulKnowledgeSessionImpl( 1, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase(conf) );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() );
        buildContext.setTupleMemoryEnabled( false );
        buildContext.setObjectTypeNodeMemoryEnabled( false );

        // override setup, so its working in sequential mode
        this.node = new JoinNode(
View Full Code Here

        when( constraint.isAllowedCachedRight( any( LeftTupleImpl.class ),
                                               any( ContextEntry.class ) ) ).thenReturn( true );

        final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl( 1, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase() );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() );

        final JoinNode joinNode = new JoinNode( 1, this.tupleSource,
                                                this.objectSource, EmptyBetaConstraints.getInstance(),
                                                buildContext );
View Full Code Here

        when( constraint.isAllowedCachedLeft(any(ContextEntry.class), any(InternalFactHandle.class))).thenReturn(true);
        when( constraint.isAllowedCachedRight(any(LeftTupleImpl.class), any(ContextEntry.class))).thenReturn(true);

        final StatefulKnowledgeSessionImpl workingMemory = new StatefulKnowledgeSessionImpl(1, (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase());

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        BuildContext buildContext = new BuildContext( kBase, kBase.getReteooBuilder().getIdGenerator() );

        final JoinNode joinNode = new JoinNode(1, this.tupleSource,
                this.objectSource, EmptyBetaConstraints.getInstance(), buildContext);

        // Add the first tuple sink and assert a tuple and object
View Full Code Here

        RuleImpl rule = pkg.getRule( "rule-1" );

        assertLength( 0,
                      builder.getErrors().getErrors() );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase)KnowledgeBaseFactory.newKnowledgeBase();
        kBase.getGlobals().put( "map", Map.class );
        final KieSession workingMemory = kBase.newStatefulKnowledgeSession();

        final HashMap map = new HashMap();
        workingMemory.setGlobal( "map",
                                 map );
View Full Code Here

                      builder.getErrors().getErrors() );

        InternalKnowledgePackage newPkg = SerializationHelper.serializeObject( pkg );
        final RuleImpl newRule = newPkg.getRule( "rule-1" );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase)KnowledgeBaseFactory.newKnowledgeBase();

        // It's been serialised so we have to simulate the re-wiring process
        newPkg.getDialectRuntimeRegistry().onAdd( kBase.getRootClassLoader() );
        newPkg.getDialectRuntimeRegistry().onBeforeExecute();

        kBase.getGlobals().put( "map", Map.class );
        final KieSession workingMemory = kBase.newStatefulKnowledgeSession();

        final HashMap map = new HashMap();

        workingMemory.setGlobal( "map",
                                 map );
View Full Code Here

    private static class ExecutorHolder {
        private static final Executor executor = ExecutorProviderFactory.getExecutorProvider().getExecutor();
    }

    private void executeJitting(InternalFactHandle handle, InternalWorkingMemory workingMemory, LeftTuple leftTuple) {
        InternalKnowledgeBase kBase = workingMemory.getKnowledgeBase();
        if ( MemoryUtil.permGenStats.isUsageThresholdExceeded(kBase.getConfiguration().getPermGenThreshold()) ) {
            return;
        }

        try {
            ClassLoader classLoader = kBase.getRootClassLoader();
            if (analyzedCondition == null) {
                analyzedCondition = ((MvelConditionEvaluator) conditionEvaluator).getAnalyzedCondition(handle, workingMemory, leftTuple);
            }
            conditionEvaluator = ASMConditionEvaluatorJitter.jitEvaluator(expression, analyzedCondition, declarations, classLoader, leftTuple);
        } catch (Throwable t) {
View Full Code Here

        context.setDeclarationResolver( declarationResolver );

        final MVELConsequenceBuilder builder = new MVELConsequenceBuilder();
        builder.build( context, RuleImpl.DEFAULT_CONSEQUENCE_NAME );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();

        PropagationContextFactory pctxFactory = kBase.getConfiguration().getComponentFactory().getPropagationContextFactory();
        kBase.addPackage(pkg);

        StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newStatefulKnowledgeSession();

        final Cheese cheddar = new Cheese( "cheddar", 10 );
        final InternalFactHandle f0 = (InternalFactHandle) ksession.insert( cheddar );
        final LeftTupleImpl tuple = new LeftTupleImpl( f0, null, true );
        f0.removeLeftTuple(tuple);
View Full Code Here

        context.setDeclarationResolver( declarationResolver );

        final MVELConsequenceBuilder builder = new MVELConsequenceBuilder();
        builder.build( context, RuleImpl.DEFAULT_CONSEQUENCE_NAME );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newStatefulKnowledgeSession();

        final Cheese cheddar = new Cheese( "cheddar",
                                           10 );
        final InternalFactHandle f0 = (InternalFactHandle) ksession.insert( cheddar );
        final LeftTupleImpl tuple = new LeftTupleImpl( f0,
View Full Code Here

        final Accumulate acc = (Accumulate) builder.build( context,
                                                           accDescr );

        ((MVELCompileable) acc.getAccumulators()[0]).compile( (MVELDialectRuntimeData) pkgBuilder.getPackageRegistry( pkg.getName() ).getDialectRuntimeRegistry().getDialectData( "mvel" ) );

        InternalKnowledgeBase kBase = (InternalKnowledgeBase) KnowledgeBaseFactory.newKnowledgeBase();
        StatefulKnowledgeSessionImpl ksession = (StatefulKnowledgeSessionImpl)kBase.newStatefulKnowledgeSession();

        MockLeftTupleSink sink = new MockLeftTupleSink();
        final Cheese cheddar1 = new Cheese( "cheddar",
                                            10 );
        final Cheese cheddar2 = new Cheese( "cheddar",
View Full Code Here

TOP

Related Classes of org.drools.core.impl.InternalKnowledgeBase

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.