[jboss-svn-commits] JBL Code SVN: r33074 - in labs/jbossrules/trunk/drools-core/src/main/java/org/drools: reteoo and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue May 25 09:58:50 EDT 2010


Author: KrisVerlaenen
Date: 2010-05-25 09:58:49 -0400 (Tue, 25 May 2010)
New Revision: 33074

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooStatelessSession.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
Log:
JBRULES-2516: Ruleflow rule task nodes not transitioning to next node with Stateless Sessions
 - applied patch

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2010-05-25 12:14:09 UTC (rev 33073)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2010-05-25 13:58:49 UTC (rev 33074)
@@ -81,7 +81,6 @@
 import org.drools.reteoo.InitialFactHandleDummyObject;
 import org.drools.reteoo.LIANodePropagation;
 import org.drools.reteoo.LeftTuple;
-import org.drools.reteoo.ModifyPreviousTuples;
 import org.drools.reteoo.ObjectTypeConf;
 import org.drools.reteoo.PartitionManager;
 import org.drools.reteoo.PartitionTaskManager;
@@ -266,10 +265,47 @@
     public AbstractWorkingMemory(final int id,
                                  final InternalRuleBase ruleBase,
                                  final FactHandleFactory handleFactory,
+                                 final SessionConfiguration config,
+                                 final Environment environment,
+                                 final WorkingMemoryEventSupport workingMemoryEventSupport,
+                                 final AgendaEventSupport agendaEventSupport,
+                                 final RuleFlowEventSupport ruleFlowEventSupport) {
+        this( id,
+              ruleBase,
+              handleFactory,
+              null,
+              0,
+              config,
+              environment,
+              workingMemoryEventSupport,
+              agendaEventSupport,
+              ruleFlowEventSupport);
+}
+
+    public AbstractWorkingMemory(final int id,
+                                 final InternalRuleBase ruleBase,
+                                 final FactHandleFactory handleFactory,
                                  final InitialFactHandle initialFactHandle,
                                  final long propagationContext,
                                  final SessionConfiguration config,
-                                 final Environment environment) {
+                                 final Environment environment)
+    {
+        this( id, ruleBase, handleFactory, initialFactHandle, propagationContext, config, environment,
+           new WorkingMemoryEventSupport(),
+           new AgendaEventSupport(),
+           new RuleFlowEventSupport());
+    }
+    
+    public AbstractWorkingMemory(final int id,
+                                 final InternalRuleBase ruleBase,
+                                 final FactHandleFactory handleFactory,
+                                 final InitialFactHandle initialFactHandle,
+                                 final long propagationContext,
+                                 final SessionConfiguration config,
+                                 final Environment environment,
+                                 final WorkingMemoryEventSupport workingMemoryEventSupport,
+                                 final AgendaEventSupport agendaEventSupport,
+                                 final RuleFlowEventSupport ruleFlowEventSupport) {
         this.id = id;
         this.config = config;
         this.ruleBase = ruleBase;
@@ -311,9 +347,9 @@
         this.actionQueue = new LinkedList<WorkingMemoryAction>();
 
         this.addRemovePropertyChangeListenerArgs = new Object[]{this};
-        this.workingMemoryEventSupport = new WorkingMemoryEventSupport();
-        this.agendaEventSupport = new AgendaEventSupport();
-        this.workflowEventSupport = new RuleFlowEventSupport();
+        this.workingMemoryEventSupport = workingMemoryEventSupport;
+        this.agendaEventSupport = agendaEventSupport;
+        this.workflowEventSupport = ruleFlowEventSupport;
         this.__ruleBaseEventListeners = new LinkedList();
         this.lock = new ReentrantLock();
         this.liaPropagations = Collections.EMPTY_LIST;

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooStatelessSession.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooStatelessSession.java	2010-05-25 12:14:09 UTC (rev 33073)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooStatelessSession.java	2010-05-25 13:58:49 UTC (rev 33074)
@@ -5,6 +5,7 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Collection;
+import java.util.EventListener;
 import java.util.Iterator;
 import java.util.List;
 
@@ -20,6 +21,7 @@
 import org.drools.concurrent.CommandExecutor;
 import org.drools.concurrent.ExecutorService;
 import org.drools.concurrent.FireAllRules;
+import org.drools.event.AbstractEventSupport;
 import org.drools.event.AgendaEventListener;
 import org.drools.event.AgendaEventSupport;
 import org.drools.event.RuleBaseEventListener;
@@ -90,12 +92,12 @@
             InternalWorkingMemory wm = new ReteooWorkingMemory( this.ruleBase.nextWorkingMemoryCounter(),
                                                                 this.ruleBase,
                                                                 this.sessionConf,
-                                                                EnvironmentFactory.newEnvironment() );
+                                                                EnvironmentFactory.newEnvironment(),
+                                                                this.workingMemoryEventSupport,
+                                                                this.agendaEventSupport,
+                                                                this.ruleFlowEventSupport);
 
             wm.setGlobalResolver( this.globalResolver );
