Package org.drools.reteoo

Examples of org.drools.reteoo.ReteooWorkingMemory$QueryResultInsertAction


            return group1.getName().compareTo( group2.getName() );
        }
    }

    public static void writeActionQueue(MarshallerWriteContext context) throws IOException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;

        WorkingMemoryAction[] queue = wm.getActionQueue().toArray( new WorkingMemoryAction[wm.getActionQueue().size()] );
        for ( int i = queue.length - 1; i >= 0; i-- ) {
            context.writeShort( PersisterEnums.WORKING_MEMORY_ACTION );
            queue[i].write( context );
        }
        context.writeShort( PersisterEnums.END );
View Full Code Here


    private AbstractWorkingMemory createWorkingMemory(RuleBase ruleBase) {
        // WorkingMemoryEntryPoint
        KnowledgeSessionConfiguration ksconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
        ksconf.setOption( ClockTypeOption.get( "pseudo" ) );
        SessionConfiguration sessionConf = ((SessionConfiguration) ksconf);
        AbstractWorkingMemory wm = new ReteooWorkingMemory(1, (InternalRuleBase) ruleBase,
                sessionConf, EnvironmentFactory.newEnvironment());
       
        return wm;
    }
View Full Code Here

        }

    }

    public static void readActionQueue( MarshallerReaderContext context ) throws IOException, ClassNotFoundException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
        Queue<WorkingMemoryAction> actionQueue = wm.getActionQueue();
        while (context.readShort() == PersisterEnums.WORKING_MEMORY_ACTION) {
            actionQueue.offer( PersisterHelper.readWorkingMemoryAction( context ) );
        }
    }
View Full Code Here

        }
    }

    public static void writeSession(MarshallerWriteContext context) throws IOException {
        //context.out.println( "... write session");
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
        wm.getAgenda().unstageActivations();

        final boolean multithread = wm.isPartitionManagersActive();
        // is multi-thread active?
        if ( multithread ) {
            context.writeBoolean( true );
            wm.stopPartitionManagers();
        } else {
            context.writeBoolean( false );
        }       
       
        long time = 0;
        if ( context.wm.getTimerService() instanceof PseudoClockScheduler ) {
          time = context.clockTime;
        }
        context.writeLong( time );

        context.writeInt( wm.getFactHandleFactory().getId() );
        context.writeLong( wm.getFactHandleFactory().getRecency() );
        ////context.out.println( "FactHandleFactory int:" + wm.getFactHandleFactory().getId() + " long:" + wm.getFactHandleFactory().getRecency() );

        context.writeLong( wm.getPropagationIdCounter() );
        //context.out.println( "PropagationCounter long:" + wm.getPropagationIdCounter() );       
       
        InternalFactHandle handle = context.wm.getInitialFactHandle();
        context.writeInt( handle.getId() );
        context.writeLong( handle.getRecency() );
        //context.out.println( "InitialFact int:" + handle.getId() + " long:" + handle.getRecency() );

       
        writeAgenda( context );       
       
       
        writeInitialFactHandleRightTuples( context );
        for ( WorkingMemoryEntryPoint wmep : wm.getEntryPoints().values() ) {
            context.stream.writeShort( PersisterEnums.ENTRY_POINT );
            context.stream.writeUTF( wmep.getEntryPointId() );
            writeFactHandles( context, (( NamedEntryPoint )wmep).getObjectStore() );
        }
        context.stream.writeShort( PersisterEnums.END );
        writeInitialFactHandleLeftTuples( context );
       
        writePropagationContexts( context );

        writeActivations( context );       


        writeActionQueue( context );

        writeTruthMaintenanceSystem( context );

        if ( context.marshalProcessInstances && processMarshaller != null ) {
            processMarshaller.writeProcessInstances( context );
        }
        else {
            context.stream.writeShort( PersisterEnums.END );
        }

        if ( context.marshalWorkItems && processMarshaller != null ) {
            processMarshaller.writeWorkItems( context );
        }    
        else {
            context.stream.writeShort( PersisterEnums.END );
        }
       
        if ( processMarshaller != null ) {
            // this now just assigns the writer, it will not write out any timer information
            processMarshaller.writeProcessTimers( context );
        }               
        else {
            context.stream.writeShort( PersisterEnums.END );
        }
       
        // Only works for JpaJDKTimerService
        writeTimers( context.wm.getTimerService().getTimerJobInstances(), context );

        if ( multithread ) {
            wm.startPartitionManagers();
        }
       
        //context.out.println( "--- write session --- END");
    }
View Full Code Here

            return group1.getName().compareTo( group2.getName() );
        }
    }

    public static void writeActionQueue(MarshallerWriteContext context) throws IOException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;

        WorkingMemoryAction[] queue = wm.getActionQueue().toArray( new WorkingMemoryAction[wm.getActionQueue().size()] );
        for ( int i = queue.length - 1; i >= 0; i-- ) {
            context.writeShort( PersisterEnums.WORKING_MEMORY_ACTION );
            queue[i].write( context );
        }
        context.writeShort( PersisterEnums.END );
