[jboss-svn-commits] JBL Code SVN: r35442 - in labs/jbossrules/trunk: drools-core/src/main/java/org/drools/command/runtime/rule and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Tue Oct 5 22:06:18 EDT 2010
Author: mark.proctor at jboss.com
Date: 2010-10-05 22:06:17 -0400 (Tue, 05 Oct 2010)
New Revision: 35442
Modified:
labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/QueryCommand.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/InputMarshaller.java
labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java
Log:
JBRULES-2709 Initial implementation of lazily enabled TMS.
-Fixed bug where marshalling did not restore the ObjectTypeConf isTmsEnabled state
Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java 2010-10-05 23:06:55 UTC (rev 35441)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/integrationtests/MarshallingTest.java 2010-10-06 02:06:17 UTC (rev 35442)
@@ -1223,7 +1223,6 @@
"" );
}
-
/**
* In this case we are dealing with facts which are not on the systems classpath.
*
@@ -1234,7 +1233,7 @@
JarInputStream jis = new JarInputStream( this.getClass().getResourceAsStream( "/billasurf.jar" ) );
JarEntry entry = null;
- byte[] buf = new byte[1024];
+ byte[] buf = new byte[ 1024 ];
int len = 0;
while ( (entry = jis.getNextJarEntry()) != null ) {
if ( !entry.isDirectory() ) {
@@ -1930,8 +1929,10 @@
rule1 += "then \n";
rule1 += " if (list.size() < 3) { \n";
rule1 += " list.add(new Integer(0)); \n";
- rule1 += " insertLogical( cheese ); \n" + " }\n";
- rule1 += " drools.halt();\n" + "end\n";
+ rule1 += " insertLogical( cheese ); \n" +
+ " }\n";
+ rule1 += " drools.halt();\n" +
+ "end\n";
String rule2 = "rule \"if cheese then person\"\n";
rule2 += "when\n";
@@ -1940,7 +1941,8 @@
rule2 += " if (list.size() < 3) {\n";
rule2 += " list.add(new Integer(0));\n";
rule2 += " insertLogical( person );\n";
- rule2 += " }\n" + " drools.halt();\n";
+ rule2 += " }\n" +
+ " drools.halt();\n";
rule2 += "end\n";
final PackageBuilder builder = new PackageBuilder();
@@ -2606,16 +2608,16 @@
ksession = SerializationHelper.getSerialisedStatefulKnowledgeSession( ksession,
true );
-
+
assertNotNull( ksession );
ksession.dispose();
}
private Marshaller createSerializableMarshaller(KnowledgeBase knowledgeBase) {
- ObjectMarshallingStrategyAcceptor acceptor = MarshallerFactory.newClassFilterAcceptor( new String[]{"*.*"} );
+ ObjectMarshallingStrategyAcceptor acceptor = MarshallerFactory.newClassFilterAcceptor( new String[]{ "*.*" } );
ObjectMarshallingStrategy strategy = MarshallerFactory.newSerializeMarshallingStrategy( acceptor );
Marshaller marshaller = MarshallerFactory.newMarshaller( knowledgeBase,
- new ObjectMarshallingStrategy[]{strategy} );
+ new ObjectMarshallingStrategy[]{ strategy } );
return marshaller;
}
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/QueryCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/QueryCommand.java 2010-10-05 23:06:55 UTC (rev 35441)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/command/runtime/rule/QueryCommand.java 2010-10-06 02:06:17 UTC (rev 35442)
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -51,7 +52,11 @@
public QueryCommand(String outIdentifier, String name, Object... arguments) {
this.outIdentifier = outIdentifier;
this.name = name;
+ if ( arguments != null ) {
this.arguments = Arrays.asList( arguments );
+ } else {
+ this.arguments = Collections.EMPTY_LIST;
+ }
}
public String getOutIdentifier() {
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-10-05 23:06:55 UTC (rev 35441)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java 2010-10-06 02:06:17 UTC (rev 35442)
@@ -922,21 +922,6 @@
null );
}
- // protected FactHandle insert(final EntryPoint entryPoint,
- // final Object object,
- // final boolean dynamic,
- // boolean logical,
- // final Rule rule,
- // final Activation activation) throws FactException {
- // return this.insert( entryPoint,
- // object,
- // 0,
- // dynamic,
- // logical,
- // rule,
- // activation );
- // }
-
public FactHandle insert(final Object object,
final boolean dynamic,
boolean logical,
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/InputMarshaller.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/InputMarshaller.java 2010-10-05 23:06:55 UTC (rev 35441)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/InputMarshaller.java 2010-10-06 02:06:17 UTC (rev 35442)
@@ -57,6 +57,7 @@
import org.drools.reteoo.LeftTuple;
import org.drools.reteoo.LeftTupleSink;
import org.drools.reteoo.NodeTypeEnums;
+import org.drools.reteoo.ObjectTypeConf;
import org.drools.reteoo.ObjectTypeNode;
import org.drools.reteoo.ReteooStatefulSession;
import org.drools.reteoo.ReteooWorkingMemory;
@@ -218,10 +219,8 @@
readActionQueue( context );
- if ( context.readBoolean() ) {
- readTruthMaintenanceSystem( context );
- }
-
+ readTruthMaintenanceSystem( context );
+
if ( context.marshalProcessInstances && processMarshaller != null ) {
processMarshaller.readProcessInstances( context );
}
@@ -292,6 +291,13 @@
int status = stream.readInt();
int factHandleId = stream.readInt();
InternalFactHandle handle = (InternalFactHandle) context.handles.get( factHandleId );
+
+ // ObjectTypeConf state is not marshalled, so it needs to be re-determined
+ ObjectTypeConf typeConf = context.wm.getObjectTypeConfigurationRegistry().getObjectTypeConf( context.wm.getEntryPoint(), handle.getObject() );
+ if ( !typeConf.isTMSEnabled() ) {
+ typeConf.enableTMS();
+ }
+
EqualityKey key = new EqualityKey( handle,
status );
handle.setEqualityKey( key );
Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java 2010-10-05 23:06:55 UTC (rev 35441)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/marshalling/impl/OutputMarshaller.java 2010-10-06 02:06:17 UTC (rev 35442)
@@ -104,14 +104,9 @@
writeFactHandles( context );
writeActionQueue( context );
+
+ writeTruthMaintenanceSystem( context );
- if ( wm.getTruthMaintenanceSystem() != null ) {
- context.writeBoolean( true );
- writeTruthMaintenanceSystem( context );
- } else {
- context.writeBoolean( false );
- }
-
if ( context.marshalProcessInstances && processMarshaller != null ) {
processMarshaller.writeProcessInstances( context );
}
More information about the jboss-svn-commits
mailing list