-            wm.setWorkingMemoryEventSupport( this.workingMemoryEventSupport );
-            wm.setAgendaEventSupport( this.agendaEventSupport );
-            wm.setRuleFlowEventSupport( ruleFlowEventSupport );
 
             final InitialFactHandleDummyObject initialFact = new InitialFactHandleDummyObject();
             final InitialFactHandle handle = new InitialFactHandle( wm.getFactHandleFactory().newFactHandle( initialFact,
@@ -111,8 +113,8 @@
             return wm;
         }
     }
-
-    public void addEventListener(final WorkingMemoryEventListener listener) {
+    
+	public void addEventListener(final WorkingMemoryEventListener listener) {
         this.workingMemoryEventSupport.addEventListener( listener );
     }
 

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java	2010-05-25 12:14:09 UTC (rev 33073)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java	2010-05-25 13:58:49 UTC (rev 33074)
@@ -20,15 +20,11 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
 
-import org.drools.FactHandle;
 import org.drools.QueryResults;
 import org.drools.SessionConfiguration;
+import org.drools.base.DroolsQuery;
 import org.drools.base.StandardQueryViewChangedEventListener;
-import org.drools.base.DroolsQuery;
 import org.drools.common.AbstractWorkingMemory;
 import org.drools.common.DefaultAgenda;
 import org.drools.common.EventFactHandle;
@@ -38,21 +34,22 @@
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.PropagationContextImpl;
 import org.drools.common.WorkingMemoryAction;
+import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventSupport;
+import org.drools.event.WorkingMemoryEventSupport;
 import org.drools.impl.EnvironmentFactory;
 import org.drools.marshalling.impl.MarshallerReaderContext;
 import org.drools.marshalling.impl.MarshallerWriteContext;
 import org.drools.rule.Declaration;
 import org.drools.rule.EntryPoint;
 import org.drools.rule.Package;
-import org.drools.rule.Query;
 import org.drools.rule.Rule;
 import org.drools.runtime.Environment;
 import org.drools.runtime.ObjectFilter;
 import org.drools.runtime.rule.LiveQuery;
 import org.drools.runtime.rule.ViewChangedEventListener;
+import org.drools.runtime.rule.impl.LiveQueryImpl;
 import org.drools.runtime.rule.impl.OpenQueryViewChangedEventListenerAdapter;
-import org.drools.runtime.rule.impl.LiveQueryImpl;
-import org.drools.runtime.rule.impl.RowAdapter;
 import org.drools.spi.FactHandleFactory;
 import org.drools.spi.PropagationContext;
 
@@ -100,7 +97,27 @@
         this.agenda = new DefaultAgenda( ruleBase );
         this.agenda.setWorkingMemory( this );
     }
+    public ReteooWorkingMemory(final int id,
+                               final InternalRuleBase ruleBase,
+                               final SessionConfiguration config,
+                               final Environment environment,
+                               final WorkingMemoryEventSupport workingMemoryEventSupport,
+                               final AgendaEventSupport agendaEventSupport,
+                               final RuleFlowEventSupport ruleFlowEventSupport) {
+        super( id, 
+               ruleBase,
+               ruleBase.newFactHandleFactory(),
+               config,
+               environment,
+               workingMemoryEventSupport,
+               agendaEventSupport,
+               ruleFlowEventSupport);
 
+        this.agenda = new DefaultAgenda( ruleBase );
+        this.agenda.setWorkingMemory( this );
+}
+
+
     public ReteooWorkingMemory(final int id,
                                final InternalRuleBase ruleBase,
                                final FactHandleFactory handleFactory,



More information about the jboss-svn-commits mailing list