View Full Code Here

        assertNotNull( retractedWorker );

        StatefulKnowledgeSessionImpl sessionImpl = (StatefulKnowledgeSessionImpl) ksession;

        ReteooWorkingMemory reteWorkingMemory = sessionImpl.session;
        AbstractWorkingMemory abstractWorkingMemory = (AbstractWorkingMemory) reteWorkingMemory;

        InternalRuleBase ruleBase = (InternalRuleBase) abstractWorkingMemory.getRuleBase();
        Collection<EntryPointNode> entryPointNodes = ruleBase.getRete().getEntryPointNodes().values();
View Full Code Here

        }

    }

    public static void readActionQueue(MarshallerReaderContext context) throws IOException, ClassNotFoundException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
        Queue<WorkingMemoryAction> actionQueue = wm.getActionQueue();
        while ( context.readShort() == PersisterEnums.WORKING_MEMORY_ACTION ) {
            actionQueue.offer( PersisterHelper.readWorkingMemoryAction( context ) );
        }
    }
View Full Code Here

        }
    }

    public static void writeSession(MarshallerWriteContext context) throws IOException {
        //context.out.println( "... write session");
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;
        wm.getAgenda().unstageActivations();

        final boolean multithread = wm.isPartitionManagersActive();
        // is multi-thread active?
        if ( multithread ) {
            context.writeBoolean( true );
            wm.stopPartitionManagers();
        } else {
            context.writeBoolean( false );
        }       
       
        long time = 0;
        if ( context.wm.getTimerService() instanceof PseudoClockScheduler ) {
          time = context.clockTime;
        }
        context.writeLong( time );

        context.writeInt( wm.getFactHandleFactory().getId() );
        context.writeLong( wm.getFactHandleFactory().getRecency() );
        ////context.out.println( "FactHandleFactory int:" + wm.getFactHandleFactory().getId() + " long:" + wm.getFactHandleFactory().getRecency() );


       
        InternalFactHandle handle = context.wm.getInitialFactHandle();
        context.writeInt( handle.getId() );
        context.writeLong( handle.getRecency() );
        //context.out.println( "InitialFact int:" + handle.getId() + " long:" + handle.getRecency() );

        context.writeLong( wm.getPropagationIdCounter() );
        //context.out.println( "PropagationCounter long:" + wm.getPropagationIdCounter() );       
       
        writeAgenda( context );       
       
       
        writeInitialFactHandleRightTuples( context );
        for ( WorkingMemoryEntryPoint wmep : wm.getEntryPoints().values() ) {
            context.stream.writeShort( PersisterEnums.ENTRY_POINT );
            context.stream.writeUTF( wmep.getEntryPointId() );
            writeFactHandles( context, (( NamedEntryPoint )wmep).getObjectStore() );
        }
        context.stream.writeShort( PersisterEnums.END );
        writeInitialFactHandleLeftTuples( context );
       
        writePropagationContexts( context );

        writeActivations( context );       


        writeActionQueue( context );

        writeTruthMaintenanceSystem( context );

        if ( context.marshalProcessInstances && processMarshaller != null ) {
            processMarshaller.writeProcessInstances( context );
        }

        if ( context.marshalWorkItems && processMarshaller != null ) {
            processMarshaller.writeWorkItems( context );
        }    
       
        if ( processMarshaller != null ) {
            // this now just assigns the writer, it will not write out any timer information
            processMarshaller.writeProcessTimers( context );
        }               
       
        // Only works for JpaJDKTimerService
        writeTimers( context.wm.getTimerService().getTimerJobInstances(), context );

        if ( multithread ) {
            wm.startPartitionManagers();
        }
       
        //context.out.println( "--- write session --- END");
    }
View Full Code Here

            return group1.getName().compareTo( group2.getName() );
        }
    }

    public static void writeActionQueue(MarshallerWriteContext context) throws IOException {
        ReteooWorkingMemory wm = (ReteooWorkingMemory) context.wm;

        WorkingMemoryAction[] queue = wm.getActionQueue().toArray( new WorkingMemoryAction[wm.getActionQueue().size()] );
        for ( int i = queue.length - 1; i >= 0; i-- ) {
            context.writeShort( PersisterEnums.WORKING_MEMORY_ACTION );
            queue[i].write( context );
        }
        context.writeShort( PersisterEnums.END );
View Full Code Here

        assertNotNull( retractedWorker );

        StatefulKnowledgeSessionImpl sessionImpl = (StatefulKnowledgeSessionImpl) ksession;

        ReteooWorkingMemory reteWorkingMemory = sessionImpl.session;
        AbstractWorkingMemory abstractWorkingMemory = (AbstractWorkingMemory) reteWorkingMemory;

        InternalRuleBase ruleBase = (InternalRuleBase) abstractWorkingMemory.getRuleBase();
        Collection<EntryPointNode> entryPointNodes = ruleBase.getRete().getEntryPointNodes().values();
View Full Code Here

TOP

Related Classes of org.drools.reteoo.ReteooWorkingMemory$QueryResultInsertAction

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.