[jboss-svn-commits] JBL Code SVN: r19037 - in labs/jbossrules/branches/ming-serialization: drools-ant/src/main/java/org/drools/contrib and 58 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Mar 17 13:22:30 EDT 2008


Author: mingjin
Date: 2008-03-17 13:22:29 -0400 (Mon, 17 Mar 2008)
New Revision: 19037

Added:
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionInsertFactCol.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionRetractFactCol.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionSetFieldCol.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/AttributeCol.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/server/util/GuidedDTDRLPersistence.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/compiler/TypeDeclarationError.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObject.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObjectHolder.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/brms/server/util/GuidedDTDRLPersistenceTest.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/big_decimal_and_literal.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_0.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_1.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_2.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic3_0.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_FromArrayIteration.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MatchesMVEL.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames1.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames2.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_ModifyBlock.drl
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/lang/declare_type.drl
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemoryEntryPoint.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/ObjectTypeConfigurationRegistry.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedTemporalWorkingMemoryContext.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedWorkingMemoryContext.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/TypeDeclaration.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/util/ArrayIterator.java
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Deployment1.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewMainScreen.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI2.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/QA.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Scenarios.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/TestScenarioEditor.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/analysis.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/rule_guis.png
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Key.png
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java
Removed:
   labs/jbossrules/branches/ming-serialization/drools-jbrms/build-readme.html
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java
Modified:
   labs/jbossrules/branches/ming-serialization/README.txt
   labs/jbossrules/branches/ming-serialization/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java
   labs/jbossrules/branches/ming-serialization/drools-ant/src/test/resources/DroolsAntTask.xml
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ConditionCol.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/GuidedDecisionTable.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/StockTick.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/LargeRuleBase.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java
   labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/HttpClientImpl.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/URLScanner.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/ClassFieldExtractor.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/SequentialKnowledgeHelper.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/BaseNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/EventFactHandle.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalRuleBase.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryActions.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ClassObjectTypeConf.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EntryPointNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/FromNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/Rete.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooFactHandleFactory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/Package.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/FactHandleFactory.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/KnowledgeHelper.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/agent/FileScannerTest.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/BaseNodeTest.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/DefaultFactHandleFactoryTest.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
   labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/ReteTest.java
   labs/jbossrules/branches/ming-serialization/drools-decisiontables/src/test/java/org/drools/decisiontable/parser/ExternalSheetListenerTest.java
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Section-Introduction.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/master.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/Chapter-Examples/Section-Examples.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/master.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-solver/en/master.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Section-Spreadsheet.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Deployment/Section-Deployment.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-IDE/Section-QuickStart.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Checkout.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Eclipse.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Install.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Maven_build.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Release_Notes/Section-Upgrade_tips.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rete_Algorithm.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rules.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-The_Drools_Rule_Engine.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-DSL.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Function.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Package.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Rule.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-RuleFlow.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-XML.xml
   labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/master.xml
   labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template
   labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/waltz/WaltzBenchmark.java
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/HelloWorldExample.java
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/sudoku/rules/DroolsUtil.java
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners/manners.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz/waltz.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb/waltzdb.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HonestPolitician.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-agendagroup.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-ruleflow.drl
   labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/troubleticket/ticketing.dsl
   labs/jbossrules/branches/ming-serialization/drools-jbrms/build.xml
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/common/FormStylePopup.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/ServiceImplementation.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/repository/RulesRepositoryManager.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java
   labs/jbossrules/branches/ming-serialization/drools-jbrms/src/test/java/org/drools/brms/server/ServiceImplementationTest.java
   labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94EventFactHandle.java
   labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandle.java
   labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandleFactory.java
   labs/jbossrules/branches/ming-serialization/src/main/assembly/bin.xml
   labs/jbossrules/branches/ming-serialization/src/main/assembly/src.xml
Log:
JBRULES-1488 Merged with trunk
- merged the latest code from trunk; behaves same as the trunk with 1 test fail: testRunScenarioWithJar(org.drools.brms.server.ServiceImplementationTest)

Modified: labs/jbossrules/branches/ming-serialization/README.txt
===================================================================
--- labs/jbossrules/branches/ming-serialization/README.txt	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/README.txt	2008-03-17 17:22:29 UTC (rev 19037)
@@ -9,6 +9,9 @@
 download into another location and specify it with
 -DlocalEclipseDrop=/folder/jboss-rules/local-eclipse-drop-mirror.
 
+NOTE: you MUST use maven version 2.0.8 or later to build because of surefire
+maven plugin classpath problems.
+
 The following builds all the jars, the documentation and the eclipse zip with a
 local folder specified to avoid downloading eclipse:
  mvn -Declipse=true -Ddocumentation=true clean install 

Modified: labs/jbossrules/branches/ming-serialization/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-ant/src/main/java/org/drools/contrib/DroolsCompilerAntTask.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -38,6 +38,7 @@
 import org.drools.lang.dsl.DSLMappingFile;
 import org.drools.lang.dsl.DefaultExpander;
 import org.drools.lang.dsl.DefaultExpanderResolver;
+import org.drools.rule.Package;
 
 import java.io.*;
 
@@ -53,10 +54,14 @@
 	public static String RULEFLOWFILEEXTENSION = ".rfm";
 	public static String DSLFILEEXTENSION = ".dslr";
     public static String XLSFILEEXTENSION = ".xls";
+    
+    public static String PACKAGEBINFORMAT = "package";
 
     private File srcdir;
 	private File toFile;
 	private Path classpath;
+	
+	private String binformat;
 
 	
 	/**
@@ -89,8 +94,7 @@
 	/**
 	 * Classpath to use, by reference, when compiling the rulebase
 	 * 
-	 * @param r
-	 *            a reference to an existing classpath
+	 * @param a reference to an existing classpath
 	 */
 	public void setClasspathref(Reference r) {
 		createClasspath().setRefid(r);
@@ -148,16 +152,20 @@
 
 			// gets the package
 			org.drools.rule.Package pkg = builder.getPackage();
+			
+            // creates the rulebase
+            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
 
-			// creates the rulebase
-			RuleBase ruleBase = RuleBaseFactory.newRuleBase();
-
-			// adds the package
-			ruleBase.addPackage(pkg);
-
-			// serialize the rule base to the destination file
-			serializeRulebase(ruleBase);
-
+            // adds the package
+            ruleBase.addPackage(pkg);
+			
+			
+			if (PACKAGEBINFORMAT.equals( binformat )  ) {
+			    serializeObject( pkg );
+			} else {
+	            // serialize the rule base to the destination file
+	            serializeObject(ruleBase);
+			}
 		} catch (Exception e) {
 			throw new BuildException("RuleBaseTask failed: " + e.getMessage(),
 					e);
@@ -167,19 +175,19 @@
 			}
 		}
 	}
-
+	
 	/**
 	 * @param ruleBase
 	 * @throws FileNotFoundException
 	 * @throws IOException
 	 */
-	private void serializeRulebase(RuleBase ruleBase)
+	private void serializeObject(Object object)
 			throws FileNotFoundException, IOException {
 		ObjectOutputStream outstream = null;
 		try {
 			FileOutputStream fout = new FileOutputStream(toFile);
 			outstream = new ObjectOutputStream(fout);
-			outstream.writeObject(ruleBase);
+			outstream.writeObject(object);
 		} finally {
 			if (outstream != null) {
 				outstream.close();
@@ -370,4 +378,12 @@
 		return fileNames;
 	}
 
+    public void setBinformat(String binformat) {
+        this.binformat = binformat;
+    }
+
+    public String getBinformat() {
+        return binformat;
+    }
+
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-ant/src/test/resources/DroolsAntTask.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-ant/src/test/resources/DroolsAntTask.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-ant/src/test/resources/DroolsAntTask.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,9 +1,9 @@
 <project default="rules">
 	
 	<!-- Uncomment this for Maven Runner -->
-	<property name="eclipsepath"  value=""/>   
+	<property name="eclipsepath"  value=""/>
 	<!-- Uncomment this for Eclipse Runner  -->
-	<!-- <property name="eclipsepath"  value="../../../"/> -->  
+	<!-- <property name="eclipsepath"  value="../../../"/> -->   
 	
 	<path id="cheese.classpath">
 		<pathelement location="${eclipsepath}lib/cheese.jar"/>
@@ -16,7 +16,7 @@
 		<pathelement location="target"/>
 	</path>	
 	
-	<taskdef name="rulebase" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="drools.classpath" />
+	<taskdef name="compiler" classname="org.drools.contrib.DroolsCompilerAntTask" classpathref="drools.classpath" />
 	<taskdef name="analytics" classname="org.drools.contrib.DroolsAnalyticsAntTask" classpathref="drools.classpath" />
 	
 	
@@ -31,17 +31,17 @@
 	
 	
 	<target name="dslRules" >
-		<rulebase 
+		<compiler 
 			srcdir="${eclipsepath}src/test/resources/rules" 		
-			tofile="${eclipsepath}target/cheese.rules"
-			classpathref="cheese.classpath" > 
-			
+			tofile="${eclipsepath}target/cheese.rules.dpkg"
+			classpathref="cheese.classpath" 
+			binformat="package" > 
 			<include name="*.dslr" />
-		</rulebase>
+		</compiler>
 	</target>
 
 	<target name="rules" >
-		<rulebase 
+		<compiler 
 			srcdir="${eclipsepath}src/test/resources/rules" 		
 			tofile="${eclipsepath}target/cheese.rules"
 			classpathref="cheese.classpath" > 
@@ -49,27 +49,27 @@
 			<include name="*.brl" />
 			<include name="*.xml" />
 			<include name="*.dslr" />			
-		</rulebase>
+		</compiler>
 	</target>
 	
 	<target name="rulesnopackagefile" >
-		<rulebase 
+		<compiler 
 			srcdir="${eclipsepath}src/test/resources/packagefiletest/emptydir" 		
 			tofile="${eclipsepath}target/cheese.rules"
 			classpathref="cheese.classpath" > 
 			<include name="*.drl" />
 			<include name="*.brl" />			
-		</rulebase>
+		</compiler>
 	</target>
 
 	<target name="rulesmanypackagefile" >
-		<rulebase 
+		<compiler 
 			srcdir="${eclipsepath}src/test/resources/packagefiletest" 		
 			tofile="${eclipsepath}target/cheese.rules"
 			classpathref="cheese.classpath" > 
 			<include name="*.drl" />
 			<include name="*.brl" />
-		</rulebase>
+		</compiler>
 	</target>
 
 </project>
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionInsertFactCol.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionInsertFactCol.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionInsertFactCol.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionInsertFactCol.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,30 @@
+package org.drools.brms.client.modeldriven.dt;
+
+public class ActionInsertFactCol extends ActionCol {
+
+	/**
+	 * The fact type (class) that is to be created.
+	 * eg Driver, Person, Cheese.
+	 */
+	public String factType;
+
+	/**
+	 * The bound name of the variable to be effected.
+	 * If the same name appears twice, is it merged into the same action.
+	 */
+	public String boundName;
+
+	/**
+	 * The field on the fact being effected.
+	 */
+	public String factField;
+
+	/**
+	 * Same as the type in ActionFieldValue - eg, either a String, or Numeric.
+	 * Refers to the data type of the literal value in the cell.
+	 * Refer to the types in SuggestionCompletionEngine.
+	 */
+	public String type;
+
+
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionRetractFactCol.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionRetractFactCol.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionRetractFactCol.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionRetractFactCol.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,12 @@
+package org.drools.brms.client.modeldriven.dt;
+
+public class ActionRetractFactCol extends ActionCol {
+
+	/**
+	 * The name of the fact to be retracted.
+	 */
+	public String boundName;
+
+
+
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionSetFieldCol.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionSetFieldCol.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionSetFieldCol.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ActionSetFieldCol.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,22 @@
+package org.drools.brms.client.modeldriven.dt;
+
+public class ActionSetFieldCol extends ActionCol {
+
+	/**
+	 * The bound name of the variable to be effected.
+	 * If the same name appears twice, is it merged into the same action.
+	 */
+	public String boundName;
+
+	/**
+	 * The field on the fact being effected.
+	 */
+	public String factField;
+
+	/**
+	 * Same as the type in ActionFieldValue - eg, either a String, or Numeric.
+	 * Refers to the data type of the literal value in the cell.
+	 * These values come from SuggestionCompletionEngine.
+	 */
+	public String type;
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/AttributeCol.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/AttributeCol.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/AttributeCol.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/AttributeCol.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,14 @@
+package org.drools.brms.client.modeldriven.dt;
+
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
+/**
+ * This is a rule attribute - eg salience, no-loop etc.
+ * @author Michael Neale
+ *
+ */
+public class AttributeCol implements PortableObject {
+
+	public String attr;
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ConditionCol.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ConditionCol.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/ConditionCol.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -2,19 +2,50 @@
 
 import org.drools.brms.client.modeldriven.brl.PortableObject;
 
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
+/**
+ * This is the config for a condition column. Typically many of them have their constraints added.
+ *
+ * @author Michael Neale
+ *
+ */
 public class ConditionCol implements PortableObject {
 
-    public String header;
+	/**
+	 * What is displayed at the top
+	 */
+	public String header;
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        header  = (String)in.readObject();
-    }
+	/**
+	 * The type of the fact - class - eg Driver, Person, Cheese etc.
+	 */
+	public String factType;
 
-    public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeObject(header);
-    }
+	/**
+	 * The name that this gets referenced as. Multiple columns with the same name mean their constraints will be combined.
+	 */
+	public String boundName;
+
+	/**
+	 * The type of the value that is in the cell, eg if it is a formula, or literal value etc.
+	 * The valid types are from ISingleFieldConstraint:
+	 *   TYPE_LITERAL
+	 *   TYPE_RET_VALUE
+	 *   TYPE_PREDICATE (in this case, the field and operator are ignored).
+	 */
+	public int constraintValueType;
+
+
+	/**
+	 * The field of the fact that this pertains to (if its a predicate, ignore it).
+	 */
+	public String factField;
+
+
+	/**
+	 * The operator to use to compare the field with the value (unless its a predicate, in which case this is ignored).
+	 */
+	public String operator;
+
+
+
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/GuidedDecisionTable.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/GuidedDecisionTable.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/client/modeldriven/dt/GuidedDecisionTable.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,35 +1,70 @@
 package org.drools.brms.client.modeldriven.dt;
 
-import java.util.ArrayList;
-import java.util.List;
+import org.drools.brms.client.modeldriven.brl.PortableObject;
+
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.drools.brms.client.modeldriven.brl.PortableObject;
 
+/**
+ * This is a decision table model for a guided editor. It is not template or XLS based.
+ * (template could be done relatively easily by taking a template, as a String, and then String[][] data and driving the SheetListener
+ * interface in the decision tables module).
+ *
+ * This works by taking the column definitions, and combining them with the table of data to produce rule models.
+ *
+ * @author Michael Neale
+ */
 public class GuidedDecisionTable implements PortableObject {
 
+	/**
+	 * The name - obviously.
+	 */
+	public String tableName;
+
+	/**
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.dt.AttributeCol>
+	 */
+	public List attributeCols = new ArrayList();
+
+	/**
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.dt.ConditionCol>
+	 */
 	public List conditionCols = new ArrayList();
+
+	/**
+	 * @gwt.typeArgs <org.drools.brms.client.modeldriven.dt.ActionCol>
+	 */
 	public List actionCols = new ArrayList();
 
 	/**
 	 * First column is always row number.
 	 * Second column is description.
-	 * Subsequent ones follow the above column definitions.
+	 * Subsequent ones follow the above column definitions:
+	 * attributeCols, then conditionCols, then actionCols, in that order, left to right.
 	 */
 	public String[][] data;
 
+	//TODO: add in precondition(s)
 
+
 	public GuidedDecisionTable() {}
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        tableName       = (String)in.readObject();
+        attributeCols   = (List)in.readObject();
         conditionCols   = (List)in.readObject();
-        actionCols   = (List)in.readObject();
+        actionCols      = (List)in.readObject();
         data   = (String[][])in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(tableName);
+        out.writeObject(attributeCols);
         out.writeObject(conditionCols);
         out.writeObject(actionCols);
         out.writeObject(data);

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/server/util/GuidedDTDRLPersistence.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/brms/server/util/GuidedDTDRLPersistence.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/server/util/GuidedDTDRLPersistence.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/brms/server/util/GuidedDTDRLPersistence.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,196 @@
+package org.drools.brms.server.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.IAction;
+import org.drools.brms.client.modeldriven.brl.IPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+import org.drools.brms.client.modeldriven.dt.ActionCol;
+import org.drools.brms.client.modeldriven.dt.ActionInsertFactCol;
+import org.drools.brms.client.modeldriven.dt.ActionRetractFactCol;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.AttributeCol;
+import org.drools.brms.client.modeldriven.dt.ConditionCol;
+import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+
+/**
+ * This takes care of converting GuidedDT object to DRL (via the RuleModel).
+ * @author Michael Neale
+ *
+ */
+public class GuidedDTDRLPersistence {
+
+
+	public String marshal(GuidedDecisionTable dt) {
+
+		StringBuilder sb = new StringBuilder();
+
+		for (int i = 0; i < dt.data.length; i++) {
+			String[] row = dt.data[i];
+			String num = row[0];
+			String desc = row[1];
+
+			RuleModel rm = new RuleModel();
+			rm.name = getName(dt.tableName, num, desc);
+
+			doAttribs(dt.attributeCols, row, rm);
+			doConditions(dt.attributeCols.size(), dt.conditionCols, row, rm);
+			doActions(dt.attributeCols.size() + dt.conditionCols.size(), dt.actionCols, row, rm);
+
+			sb.append("#from row number: " + (i + 1) + "\n");
+			String rule = BRDRLPersistence.getInstance().marshal(rm);
+			sb.append(rule);
+			sb.append("\n");
+		}
+
+
+		return sb.toString();
+
+	}
+
+	void doActions(int condAndAttrs, List<ActionCol> actionCols, String[] row, RuleModel rm) {
+		List<LabelledAction> actions = new ArrayList<LabelledAction>();
+		for (int i = 0; i < actionCols.size(); i++) {
+			ActionCol c = actionCols.get(i);
+			String cell = row[condAndAttrs + i + 2];
+			if (validCell(cell)) {
+				if (c instanceof ActionInsertFactCol) {
+					ActionInsertFactCol ac = (ActionInsertFactCol)c;
+					LabelledAction a = find(actions, ac.boundName);
+					if (a == null) {
+						a = new LabelledAction();
+						a.boundName  = ac.boundName;
+						ActionInsertFact ins = new ActionInsertFact(ac.factType);
+						a.action = ins;
+						actions.add(a);
+					}
+					ActionInsertFact ins = (ActionInsertFact) a.action;
+					ActionFieldValue val = new ActionFieldValue(ac.factField, cell, ac.type);
+					ins.addFieldValue(val);
+				} else if (c instanceof ActionRetractFactCol) {
+					ActionRetractFactCol rf = (ActionRetractFactCol)c;
+					LabelledAction a = find(actions, rf.boundName);
+					if (a == null) {
+						a = new LabelledAction();
+						a.action = new ActionRetractFact(rf.boundName);
+						a.boundName = rf.boundName;
+						actions.add(a);
+					}
+				} else if (c instanceof ActionSetFieldCol) {
+					ActionSetFieldCol sf = (ActionSetFieldCol)c;
+					LabelledAction a = find(actions, sf.boundName);
+					if (a == null) {
+						a = new LabelledAction();
+						a.boundName = sf.boundName;
+						a.action = new ActionSetField(sf.boundName);
+						actions.add(a);
+					}
+					ActionSetField asf = (ActionSetField) a.action;
+					ActionFieldValue val = new ActionFieldValue(sf.factField, cell, sf.type);
+					asf.addFieldValue(val);
+				}
+			}
+		}
+
+		rm.rhs = new IAction[actions.size()];
+		for (int i = 0; i < rm.rhs.length; i++) {
+			rm.rhs[i] = actions.get(i).action;
+		}
+	}
+
+	private LabelledAction find(List<LabelledAction> actions, String boundName) {
+		for (LabelledAction labelledAction : actions) {
+			if (labelledAction.boundName.equals(boundName)) {
+				return labelledAction;
+			}
+		}
+		return null;
+	}
+
+	void doConditions(int numOfAttributes, List<ConditionCol> conditionCols, String[] row, RuleModel rm) {
+
+		List<FactPattern> patterns = new ArrayList<FactPattern>();
+
+		for (int i = 0; i < conditionCols.size(); i++) {
+			ConditionCol c = (ConditionCol) conditionCols.get(i);
+			String cell = row[i + 2 + numOfAttributes];
+			if (validCell(cell)) {
+
+				//get or create the pattern it belongs too
+				FactPattern fp = find(patterns, c.boundName);
+				if (fp == null) {
+					fp = new FactPattern(c.factType);
+					fp.boundName = c.boundName;
+					patterns.add(fp);
+				}
+
+				//now add the constraint from this cell
+				switch (c.constraintValueType) {
+					case ISingleFieldConstraint.TYPE_LITERAL:
+					case ISingleFieldConstraint.TYPE_RET_VALUE:
+						SingleFieldConstraint sfc = new SingleFieldConstraint(c.factField);
+						sfc.operator = c.operator;
+						sfc.constraintValueType = c.constraintValueType;
+						sfc.value = cell;
+						fp.addConstraint(sfc);
+						break;
+					case ISingleFieldConstraint.TYPE_PREDICATE:
+						SingleFieldConstraint pred = new SingleFieldConstraint();
+						pred.constraintValueType = c.constraintValueType;
+						pred.value = cell;
+						fp.addConstraint(pred);
+						break;
+				default:
+					throw new IllegalArgumentException("Unknown constraintValueType: " + c.constraintValueType);
+				}
+			}
+		}
+		rm.lhs = patterns.toArray(new IPattern[patterns.size()]);
+	}
+
+	private FactPattern find(List<FactPattern> patterns, String boundName) {
+		for (FactPattern factPattern : patterns) {
+			if (factPattern.boundName.equals(boundName)) {
+				return factPattern;
+			}
+		}
+		return null;
+	}
+
+	void doAttribs(List<AttributeCol> attributeCols, String[] row, RuleModel rm) {
+		List<RuleAttribute> attribs = new ArrayList<RuleAttribute>();
+		for (int j = 0; j < attributeCols.size(); j++) {
+			AttributeCol at = attributeCols.get(j);
+			String cell = row[j + 2];
+			if (validCell(cell)) {
+				attribs.add(new RuleAttribute(at.attr, cell));
+			}
+		}
+		if (attribs.size() > 0) {
+			rm.attributes = attribs.toArray(new RuleAttribute[attribs.size()]);
+		}
+	}
+
+	String getName(String tableName, String num, String desc) {
+		return (validCell(desc)) ? num + "_" + desc : num + "_" + tableName;
+	}
+
+	boolean validCell(String c) {
+		return c !=null && !c.trim().equals("");
+	}
+
+	private class LabelledAction {
+		String boundName;
+		IAction action;
+	}
+
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/compiler/TypeDeclarationError.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/compiler/TypeDeclarationError.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/compiler/TypeDeclarationError.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/compiler/TypeDeclarationError.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,40 @@
+package org.drools.compiler;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class TypeDeclarationError extends DroolsError {
+    private String errorMessage;
+    private int[]  line;
+
+    public TypeDeclarationError(final String errorMessage, final int line) {
+        this.errorMessage = errorMessage;
+        this.line = new int[] { line };
+    }
+
+    public int[] getErrorLines() {
+        return this.line;
+    }
+
+    public String getMessage() {
+        return this.errorMessage;
+    }
+    
+    public String toString() {
+        return this.getMessage();
+    }
+
+}
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/main/java/org/drools/lang/descr/TypeDeclarationDescr.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,106 @@
+package org.drools.lang.descr;
+
+/*
+ * Copyright 2008 Red Hat
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TypeDeclarationDescr extends BaseDescr {
+    
+    /**
+     * The attribute key used to define what role the type assumes (fact, event)
+     */
+    public static final String ATTR_ROLE = "role";
+    /**
+     * The attribute key used to define what is the clock strategy used for that type
+     */
+    public static final String ATTR_CLOCK_STRATEGY = "clock_strategy";
+    /**
+     * The attribute key used to define what is the attribute to read the timestamp from
+     */
+    public static final String ATTR_TIMESTAMP = "timestamp_attribute";
+    /**
+     * The attribute key used to define what is the attribute to read the duration from
+     */
+    public static final String ATTR_DURATION = "duration_attribute";
+    /**
+     * The attribute key used to define what is the class name that implements the type
+     */
+    public static final String ATTR_CLASS = "class";
+    /**
+     * The attribute key used to define what is the template name that implements the type
+     */
+    public static final String ATTR_TEMPLATE = "template";
+    
+
+    private static final long   serialVersionUID = 400L;
+    private String              typeName;
+    private Map<String, String> attributes;
+
+    public TypeDeclarationDescr() {
+        this(null);
+    }
+    
+    public TypeDeclarationDescr(final String typeName) {
+        this.typeName = typeName;
+        this.attributes = new HashMap<String, String>();
+    }
+
+    /**
+     * @return the identifier
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @param identifier the identifier to set
+     */
+    public void setTypeName(String typeName) {
+        this.typeName = typeName;
+    }
+    
+    /**
+     * Adds a new attribute
+     * @param attr
+     * @param value
+     */
+    public void addAttribute( String attr, String value ) {
+        this.attributes.put( attr, value );
+    }
+    
+    /**
+     * Returns an attribute value or null if it is not defined
+     * @param attr
+     * @return
+     */
+    public String getAttribute( String attr ) {
+        return this.attributes.get( attr );
+    }
+
+    /**
+     * Returns the attribute map
+     * @return
+     */
+    public Map<String, String> getAttributes() {
+        return this.attributes;
+    }
+
+    public String toString() {
+        return "TypeDeclaration[ "+this.getTypeName()+" ]";
+    }
+}
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObject.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/DomainObject.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObject.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObject.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,33 @@
+package org.drools;
+
+public class DomainObject {
+
+	private String message;
+	private int value;
+	private double value2;
+
+	public String getMessage() {
+		return message;
+	}
+
+	public void setMessage(String message) {
+		this.message = message;
+	}
+
+	public int getValue() {
+		return value;
+	}
+
+	public void setValue(int value) {
+		this.value = value;
+	}
+
+	public double getValue2() {
+		return value2;
+	}
+
+	public void setValue2(double value2) {
+		this.value2 = value2;
+	}
+
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObjectHolder.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/DomainObjectHolder.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObjectHolder.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/DomainObjectHolder.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,29 @@
+package org.drools;
+
+public class DomainObjectHolder {
+
+	DomainObject[] objects = new DomainObject[3];
+
+	public DomainObjectHolder(){
+
+	objects[0] = new DomainObject();
+	objects[0].setMessage("Message1");
+	objects[0].setValue(1);
+	objects[0].setValue2(2);
+
+	objects[1] = new DomainObject();
+	objects[1].setMessage("Message2");
+	objects[1].setValue(3);
+	objects[1].setValue2(4);
+
+	objects[2] = new DomainObject();
+	objects[2].setMessage("Message3");
+	objects[2].setValue(5);
+	objects[2].setValue2(6);
+	}
+
+	public DomainObject[] getObjects(){
+	return objects;
+	}
+
+	} 

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/StockTick.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/StockTick.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/StockTick.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,12 +1,11 @@
 package org.drools;
 
-import java.io.Serializable;
-
-public class StockTick implements Serializable {
+public class StockTick {
     private long seq;
     private String company;
     private double price;
     private long time;
+    private long duration;
 
     public StockTick() {
     }
@@ -22,6 +21,19 @@
         this.time = time;
     }
 
+    public StockTick(long seq,
+                     String company,
+                     double price,
+                     long time,
+                     long duration ) {
+        super();
+        this.seq = seq;
+        this.company = company;
+        this.price = price;
+        this.time = time;
+        this.duration = duration;
+    }
+
     public String getCompany() {
         return company;
     }
@@ -51,4 +63,18 @@
         return "StockTick( "+this.seq+" : " +this.company +" : "+ this.price +" )";
     }
 
+    /**
+     * @return the duration
+     */
+    public long getDuration() {
+        return duration;
+    }
+
+    /**
+     * @param duration the duration to set
+     */
+    public void setDuration(long duration) {
+        this.duration = duration;
+    }
+
 }

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/brms/server/util/GuidedDTDRLPersistenceTest.java (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/brms/server/util/GuidedDTDRLPersistenceTest.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/brms/server/util/GuidedDTDRLPersistenceTest.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/brms/server/util/GuidedDTDRLPersistenceTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,317 @@
+package org.drools.brms.server.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ActionInsertFact;
+import org.drools.brms.client.modeldriven.brl.ActionRetractFact;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleAttribute;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+import org.drools.brms.client.modeldriven.dt.ActionCol;
+import org.drools.brms.client.modeldriven.dt.ActionInsertFactCol;
+import org.drools.brms.client.modeldriven.dt.ActionRetractFactCol;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.AttributeCol;
+import org.drools.brms.client.modeldriven.dt.ConditionCol;
+import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+
+public class GuidedDTDRLPersistenceTest extends TestCase {
+
+
+	public void test2Rules() throws Exception {
+		GuidedDecisionTable dt = new GuidedDecisionTable();
+		dt.tableName = "michael";
+
+		AttributeCol attr = new AttributeCol();
+		attr.attr = "salience";
+		dt.attributeCols.add(attr);
+
+		ConditionCol con = new ConditionCol();
+		con.boundName = "f1";
+		con.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+		con.factField = "age";
+		con.factType = "Driver";
+		con.header = "Driver f1 age";
+		con.operator = "==";
+		dt.conditionCols.add(con);
+
+		ConditionCol con2 = new ConditionCol();
+		con2.boundName = "f1";
+		con2.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+		con2.factField = "name";
+		con2.factType = "Driver";
+		con2.header = "Driver f1 name";
+		con2.operator = "==";
+		dt.conditionCols.add(con2);
+
+		ConditionCol con3 = new ConditionCol();
+		con3.boundName = "f1";
+		con3.constraintValueType = ISingleFieldConstraint.TYPE_RET_VALUE;
+		con3.factField = "rating";
+		con3.factType = "Driver";
+		con3.header = "Driver rating";
+		con3.operator = "==";
+		dt.conditionCols.add(con3);
+
+
+		ConditionCol con4 = new ConditionCol();
+		con4.boundName = "f2";
+		con4.constraintValueType = ISingleFieldConstraint.TYPE_PREDICATE;
+		con4.factType = "Driver";
+		con4.header = "Driver 2 pimp";
+		dt.conditionCols.add(con4);
+
+
+		ActionInsertFactCol ins = new ActionInsertFactCol();
+		ins.boundName = "ins";
+		ins.factType = "Cheese";
+		ins.factField = "price";
+		ins.type = SuggestionCompletionEngine.TYPE_NUMERIC;
+		dt.actionCols.add(ins);
+
+		ActionRetractFactCol ret = new ActionRetractFactCol();
+		ret.boundName = "f2";
+		dt.actionCols.add(ret);
+
+		ActionSetFieldCol set = new ActionSetFieldCol();
+		set.boundName = "f1";
+		set.factField = "goo1";
+		set.type = SuggestionCompletionEngine.TYPE_STRING;
+		dt.actionCols.add(set);
+
+		ActionSetFieldCol set2 = new ActionSetFieldCol();
+		set2.boundName = "f1";
+		set2.factField = "goo2";
+		set2.type = SuggestionCompletionEngine.TYPE_STRING;
+		dt.actionCols.add(set2);
+
+
+		dt.data = new String[][] {
+				new String[] {"1", "desc", "42", "33", "michael", "age * 0.2", "age > 7", "6.60", "true", "gooVal1", "gooVal2"},
+				new String[] {"2", "desc", "", "39", "bob", "age * 0.3", "age > 7", "6.60", "", "gooVal1", "gooVal2"}
+		};
+
+
+
+
+
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		String drl = p.marshal(dt);
+		System.err.println(drl);
+
+		assertTrue(drl.indexOf("from row number") > -1);
+		assertTrue(drl.indexOf("rating == ( age * 0.2 )") > 0);
+		assertTrue(drl.indexOf("f2 : Driver( eval( age > 7 ))") > 0);
+		assertTrue(drl.indexOf("rating == ( age * 0.3 )") > drl.indexOf("rating == ( age * 0.2 )"));
+
+	}
+
+	public void testCellVal() {
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		assertFalse(p.validCell(null));
+		assertFalse(p.validCell(""));
+		assertFalse(p.validCell("  "));
+
+	}
+
+	public void testName() {
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		assertEquals("42_hey", p.getName("XXX", "42", "hey"));
+		assertEquals("42_XXX", p.getName("XXX", "42", ""));
+	}
+
+	public void testAttribs() {
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		String[] row = new String[] {"1", "desc", "a", ""};
+
+		List<AttributeCol> attributeCols = new ArrayList<AttributeCol>();
+		RuleModel rm = new RuleModel();
+		RuleAttribute[] orig = rm.attributes;
+		p.doAttribs(attributeCols, row, rm);
+
+		assertSame(orig, rm.attributes);
+
+		AttributeCol col1 = new AttributeCol();
+		col1.attr = "salience";
+		AttributeCol col2 = new AttributeCol();
+		col2.attr = "agenda-group";
+		attributeCols.add(col1);
+		attributeCols.add(col2);
+
+		p.doAttribs(attributeCols, row, rm);
+
+		assertEquals(1, rm.attributes.length);
+		assertEquals("salience", rm.attributes[0].attributeName);
+		assertEquals("a", rm.attributes[0].value);
+
+		row = new String[] {"1", "desc", "a", "b"};
+		p.doAttribs(attributeCols, row, rm);
+		assertEquals(2, rm.attributes.length);
+		assertEquals("salience", rm.attributes[0].attributeName);
+		assertEquals("a", rm.attributes[0].value);
+		assertEquals("agenda-group", rm.attributes[1].attributeName);
+		assertEquals("b", rm.attributes[1].value);
+
+	}
+
+	public void testLHS() {
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		String[] row = new String[] {"1", "desc", "a", "mike", "33 + 1", "age > 6", "stilton"};
+
+		List<ConditionCol> cols = new ArrayList<ConditionCol>();
+		ConditionCol col = new ConditionCol();
+		col.boundName = "p1";
+		col.factType = "Person";
+		col.factField = "name";
+		col.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+		col.operator = "==";
+		cols.add(col);
+
+		ConditionCol col2 = new ConditionCol();
+		col2.boundName = "p1";
+		col2.factType = "Person";
+		col2.factField = "age";
+		col2.constraintValueType = ISingleFieldConstraint.TYPE_RET_VALUE;
+		col2.operator = "<";
+		cols.add(col2);
+
+		ConditionCol col3 = new ConditionCol();
+		col3.boundName = "p1";
+		col3.factType = "Person";
+		col3.constraintValueType = ISingleFieldConstraint.TYPE_PREDICATE;
+		cols.add(col3);
+
+		ConditionCol col4 = new ConditionCol();
+		col4.boundName = "c";
+		col4.factType = "Cheese";
+		col4.factField = "type";
+		col4.operator = "==";
+		col4.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+		cols.add(col4);
+
+		RuleModel rm = new RuleModel();
+
+		p.doConditions(1, cols, row, rm);
+		assertEquals(2, rm.lhs.length);
+
+		assertEquals("Person", ((FactPattern)rm.lhs[0]).factType);
+		assertEquals("p1", ((FactPattern)rm.lhs[0]).boundName);
+
+		assertEquals("Cheese", ((FactPattern)rm.lhs[1]).factType);
+		assertEquals("c", ((FactPattern)rm.lhs[1]).boundName);
+
+		//examine the first pattern
+		FactPattern person = (FactPattern) rm.lhs[0];
+		assertEquals(3, person.constraintList.constraints.length);
+		SingleFieldConstraint cons = (SingleFieldConstraint) person.constraintList.constraints[0];
+		assertEquals(ISingleFieldConstraint.TYPE_LITERAL, cons.constraintValueType);
+		assertEquals("name", cons.fieldName);
+		assertEquals("==", cons.operator);
+		assertEquals("mike", cons.value);
+
+		cons = (SingleFieldConstraint) person.constraintList.constraints[1];
+		assertEquals(ISingleFieldConstraint.TYPE_RET_VALUE, cons.constraintValueType);
+		assertEquals("age", cons.fieldName);
+		assertEquals("<", cons.operator);
+		assertEquals("33 + 1", cons.value);
+
+		cons = (SingleFieldConstraint) person.constraintList.constraints[2];
+		assertEquals(ISingleFieldConstraint.TYPE_PREDICATE, cons.constraintValueType);
+		assertEquals("age > 6", cons.value);
+
+
+		//examine the second pattern
+		FactPattern cheese = (FactPattern) rm.lhs[1];
+		assertEquals(1, cheese.constraintList.constraints.length);
+		cons = (SingleFieldConstraint) cheese.constraintList.constraints[0];
+		assertEquals("type", cons.fieldName);
+		assertEquals("==", cons.operator);
+		assertEquals("stilton", cons.value);
+		assertEquals(ISingleFieldConstraint.TYPE_LITERAL, cons.constraintValueType);
+	}
+
+	public void testRHS() {
+		GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
+		String[] row = new String[] {"1", "desc", "a", "a condition", "actionsetfield1", "actionsetfield2", "retract", "actioninsertfact1", "actioninsertfact2"};
+
+		List<ActionCol> cols = new ArrayList<ActionCol>();
+		ActionSetFieldCol asf1 = new ActionSetFieldCol();
+		asf1.boundName = "a";
+		asf1.factField = "field1";
+
+		asf1.type = SuggestionCompletionEngine.TYPE_STRING;
+		cols.add(asf1);
+
+		ActionSetFieldCol asf2 = new ActionSetFieldCol();
+		asf2.boundName = "a";
+		asf2.factField = "field2";
+		asf2.type = SuggestionCompletionEngine.TYPE_NUMERIC;
+		cols.add(asf2);
+
+		ActionRetractFactCol ret = new ActionRetractFactCol();
+		ret.boundName = "ret";
+		cols.add(ret);
+
+		ActionInsertFactCol ins1 = new ActionInsertFactCol();
+		ins1.boundName = "ins";
+		ins1.factType = "Cheese";
+		ins1.factField = "price";
+		ins1.type = SuggestionCompletionEngine.TYPE_NUMERIC;
+		cols.add(ins1);
+
+		ActionInsertFactCol ins2 = new ActionInsertFactCol();
+		ins2.boundName = "ins";
+		ins2.factType = "Cheese";
+		ins2.factField = "type";
+		ins2.type = SuggestionCompletionEngine.TYPE_NUMERIC;
+		cols.add(ins2);
+
+
+		RuleModel rm = new RuleModel();
+		p.doActions(2, cols, row, rm);
+		assertEquals(3, rm.rhs.length);
+
+		//examine the set field action that is produced
+		ActionSetField a1 = (ActionSetField) rm.rhs[0];
+		assertEquals("a", a1.variable);
+		assertEquals(2, a1.fieldValues.length);
+
+		assertEquals("field1", a1.fieldValues[0].field);
+		assertEquals("actionsetfield1", a1.fieldValues[0].value);
+		assertEquals(SuggestionCompletionEngine.TYPE_STRING, a1.fieldValues[0].type);
+
+		assertEquals("field2", a1.fieldValues[1].field);
+		assertEquals("actionsetfield2", a1.fieldValues[1].value);
+		assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, a1.fieldValues[1].type);
+
+
+		//examine the retract
+		ActionRetractFact a2 = (ActionRetractFact) rm.rhs[1];
+		assertEquals("ret", a2.variableName);
+
+		//examine the insert
+		ActionInsertFact a3 = (ActionInsertFact) rm.rhs[2];
+		assertEquals("Cheese", a3.factType);
+		assertEquals(2, a3.fieldValues.length);
+
+		assertEquals("price", a3.fieldValues[0].field);
+		assertEquals("actioninsertfact1", a3.fieldValues[0].value);
+		assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, a3.fieldValues[0].type);
+
+		assertEquals("type", a3.fieldValues[1].field);
+		assertEquals("actioninsertfact2", a3.fieldValues[1].value);
+		assertEquals(SuggestionCompletionEngine.TYPE_NUMERIC, a3.fieldValues[1].type);
+
+
+	}
+
+
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/compiler/PackageBuilderTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -18,13 +18,10 @@
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.ObjectInput;
-import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
-import java.io.ObjectOutputStream;
 import java.io.StringReader;
 import java.lang.reflect.Field;
 import java.util.HashMap;

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/AccumulateTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -56,7 +56,7 @@
         final RuleBase ruleBase = getRuleBase();
         ruleBase.addPackage( pkg );
         // load up the rulebase
-        return ruleBase;
+        return SerializationHelper.serializeObject(ruleBase);
     }
 
     public void testAccumulateModify() throws Exception {

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/CepEspTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,21 +1,14 @@
 package org.drools.integrationtests;
 
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-
 import junit.framework.Assert;
 import junit.framework.TestCase;
-
 import org.drools.ClockType;
 import org.drools.OrderEvent;
 import org.drools.RuleBase;
 import org.drools.RuleBaseConfiguration;
 import org.drools.RuleBaseFactory;
+import org.drools.StockTick;
 import org.drools.TemporalSession;
-import org.drools.StockTick;
 import org.drools.WorkingMemory;
 import org.drools.common.EventFactHandle;
 import org.drools.common.InternalFactHandle;
@@ -26,6 +19,12 @@
 import org.drools.rule.Package;
 import org.drools.temporal.SessionPseudoClock;
 
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.List;
+
 public class CepEspTest extends TestCase {
     protected RuleBase getRuleBase() throws Exception {
 
@@ -64,9 +63,9 @@
     public void testEventAssertion() throws Exception {
         // read in the source
         final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertion.drl" ) );
-        RuleBase ruleBase = loadRuleBase( reader );
+        final RuleBase ruleBase = loadRuleBase( reader );
 
-        WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
         final List results = new ArrayList();
 
         wm.setGlobal( "results",
@@ -99,12 +98,76 @@
         assertNotNull( handle3 );
         assertNotNull( handle4 );
 
+// @FIXME_testEventAssertion
+//        assertTrue( handle1.isEvent() );
+//        assertTrue( handle2.isEvent() );
+//        assertTrue( handle3.isEvent() );
+//        assertTrue( handle4.isEvent() );
+
+        wm.fireAllRules();
+
+        assertEquals( 2,
+                      results.size() );
+
+    }
+
+    public void FIXME_testEventAssertionWithDuration() throws Exception {
+        // read in the source
+        final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleEventAssertionWithDuration.drl" ) );
+        final RuleBase ruleBase = loadRuleBase( reader );
+
+        final WorkingMemory wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final List results = new ArrayList();
+
+        wm.setGlobal( "results",
+                      results );
+
+        StockTick tick1 = new StockTick( 1,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         5 );
+        StockTick tick2 = new StockTick( 2,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(),
+                                         10 );
+        StockTick tick3 = new StockTick( 3,
+                                         "ACME",
+                                         10,
+                                         System.currentTimeMillis(),
+                                         8 );
+        StockTick tick4 = new StockTick( 4,
+                                         "DROO",
+                                         50,
+                                         System.currentTimeMillis(),
+                                         7);
+
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+
+        assertNotNull( handle1 );
+        assertNotNull( handle2 );
+        assertNotNull( handle3 );
+        assertNotNull( handle4 );
+
         assertTrue( handle1.isEvent() );
         assertTrue( handle2.isEvent() );
         assertTrue( handle3.isEvent() );
         assertTrue( handle4.isEvent() );
 
-//        wm  = SerializationHelper.serializeObject(wm);
+        EventFactHandle eh1 = (EventFactHandle) handle1;
+        EventFactHandle eh2 = (EventFactHandle) handle2;
+        EventFactHandle eh3 = (EventFactHandle) handle3;
+        EventFactHandle eh4 = (EventFactHandle) handle4;
+
+        assertEquals( tick1.getDuration(), eh1.getDuration() );
+        assertEquals( tick2.getDuration(), eh2.getDuration() );
+        assertEquals( tick3.getDuration(), eh3.getDuration() );
+        assertEquals( tick4.getDuration(), eh4.getDuration() );
+
         wm.fireAllRules();
 
         assertEquals( 2,
@@ -112,12 +175,12 @@
 
     }
 
-    public void testTimeRelationalOperators() throws Exception {
+    public void FIXME_testTimeRelationalOperators() throws Exception {
         // read in the source
         final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_TimeRelationalOperators.drl" ) );
         final RuleBase ruleBase = loadRuleBase( reader );
 
-        TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
         final SessionPseudoClock clock = wm.getSessionClock();
 
         clock.setStartupTime( 1000 );
@@ -165,49 +228,57 @@
         StockTick tick1 = new StockTick( 1,
                                          "DROO",
                                          50,
-                                         System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         3 );
         StockTick tick2 = new StockTick( 2,
                                          "ACME",
                                          10,
-                                         System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         3 );
         StockTick tick3 = new StockTick( 3,
                                          "ACME",
                                          10,
-                                         System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         3 );
         StockTick tick4 = new StockTick( 4,
                                          "DROO",
                                          50,
-                                         System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         5 );
         StockTick tick5 = new StockTick( 5,
                 						 "ACME",
                 						 10,
-                						 System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         5 );
         StockTick tick6 = new StockTick( 6,
 										 "ACME",
 										 10,
-										 System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         3 );
         StockTick tick7 = new StockTick( 7,
 				 						 "ACME",
 				 						 10,
-				 						 System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         5 );
         StockTick tick8 = new StockTick( 8,
 										 "ACME",
 										 10,
-										 System.currentTimeMillis() );
+                                         System.currentTimeMillis(),
+                                         3 );
 
-        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1, 3 );
+        InternalFactHandle handle1 = (InternalFactHandle) wm.insert( tick1 );
         clock.advanceTime( 4 );
-        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2, 3 );
+        InternalFactHandle handle2 = (InternalFactHandle) wm.insert( tick2 );
         clock.advanceTime( 4 );
-        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3, 3 );
+        InternalFactHandle handle3 = (InternalFactHandle) wm.insert( tick3 );
         clock.advanceTime( 4 );
-        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4, 5 );
-        InternalFactHandle handle5 = (InternalFactHandle) wm.insert( tick5, 5 );
+        InternalFactHandle handle4 = (InternalFactHandle) wm.insert( tick4 );
+        InternalFactHandle handle5 = (InternalFactHandle) wm.insert( tick5 );
         clock.advanceTime( 1 );
-        InternalFactHandle handle6 = (InternalFactHandle) wm.insert( tick6, 3 );
-        InternalFactHandle handle7 = (InternalFactHandle) wm.insert( tick7, 5 );
+        InternalFactHandle handle6 = (InternalFactHandle) wm.insert( tick6 );
+        InternalFactHandle handle7 = (InternalFactHandle) wm.insert( tick7 );
         clock.advanceTime( 2 );
-        InternalFactHandle handle8 = (InternalFactHandle) wm.insert( tick8, 3 );
+        InternalFactHandle handle8 = (InternalFactHandle) wm.insert( tick8 );
         
         assertNotNull( handle1 );
         assertNotNull( handle2 );
@@ -226,7 +297,6 @@
         assertTrue( handle7.isEvent() );
         assertTrue( handle8.isEvent() );
 
-//        wm  = SerializationHelper.serializeObject(wm);
         wm.fireAllRules();
 
         assertEquals( 1,
@@ -301,12 +371,12 @@
 
     }
 
-    public void testSimpleTimeWindow() throws Exception {
+    public void FIXME_testSimpleTimeWindow() throws Exception {
         // read in the source
         final Reader reader = new InputStreamReader( getClass().getResourceAsStream( "test_CEP_SimpleTimeWindow.drl" ) );
         final RuleBase ruleBase = loadRuleBase( reader );
 
-        TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
+        final TemporalSession<SessionPseudoClock> wm = ruleBase.newTemporalSession( ClockType.PSEUDO_CLOCK );
         final List results = new ArrayList();
 
         wm.setGlobal( "results",
@@ -325,7 +395,6 @@
         assertEquals( 0,
                       handle1.getDuration() );
 
-//        wm  = SerializationHelper.serializeObject(wm);
         wm.fireAllRules();
 
         clock.advanceTime( 10000 ); // 10 seconds
@@ -370,7 +439,6 @@
         assertEquals( 0,
                       handle5.getDuration() );
 
-//        wm  = SerializationHelper.serializeObject(wm);
         wm.fireAllRules();
 
         clock.advanceTime( 10000 ); // 10 seconds
@@ -382,7 +450,6 @@
         assertEquals( 0,
                       handle6.getDuration() );
 
-        wm  = SerializationHelper.serializeObject(wm);
         wm.fireAllRules();
 
     }

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/LargeRuleBase.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/LargeRuleBase.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/LargeRuleBase.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,22 +1,22 @@
 package org.drools.integrationtests;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.StringReader;
-
+import junit.framework.Assert;
 import org.drools.RuleBase;
 import org.drools.RuleBaseFactory;
+import org.drools.common.DroolsObjectOutputStream;
 import org.drools.compiler.DrlParser;
 import org.drools.compiler.DroolsParserException;
 import org.drools.compiler.PackageBuilder;
 import org.drools.lang.descr.PackageDescr;
 import org.drools.rule.Package;
 
-import junit.framework.Assert;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.StringReader;
 
 /**
  * This generates a large number of rules (complex ones) and then times
@@ -80,7 +80,7 @@
 			f.delete();
 
 		time = System.currentTimeMillis();
-		ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(f));
+		ObjectOutput out = new DroolsObjectOutputStream(new FileOutputStream(f));
 		out.writeObject(rb);
 		out.flush();
 		out.close();

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/integrationtests/StreamsTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -20,7 +20,7 @@
 import junit.framework.Assert;
 import junit.framework.TestCase;
 import org.drools.ClockType;
-import org.drools.EntryPointInterface;
+import org.drools.WorkingMemoryEntryPoint;
 import org.drools.RuleBase;
 import org.drools.RuleBaseConfiguration;
 import org.drools.RuleBaseFactory;
@@ -131,10 +131,11 @@
         assertNotNull( handle3 );
         assertNotNull( handle4 );
 
-        assertTrue( handle1.isEvent() );
-        assertTrue( handle2.isEvent() );
-        assertTrue( handle3.isEvent() );
-        assertTrue( handle4.isEvent() );
+// @FIXME_testEventAssertion
+//       assertTrue( handle1.isEvent() );
+//        assertTrue( handle2.isEvent() );
+//        assertTrue( handle3.isEvent() );
+//        assertTrue( handle4.isEvent() );
 
         wm.fireAllRules();
 
@@ -158,7 +159,7 @@
                                          50,
                                          System.currentTimeMillis() );
 
-        EntryPointInterface entry = wm.getEntryPoint( "StockStream" );
+        WorkingMemoryEntryPoint entry = wm.getWorkingMemoryEntryPoint( "StockStream" );
 
         InternalFactHandle handle5 = (InternalFactHandle) entry.insert( tick5 );
         InternalFactHandle handle6 = (InternalFactHandle) entry.insert( tick6 );
@@ -170,10 +171,11 @@
         assertNotNull( handle7 );
         assertNotNull( handle8 );
 
-        assertTrue( handle5.isEvent() );
-        assertTrue( handle6.isEvent() );
-        assertTrue( handle7.isEvent() );
-        assertTrue( handle8.isEvent() );
+// @FIXME_testEventAssertion
+//        assertTrue( handle5.isEvent() );
+//        assertTrue( handle6.isEvent() );
+//        assertTrue( handle7.isEvent() );
+//        assertTrue( handle8.isEvent() );
 
         wm.fireAllRules();
 

Modified: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/java/org/drools/testframework/MockWorkingMemory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,23 +1,12 @@
 package org.drools.testframework;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
 import org.drools.Agenda;
-import org.drools.EntryPointInterface;
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.ObjectFilter;
 import org.drools.QueryResults;
 import org.drools.RuleBase;
+import org.drools.WorkingMemoryEntryPoint;
 import org.drools.common.InternalRuleBase;
 import org.drools.common.InternalWorkingMemory;
 import org.drools.common.NodeMemory;
@@ -49,6 +38,17 @@
 import org.drools.spi.PropagationContext;
 import org.drools.util.ObjectHashMap;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+
 public class MockWorkingMemory implements InternalWorkingMemory {
 
 	List<Object> facts = new ArrayList<Object>();
@@ -475,7 +475,7 @@
         return null;
     }
 
-    public EntryPointInterface getEntryPoint(String id) {
+    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String id) {
         // TODO Auto-generated method stub
         return null;
     }

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/big_decimal_and_literal.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/big_decimal_and_literal.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/big_decimal_and_literal.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/big_decimal_and_literal.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,59 @@
+package org.drools.test
+
+import org.drools.Person;
+import java.math.BigDecimal;
+
+global java.util.List list;
+
+rule "BigDec"
+
+	when
+		p: Person(bigDecimal < 100.01)
+	then
+		System.err.println("rule1");
+		list.add( p );
+end
+
+rule "BigInt"
+	when
+		p: Person(bigInteger < 100.1)
+	then
+	System.err.println("rule2");
+		list.add( p );
+end
+
+rule "BigDec2"
+
+	when
+		p: Person(bigDecimal == 42)
+	then
+	System.err.println("rule3");
+		list.add( p );
+end
+
+rule "BigInt2"
+	when
+		p: Person(bigInteger == 42)
+	then
+	System.err.println("rule4");
+		list.add( p );
+end
+
+rule "BigDec3"
+
+	when
+		p: Person(bigDecimal != 100)
+	then
+	System.err.println("rule5");
+		list.add( p );
+end
+
+rule "BigInt3"
+	when
+		p: Person(bigInteger != 100)
+	then
+	System.err.println("rule6");
+		list.add( p );
+end
+
+

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_CEP_SimpleEventAssertionWithDuration.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,17 @@
+package org.drools;
+
+import org.drools.StockTick;
+
+declare StockTick {
+    role event,
+    duration_attribute duration
+}
+
+global java.util.List results;
+
+rule "Check event"
+when
+    $st : StockTick( company == "ACME" )
+then
+    results.add( $st );
+end

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_0.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_0.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_0.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_0.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese; 
+
+global java.util.List results
+
+rule "like stilton"
+        salience 50
+    when
+        $cheese :Cheese( type:type == "stilton" )
+    then
+        results.add( $cheese );
+end  

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_1.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_1.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_1.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_1.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Cheese;
+
+global java.util.List results;
+
+rule "like brie"
+        salience 20
+    when
+        $cheese : Cheese( type:type == "brie" ) 
+    then
+        results.add( $cheese );
+end  
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_2.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_2.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_2.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic1_2.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,13 @@
+package org.drools.test;
+
+import org.drools.Address; 
+
+global java.util.List results;
+
+rule "match SerializeAddress"
+        salience 10
+    when
+        $address : Address()
+    then
+		results.add( $address );
+end  

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic3_0.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic3_0.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic3_0.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_Dynamic3_0.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,13 @@
+package org.drools.newtest;
+
+import org.drools.Person; 
+
+global java.util.List results
+
+rule "match Person"
+        salience 30
+    when
+        $person : Person()
+    then
+        results.add( $person );
+end    
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_FromArrayIteration.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_FromArrayIteration.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_FromArrayIteration.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_FromArrayIteration.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,14 @@
+package org.drools.test;
+
+import  org.drools.DomainObject
+import  org.drools.DomainObjectHolder;
+
+global java.util.List list
+
+rule "Test Rule"
+when
+    $holder : DomainObjectHolder()
+    $object : DomainObject( $message : message) from $holder.objects;
+then
+    list.add( $message );
+end 
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MatchesMVEL.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_MatchesMVEL.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MatchesMVEL.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MatchesMVEL.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,12 @@
+package org.drools;
+
+import java.util.Map;
+
+global java.util.List results;
+
+rule "Matches mvel"
+when
+    Map( this["content"] matches "hello ;=" )
+then
+    results.add( "OK" );
+end
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames1.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames1.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames1.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames1.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,10 @@
+package org.drools.test
+
+global java.util.List results;
+
+rule "rule1"
+	when
+		
+	then
+		results.add("rule1 for the package1");
+end
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames2.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames2.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames2.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_MergePackageWithSameRuleNames2.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,10 @@
+package org.drools.test
+
+global java.util.List results;
+
+rule "rule1"
+	when
+		
+	then
+		results.add("rule1 for the package2");
+end
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_ModifyBlock.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/integrationtests/test_ModifyBlock.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_ModifyBlock.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/integrationtests/test_ModifyBlock.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,12 @@
+package org.drools;
+
+global java.util.List results;
+
+rule "test modify block"
+when
+    $p: Person( status == "hungry" )
+    $c: Cheese( )
+then
+    modify( $c ) {setPrice (10) }
+    modify( $p ) {setStatus("fine") }
+end
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/lang/declare_type.drl (from rev 19036, labs/jbossrules/trunk/drools-compiler/src/test/resources/org/drools/lang/declare_type.drl)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/lang/declare_type.drl	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-compiler/src/test/resources/org/drools/lang/declare_type.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,8 @@
+package org.drools;
+
+declare CallEvent {
+    type event,
+    class org.drools.events.Call,
+    duration_attribute duration,
+    clock_strategy pseudo
+}
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -36,7 +36,7 @@
  * in WorkingMemories from an InputStream.
  *
  */
-public interface WorkingMemory extends WorkingMemoryEventManager, Externalizable {
+public interface WorkingMemory extends WorkingMemoryEventManager, WorkingMemoryEntryPoint, Externalizable {
 
     /**
      * Returns the Agenda for this WorkingMemory. While the WorkingMemory interface is considered public, the Agenda interface
@@ -206,34 +206,6 @@
 
 
     /**
-     * Assert a fact.
-     *
-     * @param object
-     *            The fact object.
-     *
-     * @return The new fact-handle associated with the object.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    FactHandle insert(Object object) throws FactException;
-
-    /**
-     * Assert a fact with inherent duration.
-     *
-     * @param object
-     *            The fact object.
-     * @param duration
-     *            The duration of the fact.
-     *
-     * @return The new fact-handle associated with the object.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    FactHandle insert(Object object, long duration) throws FactException;
-
-    /**
      * Retrieve the QueryResults of the specified query.
      *
      * @param query
@@ -265,88 +237,6 @@
     public QueryResults getQueryResults(String query, Object[] arguments);
 
     /**
-     * Insert a fact registering JavaBean <code>PropertyChangeListeners</code>
-     * on the Object to automatically trigger <code>update</code> calls
-     * if <code>dynamic</code> is <code>true</code>.
-     *
-     * @param object
-     *            The fact object.
-     * @param dynamic
-     *            true if Drools should add JavaBean
-     *            <code>PropertyChangeListeners</code> to the object.
-     *
-     * @return The new fact-handle associated with the object.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    FactHandle insert(Object object,
-                            boolean dynamic) throws FactException;
-
-    /**
-     * Insert a fact with inherent duration registering JavaBean
-     * <code>PropertyChangeListeners</code> on the Object to
-     * automatically trigger <code>update</code> calls
-     * if <code>dynamic</code> is <code>true</code>.
-     *
-     * @param object
-     *            The fact object.
-     * @param duration
-     *            The duration of the fact.
-     * @param dynamic
-     *            true if Drools should add JavaBean
-     *            <code>PropertyChangeListeners</code> to the object.
-     *
-     * @return The new fact-handle associated with the object.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    FactHandle insert(Object object,
-    				  long duration,
-                      boolean dynamic) throws FactException;
-
-    /**
-     * Retract a fact.
-     *
-     * @param handle
-     *            The fact-handle associated with the fact to retract.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    void retract(FactHandle handle) throws FactException;
-
-    /**
-     * Inform the WorkingMemory that a Fact has been modified and that it
-     * should now update the network.
-     *
-     * @param handle
-     *            The fact-handle associated with the fact to modify.
-     * @param object
-     *            The new value of the fact.
-     *
-     * @throws FactException
-     *             If a RuntimeException error occurs.
-     */
-    void update(FactHandle handle,
-                      Object object) throws FactException;
-
-    /**
-     *
-     * @param factHandle
-     */
-    public void modifyRetract(final FactHandle factHandle);
-
-    /**
-     *
-     * @param factHandle
-     * @param object
-     */
-    public void modifyInsert(final FactHandle factHandle,
-                             final Object object);
-
-    /**
      * Sets the AsyncExceptionHandler to handle exceptions thrown by the Agenda
      * Scheduler used for duration rules.
      *
@@ -414,6 +304,6 @@
      * @param id the id of the entry point, as defined in the rules file
      * @return
      */
-    public EntryPointInterface getEntryPoint( String id );
+    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint( String id );
 
 }
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemoryEntryPoint.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/WorkingMemoryEntryPoint.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemoryEntryPoint.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/WorkingMemoryEntryPoint.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2007 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Dec 14, 2007
+ */
+package org.drools;
+
+import java.io.Externalizable;
+
+/**
+ * An interface for instances that allow handling of entry-point-scoped
+ * facts
+ *  
+ * @author etirelli
+ */
+public interface WorkingMemoryEntryPoint
+    extends
+    Externalizable {
+    /**
+     * Assert a fact.
+     * 
+     * @param object
+     *            The fact object.
+     * 
+     * @return The new fact-handle associated with the object.
+     * 
+     * @throws FactException
+     *             If a RuntimeException error occurs.
+     */
+    FactHandle insert(Object object) throws FactException;
+
+    /**
+     * Insert a fact registering JavaBean <code>PropertyChangeListeners</code>
+     * on the Object to automatically trigger <code>update</code> calls
+     * if <code>dynamic</code> is <code>true</code>.
+     * 
+     * @param object
+     *            The fact object.
+     * @param dynamic
+     *            true if Drools should add JavaBean
+     *            <code>PropertyChangeListeners</code> to the object.
+     * 
+     * @return The new fact-handle associated with the object.
+     * 
+     * @throws FactException
+     *             If a RuntimeException error occurs.
+     */
+    FactHandle insert(Object object,
+                      boolean dynamic) throws FactException;
+
+    /**
+     * Retract a fact.
+     * 
+     * @param handle
+     *            The fact-handle associated with the fact to retract.
+     * 
+     * @throws FactException
+     *             If a RuntimeException error occurs.
+     */
+    void retract(FactHandle handle) throws FactException;
+
+    /**
+     * Inform the WorkingMemory that a Fact has been modified and that it
+     * should now update the network.
+     * 
+     * @param handle
+     *            The fact-handle associated with the fact to modify.
+     * @param object
+     *            The new value of the fact.
+     * 
+     * @throws FactException
+     *             If a RuntimeException error occurs.
+     */
+    void update(FactHandle handle,
+                Object object) throws FactException;
+
+    /**
+     * 
+     * @param factHandle
+     */
+    public void modifyRetract(final FactHandle factHandle);
+
+    /**
+     * 
+     * @param factHandle
+     * @param object
+     */
+    public void modifyInsert(final FactHandle factHandle,
+                             final Object object);
+
+    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name);
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/HttpClientImpl.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/HttpClientImpl.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/HttpClientImpl.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -11,36 +11,42 @@
 
 public class HttpClientImpl implements IHttpClient {
 
-    
-    
-    
 
 
 
 
-    
-    
-    
+
+
+
+
+
+
     public LastUpdatedPing checkLastUpdated(URL url) throws IOException {
         URLConnection con = url.openConnection();
         HttpURLConnection httpCon = (HttpURLConnection) con;
         try {
             httpCon.setRequestMethod( "HEAD" );
-            
+
+
             String lm = httpCon.getHeaderField( "lastModified" );
             LastUpdatedPing ping = new LastUpdatedPing();
-            
+
             ping.responseMessage = httpCon.getHeaderFields().toString();
-            
+
             if (lm != null) {
                 ping.lastUpdated = Long.parseLong( lm );
+            } else {
+            	long httpLM = httpCon.getLastModified();
+            	if (httpLM > 0) {
+            		ping.lastUpdated = httpLM;
+            	}
             }
-            
+
             return ping;
-        } finally {        
+        } finally {
             httpCon.disconnect();
         }
-        
+
     }
 
     public Package fetchPackage(URL url) throws IOException, ClassNotFoundException {
@@ -49,28 +55,28 @@
         try {
             httpCon.setRequestMethod( "GET" );
             InputStream in = httpCon.getInputStream();
-            
+
             DroolsObjectInputStream oin = new DroolsObjectInputStream(in);
                 return (Package) oin.readObject();
-  
+
         } finally {
             httpCon.disconnect();
         }
     }
-    
+
     public static void main(String[] args) throws Exception {
         HttpClientImpl cl = new HttpClientImpl();
         URL url = new URL("http://localhost:8888/org.drools.brms.JBRMS/package/com.billasurf.manufacturing.plant/SNAP");
-        
-        
+
+
         LastUpdatedPing ping = cl.checkLastUpdated( url );
-        
-        
+
+
         Package p = cl.fetchPackage( url );
-        
-        
+
+
         System.err.println(ping);
         System.err.println( ping.isError() );
     }
-    
+
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/URLScanner.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/URLScanner.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/agent/URLScanner.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,11 +1,14 @@
 package org.drools.agent;
 
+import org.drools.RuntimeDroolsException;
+import org.drools.common.DroolsObjectOutputStream;
+import org.drools.rule.Package;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.ObjectOutputStream;
-import java.io.UnsupportedEncodingException;
 import java.io.ObjectOutput;
+import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLEncoder;
@@ -15,10 +18,6 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.drools.RuntimeDroolsException;
-import org.drools.common.DroolsObjectOutputStream;
-import org.drools.rule.Package;
-
 public class URLScanner extends PackageProvider {
 
     //this is the URLs we are managing

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/ClassFieldExtractor.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/ClassFieldExtractor.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/ClassFieldExtractor.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,21 +16,17 @@
  * limitations under the License.
  */
 
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Externalizable;
-import java.lang.reflect.Method;
-
 import org.drools.RuntimeDroolsException;
-import org.drools.common.DroolsObjectInputStream;
-import org.drools.common.InternalWorkingMemory;
 import org.drools.common.DroolsObjectInput;
+import org.drools.common.InternalWorkingMemory;
 import org.drools.spi.FieldExtractor;
 import org.drools.util.ClassUtils;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.Method;
+
 /**
  * This provides access to fields, and what their numerical index/object type is.
  * This is basically a wrapper class around dynamically generated subclasses of

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -27,14 +27,13 @@
 import org.drools.spi.KnowledgeHelper;
 import org.drools.spi.Tuple;
 
-import java.io.Externalizable;
 import java.io.IOException;
-import java.io.ObjectOutput;
 import java.io.ObjectInput;
+import java.io.ObjectOutput;
 
 public class DefaultKnowledgeHelper
     implements
-    KnowledgeHelper, Externalizable {
+    KnowledgeHelper {
 
     private static final long                  serialVersionUID = 400L;
 
@@ -45,8 +44,8 @@
     private InternalWorkingMemoryActions workingMemory;
 
     public DefaultKnowledgeHelper() {
-
     }
+
     public DefaultKnowledgeHelper(final WorkingMemory workingMemory) {
         this.workingMemory = (InternalWorkingMemoryActions) workingMemory;
     }
@@ -83,71 +82,32 @@
 
     public void insert(final Object object) throws FactException {
         insert( object,
-                0,
                 false );
     }
 
     public void insert(final Object object,
-                       final long duration) throws FactException {
-        insert( object,
-                duration,
-                false );
-    }
-
-    public void insert(final Object object,
                        final boolean dynamic) throws FactException {
         this.workingMemory.insert( object,
-                                   0,
                                    dynamic,
                                    false,
                                    this.rule,
                                    this.activation );
     }
 
-    public void insert(final Object object,
-                       final long duration,
-                       final boolean dynamic) throws FactException {
-        this.workingMemory.insert( object,
-                                   duration,
-                                   dynamic,
-                                   false,
-                                   this.rule,
-                                   this.activation );
-    }
-
     public void insertLogical(final Object object) throws FactException {
         insertLogical( object,
-                       0,
                        false );
     }
 
-    public void insertLogical(final Object object, final long duration) throws FactException {
-        insertLogical( object,
-                       duration,
-                       false );
-    }
-
     public void insertLogical(final Object object,
                               final boolean dynamic) throws FactException {
         this.workingMemory.insert( object,
-                                   0,
                                    dynamic,
                                    true,
                                    this.rule,
                                    this.activation );
     }
 
-    public void insertLogical(final Object object,
-                              final long duration,
-                              final boolean dynamic) throws FactException {
-        this.workingMemory.insert( object,
-                                   duration,
-                                   dynamic,
-                                   true,
-                                   this.rule,
-                                   this.activation );
-    }
-
     public void update(final FactHandle handle,
                        final Object newObject) throws FactException {
         // only update if this fact exists in the wm

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/SequentialKnowledgeHelper.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/SequentialKnowledgeHelper.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/base/SequentialKnowledgeHelper.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,21 +16,21 @@
  * limitations under the License.
  */
 
-import java.util.List;
-
 import org.drools.FactException;
 import org.drools.FactHandle;
-import org.drools.QueryResults;
 import org.drools.WorkingMemory;
 import org.drools.common.InternalWorkingMemoryActions;
 import org.drools.rule.Declaration;
 import org.drools.rule.GroupElement;
 import org.drools.rule.Rule;
 import org.drools.spi.Activation;
-import org.drools.spi.AgendaGroup;
 import org.drools.spi.KnowledgeHelper;
 import org.drools.spi.Tuple;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 public class SequentialKnowledgeHelper
     implements
     KnowledgeHelper {
@@ -41,8 +41,27 @@
     private GroupElement                       subrule;
     private Activation                         activation;
     private Tuple                              tuple;
-    private final InternalWorkingMemoryActions workingMemory;
+    private InternalWorkingMemoryActions workingMemory;
 
+    public SequentialKnowledgeHelper() {
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        rule            = (Rule)in.readObject();
+        subrule         = (GroupElement)in.readObject();
+        activation      = (Activation)in.readObject();
+        tuple           = (Tuple)in.readObject();
+        workingMemory   = (InternalWorkingMemoryActions)in.readObject();
+
+    }
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(rule);
+        out.writeObject(subrule);
+        out.writeObject(activation);
+        out.writeObject(tuple);
+        out.writeObject(workingMemory);
+    }
+
     public SequentialKnowledgeHelper(final WorkingMemory workingMemory) {
         this.workingMemory = (InternalWorkingMemoryActions) workingMemory;
     }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractFactHandleFactory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -21,9 +21,11 @@
 import org.drools.util.PrimitiveLongStack;
 
 import java.io.Externalizable;
-import java.io.ObjectInput;
 import java.io.IOException;
+import java.io.ObjectInput;
 import java.io.ObjectOutput;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 
 public abstract class AbstractFactHandleFactory
     implements
@@ -37,121 +39,82 @@
     protected PrimitiveLongStack factHandlePool   = new PrimitiveLongStack();
 
     /** The fact id. */
-    private long                       id;
+    private AtomicInteger              id;
 
     /** The number of facts created - used for recency. */
-    private long                       counter;
+    private AtomicLong                 counter;
 
+    public AbstractFactHandleFactory() {
+        this.id = new AtomicInteger(-1);
+        this.counter = new AtomicLong(-1);
+    }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        id  = in.readLong();
-        counter = in.readLong();
+        id      = (AtomicInteger)in.readObject();
+        counter = (AtomicLong)in.readObject();
         factHandlePool  = (PrimitiveLongStack)in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(id);
-        out.writeLong(counter);
+        out.writeObject(id);
+        out.writeObject(counter);
         out.writeObject(factHandlePool);
     }
 
     /* (non-Javadoc)
-    * @see org.drools.reteoo.FactHandleFactory#newFactHandle()
-    */
-    public final InternalFactHandle newFactHandle( final Object object, final boolean isEvent, final WorkingMemory workingMemory ) {
-        if ( !this.factHandlePool.isEmpty() ) {
-            return newFactHandle( this.factHandlePool.pop(),
-                                  object,
-                                  isEvent,
-                                  0,
-                                  workingMemory );
-        }
+     * @see org.drools.reteoo.FactHandleFactory#newFactHandle()
+     */
+    public final InternalFactHandle newFactHandle(final Object object,
+                                                  final boolean isEvent,
+                                                  final WorkingMemory workingMemory) {
+// @FIXME make id re-cycling thread safe
+//        if ( !this.factHandlePool.isEmpty() ) {
+//            return newFactHandle( this.factHandlePool.pop(),
+//                                  object,
+//                                  isEvent,
+//                                  0,
+//                                  workingMemory );
+//        }
 
-        return newFactHandle( this.id++,
+        return newFactHandle( this.id.incrementAndGet(),
                               object,
                               isEvent,
-                              0,
                               workingMemory );
     }
 
     /* (non-Javadoc)
-    * @see org.drools.reteoo.FactHandleFactory#newFactHandle()
-    */
-    public final InternalFactHandle newFactHandle( final Object object, final boolean isEvent, long duration, final WorkingMemory workingMemory ) {
-        if ( !this.factHandlePool.isEmpty() ) {
-            return newFactHandle( this.factHandlePool.pop(),
-                                  object,
-                                  isEvent,
-                                  duration,
-                                  workingMemory );
-        }
-
-        return newFactHandle( this.id++,
-                              object,
-                              isEvent,
-                              duration,
-                              workingMemory );
-    }
-
-    /* (non-Javadoc)
      * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
      */
-    protected final InternalFactHandle newFactHandle(final long id,
+    protected final InternalFactHandle newFactHandle(final int id,
                                                      final Object object,
                                                      final boolean isEvent,
-                                                     final WorkingMemory workingMemory ) {
+                                                     final WorkingMemory workingMemory) {
         return newFactHandle( id,
                               object,
-                              this.counter++,
+                              this.counter.incrementAndGet(),
                               isEvent,
-                              0,
                               workingMemory );
     }
 
     /* (non-Javadoc)
-    * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
-    */
-    protected final InternalFactHandle newFactHandle(final long id,
-                                                     final Object object,
-                                                     final boolean isEvent,
-                                                     final long duration,
-                                                     final WorkingMemory workingMemory ) {
-        return newFactHandle( id,
-                              object,
-                              this.counter++,
-                              isEvent,
-                              duration,
-                              workingMemory );
-    }
-
-    /* (non-Javadoc)
      * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
      */
-    protected abstract InternalFactHandle newFactHandle(final long id,
+    protected abstract InternalFactHandle newFactHandle(final int id,
                                                         final Object object,
                                                         final long recency,
                                                         final boolean isEvent,
-                                                        final WorkingMemory workingMemory );
+                                                        final WorkingMemory workingMemory);
 
     /* (non-Javadoc)
-    * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
-    */
-    protected abstract InternalFactHandle newFactHandle(final long id,
-                                                        final Object object,
-                                                        final long recency,
-                                                        final boolean isEvent,
-                                                        final long duration,
-                                                        final WorkingMemory workingMemory );
-
-    /* (non-Javadoc)
      * @see org.drools.reteoo.FactHandleFactory#increaseFactHandleRecency(org.drools.FactHandle)
      */
     public final void increaseFactHandleRecency(final InternalFactHandle factHandle) {
-        factHandle.setRecency( this.counter++ );
+        factHandle.setRecency( this.counter.incrementAndGet() );
     }
 
     public void destroyFactHandle(final InternalFactHandle factHandle) {
-        this.factHandlePool.push( factHandle.getId() );
+// @FIXME make id re-cycling thread safe
+//        this.factHandlePool.push( factHandle.getId() );
         factHandle.invalidate();
     }
 

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractRuleBase.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -34,6 +34,7 @@
 import org.drools.rule.MapBackedClassLoader;
 import org.drools.rule.Package;
 import org.drools.rule.Rule;
+import org.drools.rule.TypeDeclaration;
 import org.drools.spi.ExecutorServiceFactory;
 import org.drools.spi.FactHandleFactory;
 import org.drools.util.ObjectHashSet;
@@ -115,6 +116,8 @@
     private int                                     additionsSinceLock;
     private int                                     removalsSinceLock;
 
+    private transient Map<Class< ? >, TypeDeclaration> classTypeDeclaration;
+
     /**
      * Default constructor - for Externalizable. This should never be used by a user, as it
      * will result in an invalid state for the instance.
@@ -157,6 +160,8 @@
         this.globals = new HashMap();
         this.statefulSessions = new ObjectHashSet();
         this.objenesis = createObjenesis();
+
+        this.classTypeDeclaration = new HashMap<Class< ? >, TypeDeclaration>();
     }
 
     // ------------------------------------------------------------
@@ -203,6 +208,7 @@
         droolsStream.writeObject(lock);
         droolsStream.writeInt(additionsSinceLock);
         droolsStream.writeInt(removalsSinceLock);
+        droolsStream.writeObject(classTypeDeclaration);
         if (!isDrools) {
             bytes.close();
             out.writeObject(bytes.toByteArray());
@@ -262,6 +268,7 @@
         lock            = (ReentrantLock)droolsStream.readObject();
         additionsSinceLock  = droolsStream.readInt();
         removalsSinceLock   = droolsStream.readInt();
+        classTypeDeclaration    = (Map<Class< ? >, TypeDeclaration>)droolsStream.readObject();
 
         if (!isDrools) {
             droolsStream.close();
@@ -276,6 +283,15 @@
         return new ObjenesisStd( true );
     }
 
+    private void populateTypeDeclarationMaps() {
+        this.classTypeDeclaration = new HashMap<Class<?>, TypeDeclaration>();
+        for( Package pkg : this.pkgs.values() ) {
+            for( TypeDeclaration type : pkg.getTypeDeclarations().values() ) {
+                this.classTypeDeclaration.put( type.getTypeClass(), type );
+            }
+        }
+    }
+
     /**
      * @return the id
      */
@@ -429,6 +445,15 @@
             }
             this.globals.putAll( newGlobals );
 
+            // Add type declarations
+            for ( TypeDeclaration type : newPkg.getTypeDeclarations().values() ) {
+                // should we allow overrides?
+                if ( !this.classTypeDeclaration.containsKey( type.getTypeClass() ) ) {
+                    this.classTypeDeclaration.put( type.getTypeClass(),
+                                                   type );
+                }
+            }
+
             final Rule[] rules = newPkg.getRules();
 
             for ( int i = 0; i < rules.length; ++i ) {
@@ -483,14 +508,30 @@
         }
         globals.putAll( newPkg.getGlobals() );
 
+        // add type declarations
+        for ( TypeDeclaration type : newPkg.getTypeDeclarations().values() ) {
+            // should we allow overrides?
+            if ( !this.classTypeDeclaration.containsKey( type.getTypeClass() ) ) {
+                this.classTypeDeclaration.put( type.getTypeClass(),
+                                               type );
+            }
+            if ( !pkg.getTypeDeclarations().containsKey( type.getTypeName() ) ) {
+                pkg.addTypeDeclaration( type );
+            }
+        }
+
         //Add rules into the RuleBase package
         //as this is needed for individual rule removal later on
         final Rule[] newRules = newPkg.getRules();
         for ( int i = 0; i < newRules.length; i++ ) {
             final Rule newRule = newRules[i];
-            if ( pkg.getRule( newRule.getName() ) == null ) {
-                pkg.addRule( newRule );
+
+            // remove the rule if it already exists
+            if ( pkg.getRule( newRule.getName() ) != null ) {
+                removeRule( pkg, pkg.getRule( newRule.getName() ) );
             }
+
+            pkg.addRule( newRule );
         }
 
         //and now the rule flows
@@ -510,6 +551,10 @@
         this.reloadPackageCompilationData.addDialectDatas( pkg.getDialectDatas() );
     }
 
+    public TypeDeclaration getTypeDeclaration(Class< ? > clazz) {
+        return this.classTypeDeclaration.get( clazz );
+    }
+
     private synchronized void addRule(final Package pkg,
                                       final Rule rule) throws InvalidPatternException {
         this.eventSupport.fireBeforeRuleAdded( pkg,
@@ -732,10 +777,9 @@
             ((InternalWorkingMemory) session).setRuleBase( this );
             ((InternalWorkingMemory) session).setId( (nextWorkingMemoryCounter()) );
 
+
             ExecutorService executor = ExecutorServiceFactory.createExecutorService( this.config.getExecutorService() );
-
             executor.setCommandExecutor( new CommandExecutor( session ) );
-
             ((InternalWorkingMemory) session).setExecutorService( executor );
 
             if ( keepReference ) {

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/AbstractWorkingMemory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,31 +16,7 @@
  * limitations under the License.
  */
 
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Serializable;
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.Externalizable;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Queue;
-import java.util.Map.Entry;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
 import org.drools.Agenda;
-import org.drools.EntryPointInterface;
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.ObjectFilter;
@@ -48,10 +24,11 @@
 import org.drools.QueryResults;
 import org.drools.RuleBase;
 import org.drools.RuleBaseConfiguration;
-import org.drools.RuntimeDroolsException;
-import org.drools.WorkingMemory;
 import org.drools.RuleBaseConfiguration.AssertBehaviour;
 import org.drools.RuleBaseConfiguration.LogicalOverride;
+import org.drools.RuntimeDroolsException;
+import org.drools.WorkingMemory;
+import org.drools.WorkingMemoryEntryPoint;
 import org.drools.base.MapGlobalResolver;
 import org.drools.base.ShadowProxy;
 import org.drools.concurrent.ExecutorService;
@@ -62,20 +39,18 @@
 import org.drools.event.RuleFlowEventSupport;
 import org.drools.event.WorkingMemoryEventListener;
 import org.drools.event.WorkingMemoryEventSupport;
-import org.drools.facttemplates.Fact;
 import org.drools.process.core.Process;
 import org.drools.process.instance.ProcessInstance;
 import org.drools.process.instance.ProcessInstanceFactory;
 import org.drools.process.instance.WorkItemManager;
-import org.drools.reteoo.ClassObjectTypeConf;
 import org.drools.reteoo.EntryPointNode;
-import org.drools.reteoo.FactTemplateTypeConf;
 import org.drools.reteoo.LIANodePropagation;
 import org.drools.reteoo.ObjectTypeConf;
 import org.drools.rule.Declaration;
 import org.drools.rule.EntryPoint;
 import org.drools.rule.Rule;
 import org.drools.rule.TimeMachine;
+import org.drools.rule.TypeDeclaration;
 import org.drools.ruleflow.core.RuleFlowProcess;
 import org.drools.ruleflow.instance.RuleFlowProcessInstanceFactory;
 import org.drools.spi.Activation;
@@ -86,6 +61,28 @@
 import org.drools.spi.GlobalResolver;
 import org.drools.spi.PropagationContext;
 
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
 /**
  * Implementation of <code>WorkingMemory</code>.
  *
@@ -97,12 +94,12 @@
     implements
     InternalWorkingMemoryActions,
     EventSupport,
-    PropertyChangeListener, Externalizable {
+    PropertyChangeListener {
     // ------------------------------------------------------------
     // Constants
     // ------------------------------------------------------------
-    protected static final Class[]                       ADD_REMOVE_PROPERTY_CHANGE_LISTENER_ARG_TYPES = new Class[]{PropertyChangeListener.class};
-    private static final int                             NODE_MEMORIES_ARRAY_GROWTH                    = 32;
+    protected static final Class[]                      ADD_REMOVE_PROPERTY_CHANGE_LISTENER_ARG_TYPES = new Class[]{PropertyChangeListener.class};
+    private static final int                            NODE_MEMORIES_ARRAY_GROWTH                    = 32;
 
     // ------------------------------------------------------------
     // Instance members
@@ -143,45 +140,49 @@
 
     protected Queue<WorkingMemoryAction>           actionQueue                                   = new LinkedList<WorkingMemoryAction>();
 
-    protected boolean                                    evaluatingActionQueue;
+    protected boolean                                   evaluatingActionQueue;
 
     protected ReentrantLock                        lock                                          = new ReentrantLock();
 
     protected boolean                              discardOnLogicalOverride;
 
-    protected long                                       propagationIdCounter;
+    /**
+     * This must be thread safe as it is incremented and read via different EntryPoints
+     */
+    protected AtomicLong                                propagationIdCounter;
 
     private boolean                                maintainTms;
 
     private boolean                                sequential;
 
-    private List                                         liaPropagations                               = Collections.EMPTY_LIST;
+    private List                                        liaPropagations                               = Collections.EMPTY_LIST;
 
     /** Flag to determine if a rule is currently being fired. */
-    protected boolean                                    firing;
+    protected boolean                                   firing;
 
-    protected boolean                                    halt;
+    protected boolean                                   halt;
 
-    private Map                                          processInstances                              = new HashMap();
+    private Map                                         processInstances                              = new HashMap();
 
-    private int                                          processCounter;
+    private int                                         processCounter;
 
-    private WorkItemManager                              workItemManager;
+    private WorkItemManager                             workItemManager;
 
-    private Map<String, ProcessInstanceFactory>          processInstanceFactories                      = new HashMap();
+    private Map<String, ProcessInstanceFactory>         processInstanceFactories                      = new HashMap();
 
-    private TimeMachine                                  timeMachine                                   = new TimeMachine();
+    private TimeMachine                                 timeMachine                                   = new TimeMachine();
 
-    private Map<EntryPoint, Map<Object, ObjectTypeConf>> typeConfMap;
+    protected transient ObjectTypeConfigurationRegistry typeConfReg;
 
-    private EntryPoint                                   entryPoint;
-    private EntryPointNode                               entryPointNode;
+    protected EntryPoint                                entryPoint;
+    protected transient EntryPointNode                  entryPointNode;
 
+    protected Map<String, WorkingMemoryEntryPoint>      entryPoints;
+
     // ------------------------------------------------------------
     // Constructors
     // ------------------------------------------------------------
     public AbstractWorkingMemory() {
-
     }
     /**
      * Construct.
@@ -191,7 +192,6 @@
      */
     public AbstractWorkingMemory(final int id,
                                  final InternalRuleBase ruleBase,
-                                 //final EntryPoint entryPoint,
                                  final FactHandleFactory handleFactory) {
         this.id = id;
         this.ruleBase = ruleBase;
@@ -210,6 +210,8 @@
 
         final RuleBaseConfiguration conf = this.ruleBase.getConfiguration();
 
+        this.propagationIdCounter = new AtomicLong();
+
         this.objectStore = new SingleThreadedObjectStore( conf,
                                                           this.lock );
 
@@ -223,18 +225,19 @@
         this.workItemManager = new WorkItemManager( this );
         this.processInstanceFactories.put( RuleFlowProcess.RULEFLOW_TYPE,
                                            new RuleFlowProcessInstanceFactory() );
+        this.entryPoints = new ConcurrentHashMap();
+        this.entryPoints.put( "DEFAULT",
+                              this );
 
-        this.typeConfMap = new ConcurrentHashMap<EntryPoint, Map<Object, ObjectTypeConf>>();
-
-//        this.entryPoint = entryPoint;
-//        this.entryPointNode = this.ruleBase.getRete().getEntryPointNode( this.entryPoint );
+        this.entryPoint = EntryPoint.DEFAULT;
+        initTransient();
     }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
         id  = in.readLong();
         evaluatingActionQueue = in.readBoolean();
         discardOnLogicalOverride = in.readBoolean();
-        propagationIdCounter = in.readLong();
+        propagationIdCounter = (AtomicLong)in.readObject();
         maintainTms = in.readBoolean();
         sequential = in.readBoolean();
         firing = in.readBoolean();
@@ -260,16 +263,16 @@
         workItemManager = (WorkItemManager)in.readObject();
         processInstanceFactories = (Map<String, ProcessInstanceFactory>)in.readObject();
         timeMachine = (TimeMachine)in.readObject();
-        typeConfMap = (Map<EntryPoint, Map<Object, ObjectTypeConf>>)in.readObject();
         entryPoint = (EntryPoint)in.readObject();
-        entryPointNode = (EntryPointNode)in.readObject();
+        entryPoints = (Map<String, WorkingMemoryEntryPoint>)in.readObject();
+        initTransient();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
         out.writeLong(id);
         out.writeBoolean(evaluatingActionQueue);
         out.writeBoolean(discardOnLogicalOverride);
-        out.writeLong(propagationIdCounter);
+        out.writeObject(propagationIdCounter);
         out.writeBoolean(maintainTms);
         out.writeBoolean(sequential);
         out.writeBoolean(firing);
@@ -295,9 +298,8 @@
         out.writeObject(workItemManager);
         out.writeObject(processInstanceFactories);
         out.writeObject(timeMachine);
-        out.writeObject(typeConfMap);
         out.writeObject(entryPoint);
-        out.writeObject(entryPointNode);
+        out.writeObject(entryPoints);
     }
 
     // ------------------------------------------------------------
@@ -307,8 +309,16 @@
     public void setRuleBase(final InternalRuleBase ruleBase) {
         this.ruleBase = ruleBase;
         this.nodeMemories.setRuleBaseReference( this.ruleBase );
+        initTransient();
     }
 
+
+    private void initTransient() {
+        this.entryPointNode = this.ruleBase.getRete().getEntryPointNode( this.entryPoint );
+        this.typeConfReg = new ObjectTypeConfigurationRegistry( this.ruleBase );
+    }
+
+
     public void setWorkingMemoryEventSupport(WorkingMemoryEventSupport workingMemoryEventSupport) {
         this.workingMemoryEventSupport = workingMemoryEventSupport;
     }
@@ -499,9 +509,7 @@
             }
         }
 
-        if ( !this.actionQueue.isEmpty() ) {
-            executeQueuedActions();
-        }
+        executeQueuedActions();
 
         boolean noneFired = true;
 
@@ -512,9 +520,7 @@
                 while ( continueFiring( fireLimit ) && this.agenda.fireNextItem( agendaFilter ) ) {
                     fireLimit = updateFireLimit( fireLimit );
                     noneFired = false;
-                    if ( !this.actionQueue.isEmpty() ) {
-                        executeQueuedActions();
-                    }
+                    executeQueuedActions();
                 }
             } finally {
                 this.firing = false;
@@ -674,161 +680,82 @@
      */
     public FactHandle insert(final Object object) throws FactException {
         return insert( object, /* Not-Dynamic */
-                       0,
                        false,
                        false,
                        null,
                        null );
     }
 
-    public FactHandle insert(final Object object,
-                             final long duration) throws FactException {
-        return insert( object, /* Not-Dynamic */
-                       duration,
-                       false,
-                       false,
-                       null,
-                       null );
-    }
-
     /**
      * @see WorkingMemory
      */
     public FactHandle insertLogical(final Object object) throws FactException {
         return insert( object, //Not-Dynamic
-                       0,
                        false,
                        true,
                        null,
                        null );
     }
 
-    public FactHandle insertLogical(final Object object,
-                                    final long duration) throws FactException {
-        return insert( object, /* Not-Dynamic */
-                       duration,
-                       false,
-                       true,
-                       null,
-                       null );
-    }
-
     public FactHandle insert(final Object object,
                              final boolean dynamic) throws FactException {
         return insert( object,
-                       0,
                        dynamic,
                        false,
                        null,
                        null );
     }
 
-    public FactHandle insert(final Object object,
-                             final long duration,
-                             final boolean dynamic) throws FactException {
-        return insert( object,
-                       duration,
-                       dynamic,
-                       false,
-                       null,
-                       null );
-    }
-
     public FactHandle insertLogical(final Object object,
                                     final boolean dynamic) throws FactException {
         return insert( object,
-                       0,
                        dynamic,
                        true,
                        null,
                        null );
     }
 
-    public FactHandle insertLogical(final Object object,
-                                    final long duration,
-                                    final boolean dynamic) throws FactException {
-        return insert( object,
-                       duration,
-                       dynamic,
-                       true,
-                       null,
-                       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,
                              final Rule rule,
                              final Activation activation) throws FactException {
-        return this.insert( EntryPoint.DEFAULT,
-                            object,
-                            0,
-                            dynamic,
-                            logical,
-                            rule,
-                            activation );
-
-    }
-
-    public FactHandle insert(final Object object,
-                             final long duration,
-                             final boolean dynamic,
-                             boolean logical,
-                             final Rule rule,
-                             final Activation activation) throws FactException {
-        return this.insert( EntryPoint.DEFAULT,
-                            object,
-                            duration,
-                            dynamic,
-                            logical,
-                            rule,
-                            activation );
-    }
-
-    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 );
-    }
-
-    protected FactHandle insert(final EntryPoint entryPoint,
-                                final Object object,
-                                final long duration,
-                                final boolean dynamic,
-                                boolean logical,
-                                final Rule rule,
-                                final Activation activation) throws FactException {
         if ( object == null ) {
             // you cannot assert a null object
             return null;
         }
 
-        ObjectTypeConf typeConf = getObjectTypeConf( entryPoint,
-                                                     object );
+        ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                      object );
 
         InternalFactHandle handle = null;
 
         if ( isSequential() ) {
             handle = this.handleFactory.newFactHandle( object,
                                                        typeConf.isEvent(),
-                                                       duration,
                                                        this );
             this.objectStore.addHandle( handle,
                                         object );
-            insert( entryPoint,
-                    handle,
+            insert( handle,
                     object,
                     rule,
-                    activation );
+                    activation,
+                    typeConf );
             return handle;
         }
 
@@ -879,7 +806,6 @@
                     // assert
                     handle = this.handleFactory.newFactHandle( object,
                                                                typeConf.isEvent(),
-                                                               duration,
                                                                this );
                     this.objectStore.addHandle( handle,
                                                 object );
@@ -910,7 +836,7 @@
                             key.setStatus( EqualityKey.STATED );
                             handle = key.getFactHandle();
 
-                            if ( AssertBehaviour.IDENTITY.equals(this.ruleBase.getConfiguration().getAssertBehaviour()) ) {
+                            if ( this.ruleBase.getConfiguration().getAssertBehaviour() == AssertBehaviour.IDENTITY ) {
                                 // as assertMap may be using an "identity"
                                 // equality comparator,
                                 // we need to remove the handle from the map,
@@ -934,7 +860,6 @@
                             key.setStatus( EqualityKey.STATED );
                             handle = this.handleFactory.newFactHandle( object,
                                                                        typeConf.isEvent(),
-                                                                       duration,
                                                                        this );
                             handle.setEqualityKey( key );
                             key.addFactHandle( handle );
@@ -946,7 +871,6 @@
                     } else {
                         handle = this.handleFactory.newFactHandle( object,
                                                                    typeConf.isEvent(),
-                                                                   duration,
                                                                    this );
                         this.objectStore.addHandle( handle,
                                                     object );
@@ -978,7 +902,6 @@
                 }
                 handle = this.handleFactory.newFactHandle( object,
                                                            typeConf.isEvent(),
-                                                           duration,
                                                            this );
                 this.objectStore.addHandle( handle,
                                             object );
@@ -989,11 +912,11 @@
                 addPropertyChangeListener( object );
             }
 
-            insert( entryPoint,
-                    handle,
+            insert( handle,
                     object,
                     rule,
-                    activation );
+                    activation,
+                    typeConf );
 
         } finally {
             this.lock.unlock();
@@ -1001,18 +924,18 @@
         return handle;
     }
 
-    protected void insert(final EntryPoint entryPoint,
-                          final InternalFactHandle handle,
+    protected void insert(final InternalFactHandle handle,
                           final Object object,
                           final Rule rule,
-                          final Activation activation) {
+                          final Activation activation,
+                          ObjectTypeConf typeConf) {
         this.ruleBase.executeQueuedActions();
 
         if ( activation != null ) {
             // release resources so that they can be GC'ed
             activation.getPropagationContext().releaseResources();
         }
-        final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+        final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                   PropagationContext.ASSERTION,
                                                                                   rule,
                                                                                   activation,
@@ -1020,13 +943,12 @@
                                                                                   this.agenda.getDormantActivations(),
                                                                                   entryPoint );
 
-        doInsert( handle,
-                  object,
-                  propagationContext );
+        this.entryPointNode.assertObject( handle,
+                                          propagationContext,
+                                          typeConf,
+                                          this );
 
-        if ( !this.actionQueue.isEmpty() ) {
-            executeQueuedActions();
-        }
+        executeQueuedActions();
 
         this.workingMemoryEventSupport.fireObjectInserted( propagationContext,
                                                            handle,
@@ -1057,14 +979,10 @@
         }
     }
 
-    public abstract void doInsert(InternalFactHandle factHandle,
-                                  Object object,
-                                  PropagationContext propagationContext) throws FactException;
-
     protected void removePropertyChangeListener(final FactHandle handle) {
         Object object = null;
         try {
-            object = getObject( handle );
+            object = ((InternalFactHandle) handle).getObject();
 
             if ( object != null ) {
                 final Method mehod = object.getClass().getMethod( "removePropertyChangeListener",
@@ -1100,32 +1018,11 @@
                  null );
     }
 
-    public abstract void doRetract(InternalFactHandle factHandle,
-                                   PropagationContext propagationContext);
-
-    /**
-     * @see WorkingMemory
-     */
     public void retract(final FactHandle factHandle,
                         final boolean removeLogical,
                         final boolean updateEqualsMap,
                         final Rule rule,
                         final Activation activation) throws FactException {
-        this.retract( EntryPoint.DEFAULT,
-                      factHandle,
-                      removeLogical,
-                      updateEqualsMap,
-                      rule,
-                      activation );
-
-    }
-
-    protected void retract(final EntryPoint entryPoint,
-                           final FactHandle factHandle,
-                           final boolean removeLogical,
-                           final boolean updateEqualsMap,
-                           final Rule rule,
-                           final Activation activation) throws FactException {
         try {
             this.lock.lock();
             this.ruleBase.executeQueuedActions();
@@ -1141,17 +1038,22 @@
                 // release resources so that they can be GC'ed
                 activation.getPropagationContext().releaseResources();
             }
-            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+            final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                       PropagationContext.RETRACTION,
                                                                                       rule,
                                                                                       activation,
                                                                                       this.agenda.getActiveActivations(),
                                                                                       this.agenda.getDormantActivations(),
-                                                                                      entryPoint );
+                                                                                      this.entryPoint );
 
-            doRetract( handle,
-                       propagationContext );
+            final Object object = handle.getObject();
 
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                                   object ),
+                                               this );
+
             if ( this.maintainTms ) {
                 // Update the equality key, which maintains a list of stated
                 // FactHandles
@@ -1173,8 +1075,6 @@
                 }
             }
 
-            final Object object = handle.getObject();
-
             this.workingMemoryEventSupport.fireObjectRetracted( propagationContext,
                                                                 handle,
                                                                 object,
@@ -1184,32 +1084,12 @@
 
             this.handleFactory.destroyFactHandle( handle );
 
-            if ( !this.actionQueue.isEmpty() ) {
-                executeQueuedActions();
-            }
+            executeQueuedActions();
         } finally {
             this.lock.unlock();
         }
     }
 
-    //    private void addHandleToMaps(InternalFactHandle handle) {
-    //        this.assertMap.put( handle,
-    //                            handle,
-    //                            false );
-    //        if ( this.ruleBase.getConfiguration().getAssertBehaviour() == AssertBehaviour.EQUALITY ) {
-    //            this.identityMap.put( handle,
-    //                                  handle,
-    //                                  false );
-    //        }
-    //    }
-    //
-    //    private void removeHandleFromMaps(final InternalFactHandle handle) {
-    //        this.assertMap.remove( handle );
-    //        if ( this.ruleBase.getConfiguration().getAssertBehaviour() == AssertBehaviour.EQUALITY ) {
-    //            this.identityMap.remove( handle );
-    //        }
-    //    }
-
     public void modifyRetract(final FactHandle factHandle) {
         modifyRetract( factHandle,
                        null,
@@ -1219,16 +1099,6 @@
     public void modifyRetract(final FactHandle factHandle,
                               final Rule rule,
                               final Activation activation) {
-        this.modifyRetract( EntryPoint.DEFAULT,
-                            factHandle,
-                            rule,
-                            activation );
-    }
-
-    protected void modifyRetract(final EntryPoint entryPoint,
-                                 final FactHandle factHandle,
-                                 final Rule rule,
-                                 final Activation activation) {
         try {
             this.lock.lock();
             this.ruleBase.executeQueuedActions();
@@ -1255,16 +1125,20 @@
                 activation.getPropagationContext().releaseResources();
             }
             // Nowretract any trace of the original fact
-            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+            final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                       PropagationContext.MODIFICATION,
                                                                                       rule,
                                                                                       activation,
                                                                                       this.agenda.getActiveActivations(),
                                                                                       this.agenda.getDormantActivations(),
                                                                                       entryPoint );
-            doRetract( handle,
-                       propagationContext );
 
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                                   handle.getObject() ),
+                                               this );
+
             if ( this.maintainTms ) {
 
                 // the hashCode and equality has changed, so we must update the
@@ -1294,18 +1168,6 @@
                              final Object object,
                              final Rule rule,
                              final Activation activation) {
-        this.modifyInsert( EntryPoint.DEFAULT,
-                           factHandle,
-                           object,
-                           rule,
-                           activation );
-    }
-
-    protected void modifyInsert(final EntryPoint entryPoint,
-                                final FactHandle factHandle,
-                                final Object object,
-                                final Rule rule,
-                                final Activation activation) {
         try {
             this.lock.lock();
             this.ruleBase.executeQueuedActions();
@@ -1337,7 +1199,7 @@
                 activation.getPropagationContext().releaseResources();
             }
             // Nowretract any trace of the original fact
-            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+            final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                       PropagationContext.MODIFICATION,
                                                                                       rule,
                                                                                       activation,
@@ -1345,9 +1207,11 @@
                                                                                       this.agenda.getDormantActivations(),
                                                                                       entryPoint );
 
-            doInsert( handle,
-                      object,
-                      propagationContext );
+            this.entryPointNode.assertObject( handle,
+                                              propagationContext,
+                                              this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                                  object ),
+                                              this );
 
             this.workingMemoryEventSupport.fireObjectUpdated( propagationContext,
                                                               factHandle,
@@ -1357,9 +1221,7 @@
 
             propagationContext.clearRetractedTuples();
 
-            if ( !this.actionQueue.isEmpty() ) {
-                executeQueuedActions();
-            }
+            executeQueuedActions();
         } finally {
             this.lock.unlock();
         }
@@ -1373,29 +1235,10 @@
                 null );
     }
 
-    /**
-     * modify is implemented as half way retract / assert due to the truth
-     * maintenance issues.
-     *
-     * @see WorkingMemory
-     */
     public void update(final FactHandle factHandle,
                        final Object object,
                        final Rule rule,
                        final Activation activation) throws FactException {
-        this.update( EntryPoint.DEFAULT,
-                     factHandle,
-                     object,
-                     rule,
-                     activation );
-
-    }
-
-    protected void update(final EntryPoint entryPoint,
-                          final FactHandle factHandle,
-                          final Object object,
-                          final Rule rule,
-                          final Activation activation) throws FactException {
         try {
             this.lock.lock();
             this.ruleBase.executeQueuedActions();
@@ -1421,17 +1264,23 @@
                 activation.getPropagationContext().releaseResources();
             }
             // Nowretract any trace of the original fact
-            final PropagationContext propagationContext = new PropagationContextImpl( this.propagationIdCounter++,
+            final PropagationContext propagationContext = new PropagationContextImpl( getNextPropagationIdCounter(),
                                                                                       PropagationContext.MODIFICATION,
                                                                                       rule,
                                                                                       activation,
                                                                                       this.agenda.getActiveActivations(),
                                                                                       this.agenda.getDormantActivations(),
                                                                                       entryPoint );
-            doRetract( handle,
-                       propagationContext );
 
-            if ( originalObject != object || !AssertBehaviour.IDENTITY.equals(this.ruleBase.getConfiguration().getAssertBehaviour()) ) {
+            ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                          object );
+
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               typeConf,
+                                               this );
+
+            if ( (originalObject != object) || (this.ruleBase.getConfiguration().getAssertBehaviour() != AssertBehaviour.IDENTITY) ) {
                 this.objectStore.removeHandle( handle );
 
                 // set anyway, so that it updates the hashCodes
@@ -1468,9 +1317,10 @@
 
             this.handleFactory.increaseFactHandleRecency( handle );
 
-            doInsert( handle,
-                      object,
-                      propagationContext );
+            this.entryPointNode.assertObject( handle,
+                                              propagationContext,
+                                              typeConf,
+                                              this );
 
             this.workingMemoryEventSupport.fireObjectUpdated( propagationContext,
                                                               factHandle,
@@ -1480,20 +1330,18 @@
 
             propagationContext.clearRetractedTuples();
 
-            if ( !this.actionQueue.isEmpty() ) {
-                executeQueuedActions();
-            }
+            executeQueuedActions();
         } finally {
             this.lock.unlock();
         }
     }
 
     public void executeQueuedActions() {
-        if( ! evaluatingActionQueue ) {
+        if ( !this.actionQueue.isEmpty() && !evaluatingActionQueue ) {
             evaluatingActionQueue = true;
             WorkingMemoryAction action = null;
 
-            while ( ( action = actionQueue.poll() ) != null ) {
+            while ( (action = actionQueue.poll()) != null ) {
                 action.execute( this );
             }
             evaluatingActionQueue = false;
@@ -1575,7 +1423,7 @@
     }
 
     public long getNextPropagationIdCounter() {
-        return this.propagationIdCounter++;
+        return this.propagationIdCounter.incrementAndGet();
     }
 
     public Lock getLock() {
@@ -1709,168 +1557,101 @@
         // no executor service, so nothing to set
     }
 
-    /**
-     * Returns the ObjectTypeConfiguration object for the given object or
-     * creates a new one if none is found in the cache
-     *
-     * @param object
-     * @return
-     */
-    public ObjectTypeConf getObjectTypeConf(EntryPoint entrypoint,
-                                            Object object) {
-        Map<Object, ObjectTypeConf> map = this.typeConfMap.get( entrypoint );
-        if ( map == null ) {
-            map = new ConcurrentHashMap<Object, ObjectTypeConf>();
-            this.typeConfMap.put( entrypoint,
-                                  map );
-        }
-        ObjectTypeConf objectTypeConf;
+    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name) {
+        WorkingMemoryEntryPoint wmEntryPoint = this.entryPoints.get( name );
+        if ( wmEntryPoint == null ) {
+            EntryPoint entryPoint = new EntryPoint( name );
+            EntryPointNode entryPointNode = this.ruleBase.getRete().getEntryPointNode( entryPoint );
 
-        if ( object instanceof Fact ) {
-            String key = ((Fact) object).getFactTemplate().getName();
-            objectTypeConf = map.get( key );
-            if ( objectTypeConf == null ) {
-                objectTypeConf = new FactTemplateTypeConf( entrypoint,
-                                                           ((Fact) object).getFactTemplate(),
-                                                           this.ruleBase );
-                this.addObjectTypeConf( entrypoint,
-                                        key,
-                                        objectTypeConf );
+            if ( entryPointNode != null ) {
+                wmEntryPoint = new NamedEntryPoint( entryPoint,
+                                                    entryPointNode,
+                                                    this );
             }
-            object = key;
-        } else {
-            Class cls = null;
-            if ( object instanceof ShadowProxy ) {
-                cls = ((ShadowProxy) object).getShadowedObject().getClass();
-            } else {
-                cls = object.getClass();
-            }
 
-            objectTypeConf = map.get( cls );
-            if ( objectTypeConf == null ) {
-
-                final boolean isEvent = this.ruleBase.isEvent( cls );
-                objectTypeConf = new ClassObjectTypeConf( entrypoint,
-                                                          cls,
-                                                          isEvent,
-                                                          this.ruleBase );
-                this.addObjectTypeConf( entrypoint,
-                                        cls,
-                                        objectTypeConf );
+            if ( wmEntryPoint != null ) {
+                this.entryPoints.put( name,
+                                      wmEntryPoint );
             }
-
         }
-        return objectTypeConf;
+        return wmEntryPoint;
     }
 
-    public Map<Object, ObjectTypeConf> getObjectTypeConfMap(EntryPoint entryPoint) {
-        Map<Object, ObjectTypeConf> map = this.typeConfMap.get( entryPoint );
-        if ( map == null ) {
-            map = Collections.emptyMap();
-        }
-        return map;
-    }
+    //    protected static class EntryPointInterfaceImpl
+    //        implements
+    //        EntryPointInterface {
+    //
+    //        private static final long           serialVersionUID = 2917871170743358801L;
+    //
+    //        private final EntryPoint            entryPoint;
+    //        private final AbstractWorkingMemory wm;
+    //
+    //        public EntryPointInterfaceImpl(EntryPoint entryPoint,
+    //                                       AbstractWorkingMemory wm) {
+    //            this.entryPoint = entryPoint;
+    //            this.wm = wm;
+    //        }
+    //
+    //        public FactHandle insert(Object object) throws FactException {
+    //            return wm.insert( this.entryPoint,
+    //                              object, /* Not-Dynamic */
+    //                              false,
+    //                              false,
+    //                              null,
+    //                              null );
+    //        }
+    //
+    //        public FactHandle insert(Object object,
+    //                                 boolean dynamic) throws FactException {
+    //            return wm.insert( this.entryPoint,
+    //                              object, /* Not-Dynamic */
+    //                              dynamic,
+    //                              false,
+    //                              null,
+    //                              null );
+    //        }
+    //
+    //        public void modifyInsert(FactHandle factHandle,
+    //                                 Object object) {
+    //            wm.modifyInsert( this.entryPoint,
+    //                             factHandle,
+    //                             object,
+    //                             null,
+    //                             null );
+    //        }
+    //
+    //        public void modifyRetract(FactHandle factHandle) {
+    //            wm.modifyRetract( this.entryPoint,
+    //                              factHandle,
+    //                              null,
+    //                              null );
+    //        }
+    //
+    //        public void retract(FactHandle handle) throws FactException {
+    //            wm.retract( this.entryPoint,
+    //                        handle,
+    //                        true,
+    //                        true,
+    //                        null,
+    //                        null );
+    //        }
+    //
+    //        public void update(FactHandle handle,
+    //                           Object object) throws FactException {
+    //            wm.update( this.entryPoint,
+    //                       handle,
+    //                       object,
+    //                       null,
+    //                       null );
+    //        }
+    //
+    //    }
 
-    private void addObjectTypeConf(EntryPoint entryPoint,
-                                   Object key,
-                                   ObjectTypeConf conf) {
-        Map<Object, ObjectTypeConf> map = this.typeConfMap.get( entryPoint );
-        if ( map == null ) {
-            map = new ConcurrentHashMap<Object, ObjectTypeConf>();
-            this.typeConfMap.put( entryPoint,
-                                  map );
-        }
-        map.put( key,
-                 conf );
+    public ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry() {
+        return this.typeConfReg;
     }
 
-    public EntryPointInterface getEntryPoint(String id) {
-        EntryPoint ep = new EntryPoint( id );
-        return new EntryPointInterfaceImpl( ep,
-                                            this );
+    public TypeDeclaration getTypeDeclaration(Class<?> clazz) {
+        return null;
     }
-
-    public static class EntryPointInterfaceImpl
-        implements
-        EntryPointInterface {
-
-        private static final long           serialVersionUID = 2917871170743358801L;
-
-        private EntryPoint            entryPoint;
-        private AbstractWorkingMemory wm;
-
-        public EntryPointInterfaceImpl() {
-
-        }
-        public EntryPointInterfaceImpl(EntryPoint entryPoint,
-                                       AbstractWorkingMemory wm) {
-            this.entryPoint = entryPoint;
-            this.wm = wm;
-        }
-
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            entryPoint  = (EntryPoint)in.readObject();
-            wm          = (AbstractWorkingMemory)in.readObject();
-        }
-
-        public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeObject(entryPoint);
-            out.writeObject(wm);
-        }
-
-        public FactHandle insert(Object object) throws FactException {
-            return wm.insert( this.entryPoint,
-                              object, /* Not-Dynamic */
-                              false,
-                              false,
-                              null,
-                              null );
-        }
-
-        public FactHandle insert(Object object,
-                                 boolean dynamic) throws FactException {
-            return wm.insert( this.entryPoint,
-                              object, /* Not-Dynamic */
-                              dynamic,
-                              false,
-                              null,
-                              null );
-        }
-
-        public void modifyInsert(FactHandle factHandle,
-                                 Object object) {
-            wm.modifyInsert( this.entryPoint,
-                             factHandle,
-                             object,
-                             null,
-                             null );
-        }
-
-        public void modifyRetract(FactHandle factHandle) {
-            wm.modifyRetract( this.entryPoint,
-                              factHandle,
-                              null,
-                              null );
-        }
-
-        public void retract(FactHandle handle) throws FactException {
-            wm.retract( this.entryPoint,
-                        handle,
-                        true,
-                        true,
-                        null,
-                        null );
-        }
-
-        public void update(FactHandle handle,
-                           Object object) throws FactException {
-            wm.update( this.entryPoint,
-                       handle,
-                       object,
-                       null,
-                       null );
-        }
-
-    }
-
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/BaseNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/BaseNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/BaseNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -73,6 +73,13 @@
 
     public abstract void attach(InternalWorkingMemory[] workingMemories);
 
+    /**
+     * A method that is called for all nodes whose network bellow them
+     * changed, after the change is complete, providing them with an oportunity
+     * for state update
+     */
+    public abstract void networkUpdated();
+
     public void remove(RuleRemovalContext context,
                        ReteooBuilder builder,
                        BaseNode node,
@@ -110,6 +117,6 @@
     }
 
     public String toString() {
-        return "[" + this.getClass().getName() + "(" + this.id + ")]";
+        return "[" + this.getClass().getSimpleName() + "(" + this.id + ")]";
     }
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/DefaultFactHandle.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -39,7 +39,7 @@
      */
     private static final long serialVersionUID = 400L;
     /** Handle id. */
-    private long              id;
+    private int               id;
     private long              recency;
     private Object            object;
     private EqualityKey       key;
@@ -47,7 +47,7 @@
     private boolean           shadowFact;
 
     public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeLong(id);
+        out.writeInt(id);
         out.writeLong(recency);
         out.writeObject(object);
         out.writeObject(key);
@@ -56,7 +56,7 @@
     }
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        id  = in.readLong();
+        id  = in.readInt();
         recency = in.readLong();
         object  = in.readObject();
         key     = (EqualityKey)in.readObject();
@@ -70,7 +70,7 @@
     public DefaultFactHandle() {
     }
 
-    public DefaultFactHandle(final long id,
+    public DefaultFactHandle(final int id,
                              final Object object) {
         this( id,
               object,
@@ -83,7 +83,7 @@
      * @param id
      *            Handle id.
      */
-    public DefaultFactHandle(final long id,
+    public DefaultFactHandle(final int id,
                              final Object object,
                              final long recency) {
         this.id = id;
@@ -119,7 +119,7 @@
      * @see Object
      */
     public int hashCode() {
-        return (int) (this.id ^ (this.id >>> 32));
+        return this.id;
     }
 
     /**

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/EventFactHandle.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/EventFactHandle.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/EventFactHandle.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -23,7 +23,7 @@
         this.duration = 0;
     }
 
-    public EventFactHandle(final long id,
+    public EventFactHandle(final int id,
                            final Object object) {
         super( id,
                object );
@@ -37,7 +37,7 @@
      * @param id
      *            Handle id.
      */
-    public EventFactHandle(final long id,
+    public EventFactHandle(final int id,
                            final Object object,
                            final long recency) {
         super( id,
@@ -56,7 +56,7 @@
      * @param timestamp the timestamp of the occurrence of this event
      * @param duration the duration of this event. May be 0 (zero) in case this is a primitive event.
      */
-    public EventFactHandle( final long id,
+    public EventFactHandle( final int id,
                             final Object object,
                             final long recency,
                             final long timestamp,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalRuleBase.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalRuleBase.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalRuleBase.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -30,6 +30,7 @@
 import org.drools.rule.CompositePackageClassLoader;
 import org.drools.rule.MapBackedClassLoader;
 import org.drools.rule.Package;
+import org.drools.rule.TypeDeclaration;
 import org.drools.spi.FactHandleFactory;
 import org.drools.spi.PropagationContext;
 
@@ -116,4 +117,12 @@
 	public Objenesis getObjenesis();
 	
 	public int getNodeCount();
+
+	/**
+	 * Returns the type declaration associated to the given class
+	 *
+	 * @param clazz
+	 * @return
+	 */
+    public TypeDeclaration getTypeDeclaration(Class<?> clazz);
 }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,8 +1,5 @@
 package org.drools.common;
 
-import java.util.Map;
-import java.util.concurrent.locks.Lock;
-
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.WorkingMemory;
@@ -13,21 +10,21 @@
 import org.drools.process.instance.ProcessInstance;
 import org.drools.process.instance.ProcessInstanceFactory;
 import org.drools.reteoo.LIANodePropagation;
-import org.drools.reteoo.ObjectTypeConf;
-import org.drools.rule.EntryPoint;
 import org.drools.rule.Rule;
 import org.drools.rule.TimeMachine;
 import org.drools.spi.Activation;
 import org.drools.spi.FactHandleFactory;
 import org.drools.spi.PropagationContext;
 
+import java.util.concurrent.locks.Lock;
+
 public interface InternalWorkingMemory
     extends
     WorkingMemory {
     public long getId();
-    
+
     public void setId(long id);
-    
+
     void setRuleBase(final InternalRuleBase ruleBase);
 
     public void setWorkingMemoryEventSupport(WorkingMemoryEventSupport workingMemoryEventSupport);
@@ -37,7 +34,7 @@
     public void setAgendaEventSupport(AgendaEventSupport agendaEventSupport);
 
     public void setRuleFlowEventSupport(RuleFlowEventSupport ruleFlowEventSupport);
-    
+
     public void registerProcessInstanceFactory(String type, ProcessInstanceFactory nodeInstanceFactory);
 
     public Object getNodeMemory(NodeMemory node);
@@ -47,7 +44,7 @@
     public long getNextPropagationIdCounter();
 
     //public ObjectHashMap getFactHandleMap()
-    
+
     public ObjectStore getObjectStore();
 
     public TruthMaintenanceSystem getTruthMaintenanceSystem();
@@ -57,7 +54,7 @@
     public void queueWorkingMemoryAction(final WorkingMemoryAction action);
 
     public FactHandleFactory getFactHandleFactory();
-    
+
     /**
      * Looks for the fact handle associated to the given object
      * by looking up the object IDENTITY (==), even if rule base
@@ -87,26 +84,10 @@
 	public TimeMachine getTimeMachine();
 
 	public void setTimeMachine(TimeMachine tm);
-    
+
     public void removeProcessInstance(ProcessInstance processInstance);
-    
-    /**
-     * Returns the ObjectTypeConfiguration object for the given object
-     * or creates a new one if none is found in the cache
-     * 
-     * @param object
-     * @return
-     */
-    public ObjectTypeConf getObjectTypeConf(EntryPoint entryPoint, Object object);
-    
-    /**
-     * Returns the Map<Object key, ObjectTypeConf conf> of object type
-     * confs in this working memory
-     *  
-     * @return
-     */
-    public Map<Object, ObjectTypeConf> getObjectTypeConfMap(EntryPoint entryPoint);
 
+
     public ExecutorService getExecutorService();
 
     public void setExecutorService(ExecutorService executor);

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryActions.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryActions.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryActions.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -21,11 +21,10 @@
 import org.drools.rule.Rule;
 import org.drools.spi.Activation;
 
-import java.io.Externalizable;
-
 public interface InternalWorkingMemoryActions
     extends
-    InternalWorkingMemory {
+    InternalWorkingMemory,
+    InternalWorkingMemoryEntryPoint {
     public void update(FactHandle handle,
                        Object object,
                        Rule rule,
@@ -37,24 +36,13 @@
                         Rule rule,
                         Activation activation) throws FactException;
 
-    /*FactHandle insert(Object object,
-                      boolean dynamic,
-                      boolean logical,
-                      Rule rule,
-                      Activation activation) throws FactException;*/
-
     FactHandle insert(Object object,
-                      long duration,
                       boolean dynamic,
                       boolean logical,
                       Rule rule,
                       Activation activation) throws FactException;
 
-    /*public FactHandle insertLogical(Object object,
-                                    boolean dynamic) throws FactException;*/
-
     public FactHandle insertLogical(Object object,
-                                    long duration,
                                     boolean dynamic) throws FactException;
 
     public void modifyRetract(final FactHandle factHandle,

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/InternalWorkingMemoryEntryPoint.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,7 @@
+package org.drools.common;
+
+import org.drools.WorkingMemoryEntryPoint;
+
+public interface InternalWorkingMemoryEntryPoint extends WorkingMemoryEntryPoint {
+    ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry();
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/NamedEntryPoint.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,495 @@
+/**
+ * 
+ */
+package org.drools.common;
+
+import org.drools.FactException;
+import org.drools.FactHandle;
+import org.drools.RuleBaseConfiguration.AssertBehaviour;
+import org.drools.RuntimeDroolsException;
+import org.drools.WorkingMemory;
+import org.drools.WorkingMemoryEntryPoint;
+import org.drools.base.ShadowProxy;
+import org.drools.reteoo.EntryPointNode;
+import org.drools.reteoo.ObjectTypeConf;
+import org.drools.rule.EntryPoint;
+import org.drools.rule.Rule;
+import org.drools.spi.Activation;
+import org.drools.spi.FactHandleFactory;
+import org.drools.spi.PropagationContext;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.concurrent.locks.ReentrantLock;
+
+public class NamedEntryPoint
+    implements
+    InternalWorkingMemoryEntryPoint {
+    /** The arguments used when adding/removing a property change listener. */
+    protected final Object[]                addRemovePropertyChangeListenerArgs = new Object[]{this};
+
+    private static final long               serialVersionUID                    = 500;
+
+    protected ObjectStore                   objectStore;
+
+    protected transient InternalRuleBase    ruleBase;
+
+    protected EntryPoint                    entryPoint;
+    protected EntryPointNode                entryPointNode;
+
+    private ObjectTypeConfigurationRegistry typeConfReg;
+
+    private AbstractWorkingMemory     wm;
+
+    private FactHandleFactory               handleFactory;
+
+    protected ReentrantLock           lock;
+
+    public NamedEntryPoint() {
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        objectStore     = (ObjectStore)in.readObject();
+        entryPoint      = (EntryPoint)in.readObject();
+        entryPointNode      = (EntryPointNode)in.readObject();
+        typeConfReg      = (ObjectTypeConfigurationRegistry)in.readObject();
+        wm      = (AbstractWorkingMemory)in.readObject();
+        handleFactory      = (FactHandleFactory)in.readObject();
+        lock      = (ReentrantLock)in.readObject();
+        
+        ruleBase = (InternalRuleBase)wm.getRuleBase();
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(objectStore);
+        out.writeObject(entryPoint);
+        out.writeObject(entryPointNode);
+        out.writeObject(typeConfReg);
+        out.writeObject(wm);
+        out.writeObject(handleFactory);
+        out.writeObject(lock);
+
+    }
+
+    public NamedEntryPoint(EntryPoint entryPoint,
+                           EntryPointNode entryPointNode,
+                           AbstractWorkingMemory wm) {
+        this( entryPoint,
+              entryPointNode,
+              wm,
+              new ReentrantLock() );
+    }
+
+    public NamedEntryPoint(EntryPoint entryPoint,
+                           EntryPointNode entryPointNode,
+                           AbstractWorkingMemory wm,
+                           ReentrantLock lock) {
+        this.entryPoint = entryPoint;
+        this.entryPointNode = entryPointNode;
+        this.wm = wm;
+        this.ruleBase = (InternalRuleBase) this.wm.getRuleBase();
+        this.lock = lock;
+        this.typeConfReg = new ObjectTypeConfigurationRegistry( this.ruleBase );
+        this.handleFactory = this.wm.getFactHandleFactory();
+        this.objectStore = new SingleThreadedObjectStore( this.ruleBase.getConfiguration(),
+                                                          this.lock );
+    }
+
+    /**
+     * @see WorkingMemory
+     */
+    public FactHandle insert(final Object object) throws FactException {
+        return insert( object, /* Not-Dynamic */
+                       false,
+                       false,
+                       null,
+                       null );
+    }
+
+    public FactHandle insert(final Object object,
+                             final boolean dynamic) throws FactException {
+        return insert( object,
+                       dynamic,
+                       false,
+                       null,
+                       null );
+    }
+
+    protected FactHandle insert(final Object object,
+                                final boolean dynamic,
+                                boolean logical,
+                                final Rule rule,
+                                final Activation activation) throws FactException {
+        if ( object == null ) {
+            // you cannot assert a null object
+            return null;
+        }
+
+        ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                      object );
+
+        InternalFactHandle handle = this.handleFactory.newFactHandle( object,
+                                                                      typeConf.isEvent(),
+                                                                      wm );
+        this.objectStore.addHandle( handle,
+                                    object );
+
+        if ( dynamic ) {
+            addPropertyChangeListener( object );
+        }
+
+        try {
+            this.lock.lock();
+            insert( handle,
+                    object,
+                    rule,
+                    activation );
+
+        } finally {
+            this.lock.unlock();
+        }
+        return handle;
+    }
+
+    protected void insert(final InternalFactHandle handle,
+                          final Object object,
+                          final Rule rule,
+                          final Activation activation) {
+        this.ruleBase.executeQueuedActions();
+
+        if ( activation != null ) {
+            // release resources so that they can be GC'ed
+            activation.getPropagationContext().releaseResources();
+        }
+        final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
+                                                                                  PropagationContext.ASSERTION,
+                                                                                  rule,
+                                                                                  activation,
+                                                                                  -1,
+                                                                                  -1,
+                                                                                  this.entryPoint );
+
+        this.entryPointNode.assertObject( handle,
+                                          propagationContext,
+                                          this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                              object ),
+                                          this.wm );
+
+        this.wm.executeQueuedActions();
+
+        this.wm.getWorkingMemoryEventSupport().fireObjectInserted( propagationContext,
+                                                                   handle,
+                                                                   object,
+                                                                   wm );
+    }
+
+    public void update(final FactHandle handle,
+                       final Object object) throws FactException {
+        update( handle,
+                object,
+                null,
+                null );
+    }
+
+    protected void update(final FactHandle factHandle,
+                          final Object object,
+                          final Rule rule,
+                          final Activation activation) throws FactException {
+        try {
+            this.lock.lock();
+            this.ruleBase.executeQueuedActions();
+
+            final InternalFactHandle handle = (InternalFactHandle) factHandle;
+            final Object originalObject = (handle.isShadowFact()) ? ((ShadowProxy) handle.getObject()).getShadowedObject() : handle.getObject();
+
+            if ( handle.getId() == -1 || object == null ) {
+                // the handle is invalid, most likely already retracted, so
+                // return
+                // and we cannot assert a null object
+                return;
+            }
+
+            ObjectTypeConf typeConf = this.typeConfReg.getObjectTypeConf( this.entryPoint,
+                                                                          object );
+
+            if ( activation != null ) {
+                // release resources so that they can be GC'ed
+                activation.getPropagationContext().releaseResources();
+            }
+            // Nowretract any trace of the original fact
+            final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
+                                                                                      PropagationContext.MODIFICATION,
+                                                                                      rule,
+                                                                                      activation,
+                                                                                      -1,
+                                                                                      -1,
+                                                                                      this.entryPoint );
+
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               typeConf,
+                                               this.wm );
+
+            if ( (originalObject != object) || (this.ruleBase.getConfiguration().getAssertBehaviour() != AssertBehaviour.IDENTITY) ) {
+                this.objectStore.removeHandle( handle );
+
+                // set anyway, so that it updates the hashCodes
+                handle.setObject( object );
+                this.objectStore.addHandle( handle,
+                                            object );
+            }
+
+            this.handleFactory.increaseFactHandleRecency( handle );
+
+            this.entryPointNode.assertObject( handle,
+                                              propagationContext,
+                                              typeConf,
+                                              this.wm );
+
+            this.wm.getWorkingMemoryEventSupport().fireObjectUpdated( propagationContext,
+                                                                      factHandle,
+                                                                      originalObject,
+                                                                      object,
+                                                                      this.wm );
+
+            propagationContext.clearRetractedTuples();
+
+            this.wm.executeQueuedActions();
+        } finally {
+            this.lock.unlock();
+        }
+    }
+
+    public void retract(final FactHandle handle) throws FactException {
+        retract( handle,
+                 true,
+                 true,
+                 null,
+                 null );
+    }
+
+    public void retract(final FactHandle factHandle,
+                        final boolean removeLogical,
+                        final boolean updateEqualsMap,
+                        final Rule rule,
+                        final Activation activation) throws FactException {
+        try {
+            this.lock.lock();
+            this.ruleBase.executeQueuedActions();
+
+            final InternalFactHandle handle = (InternalFactHandle) factHandle;
+            if ( handle.getId() == -1 ) {
+                // can't retract an already retracted handle
+                return;
+            }
+            removePropertyChangeListener( handle );
+
+            if ( activation != null ) {
+                // release resources so that they can be GC'ed
+                activation.getPropagationContext().releaseResources();
+            }
+            final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
+                                                                                      PropagationContext.RETRACTION,
+                                                                                      rule,
+                                                                                      activation,
+                                                                                      -1,
+                                                                                      -1,
+                                                                                      this.entryPoint );
+
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               this.wm );
+
+            final Object object = handle.getObject();
+
+            this.wm.getWorkingMemoryEventSupport().fireObjectRetracted( propagationContext,
+                                                                        handle,
+                                                                        object,
+                                                                        this.wm );
+
+            this.objectStore.removeHandle( handle );
+
+            this.handleFactory.destroyFactHandle( handle );
+
+            this.wm.executeQueuedActions();
+        } finally {
+            this.lock.unlock();
+        }
+    }
+
+    public void modifyRetract(final FactHandle factHandle) {
+        modifyRetract( factHandle,
+                       null,
+                       null );
+    }
+
+    public void modifyRetract(final FactHandle factHandle,
+                              final Rule rule,
+                              final Activation activation) {
+        try {
+            this.lock.lock();
+            this.ruleBase.executeQueuedActions();
+
+            final InternalFactHandle handle = (InternalFactHandle) factHandle;
+            // final Object originalObject = (handle.isShadowFact()) ?
+            // ((ShadowProxy) handle.getObject()).getShadowedObject() :
+            // handle.getObject();
+
+            if ( handle.getId() == -1 ) {
+                // the handle is invalid, most likely already retracted, so
+                // return
+                return;
+            }
+
+            if ( activation != null ) {
+                // release resources so that they can be GC'ed
+                activation.getPropagationContext().releaseResources();
+            }
+            // Nowretract any trace of the original fact
+            final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
+                                                                                      PropagationContext.MODIFICATION,
+                                                                                      rule,
+                                                                                      activation,
+                                                                                      -1,
+                                                                                      -1,
+                                                                                      entryPoint );
+
+            this.entryPointNode.retractObject( handle,
+                                               propagationContext,
+                                               this.wm );
+
+        } finally {
+            this.lock.unlock();
+        }
+    }
+
+    public void modifyInsert(final FactHandle factHandle,
+                             final Object object) {
+        modifyInsert( factHandle,
+                      object,
+                      null,
+                      null );
+    }
+
+    public void modifyInsert(final FactHandle factHandle,
+                             final Object object,
+                             final Rule rule,
+                             final Activation activation) {
+        this.modifyInsert( EntryPoint.DEFAULT,
+                           factHandle,
+                           object,
+                           rule,
+                           activation );
+    }
+
+    protected void modifyInsert(final EntryPoint entryPoint,
+                                final FactHandle factHandle,
+                                final Object object,
+                                final Rule rule,
+                                final Activation activation) {
+        try {
+            this.lock.lock();
+            this.ruleBase.executeQueuedActions();
+
+            final InternalFactHandle handle = (InternalFactHandle) factHandle;
+            final Object originalObject = (handle.isShadowFact()) ? ((ShadowProxy) handle.getObject()).getShadowedObject() : handle.getObject();
+
+            this.handleFactory.increaseFactHandleRecency( handle );
+
+            if ( activation != null ) {
+                // release resources so that they can be GC'ed
+                activation.getPropagationContext().releaseResources();
+            }
+            // Nowretract any trace of the original fact
+            final PropagationContext propagationContext = new PropagationContextImpl( this.wm.getNextPropagationIdCounter(),
+                                                                                      PropagationContext.MODIFICATION,
+                                                                                      rule,
+                                                                                      activation,
+                                                                                      -1,
+                                                                                      -1,
+                                                                                      entryPoint );
+
+            this.entryPointNode.assertObject( handle,
+                                              propagationContext,
+                                              this.wm );
+
+            this.wm.getWorkingMemoryEventSupport().fireObjectUpdated( propagationContext,
+                                                                      factHandle,
+                                                                      originalObject,
+                                                                      object,
+                                                                      this.wm );
+
+            propagationContext.clearRetractedTuples();
+
+            this.wm.executeQueuedActions();
+        } finally {
+            this.lock.unlock();
+        }
+    }
+
+    protected void addPropertyChangeListener(final Object object) {
+        try {
+            final Method method = object.getClass().getMethod( "addPropertyChangeListener",
+                                                               AbstractWorkingMemory.ADD_REMOVE_PROPERTY_CHANGE_LISTENER_ARG_TYPES );
+
+            method.invoke( object,
+                           this.addRemovePropertyChangeListenerArgs );
+        } catch ( final NoSuchMethodException e ) {
+            System.err.println( "Warning: Method addPropertyChangeListener not found" + " on the class " + object.getClass() + " so Drools will be unable to process JavaBean" + " PropertyChangeEvents on the asserted Object" );
+        } catch ( final IllegalArgumentException e ) {
+            System.err.println( "Warning: The addPropertyChangeListener method" + " on the class " + object.getClass() + " does not take" + " a simple PropertyChangeListener argument" + " so Drools will be unable to process JavaBean"
+                                + " PropertyChangeEvents on the asserted Object" );
+        } catch ( final IllegalAccessException e ) {
+            System.err.println( "Warning: The addPropertyChangeListener method" + " on the class " + object.getClass() + " is not public" + " so Drools will be unable to process JavaBean" + " PropertyChangeEvents on the asserted Object" );
+        } catch ( final InvocationTargetException e ) {
+            System.err.println( "Warning: The addPropertyChangeListener method" + " on the class " + object.getClass() + " threw an InvocationTargetException" + " so Drools will be unable to process JavaBean"
+                                + " PropertyChangeEvents on the asserted Object: " + e.getMessage() );
+        } catch ( final SecurityException e ) {
+            System.err.println( "Warning: The SecurityManager controlling the class " + object.getClass() + " did not allow the lookup of a" + " addPropertyChangeListener method" + " so Drools will be unable to process JavaBean"
+                                + " PropertyChangeEvents on the asserted Object: " + e.getMessage() );
+        }
+    }
+
+    protected void removePropertyChangeListener(final FactHandle handle) {
+        Object object = null;
+        try {
+            object = ((InternalFactHandle) handle).getObject();
+
+            if ( object != null ) {
+                final Method mehod = object.getClass().getMethod( "removePropertyChangeListener",
+                                                                  AbstractWorkingMemory.ADD_REMOVE_PROPERTY_CHANGE_LISTENER_ARG_TYPES );
+
+                mehod.invoke( object,
+                              this.addRemovePropertyChangeListenerArgs );
+            }
+        } catch ( final NoSuchMethodException e ) {
+            // The removePropertyChangeListener method on the class
+            // was not found so Drools will be unable to
+            // stop processing JavaBean PropertyChangeEvents
+            // on the retracted Object
+        } catch ( final IllegalArgumentException e ) {
+            throw new RuntimeDroolsException( "Warning: The removePropertyChangeListener method on the class " + object.getClass() + " does not take a simple PropertyChangeListener argument so Drools will be unable to stop processing JavaBean"
+                                              + " PropertyChangeEvents on the retracted Object" );
+        } catch ( final IllegalAccessException e ) {
+            throw new RuntimeDroolsException( "Warning: The removePropertyChangeListener method on the class " + object.getClass() + " is not public so Drools will be unable to stop processing JavaBean PropertyChangeEvents on the retracted Object" );
+        } catch ( final InvocationTargetException e ) {
+            throw new RuntimeDroolsException( "Warning: The removePropertyChangeL istener method on the class " + object.getClass() + " threw an InvocationTargetException so Drools will be unable to stop processing JavaBean"
+                                              + " PropertyChangeEvents on the retracted Object: " + e.getMessage() );
+        } catch ( final SecurityException e ) {
+            throw new RuntimeDroolsException( "Warning: The SecurityManager controlling the class " + object.getClass() + " did not allow the lookup of a removePropertyChangeListener method so Drools will be unable to stop processing JavaBean"
+                                              + " PropertyChangeEvents on the retracted Object: " + e.getMessage() );
+        }
+    }
+
+    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name) {
+        return this.wm.getWorkingMemoryEntryPoint( name );
+    }
+
+    public ObjectTypeConfigurationRegistry getObjectTypeConfigurationRegistry() {
+        return this.typeConfReg;
+    }
+
+}
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/ObjectTypeConfigurationRegistry.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/ObjectTypeConfigurationRegistry.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/ObjectTypeConfigurationRegistry.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/ObjectTypeConfigurationRegistry.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,76 @@
+package org.drools.common;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.drools.base.ShadowProxy;
+import org.drools.facttemplates.Fact;
+import org.drools.reteoo.ClassObjectTypeConf;
+import org.drools.reteoo.FactTemplateTypeConf;
+import org.drools.reteoo.ObjectTypeConf;
+import org.drools.rule.EntryPoint;
+
+public class ObjectTypeConfigurationRegistry implements Serializable {
+    private InternalRuleBase ruleBase;
+    private Map<Object, ObjectTypeConf> typeConfMap;
+    
+
+    
+    public ObjectTypeConfigurationRegistry(InternalRuleBase ruleBase ) {
+        super();
+        this.ruleBase = ruleBase;
+        this.typeConfMap = new HashMap<Object, ObjectTypeConf>();
+    }
+
+
+
+    /**
+     * Returns the ObjectTypeConfiguration object for the given object or
+     * creates a new one if none is found in the cache
+     * 
+     * @param object
+     * @return
+     */
+    public ObjectTypeConf getObjectTypeConf(EntryPoint entrypoint,
+                                            Object object) {
+        
+        // first see if it's a ClassObjectTypeConf
+        Class cls = null;
+        if ( object instanceof ShadowProxy ) {
+            cls = ((ShadowProxy) object).getShadowedObject().getClass();
+        } else {
+            cls = object.getClass();
+        }        
+        ObjectTypeConf objectTypeConf = this.typeConfMap.get( cls );
+        
+        // Now see if it's something else 
+        if ( objectTypeConf == null ) {
+            objectTypeConf = this.typeConfMap.get( object );
+        }
+        
+        
+        // it doesn't exist, so create it.
+        if ( objectTypeConf == null ) {
+            if ( object instanceof Fact ) {
+                objectTypeConf = new FactTemplateTypeConf( entrypoint,
+                                                           ((Fact) object).getFactTemplate(),
+                                                           this.ruleBase );           
+                this.typeConfMap.put( object, objectTypeConf );
+            } else {
+                objectTypeConf = new ClassObjectTypeConf( entrypoint,
+                                                          cls,
+                                                          this.ruleBase );
+                this.typeConfMap.put( cls, objectTypeConf );
+            }            
+        }
+
+        return objectTypeConf;
+    }
+
+    
+    public Collection<ObjectTypeConf> values() {
+        return this.typeConfMap.values();
+    }
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedTemporalWorkingMemoryContext.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SharedTemporalWorkingMemoryContext.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedTemporalWorkingMemoryContext.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedTemporalWorkingMemoryContext.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,33 @@
+package org.drools.common;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.base.MapGlobalResolver;
+import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventSupport;
+import org.drools.event.WorkingMemoryEventSupport;
+import org.drools.process.instance.ProcessInstanceFactory;
+import org.drools.process.instance.WorkItemManager;
+import org.drools.rule.TimeMachine;
+import org.drools.spi.FactHandleFactory;
+import org.drools.spi.GlobalResolver;
+import org.drools.temporal.SessionClock;
+
+public class SharedTemporalWorkingMemoryContext<T extends SessionClock>  extends SharedWorkingMemoryContext {    
+    protected T                                   sessionClock;
+    
+    public SharedTemporalWorkingMemoryContext(FactHandleFactory handleFactory, T sessionClock) {
+        super( handleFactory );        
+        this.sessionClock = sessionClock;
+    }
+
+    public T getSessionClock() {
+        return sessionClock;
+    }
+    
+            
+    
+}

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedWorkingMemoryContext.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/common/SharedWorkingMemoryContext.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedWorkingMemoryContext.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/common/SharedWorkingMemoryContext.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,119 @@
+package org.drools.common;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.base.MapGlobalResolver;
+import org.drools.event.AgendaEventSupport;
+import org.drools.event.RuleFlowEventSupport;
+import org.drools.event.WorkingMemoryEventSupport;
+import org.drools.process.instance.ProcessInstanceFactory;
+import org.drools.process.instance.WorkItemManager;
+import org.drools.rule.TimeMachine;
+import org.drools.spi.FactHandleFactory;
+import org.drools.spi.GlobalResolver;
+import org.drools.temporal.SessionClock;
+
+public class SharedWorkingMemoryContext {
+    protected InternalRuleBase                  ruleBase;
+
+    protected FactHandleFactory                 handleFactory;
+
+    /** Global values which are associated with this memory. */
+    protected GlobalResolver                    globalResolver;
+
+    /** The eventSupport */
+    protected WorkingMemoryEventSupport         workingMemoryEventSupport;
+
+    protected AgendaEventSupport                agendaEventSupport;
+
+    protected RuleFlowEventSupport              workflowEventSupport;
+
+    protected List                              __ruleBaseEventListeners;
+
+    protected long                              propagationIdCounter;
+
+    private Map                                 processInstances;
+
+    private int                                 processCounter;
+
+    private WorkItemManager                     workItemManager;
+
+    private Map<String, ProcessInstanceFactory> processInstanceFactories;
+
+    private TimeMachine                         timeMachine;
+
+    public SharedWorkingMemoryContext(FactHandleFactory handleFactory) {
+        this.handleFactory = handleFactory;
+
+        this.globalResolver = new MapGlobalResolver();
+
+        this.workingMemoryEventSupport = new WorkingMemoryEventSupport();
+        this.agendaEventSupport = new AgendaEventSupport();
+        this.workflowEventSupport = new RuleFlowEventSupport();
+        this.__ruleBaseEventListeners = new LinkedList();
+
+        processInstanceFactories = new HashMap();
+
+        timeMachine = new TimeMachine();
+    }
+
+    public Map getProcessInstances() {
+        return processInstances;
+    }
+
+    public void setProcessInstances(Map processInstances) {
+        this.processInstances = processInstances;
+    }
+
+    public WorkItemManager getWorkItemManager() {
+        return workItemManager;
+    }
+
+    public void setWorkItemManager(WorkItemManager workItemManager) {
+        this.workItemManager = workItemManager;
+    }
+
+    public TimeMachine getTimeMachine() {
+        return timeMachine;
+    }
+
+    public void setTimeMachine(TimeMachine timeMachine) {
+        this.timeMachine = timeMachine;
+    }
+
+    public FactHandleFactory getHandleFactory() {
+        return handleFactory;
+    }
+
+    public GlobalResolver getGlobalResolver() {
+        return globalResolver;
+    }
+
+    public WorkingMemoryEventSupport getWorkingMemoryEventSupport() {
+        return workingMemoryEventSupport;
+    }
+
+    public AgendaEventSupport getAgendaEventSupport() {
+        return agendaEventSupport;
+    }
+
+    public RuleFlowEventSupport getWorkflowEventSupport() {
+        return workflowEventSupport;
+    }
+
+    public List get__ruleBaseEventListeners() {
+        return __ruleBaseEventListeners;
+    }
+
+    public int getProcessCounter() {
+        return processCounter;
+    }
+
+    public Map<String, ProcessInstanceFactory> getProcessInstanceFactories() {
+        return processInstanceFactories;
+    }
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/AccumulateNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,12 +16,6 @@
 
 package org.drools.reteoo;
 
-import java.util.Arrays;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-import java.io.Externalizable;
-
 import org.drools.RuleBaseConfiguration;
 import org.drools.RuntimeDroolsException;
 import org.drools.common.BetaConstraints;
@@ -38,6 +32,12 @@
 import org.drools.util.Iterator;
 import org.drools.util.ObjectHashMap.ObjectEntry;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Arrays;
+
 /**
  * AccumulateNode
  * A beta node capable of doing accumulate logic.
@@ -94,7 +94,7 @@
         out.writeObject(resultConstraints);
         out.writeObject(resultBinder);
     }
-    
+
     /**
      * @inheritDoc
      *
@@ -416,7 +416,7 @@
 
         // First alpha node filters
         boolean isAllowed = true;
-        final InternalFactHandle createdHandle = workingMemory.getFactHandleFactory().newFactHandle( result, false, 0, workingMemory ); // so far, result is not an event
+        final InternalFactHandle createdHandle = workingMemory.getFactHandleFactory().newFactHandle( result, false, workingMemory ); // so far, result is not an event
         for ( int i = 0, length = this.resultConstraints.length; i < length; i++ ) {
             if ( !this.resultConstraints[i].isAllowed( createdHandle,
                                                        workingMemory,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/BetaNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/BetaNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/BetaNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,12 +16,6 @@
  * limitations under the License.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-import java.io.ObjectOutput;
-import java.io.IOException;
-import java.io.ObjectInput;
-
 import org.drools.RuleBaseConfiguration;
 import org.drools.common.BaseNode;
 import org.drools.common.BetaConstraints;
@@ -33,6 +27,12 @@
 import org.drools.util.LinkedList;
 import org.drools.util.LinkedListEntry;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * <code>BetaNode</code> provides the base abstract class for <code>JoinNode</code> and <code>NotNode</code>. It implements
  * both TupleSink and ObjectSink and as such can receive <code>Tuple</code>s and <code>FactHandle</code>s. BetaNode uses BetaMemory
@@ -141,10 +141,15 @@
      * @see org.drools.reteoo.BaseNode#attach()
      */
     public void attach() {
+        this.rightInput.addObjectSink( this );
         this.leftInput.addTupleSink( this );
-        this.rightInput.addObjectSink( this );
     }
 
+    public void networkUpdated() {
+        this.rightInput.networkUpdated();
+        this.leftInput.networkUpdated();
+    }
+
     public List getRules() {
         final List list = new ArrayList();
 
@@ -177,12 +182,12 @@
                                                                                       PropagationContext.RULE_ADDITION,
                                                                                       null,
                                                                                       null );
+            this.rightInput.updateSink( this,
+                                        propagationContext,
+                                        workingMemory );
             this.leftInput.updateSink( this,
                                        propagationContext,
                                        workingMemory );
-            this.rightInput.updateSink( this,
-                                        propagationContext,
-                                        workingMemory );
         }
 
     }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ClassObjectTypeConf.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ClassObjectTypeConf.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ClassObjectTypeConf.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -17,43 +17,45 @@
  */
 package org.drools.reteoo;
 
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
-import java.io.ObjectInput;
-import java.io.Externalizable;
-import java.io.ObjectOutput;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
 import org.drools.FactException;
 import org.drools.RuntimeDroolsException;
 import org.drools.base.ClassObjectType;
 import org.drools.base.DroolsQuery;
 import org.drools.base.ShadowProxy;
 import org.drools.base.ShadowProxyFactory;
-import org.drools.common.DroolsObjectInputStream;
+import org.drools.common.DroolsObjectInput;
 import org.drools.common.InternalRuleBase;
-import org.drools.common.DroolsObjectInput;
 import org.drools.objenesis.instantiator.ObjectInstantiator;
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.reteoo.builder.PatternBuilder;
 import org.drools.rule.EntryPoint;
+import org.drools.rule.TypeDeclaration;
 import org.drools.spi.ObjectType;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
 public class ClassObjectTypeConf
     implements
     ObjectTypeConf,
     Externalizable {
 
-    private Class                    cls;
+    private static final long serialVersionUID = 8218802585428841926L;
+
+    private Class<?>                        cls;
     private transient InternalRuleBase     ruleBase;
     private ObjectTypeNode[]               objectTypeNodes;
 
     protected boolean                      shadowEnabled;
-    protected Class                        shadowClass;
+    protected Class<ShadowProxy>           shadowClass;
     protected transient ObjectInstantiator instantiator;
 
     private ObjectTypeNode                 concreteObjectTypeNode;
@@ -64,12 +66,13 @@
     }
 
     public ClassObjectTypeConf(final EntryPoint entryPoint,
-                               final Class clazz,
-                               final boolean isEvent,
+                               final Class<?> clazz,
                                final InternalRuleBase ruleBase) {
         this.cls = clazz;
         this.ruleBase = ruleBase;
         this.entryPoint = entryPoint;
+        TypeDeclaration type = ruleBase.getTypeDeclaration( clazz );
+        final boolean isEvent = type != null && type.getRole() == TypeDeclaration.Role.EVENT;
 
         ObjectType objectType = new ClassObjectType( clazz,
                                                      isEvent );
@@ -177,7 +180,7 @@
      * This will return the package name - if the package is null, it will
      * work it out from the class name (this is in cases where funky classloading is used).
      */
-    public static String getPackageName(Class clazz,
+    public static String getPackageName(Class<?> clazz,
                                         Package pkg) {
         String pkgName = "";
         if ( pkg == null ) {
@@ -249,6 +252,12 @@
         return ret;
     }
 
+    private void readObject(ObjectInputStream stream) throws IOException,
+                                                     ClassNotFoundException {
+        stream.defaultReadObject();
+        this.ruleBase = ((DroolsObjectInput) stream).getRuleBase();
+    }
+
     /**
      *
      */

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EntryPointNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EntryPointNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EntryPointNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -18,17 +18,11 @@
  * Created on January 8th, 2007
  */
 
-import java.io.Externalizable;
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.util.HashMap;
-import java.util.Map;
-
 import org.drools.base.ShadowProxy;
 import org.drools.common.BaseNode;
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalWorkingMemory;
+import org.drools.common.InternalWorkingMemoryEntryPoint;
 import org.drools.common.NodeMemory;
 import org.drools.common.PropagationContextImpl;
 import org.drools.reteoo.builder.BuildContext;
@@ -39,6 +33,13 @@
 import org.drools.util.FactHashTable;
 import org.drools.util.Iterator;
 
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  * A node that is an entry point into the Rete network.
  *
@@ -119,25 +120,10 @@
         return entryPoint;
     }
 
-    /**
-     * This is the entry point into the network for all asserted Facts. Iterates a cache
-     * of matching <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not
-     * exist it first iterates and builds the cache.
-     *
-     * @param handle
-     *            The FactHandle of the fact to assert
-     * @param context
-     *            The <code>PropagationContext</code> of the <code>WorkingMemory</code> action
-     * @param workingMemory
-     *            The working memory session.
-     */
     public void assertObject(final InternalFactHandle handle,
                              final PropagationContext context,
+                             final ObjectTypeConf objectTypeConf,
                              final InternalWorkingMemory workingMemory) {
-
-        ObjectTypeConf objectTypeConf = workingMemory.getObjectTypeConf( this.entryPoint,
-                                                                         handle.getObject() );
-
         // checks if shadow is enabled
         if ( objectTypeConf.isShadowEnabled() ) {
             // need to improve this
@@ -160,6 +146,24 @@
     }
 
     /**
+     * This is the entry point into the network for all asserted Facts. Iterates a cache
+     * of matching <code>ObjectTypdeNode</code>s asserting the Fact. If the cache does not
+     * exist it first iterates and builds the cache.
+     *
+     * @param handle
+     *            The FactHandle of the fact to assert
+     * @param context
+     *            The <code>PropagationContext</code> of the <code>WorkingMemory</code> action
+     * @param workingMemory
+     *            The working memory session.
+     */
+    public void assertObject(final InternalFactHandle handle,
+                             final PropagationContext context,
+                             final InternalWorkingMemory workingMemory) {
+        // do nothing, dummy method to impl the interface
+    }
+
+    /**
      * Retract a fact object from this <code>RuleBase</code> and the specified
      * <code>WorkingMemory</code>.
      *
@@ -170,11 +174,10 @@
      */
     public void retractObject(final InternalFactHandle handle,
                               final PropagationContext context,
+                              final ObjectTypeConf objectTypeConf,
                               final InternalWorkingMemory workingMemory) {
         final Object object = handle.getObject();
 
-        ObjectTypeConf objectTypeConf = workingMemory.getObjectTypeConf( this.entryPoint,
-                                                                         object );
         ObjectTypeNode[] cachedNodes = objectTypeConf.getObjectTypeNodes();
 
         if ( cachedNodes == null ) {
@@ -189,6 +192,12 @@
         }
     }
 
+    public void retractObject(final InternalFactHandle handle,
+                              final PropagationContext context,
+                              final InternalWorkingMemory workingMemory) {
+        // do nothing, dummy method to impl the interface
+    }
+
     /**
      * Adds the <code>ObjectSink</code> so that it may receive
      * <code>Objects</code> propagated from this <code>ObjectSource</code>.
@@ -268,7 +277,9 @@
         final ObjectTypeNode node = (ObjectTypeNode) sink;
         final ObjectType newObjectType = node.getObjectType();
 
-        for ( ObjectTypeConf objectTypeConf : workingMemory.getObjectTypeConfMap( this.entryPoint ).values() ) {
+        InternalWorkingMemoryEntryPoint wmEntryPoint = ( InternalWorkingMemoryEntryPoint ) workingMemory.getWorkingMemoryEntryPoint( this.entryPoint.getEntryPointId() );
+
+        for ( ObjectTypeConf objectTypeConf : wmEntryPoint.getObjectTypeConfigurationRegistry().values() ) {
             if ( newObjectType.isAssignableFrom( objectTypeConf.getConcreteObjectTypeNode().getObjectType() ) ) {
                 objectTypeConf.resetCache();
                 ObjectTypeNode sourceNode = objectTypeConf.getConcreteObjectTypeNode();

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/EvalConditionNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -136,6 +136,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.tupleSource.networkUpdated();
+    }
+
     // ------------------------------------------------------------
     // Instance methods
     // ------------------------------------------------------------

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/FromNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/FromNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/FromNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,10 +1,5 @@
 package org.drools.reteoo;
 
-import java.io.Serializable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
-
 import org.drools.RuleBaseConfiguration;
 import org.drools.common.BaseNode;
 import org.drools.common.BetaConstraints;
@@ -22,6 +17,11 @@
 import org.drools.util.LinkedListEntry;
 import org.drools.util.TupleHashTable;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.Serializable;
+
 public class FromNode extends TupleSource
     implements
     TupleSinkNode,
@@ -182,6 +182,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.tupleSource.networkUpdated();
+    }
+
     protected void doRemove(final RuleRemovalContext context,
                             final ReteooBuilder builder,
                             final BaseNode node,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/LeftInputAdapterNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -120,6 +120,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.objectSource.networkUpdated();
+    }
+
     /**
      * Takes the asserted <code>FactHandleImpl</code> received from the <code>ObjectSource</code> and puts it
      * in a new <code>ReteTuple</code> before propagating to the <code>TupleSinks</code>

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectSource.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,17 +16,16 @@
  * limitations under the License.
  */
 
-import java.io.Serializable;
+import org.drools.common.BaseNode;
+import org.drools.common.DefaultFactHandle;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.spi.PropagationContext;
+
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.drools.common.BaseNode;
-import org.drools.common.DefaultFactHandle;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.spi.PropagationContext;
-
 /**
  * A source of <code>FactHandle</code>s for an <code>ObjectSink</code>.
  *
@@ -113,7 +112,7 @@
      *            <code>FactHandleImpl</code>.
      */
     protected void addObjectSink(final ObjectSink objectSink) {
-        if ( EmptyObjectSinkAdapter.getInstance().equals(this.sink) ) {
+        if ( this.sink instanceof EmptyObjectSinkAdapter ) {
             this.sink = new SingleObjectSinkAdapter( objectSink );
         } else if ( this.sink instanceof SingleObjectSinkAdapter ) {
             final CompositeObjectSinkAdapter sinkAdapter = new CompositeObjectSinkAdapter( this.alphaNodeHashingThreshold );
@@ -132,7 +131,7 @@
      *            The <code>ObjectSink</code> to remove
      */
     protected void removeObjectSink(final ObjectSink objectSink) {
-        if ( this.sink == EmptyObjectSinkAdapter.getInstance() ) {
+        if ( this.sink instanceof EmptyObjectSinkAdapter ) {
             throw new IllegalArgumentException( "Cannot remove a sink, when the list of sinks is null" );
         }
 
@@ -151,6 +150,10 @@
                                     PropagationContext context,
                                     InternalWorkingMemory workingMemory);
 
+    public void networkUpdated() {
+        this.objectSource.networkUpdated();
+    }
+
     public ObjectSinkPropagator getSinkPropagator() {
         return this.sink;
     }

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ObjectTypeNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -31,6 +31,7 @@
 import org.drools.reteoo.builder.BuildContext;
 import org.drools.rule.Declaration;
 import org.drools.rule.EntryPoint;
+import org.drools.rule.EvalCondition;
 import org.drools.spi.Constraint;
 import org.drools.spi.ObjectType;
 import org.drools.spi.PropagationContext;
@@ -240,6 +241,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.skipOnModify = canSkipOnModify( this.sink.getSinks() );
+    }
+
     /**
      * OTN needs to override remove to avoid releasing the node ID, since OTN are
      * never removed from the rulebase in the current implementation
@@ -314,7 +319,6 @@
      */
     protected void addObjectSink(final ObjectSink objectSink) {
         super.addObjectSink( objectSink );
-        this.skipOnModify = canSkipOnModify( this.sink.getSinks() );
     }
 
     /**
@@ -322,7 +326,6 @@
      */
     protected void removeObjectSink(final ObjectSink objectSink) {
         super.removeObjectSink( objectSink );
-        this.skipOnModify = canSkipOnModify( this.sink.getSinks() );
     }
 
     /**
@@ -336,15 +339,17 @@
         // If we have no alpha or beta node with constraints on this ObjectType, we can just skip modifies
         boolean hasConstraints = false;
         for ( int i = 0; i < sinks.length && !hasConstraints; i++ ) {
-            if ( sinks[i] instanceof AlphaNode ) {
-                hasConstraints = this.usesDeclaration( ((AlphaNode) sinks[i]).getConstraint() );
+            if ( sinks[i] instanceof AlphaNode || sinks[i] instanceof AccumulateNode || sinks[i] instanceof CollectNode || sinks[i] instanceof FromNode ) {
+                hasConstraints = true;
             } else if ( sinks[i] instanceof BetaNode && ((BetaNode) sinks[i]).getConstraints().length > 0 ) {
                 hasConstraints = this.usesDeclaration( ((BetaNode) sinks[i]).getConstraints() );
+            } else if ( sinks[i] instanceof EvalConditionNode ) {
+                hasConstraints = this.usesDeclaration( ((EvalConditionNode)sinks[i]).getCondition() );
             }
             if ( !hasConstraints && sinks[i] instanceof ObjectSource ) {
-                hasConstraints = this.canSkipOnModify( ((ObjectSource) sinks[i]).getSinkPropagator().getSinks() );
-            } else if ( sinks[i] instanceof TupleSource ) {
-                hasConstraints = this.canSkipOnModify( ((TupleSource) sinks[i]).getSinkPropagator().getSinks() );
+                hasConstraints = !this.canSkipOnModify( ((ObjectSource) sinks[i]).getSinkPropagator().getSinks() );
+            } else if ( !hasConstraints && sinks[i] instanceof TupleSource ) {
+                hasConstraints = !this.canSkipOnModify( ((TupleSource) sinks[i]).getSinkPropagator().getSinks() );
             }
         }
 
@@ -352,6 +357,7 @@
         return !hasConstraints;
     }
 
+
     private boolean usesDeclaration(final Constraint[] constraints) {
         boolean usesDecl = false;
         for ( int i = 0; !usesDecl && i < constraints.length; i++ ) {
@@ -369,6 +375,15 @@
         return usesDecl;
     }
 
+    private boolean usesDeclaration(final EvalCondition condition) {
+        boolean usesDecl = false;
+        final Declaration[] declarations = condition.getRequiredDeclarations();
+        for ( int j = 0; !usesDecl && j < declarations.length; j++ ) {
+            usesDecl = (declarations[j].getPattern().getObjectType() == this.objectType);
+        }
+        return usesDecl;
+    }
+
     /**
      * @return the entryPoint
      */

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/QueryTerminalNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -174,6 +174,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.tupleSource.networkUpdated();
+    }
+
     protected void doRemove(final RuleRemovalContext context,
                             final ReteooBuilder builder,
                             final BaseNode node,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/Rete.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/Rete.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/Rete.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,30 +16,24 @@
  * limitations under the License.
  */
 
+import org.drools.common.BaseNode;
+import org.drools.common.InternalFactHandle;
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.common.InternalWorkingMemoryEntryPoint;
+import org.drools.rule.EntryPoint;
+import org.drools.spi.ObjectType;
+import org.drools.spi.PropagationContext;
+
+import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.Externalizable;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-import org.drools.common.BaseNode;
-import org.drools.common.InternalFactHandle;
-import org.drools.common.InternalRuleBase;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.common.DroolsObjectInput;
-import org.drools.reteoo.builder.BuildContext;
-import org.drools.rule.EntryPoint;
-import org.drools.spi.ObjectType;
-import org.drools.spi.PropagationContext;
-import org.drools.util.FactEntry;
-import org.drools.util.FactHashTable;
-import org.drools.util.Iterator;
-import org.drools.util.ObjectHashMap;
-import org.drools.RuleBase;
-
 /**
  * The Rete-OO network.
  *
@@ -109,9 +103,12 @@
     public void assertObject(final InternalFactHandle handle,
                              final PropagationContext context,
                              final InternalWorkingMemory workingMemory) {
-        EntryPointNode node = this.entryPoints.get( context.getEntryPoint() );
+        EntryPoint entryPoint = context.getEntryPoint();
+        EntryPointNode node = this.entryPoints.get( entryPoint );
+        ObjectTypeConf typeConf = ((InternalWorkingMemoryEntryPoint) workingMemory.getWorkingMemoryEntryPoint(  entryPoint.getEntryPointId() )).getObjectTypeConfigurationRegistry().getObjectTypeConf( entryPoint, handle.getObject() );
         node.assertObject( handle,
                            context,
+                           typeConf,
                            workingMemory );
     }
 
@@ -127,9 +124,12 @@
     public void retractObject(final InternalFactHandle handle,
                               final PropagationContext context,
                               final InternalWorkingMemory workingMemory) {
-        EntryPointNode node = this.entryPoints.get( context.getEntryPoint() );
+        EntryPoint entryPoint = context.getEntryPoint();
+        EntryPointNode node = this.entryPoints.get( entryPoint );
+        ObjectTypeConf typeConf = ((InternalWorkingMemoryEntryPoint) workingMemory.getWorkingMemoryEntryPoint(  entryPoint.getEntryPointId() )).getObjectTypeConfigurationRegistry().getObjectTypeConf( entryPoint, handle.getObject() );
         node.retractObject( handle,
                             context,
+                            typeConf,
                             workingMemory );
     }
 
@@ -161,6 +161,10 @@
         throw new UnsupportedOperationException( "cannot call attach() from the root Rete node" );
     }
 
+    public void networkUpdated() {
+        // nothing to do
+    }
+
     protected void doRemove(final RuleRemovalContext context,
                             final ReteooBuilder builder,
                             final BaseNode node,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooBuilder.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,17 +16,26 @@
  * limitations under the License.
  */
 
+import org.drools.RuleIntegrationException;
+import org.drools.base.SalienceInteger;
+import org.drools.common.BaseNode;
+import org.drools.common.DroolsObjectInputStream;
+import org.drools.common.DroolsObjectOutputStream;
+import org.drools.common.InternalRuleBase;
+import org.drools.common.InternalWorkingMemory;
+import org.drools.reteoo.builder.ReteooRuleBuilder;
+import org.drools.rule.InvalidPatternException;
+import org.drools.rule.Rule;
+import org.drools.spi.Salience;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.Externalizable;
 import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Serializable;
+import java.io.InputStream;
 import java.io.ObjectInput;
+import java.io.ObjectInputStream;
 import java.io.ObjectOutput;
-import java.io.Externalizable;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -35,21 +44,9 @@
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.Queue;
 import java.util.Map.Entry;
+import java.util.Queue;
 
-import org.drools.RuleIntegrationException;
-import org.drools.base.SalienceInteger;
-import org.drools.common.BaseNode;
-import org.drools.common.DroolsObjectInputStream;
-import org.drools.common.InternalRuleBase;
-import org.drools.common.InternalWorkingMemory;
-import org.drools.common.DroolsObjectOutputStream;
-import org.drools.reteoo.builder.ReteooRuleBuilder;
-import org.drools.rule.InvalidPatternException;
-import org.drools.rule.Rule;
-import org.drools.spi.Salience;
-
 /**
  * Builds the Rete-OO network for a <code>Package</code>.
  *
@@ -300,7 +297,7 @@
             droolsStream    = (DroolsObjectOutputStream)out;
         } else {
              bytes = new ByteArrayOutputStream();
-             droolsStream   = new DroolsObjectOutputStream((OutputStream)new ObjectOutputStream(bytes));
+             droolsStream   = new DroolsObjectOutputStream(bytes);
         }
         droolsStream.writeObject(rules);
         droolsStream.writeObject(idGenerator);

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooFactHandleFactory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooFactHandleFactory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooFactHandleFactory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -25,26 +25,14 @@
 import org.drools.spi.FactHandleFactory;
 import org.drools.temporal.SessionClock;
 
-import java.io.ObjectInput;
-import java.io.IOException;
-import java.io.ObjectOutput;
-
 public class ReteooFactHandleFactory extends AbstractFactHandleFactory {
 
     private static final long serialVersionUID = 400L;
 
-    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-    }
-
-    public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-    }
-
     /* (non-Javadoc)
      * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
      */
-    protected final InternalFactHandle newFactHandle(final long id,
+    protected final InternalFactHandle newFactHandle(final int id,
                                                      final Object object,
                                                      final long recency,
                                                      final boolean isEvent,
@@ -64,29 +52,6 @@
     }
 
     /* (non-Javadoc)
-    * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
-    */
-    protected final InternalFactHandle newFactHandle(final long id,
-                                                     final Object object,
-                                                     final long recency,
-                                                     final boolean isEvent,
-                                                     final long duration,
-                                                     final WorkingMemory workingMemory ) {
-        if ( isEvent ) {
-            SessionClock clock = ((TemporalSession) workingMemory).getSessionClock();
-            return new EventFactHandle( id,
-                                        object,
-                                        recency,
-                                        clock.getCurrentTime(),
-                                        duration );  // primitive events have 0 duration
-        } else {
-            return new DefaultFactHandle( id,
-                                          object,
-                                          recency );
-        }
-    }
-
-    /* (non-Javadoc)
      * @see org.drools.reteoo.FactHandleFactory#newInstance()
      */
     public FactHandleFactory newInstance() {

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooRuleBase.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -19,7 +19,6 @@
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.Serializable;
 import java.io.Externalizable;
 import java.util.Iterator;
 
@@ -83,7 +82,7 @@
     /**
      * Construct.
      *
-     * @param id
+     * @param rete
      *            The rete network.
      */
     public ReteooRuleBase(final String id) {

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooStatefulSession.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -5,6 +5,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.drools.WorkingMemoryEntryPoint;
 import org.drools.FactHandle;
 import org.drools.StatefulSession;
 import org.drools.common.InternalRuleBase;
@@ -16,6 +17,7 @@
 import org.drools.concurrent.RetractObject;
 import org.drools.concurrent.UpdateObject;
 import org.drools.event.RuleBaseEventListener;
+import org.drools.rule.EntryPoint;
 import org.drools.spi.AgendaFilter;
 import org.drools.spi.RuleBaseUpdateListener;
 import org.drools.spi.RuleBaseUpdateListenerFactory;

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/ReteooWorkingMemory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -33,6 +33,7 @@
 import org.drools.common.InternalFactHandle;
 import org.drools.common.InternalRuleBase;
 import org.drools.common.InternalWorkingMemory;
+import org.drools.common.ObjectTypeConfigurationRegistry;
 import org.drools.common.PropagationContextImpl;
 import org.drools.common.WorkingMemoryAction;
 import org.drools.event.RuleBaseEventListener;
@@ -49,7 +50,7 @@
  * @author <a href="mailto:mark.proctor at jboss.com">Mark Proctor</a>
  * @author <a href="mailto:simon at redhillconsulting.com.au">Simon Harris</a>
  */
-public class ReteooWorkingMemory extends AbstractWorkingMemory implements Externalizable {
+public class ReteooWorkingMemory extends AbstractWorkingMemory {
 
     /**
      *
@@ -67,29 +68,13 @@
      *            The backing rule-base.
      */
     public ReteooWorkingMemory(final int id,
-                               final InternalRuleBase ruleBase) {
+                               final InternalRuleBase ruleBase ) {
         super( id,
                ruleBase,
                ruleBase.newFactHandleFactory() );
         this.agenda = new DefaultAgenda( this );
     }
 
-    public void doInsert(final InternalFactHandle handle,
-                               final Object object,
-                               final PropagationContext propagationContext) throws FactException {
-        this.ruleBase.assertObject( handle,
-                                    object,
-                                    propagationContext,
-                                    this );
-    }
-
-    public void doRetract(final InternalFactHandle handle,
-                          final PropagationContext propagationContext) {
-        this.ruleBase.retractObject( handle,
-                                     propagationContext,
-                                     this );
-    }
-
     public QueryResults getQueryResults(final String query) {
         return getQueryResults( query, null );
     }
@@ -97,13 +82,13 @@
     public QueryResults getQueryResults(final String query, final Object[] arguments) {
 
         Object object = new DroolsQuery( query, arguments );
-        InternalFactHandle handle = this.handleFactory.newFactHandle( object, false, 0, this );
+        InternalFactHandle handle = this.handleFactory.newFactHandle( object, false, this );
 
-        insert( EntryPoint.DEFAULT, // query dummy objects always use default entry point
-                handle,
+        insert( handle,
                 object,
                 null,
-                null );
+                null,
+                this.typeConfReg.getObjectTypeConf( this.entryPoint, object ));
 
         final QueryTerminalNode node = (QueryTerminalNode) this.queryResults.remove( query );
         Query queryObj = null;

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/reteoo/RuleTerminalNode.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -457,6 +457,10 @@
         }
     }
 
+    public void networkUpdated() {
+        this.tupleSource.networkUpdated();
+    }
+
     protected void doRemove(final RuleRemovalContext context,
                             final ReteooBuilder builder,
                             final BaseNode node,

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/Package.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/Package.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/Package.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,12 +16,18 @@
  * limitations under the License.
  */
 
+import org.drools.common.DroolsObjectInput;
+import org.drools.common.DroolsObjectInputStream;
+import org.drools.common.DroolsObjectOutputStream;
+import org.drools.facttemplates.FactTemplate;
+import org.drools.process.core.Process;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
-import java.io.ByteArrayOutputStream;
-import java.io.ByteArrayInputStream;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -29,12 +35,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.drools.common.DroolsObjectInputStream;
-import org.drools.common.DroolsObjectOutputStream;
-import org.drools.common.DroolsObjectInput;
-import org.drools.facttemplates.FactTemplate;
-import org.drools.process.core.Process;
-
 /**
  * Collection of related <code>Rule</code>s.
  *
@@ -81,6 +81,8 @@
     //    private JavaDialectData         packageCompilationData;
     private DialectDatas                   dialectDatas;
 
+    private Map<String, TypeDeclaration>   typeDeclarations;
+
     /** This is to indicate the the package has no errors during the compilation/building phase */
     private boolean                        valid            = true;
 
@@ -120,6 +122,7 @@
                    ClassLoader parentClassLoader) {
         this.name = name;
         this.imports = new HashMap<String, ImportDeclaration>();
+        this.typeDeclarations = new HashMap<String, TypeDeclaration>();
         this.staticImports = Collections.EMPTY_SET;
         this.rules = new LinkedHashMap();
         this.ruleFlows = Collections.EMPTY_MAP;
@@ -157,6 +160,7 @@
             out = new DroolsObjectOutputStream(bytes);
         }
         out.writeObject( this.dialectDatas );
+        out.writeObject( this.typeDeclarations );
         out.writeObject( this.name );
         out.writeObject( this.imports );
         out.writeObject( this.staticImports );
@@ -194,6 +198,7 @@
         if (!isDroolsStream)
             ((DroolsObjectInput)in).setClassLoader(this.dialectDatas.getClassLoader());
 
+        this.typeDeclarations   = (Map)in.readObject();
         this.name = (String) in.readObject();
         this.imports = (Map<String, ImportDeclaration>) in.readObject();
         this.staticImports = (Set) in.readObject();
@@ -239,6 +244,22 @@
         return this.imports;
     }
 
+    public void addTypeDeclaration( final TypeDeclaration typeDecl ) {
+        this.typeDeclarations.put( typeDecl.getTypeName(), typeDecl );
+    }
+
+    public void removeTypeDeclaration( final String type ) {
+        this.typeDeclarations.remove( type );
+    }
+
+    public Map<String, TypeDeclaration> getTypeDeclarations() {
+        return this.typeDeclarations;
+    }
+
+    public TypeDeclaration getTypeDeclaration( String type ) {
+        return this.typeDeclarations.get( type );
+    }
+
     public void addStaticImport(final String functionImport) {
         if ( this.staticImports == Collections.EMPTY_SET ) {
             this.staticImports = new HashSet( 2 );
@@ -478,29 +499,20 @@
     /**
      * Returns true if clazz is imported as an Event class in this package
      * @param clazz
-     * @return true if clazz is imported as an Event class in this package
+     * @return
      */
     public boolean isEvent(Class clazz) {
         if ( clazz == null ) {
             return false;
         }
-        // check if clazz is resolved by any of the import declarations
-        for ( ImportDeclaration imp : this.imports.values() ) {
-            if ( imp.isEvent() && imp.matches( clazz ) ) {
+
+        // check if clazz is resolved by any of the type declarations
+        for( TypeDeclaration type : this.typeDeclarations.values() ) {
+            if( type.matches( clazz ) && type.getRole() == TypeDeclaration.Role.EVENT ) {
                 return true;
             }
         }
-        // if it is not resolved, try superclass
-        if ( this.isEvent( clazz.getSuperclass() ) ) {
-            return true;
-        }
 
-        // if it is no resolved, try interfaces
-        for ( Class interf : clazz.getInterfaces() ) {
-            if ( this.isEvent( interf ) ) {
-                return true;
-            }
-        }
         return false;
     }
 

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/TypeDeclaration.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/TypeDeclaration.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/TypeDeclaration.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/rule/TypeDeclaration.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,224 @@
+/*
+ * Copyright 2008 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Created on Jan 23, 2008
+ */
+
+package org.drools.rule;
+
+import org.drools.facttemplates.FactTemplate;
+
+/**
+ * The type declaration class stores all type's metadata
+ * declared in source files.
+ *  
+ * @author etirelli
+ */
+public class TypeDeclaration {
+    
+    public static enum Role {
+        FACT,
+        EVENT;
+        
+        public static Role parseRole( String role ) {
+            if( "event".equalsIgnoreCase( role ) ) {
+                return EVENT;
+            } else if( "fact".equalsIgnoreCase( role ) ) {
+                return FACT;
+            }
+            return null;
+        }
+    }
+    
+    public static enum Format {
+        POJO, 
+        TEMPLATE;
+
+        public static Format parseFormat( String format ) {
+            if( "pojo".equalsIgnoreCase( format ) ) {
+                return POJO;
+            } else if( "template".equalsIgnoreCase( format ) ) {
+                return TEMPLATE;
+            }
+            return null;
+        }
+    }
+    
+    public static enum ClockStrategy {
+        NONE,
+        PSEUDO, 
+        SYSTEM, 
+        HEARTBEAT, 
+        ATTRIBUTE;
+        
+        public static ClockStrategy parseClockStrategy( String clockStrategy ) {
+            if( "none".equalsIgnoreCase( clockStrategy ) ) {
+                return NONE;
+            } else if( "pseudo".equalsIgnoreCase( clockStrategy ) ) {
+                return PSEUDO;
+            } else if( "system".equalsIgnoreCase( clockStrategy ) ) {
+                return SYSTEM;
+            } else if( "heartbeat".equalsIgnoreCase( clockStrategy ) ) {
+                return HEARTBEAT;
+            } else if( "attribute".equalsIgnoreCase( clockStrategy ) ) {
+                return ATTRIBUTE;
+            }
+            return null;
+        }
+    }
+
+    private final String typeName;
+    private Role role;
+    private Format format;
+    private ClockStrategy clockStrategy;
+    private String timestampAttribute;
+    private String durationAttribute;
+    private Class<?> typeClass;
+    private FactTemplate typeTemplate;
+    
+    public TypeDeclaration( String typeName ) {
+        this.typeName = typeName;
+        this.role = Role.FACT;
+        this.format = Format.POJO;
+        this.clockStrategy = ClockStrategy.NONE;
+        this.durationAttribute = null;
+        this.timestampAttribute = null;
+        this.typeClass = null;
+        this.typeTemplate = null;
+    }
+    
+    /**
+     * @return the type
+     */
+    public String getTypeName() {
+        return typeName;
+    }
+
+    /**
+     * @return the category
+     */
+    public Role getRole() {
+        return role;
+    }
+
+    /**
+     * @param role the category to set
+     */
+    public void setRole(Role role) {
+        this.role = role;
+    }
+
+    /**
+     * @return the format
+     */
+    public Format getFormat() {
+        return format;
+    }
+
+    /**
+     * @param format the format to set
+     */
+    public void setFormat(Format format) {
+        this.format = format;
+    }
+
+    /**
+     * @return the clockStrategy
+     */
+    public ClockStrategy getClockStrategy() {
+        return clockStrategy;
+    }
+
+    /**
+     * @param clockStrategy the clockStrategy to set
+     */
+    public void setClockStrategy(ClockStrategy clockStrategy) {
+        this.clockStrategy = clockStrategy;
+    }
+
+    /**
+     * @return the timestampAttribute
+     */
+    public String getTimestampAttribute() {
+        return timestampAttribute;
+    }
+
+    /**
+     * @param timestampAttribute the timestampAttribute to set
+     */
+    public void setTimestampAttribute(String timestampAttribute) {
+        this.timestampAttribute = timestampAttribute;
+    }
+
+    /**
+     * @return the durationAttribute
+     */
+    public String getDurationAttribute() {
+        return durationAttribute;
+    }
+
+    /**
+     * @param durationAttribute the durationAttribute to set
+     */
+    public void setDurationAttribute(String durationAttribute) {
+        this.durationAttribute = durationAttribute;
+    }
+
+    /**
+     * @return the typeClass
+     */
+    public Class< ? > getTypeClass() {
+        return typeClass;
+    }
+
+    /**
+     * @param typeClass the typeClass to set
+     */
+    public void setTypeClass(Class< ? > typeClass) {
+        this.typeClass = typeClass;
+    }
+
+    /**
+     * @return the typeTemplate
+     */
+    public FactTemplate getTypeTemplate() {
+        return typeTemplate;
+    }
+
+    /**
+     * @param typeTemplate the typeTemplate to set
+     */
+    public void setTypeTemplate(FactTemplate typeTemplate) {
+        this.typeTemplate = typeTemplate;
+    }
+    
+    /**
+     * Returns true if the given parameter matches this type declaration
+     * 
+     * @param clazz
+     * @return
+     */
+    public boolean matches( Object clazz ) {
+        boolean matches = false;
+        if( clazz instanceof FactTemplate ) {
+            matches = this.typeTemplate.equals( clazz );
+        } else {
+            matches = this.typeClass.isAssignableFrom( (Class<?>) clazz );
+        }
+        return matches;
+    }
+    
+    
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/FactHandleFactory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/FactHandleFactory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/FactHandleFactory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,12 +16,12 @@
  * limitations under the License.
  */
 
-import java.io.Serializable;
-
 import org.drools.FactHandle;
 import org.drools.WorkingMemory;
 import org.drools.common.InternalFactHandle;
 
+import java.io.Serializable;
+
 /**
  * Factory Interface to return new <code>FactHandle</code>s
  * 
@@ -38,16 +38,9 @@
      * 
      * @return The handle.
      */
-    InternalFactHandle newFactHandle(Object object, boolean isEvent, WorkingMemory workingMemory );
+    public InternalFactHandle newFactHandle(Object object, boolean isEvent, WorkingMemory workingMemory );
     
     /**
-     * Construct a handle with a new id and a duration.
-     * 
-     * @return The handle.
-     */
-    InternalFactHandle newFactHandle(Object object, boolean isEvent, long duration, WorkingMemory workingMemory );
-
-    /**
      * Increases the recency of the FactHandle
      * 
      * @param factHandle

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/KnowledgeHelper.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/KnowledgeHelper.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/spi/KnowledgeHelper.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,14 +16,14 @@
  * limitations under the License.
  */
 
-import java.io.Serializable;
-
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.WorkingMemory;
 import org.drools.rule.Declaration;
 import org.drools.rule.Rule;
 
+import java.io.Externalizable;
+
 /**
  * KnowledgeHelper implementation types are injected into consequenses
  * instrumented at compile time and instances passed at runtime. It provides
@@ -39,7 +39,7 @@
  */
 public interface KnowledgeHelper
     extends
-    Serializable {
+    Externalizable {
     
     public void setActivation(final Activation agendaItem); 
     
@@ -58,17 +58,6 @@
     void insert(Object object) throws FactException;
     
     /**
-     * Asserts an object, notice that it does not return the FactHandle
-     * 
-     * @param object -
-     *            the object to be asserted
-     * @throws FactException -
-     *             Exceptions can be thrown by conditions which are wrapped and
-     *             returned as a FactException
-     */
-    void insert(Object object, long duration) throws FactException;
-
-    /**
      * Asserts an object specifying that it implement the onPropertyChange
      * listener, notice that it does not return the FactHandle.
      * 
@@ -83,33 +72,11 @@
     void insert(Object object,
                       boolean dynamic) throws FactException;
     
-    /**
-     * Asserts an object specifying that it implement the onPropertyChange
-     * listener, notice that it does not return the FactHandle.
-     * 
-     * @param object -
-     *            the object to be asserted
-     * @param dynamic -
-     *            specifies the object implements onPropertyChangeListener
-     * @throws FactException -
-     *             Exceptions can be thrown by conditions which are wrapped and
-     *             returned as a FactException
-     */
-    void insert(Object object,
-    			long duration,
-                boolean dynamic) throws FactException;
-
     public void insertLogical(Object object) throws FactException;
     
-    public void insertLogical(Object object, long duration) throws FactException;
-
     public void insertLogical(Object object,
                                     boolean dynamic) throws FactException;
     
-    public void insertLogical(Object object,
-    						  long duration,
-    						  boolean dynamic) throws FactException;
-
     void update(FactHandle handle,
                       Object newObject) throws FactException;
 

Copied: labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/util/ArrayIterator.java (from rev 19036, labs/jbossrules/trunk/drools-core/src/main/java/org/drools/util/ArrayIterator.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/util/ArrayIterator.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/main/java/org/drools/util/ArrayIterator.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,158 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.drools.util;
+
+import java.lang.reflect.Array;
+import java.util.NoSuchElementException;
+
+/** 
+ * Implements an {@link java.util.Iterator Iterator} over any array.
+ * <p>
+ * The array can be either an array of object or of primitives. If you know 
+ * that you have an object array, the 
+ * {@link org.apache.commons.collections.iterators.ObjectArrayIterator ObjectArrayIterator}
+ * class is a better choice, as it will perform better.
+ * <p>
+ * The iterator implements a {@link #reset} method, allowing the reset of 
+ * the iterator back to the start if required.
+ *
+ * @since Commons Collections 1.0
+ * @version $Revision$ $Date$
+ *
+ * @author James Strachan
+ * @author Mauricio S. Moura
+ * @author Michael A. Smith
+ * @author Neil O'Toole
+ * @author Stephen Colebourne
+ */
+public class ArrayIterator implements java.util.Iterator {
+
+    /** The array to iterate over */    
+    protected Object array;
+    /** The end index to loop to */
+	protected int endIndex = 0;
+    /** The current iterator index */
+	protected int index = 0;
+    
+   
+    /**
+     * Constructs an ArrayIterator that will iterate over the values in the
+     * specified array.
+     *
+     * @param array the array to iterate over.
+     * @throws IllegalArgumentException if <code>array</code> is not an array.
+     * @throws NullPointerException if <code>array</code> is <code>null</code>
+     */
+    public ArrayIterator(final Object array) {
+        setArray(array);
+    }
+
+    /**
+     * Checks whether the index is valid or not.
+     * 
+     * @param bound  the index to check
+     * @param type  the index type (for error messages)
+     * @throws IndexOutOfBoundsException if the index is invalid
+     */
+    protected void checkBound(final int bound, final String type ) {
+        if (bound > this.endIndex) {
+            throw new ArrayIndexOutOfBoundsException(
+              "Attempt to make an ArrayIterator that " + type +
+              "s beyond the end of the array. "
+            );
+        }
+        if (bound < 0) {
+            throw new ArrayIndexOutOfBoundsException(
+              "Attempt to make an ArrayIterator that " + type +
+              "s before the start of the array. "
+            );
+        }
+    }
+
+    // Iterator interface
+    //-----------------------------------------------------------------------
+    /**
+     * Returns true if there are more elements to return from the array.
+     *
+     * @return true if there is a next element to return
+     */
+    public boolean hasNext() {
+        return (index < endIndex);
+    }
+
+    /**
+     * Returns the next element in the array.
+     *
+     * @return the next element in the array
+     * @throws NoSuchElementException if all the elements in the array
+     *  have already been returned
+     */
+    public Object next() {
+        if (hasNext() == false) {
+            throw new NoSuchElementException();
+        }
+        return Array.get(array, index++);
+    }
+
+    /**
+     * Throws {@link UnsupportedOperationException}.
+     *
+     * @throws UnsupportedOperationException always
+     */
+    public void remove() {
+        throw new UnsupportedOperationException("remove() method is not supported");
+    }
+
+    // Properties
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the array that this iterator is iterating over. 
+     *
+     * @return the array this iterator iterates over, or <code>null</code> if
+     *  the no-arg constructor was used and {@link #setArray(Object)} has never
+     *  been called with a valid array.
+     */
+    public Object getArray() {
+        return array;
+    }
+    
+    /**
+     * Sets the array that the ArrayIterator should iterate over.
+     * <p>
+     * If an array has previously been set (using the single-arg constructor
+     * or this method) then that array is discarded in favour of this one.
+     * Iteration is restarted at the start of the new array.
+     * Although this can be used to reset iteration, the {@link #reset()} method
+     * is a more effective choice.
+     *
+     * @param array the array that the iterator should iterate over.
+     * @throws IllegalArgumentException if <code>array</code> is not an array.
+     * @throws NullPointerException if <code>array</code> is <code>null</code>
+     */
+    private void setArray(final Object array) {
+        // Array.getLength throws IllegalArgumentException if the object is not
+        // an array or NullPointerException if the object is null.  This call
+        // is made before saving the array and resetting the index so that the
+        // array iterator remains in a consistent state if the argument is not
+        // an array or is null.
+        this.endIndex = Array.getLength(array);
+        this.array = array;
+        this.index = 0;
+    }
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/agent/FileScannerTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/agent/FileScannerTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/agent/FileScannerTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,20 +1,15 @@
 package org.drools.agent;
 
+import junit.framework.TestCase;
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.rule.Package;
+
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.ObjectOutputStream;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-import org.drools.RuleBase;
-import org.drools.RuleBaseFactory;
-import org.drools.rule.Package;
-
-import junit.framework.TestCase;
-
 public class FileScannerTest extends TestCase {
 
     public void testHasChanged() {

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/BaseNodeTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/BaseNodeTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/BaseNodeTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -78,6 +78,12 @@
             return true;
         }
 
+        @Override
+        public void networkUpdated() {
+            // TODO Auto-generated method stub
+
+        }
+
     }
 
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/DefaultFactHandleFactoryTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/DefaultFactHandleFactoryTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/DefaultFactHandleFactoryTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -62,20 +62,21 @@
         // destroy handle
         factory.destroyFactHandle( handle2 );
 
-        // issue  new  fact handle and  make sure it  recycled the  id=2
-        handle = (DefaultFactHandle) factory.newFactHandle( "cheese", false, null );
-        assertEquals( 2,
-                      handle.getId() );
-        assertEquals( 5,
-                      handle.getRecency() );
+        //@FIXME recycling is currently disabled
+//        // issue  new  fact handle and  make sure it  recycled the  id=2
+//        handle = (DefaultFactHandle) factory.newFactHandle( "cheese", false, null );
+//        assertEquals( 2,
+//                      handle.getId() );
+//        assertEquals( 5,
+//                      handle.getRecency() );
+//
+//        // issue new  handle  making  sure it correctly resumes  ids  and recency
+//        handle = (DefaultFactHandle) factory.newFactHandle( "cheese", false, null );
+//        assertEquals( 4,
+//                      handle.getId() );
+//        assertEquals( 6,
+//                      handle.getRecency() );
 
-        // issue new  handle  making  sure it correctly resumes  ids  and recency
-        handle = (DefaultFactHandle) factory.newFactHandle( "cheese", false, null );
-        assertEquals( 4,
-                      handle.getId() );
-        assertEquals( 6,
-                      handle.getRecency() );
-
     }
 
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSink.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,11 +16,6 @@
  * limitations under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
 import org.drools.FactException;
 import org.drools.RuleBaseConfiguration;
 import org.drools.common.BaseNode;
@@ -28,6 +23,11 @@
 import org.drools.common.NodeMemory;
 import org.drools.spi.PropagationContext;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+
 public class MockTupleSink extends TupleSource
     implements
     TupleSinkNode,
@@ -159,4 +159,10 @@
         
     }
 
+    @Override
+    public void networkUpdated() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/MockTupleSource.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -64,4 +64,10 @@
 
     }
 
+    @Override
+    public void networkUpdated() {
+        // TODO Auto-generated method stub
+
+    }
+
 }
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/ReteTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/ReteTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-core/src/test/java/org/drools/reteoo/ReteTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -16,14 +16,6 @@
  * limitations under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
 import org.drools.Cheese;
 import org.drools.DroolsTestCase;
 import org.drools.FactException;
@@ -40,6 +32,13 @@
 import org.drools.rule.EntryPoint;
 import org.drools.spi.PropagationContext;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
 /**
  * @author mproctor
  *
@@ -143,12 +142,11 @@
                                                        null ),
                            workingMemory );
 
-        final Map map = workingMemory.getObjectTypeConfMap( EntryPoint.DEFAULT );
-        ClassObjectTypeConf conf = (ClassObjectTypeConf) map.get( ArrayList.class );
+        ClassObjectTypeConf conf = ( ClassObjectTypeConf ) workingMemory.getObjectTypeConfigurationRegistry().getObjectTypeConf( this.entryPoint.getEntryPoint(), ArrayList.class );
         assertLength( 3,
                       conf.getObjectTypeNodes() );
 
-        conf = (ClassObjectTypeConf) map.get( LinkedList.class );
+        conf = ( ClassObjectTypeConf ) workingMemory.getObjectTypeConfigurationRegistry().getObjectTypeConf( this.entryPoint.getEntryPoint(), LinkedList.class );
         assertLength( 3,
                       conf.getObjectTypeNodes() );
 
@@ -249,8 +247,7 @@
                     rete.getObjectTypeNodes( EntryPoint.DEFAULT ).get( new ClassObjectType( List.class ) ) );
 
         // ArrayConf should match two ObjectTypenodes for List and ArrayList
-        Map memory = workingMemory.getObjectTypeConfMap( EntryPoint.DEFAULT );
-        ObjectTypeConf arrayConf = (ObjectTypeConf) memory.get( ArrayList.class );
+        ClassObjectTypeConf arrayConf = ( ClassObjectTypeConf ) workingMemory.getObjectTypeConfigurationRegistry().getObjectTypeConf( this.entryPoint.getEntryPoint(), ArrayList.class );
         final ObjectTypeNode arrayOtn = arrayConf.getConcreteObjectTypeNode();
         assertEquals( 2,
                       arrayConf.getObjectTypeNodes().length );

Modified: labs/jbossrules/branches/ming-serialization/drools-decisiontables/src/test/java/org/drools/decisiontable/parser/ExternalSheetListenerTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-decisiontables/src/test/java/org/drools/decisiontable/parser/ExternalSheetListenerTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-decisiontables/src/test/java/org/drools/decisiontable/parser/ExternalSheetListenerTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -2,13 +2,13 @@
 
 import junit.framework.TestCase;
 import org.drools.Agenda;
-import org.drools.EntryPointInterface;
 import org.drools.FactException;
 import org.drools.FactHandle;
 import org.drools.ObjectFilter;
 import org.drools.QueryResults;
 import org.drools.RuleBase;
 import org.drools.StatefulSession;
+import org.drools.WorkingMemoryEntryPoint;
 import org.drools.concurrent.Future;
 import org.drools.event.AgendaEventListener;
 import org.drools.event.RuleBaseEventListener;
@@ -408,11 +408,6 @@
                     return null;
                 }
 
-                public EntryPointInterface getEntryPoint(String id) {
-                    // TODO Auto-generated method stub
-                    return null;
-                }
-
                 public Collection getProcessInstances() {
                     // TODO Auto-generated method stub
                     return null;
@@ -441,12 +436,17 @@
                     return null;
                 }
 
+                public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String id) {
+                    // TODO Auto-generated method stub
+                    return null;
+                }
+
                 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
                 }
 
                 public void writeExternal(ObjectOutput out) throws IOException {
                 }
-			};
+            };
 		}
 	}
 

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Deployment1.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/Deployment1.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewMainScreen.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewMainScreen.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI2.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/NewUI2.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/QA.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/QA.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Scenarios.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/Scenarios.png)
===================================================================
(Binary files differ)

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Section-Introduction.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Section-Introduction.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/Section-Introduction.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -8,11 +8,11 @@
   installation, usage and administration.</para>
 
   <figure>
-    <title>The BRMS in action</title>
+    <title>The BRMS main screen</title>
 
     <mediaobject>
       <imageobject>
-        <imagedata align="center" fileref="Intro1.png" format="PNG"
+        <imagedata align="center" fileref="NewMainScreen.png" format="PNG"
                    scalefit="1" />
       </imageobject>
     </mediaobject>

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/TestScenarioEditor.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/TestScenarioEditor.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/analysis.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/analysis.png)
===================================================================
(Binary files differ)

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/Chapter-BRMS/rule_guis.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-brms/en/Chapter-BRMS/rule_guis.png)
===================================================================
(Binary files differ)

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/master.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/master.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-brms/en/master.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<book xmlns:xi="http://www.w3.org/2003/XInclude">
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
   <bookinfo>
     <title>Drools BRMS</title>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/Chapter-Examples/Section-Examples.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/Chapter-Examples/Section-Examples.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/Chapter-Examples/Section-Examples.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -31,7 +31,7 @@
 
 PackageBuilder builder = new PackageBuilder();
 
-//this wil parse and compile in one step
+//this will parse and compile in one step
 builder.addPackageFromDrl( source );
 
 // Check the builder for errors

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/master.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/master.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-examples/en/master.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<book xmlns:xi="http://www.w3.org/2003/XInclude">
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
   <bookinfo>
     <title>Drools Examples</title>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-solver/en/master.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-solver/en/master.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-solver/en/master.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<book xmlns:xi="http://www.w3.org/2003/XInclude">
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
   <bookinfo>
     <title>Drools Solver (experimental)</title>
 

Copied: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Key.png (from rev 19036, labs/jbossrules/trunk/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Key.png)
===================================================================
(Binary files differ)

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Section-Spreadsheet.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Section-Spreadsheet.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Decision_Tables/Section-Spreadsheet.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -175,7 +175,7 @@
     case, it will generate: Person(age=="42") etc (where 42 comes from row
     18). In the above example, the "==" is implicit (if you just put a field
     name, it will assume that you are looking for exact matches). Also note
-    that you can have a ObjectType declaration span columns (via merged cells)
+    that you can have an ObjectType declaration span columns (via merged cells)
     - and that means that all columns below the merged range will be combined
     into the one set of constraints.</para>
 
@@ -312,7 +312,7 @@
 
               <entry>Description</entry>
 
-              <entry>Is required?</entry>
+              <entry>Inclusion Status</entry>
             </row>
           </thead>
 
@@ -340,7 +340,7 @@
               <entry>Import</entry>
 
               <entry>The cell to the right contains a comma separated list of
-              java classes to import</entry>
+              Java classes to import</entry>
 
               <entry>optional</entry>
             </row>
@@ -419,7 +419,7 @@
               <entry>Variables</entry>
 
               <entry>The cell immediately to the right can contain global
-              declarations which drools supports. This is a type, followed by a
+              declarations which Drools supports. This is a type, followed by a
               variable name. (if multiple variables are needed, comma separate
               them).</entry>
 
@@ -427,10 +427,9 @@
             </row>
 
             <row>
-              <entry>UNLOOP</entry>
+              <entry>No-loop or Unloop</entry>
 
-              <entry>Indicates that if there cell values in this column, the
-              no-loop attribute should be set</entry>
+              <entry>Placed in the header of a table, no-loop or unloop will both complete the same function of not allowing a rule (row) to loop. For this option to function correctly, there must be a value (true or false) in the cell for the option to take effect. If the cell is left blank then this option will not be set for the row.</entry>
 
               <entry>optional</entry>
             </row>
@@ -464,6 +463,17 @@
 
         <mediaobject>
           <imageobject>
+            <imagedata fileref="Key.png" />
+          </imageobject>
+        </mediaobject>
+      </screenshot>
+
+      <screenshot>
+        <screeninfo>Example usage of keywords for imports, functions
+        etc.</screeninfo>
+
+        <mediaobject>
+          <imageobject>
             <imagedata fileref="keywords.png" />
           </imageobject>
         </mediaobject>
@@ -484,7 +494,7 @@
     the rules if needed).</para>
 
     <para>To get started, you can find a sample spreadsheet and base it on
-    that. Alternatively, if you are using the plug in (Rule Workbench IDE) the
+    that. Alternatively, if you are using the plug-in (Rule Workbench IDE) the
     wizard can generate a spreadsheet for you from a template (to edit it you
     will need to use an xls compatible spreadsheet editor). <screenshot>
         <screeninfo>Wizard in the IDE</screeninfo>
@@ -577,4 +587,5 @@
       http://www.drools.org/Business+rules+in+decision+tables+explained</para>
     </section>
   </section>
-</section>
\ No newline at end of file
+  
+</section>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Deployment/Section-Deployment.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Deployment/Section-Deployment.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Deployment/Section-Deployment.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -212,7 +212,7 @@
 
       <para>Use the PackageBuilder class out of process, and then use
       getPackage() to get the Package object. You can then (for example)
-      serialize the Package object to a file (using standard java
+      serialize the Package object to a file (using standard Java
       serialization). The runtime system, which only needs drools-core, can
       then load the file using
       RuleBaseFactory.newRuleBase().addPackage(deserialized package
@@ -287,4 +287,5 @@
     <para>A future release of Drools will contain a rule repository (server)
     component that will directly support the above patterns, and more.</para>
   </section>
+  
 </section>
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-IDE/Section-QuickStart.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-IDE/Section-QuickStart.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-IDE/Section-QuickStart.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -7,7 +7,7 @@
   <para>
     The IDE provides developers (and very technical users) with an environment to edit and test rules in various formats, and integrate it deeply with their applications. In cases where you prefer business rules and web tooling, you will want to look at the BRMS (but using the BRMS and the IDE together is not uncommon).</para>
 
-  <para>The Drools IDE is delivered as an eclipse plugin, which
+  <para>The Drools IDE is delivered as an Eclipse plug-in, which
   allows you to author and manage rules from within Eclipse, as well as
   integrate rules with your application. This is an optional tool, and not all
   components are required to be used, you can use what components are relevant
@@ -20,7 +20,7 @@
   on Eclipse, and integrators are free to use their tools of choice, as always
   ! Plenty of people use IntelliJ with rules, for instance.</para>
 
-  <para>Note you can get the plug in either as a zip to download, or from an
+  <para>Note you can get the plug-in either as a zip to download, or from an
   update site (refer to the chapter on installation).</para>
 
   <figure>
@@ -106,7 +106,7 @@
     </orderedlist>
 
     <para>You can see the above features make use of Eclipse infrastructure
-    and features. All of the power of eclipse is available.</para>
+    and features. All of the power of Eclipse is available.</para>
   </section>
 
   <section>
@@ -126,7 +126,7 @@
       </mediaobject>
     </figure>
 
-      <para>When you choose to create a new "rule project" - you will get a choice to add some default artifacts to it (like rules, decision tables, ruleflows etc). These can serve as a starting point, and will give you something executable to play with (which you can then modify and mould to your needs). The simplest case (a hello world rule) is shown below. Feel free to experiment with the plugin at this point.</para>
+      <para>When you choose to create a new "rule project" - you will get a choice to add some default artifacts to it (like rules, decision tables, ruleflows etc). These can serve as a starting point, and will give you something executable to play with (which you can then modify and mould to your needs). The simplest case (a hello world rule) is shown below. Feel free to experiment with the plug-in at this point.</para>
 
     <figure>
       <title>New rule project result</title>
@@ -139,16 +139,16 @@
     </figure>
 
     <para>The newly created project contains an example rule file (Sample.drl)
-    in the src/rules dir and an example java file (DroolsTest.java) that can
-    be used to execute the rules in a Drools engine in the folder src/java, in
+    in the src/rules dir and an example Java file (DroolsTest.Java) that can
+    be used to execute the rules in a Drools engine in the folder src/Java, in
     the com.sample package. All the others jars that are necessary during
     execution are also added to the classpath in a custom classpath container
-    called Drools Library. Rules do not have to be kept in "java"
+    called Drools Library. Rules do not have to be kept in "Java"
     projects at all, this is just a convenience for people who are already
-    using eclipse as their Java IDE.</para>
+    using Eclipse as their Java IDE.</para>
 
-    <para>Important note: The Drools plug in adds a "Drools Builder"
-    capability to your eclipse instance. This means you can enable a builder
+    <para>Important note: The Drools plug-in adds a "Drools Builder"
+    capability to your Eclipse instance. This means you can enable a builder
     on any project that will build and validate your rules when resources
     change. This happens automatically with the Rule Project Wizard, but you
     can also enable it manually on any project. One downside of this is if you
@@ -183,7 +183,7 @@
     of location, typically you would create a top level /rules directory to
     store your rules if you are creating a rule project, and store it in a
     suitably named subdirectory. The package name is mandatory, and is similar
-    to a package name in java (ie. its a namespace that groups like rules
+    to a package name in Java (ie. its a namespace that groups like rules
     together).</para>
 
     <figure>
@@ -206,7 +206,7 @@
 
     <para>The rule editor is where rule managers and developers will be
     spending most of their time. The rule editor follows the pattern of a
-    normal text editor in eclipse, with all the normal features of a text
+    normal text editor in Eclipse, with all the normal features of a text
     editor. On top of this, the rule editor provides pop up content
     assistance. You invoke popup content assistance the "normal" way by
     pressing Control + Space at the same time.</para>
@@ -536,7 +536,7 @@
       loaded for editing). The Rule language mapping is the "code" for the
       rules - which the language expression will be compiled to by the rule
       engine compiler. For form of this Rule language depends if it is for a
-      condition or action part of a rule (it may be a snippet of java, for
+      condition or action part of a rule (it may be a snippet of Java, for
       instance). The "scope" item indicates where the expression is targeted:
       is it for the "when" part of the rule (LHS)? the "then" part (RHS)? Or
       anywhere?</para>
@@ -567,7 +567,7 @@
       to 2 constraints on a fact of type Person (ie the person object has the
       age field as less than {age}, and the location value is the string of
       {value}, where {age} and {value} are pulled out of the original rule
-      source. The Rule mapping may be a java expression (such as if the scope
+      source. The Rule mapping may be a Java expression (such as if the scope
       was "then"). If you did not wish to use a language mapping for a
       particular rule in a drl, prefix the expression with &gt; and the
       compiler will not try to translate it according to the language
@@ -590,7 +590,7 @@
 
     <para>There is no export function, which creates a gif or jpeg picture, in
     the current release. Please use ctrl + alt + print to create a copy of
-    your current eclipse window and cut it off.</para>
+    your current Eclipse window and cut it off.</para>
 
     <mediaobject>
       <imageobject>
@@ -621,10 +621,10 @@
     permanent generation max size. Both SUN and IBM jdk have a permanent
     generation, whereas BEA JRockit does not.</para>
 
-    <para>To increase the permanent generation, start eclipse with
+    <para>To increase the permanent generation, start Eclipse with
     -XX:MaxPermSize=###m</para>
 
-    <para>Example: c:\eclipse\eclipse.exe -XX:MaxPermSize=128m</para>
+    <para>Example: c:\Eclipse\Eclipse.exe -XX:MaxPermSize=128m</para>
 
     <para>Rulesets of 4,000 rules or greater should set the permanent
     generation to atleast 128Mb.</para>
@@ -715,11 +715,11 @@
             <listitem>
               <para>Change the name of your debug configuration to something meaningful.
           You can just accept the defaults for all other properties.  For more information
-          about these properties, please check the eclipse jdt documentation.</para>
+          about these properties, please check the Eclipse jdt documentation.</para>
             </listitem>
             <listitem>
               <para>Click the "Debug" button on the bottom to start debugging your application. You only have to define your debug configuration once.  The next time you try to run your Drools application, you don't have to create a new one but select the one you defined previously by selecting it in the tree on the left, as a sub-element of the "Drools Application"
-     tree node, and then click the Debug button.  The eclipse toolbar also contains shortcut
+     tree node, and then click the Debug button.  The Eclipse toolbar also contains shortcut
      buttons to quickly re-execute the one of your previous configurations (at least when the
      Java, Java Debug, or Drools perspective has been selected).
               </para>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Checkout.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Checkout.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Checkout.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -20,7 +20,7 @@
     </listitem>
   </itemizedlist>
 
-To checkout drools source code just execute the following command.
+To checkout Drools source code just execute the following command.
 
 <programlisting>fmeyer:~/jboss $ svn checkout http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/ jbossrules</programlisting>
 
@@ -93,7 +93,7 @@
 
 
 
-  <para>Although, we highly recommend command line tools to work with repository you can also use both eclipse's integrated SVN client or TortoiseSVN</para> 
+  <para>Although, we highly recommend command line tools to work with repository you can also use both Eclipse's integrated SVN client or TortoiseSVN</para> 
 
   <para>Setup TortoiseSVN to checkout from the subversion repository and click
   <literal>'OK'</literal> Once the checkout has finished you should see the

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Eclipse.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Eclipse.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Eclipse.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -5,20 +5,20 @@
   <section>
     <title>Generating Eclipse Projects</title>
 
-    <para>The drools project has eclipse projects checked in for convenience.
+    <para>The Drools project has Eclipse projects checked in for convenience.
     However, these are originally generated by maven 2. If you have maven 2
-    installed, you can also regenerate the eclipse projects automatically, or
+    installed, you can also regenerate the Eclipse projects automatically, or
     even generate it for IntelliJ etc, see the instructions below for this
     (most people can ignore this section)</para>
 
     <para><indexterm>
         <primary>maven</primary>
       </indexterm>Maven is able to generate standard <indexterm>
-        <primary>eclipse</primary>
+        <primary>Eclipse</primary>
       </indexterm>Eclipse projects, but it is not able to generate Eclipse
-    plugin projects. To generate the Eclipse projects for drools-core,
+    plug-in projects. To generate the Eclipse projects for drools-core,
     drools-compiler and drools-jsr94 type <literal>'mvn
-    eclipse:eclipse'</literal>.</para>
+    Eclipse:Eclipse'</literal>.</para>
 
     <screenshot>
       <screeninfo>Start Maven Eclipse project generation</screeninfo>
@@ -45,9 +45,9 @@
     <title>Importing Eclipse Projects</title>
 
     <para>With the <indexterm>
-        <primary>eclipse</primary>
+        <primary>Eclipse</primary>
       </indexterm>Eclispe project files generated they can now be imported
-    into eclipse. When starting Eclipse open the workspace in the root of your
+    into Eclipse. When starting Eclipse open the workspace in the root of your
     subversion checkout.</para>
 
     <screenshot>
@@ -137,7 +137,7 @@
   </section>
 
   <section>
-    <title>Exporting the IDE Plugin</title>
+    <title>Exporting the IDE plug-in</title>
 
     <para>The drools-ide project was checked out out using subversion and is
     ready for exporting.</para>
@@ -173,7 +173,7 @@
     </screenshot>
 
     <screenshot>
-      <screeninfo>Wait while the plugin is built and exported</screeninfo>
+      <screeninfo>Wait while the plug-in is built and exported</screeninfo>
 
       <mediaobject>
         <imageobject>
@@ -182,8 +182,8 @@
       </mediaobject>
     </screenshot>
 
-    <para>Once the plugin has been built open the output directory and copy
-    the jar to the Eclipse plugin directory.</para>
+    <para>Once the plug-in has been built open the output directory and copy
+    the jar to the Eclipse plug-in directory.</para>
 
     <screenshot>
       <screeninfo>Open the directory with the build jar</screeninfo>
@@ -196,7 +196,7 @@
     </screenshot>
 
     <screenshot>
-      <screeninfo>Copy the jar to the Eclipse plugin directory</screeninfo>
+      <screeninfo>Copy the jar to the Eclipse plug-in directory</screeninfo>
 
       <mediaobject>
         <imageobject>
@@ -234,17 +234,17 @@
   <section>
     <title>Building the update site</title>
 
-    <para>There is also an update site for the plug in. For developers who
+    <para>There is also an update site for the plug-in. For developers who
     want to update the update site (ha) you will need to get to the update
     site project (or create a new one). They are kept in SVN, but in
-    /jbossrules/update instead of /trunk. They are plain vanilla eclipse
+    /jbossrules/update instead of /trunk. They are plain vanilla Eclipse
     feature and site projects.</para>
 
-    <para>PLEASE REMEMBER that the plug in in the downloads directory, as a
+    <para>PLEASE REMEMBER that the plug-in in the downloads directory, as a
     zip, should also be updated at the same time as the update site (as they
-    are alternative ways ot getting the same plug in).</para>
+    are alternative ways ot getting the same plug-in).</para>
 
-    <para>Eclipse refreshing plugins in features and sites seems to not work,
+    <para>Eclipse refreshing plug-ins in features and sites seems to not work,
     so what is best is to manually edit the site.xml project and the
     feature.xml. To do this, open the site.xml file in the drools-ide-update
     project, it should look something like this: <programlisting>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
@@ -290,23 +290,24 @@
   limitations under the License.
    &lt;/license&gt;
 
-   &lt;plugin
+   &lt;plug-in
  id="org.drools.ide"
  download-size="0"
  install-size="0"
- version="1.0.0"/&gt; &lt;!-- THIS JUST HAS TO BE CONSISTENT WITH THE PLUG IN --&gt;
+ version="1.0.0"/&gt; &lt;!-- THIS JUST HAS TO BE CONSISTENT WITH THE plug-in --&gt;
 
 &lt;/feature&gt;
 </programlisting> Change the version number in the FEATURE tag to be the same
     as what you referred to in the site.xml. If you changed the version number
-    of the main plug in, you will need to put the version number in the plug
-    in tag (which refers to org.drools.ide plugin). Then zip up the
+    of the main plug-in, you will need to put the version number in the plug
+    in tag (which refers to org.drools.ide plug-in). Then zip up the
     feature.xml into a jar with the same name as you referred to in the
     site.xml.</para>
 
-    <para>Finally, drop the plugin jar into the /plugins jar directory of the
-    update site (get the actual plug in from the exported plugin in the
+    <para>Finally, drop the plug-in jar into the /plugins jar directory of the
+    update site (get the actual plug-in from the exported plug-in in the
     previous step). Now you can upload the site as is, and it will show up as
     a new version for Eclipse clients.</para>
   </section>
+  
 </section>
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Install.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Install.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Install.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -2,19 +2,19 @@
 <section>
   <title>Installing and using</title>
 
-  <para>Drools provides an eclipse based IDE (which is optional), but at its
+  <para>Drools provides an Eclipse-based IDE (which is optional), but at its
   core only Java 1.4 (J2SE) is required.</para>
 
-  <para>A simple way to get started is to download and install the eclipse
-  plug in - this will also require the Eclipse GEF framework to be installed
+  <para>A simple way to get started is to download and install the Eclipse
+  plug-in - this will also require the Eclipse GEF framework to be installed
   (see below, if you don't have it installed already). This will provide you
   with all the dependencies you need to get going: you can simply create a new
   rule project and everything will be done for you. Refer to the chapter on
   the Rule Workbench and IDE for detailed instructions on this. Installing the
-  eclipse plugin is generally as simple as unzipping a file into your eclipse
-  plugin directory.</para>
+  Eclipse plug-in is generally as simple as unzipping a file into your Eclipse
+  plug-in directory.</para>
 
-  <para>Use of the eclipse plug in is not required. Rule files are just
+  <para>Use of the Eclipse plug-in is not required. Rule files are just
   textual input (or spreadsheets as the case may be) and the IDE (also known
   as the Rule Workbench) is just a convenience. People have integrated the
   rule engine in many ways, there is no "one size fits all".</para>
@@ -60,7 +60,7 @@
         this is essentially a layer over the drools-compiler component. Note
         that due to the nature of the JSR-94 specification, not all features
         are easily exposed via this interface. In some cases, it will be
-        easier to go direct to the drools API, but in some environments the
+        easier to go direct to the Drools API, but in some environments the
         JSR-94 is mandated.</para>
       </listitem>
 
@@ -107,23 +107,23 @@
   <section>
     <title>Installing IDE (Rule Workbench)</title>
 
-    <para>The rule workbench (for Eclipse) requires that you have eclipse 3.2
+    <para>The rule workbench (for Eclipse) requires that you have Eclipse 3.2
     or greater, as well as Eclipse GEF 3.2 or greater. You can install it
-    either by downloading the plugin or, or using the update site.</para>
+    either by downloading the plug-in or, or using the update site.</para>
 
     <para>Another option is to use the JBoss IDE, which comes with all the
-    plug in requirements pre packaged, as well as a choice of other tools
+    plug-in requirements pre packaged, as well as a choice of other tools
     separate to rules. You can choose just to install rules from the "bundle"
     that JBoss IDE ships with.</para>
 
     <section>
       <title>Installing GEF (a required dependency)</title>
 
-      <para>GEF is the eclipse Graphical Editing Framework, which is used for
-      graph viewing components in the plug in.</para>
+      <para>GEF is the Eclipse Graphical Editing Framework, which is used for
+      graph viewing components in the plug-in.</para>
 
       <para>If you don't have GEF installed, you can install it using the
-      built in update mechanism (or downloading GEF from the eclipse.org
+      built in update mechanism (or downloading GEF from the Eclipse.org
       website not recommended). JBoss IDE has GEF already, as do many other "distributions" of
       Eclipse, so this step may be redundant for some people.</para>
 
@@ -131,7 +131,7 @@
       from the help menu. Then you choose the Calisto update site:</para>
 
 	  <para>If you aren't using Calisto you can use the following update site do download GEF</para>
-	  <programlisting>http://europa-mirror1.eclipse.org/tools/gef/update-site/releases/</programlisting>
+	  <programlisting>http://europa-mirror1.Eclipse.org/tools/gef/update-site/releases/</programlisting>
 	
       <screenshot>
         <mediaobject>
@@ -141,7 +141,7 @@
         </mediaobject>
       </screenshot>
 
-      <para>Next you choose the GEF plug in:</para>
+      <para>Next you choose the GEF plug-in:</para>
 
       <screenshot>
         <mediaobject>
@@ -151,34 +151,34 @@
         </mediaobject>
       </screenshot>
 
-      <para>Press next, and agree to install the plug in (an eclipse restart
+      <para>Press next, and agree to install the plug-in (an Eclipse restart
       may be required). Once this is completed, then you can continue on
-      installing the rules plug in.</para>
+      installing the rules plug-in.</para>
     </section>
 
     <section>
       <title>Installing from zip file</title>
 
       <para>To install from the zip file, download and unzip the file. Inside
-      the zip you will see a plugin directory, and the plugin jar itself. You
-      place the plugin jar into your eclipse applications plugin directory,
-      and restart eclipse.</para>
+      the zip you will see a plug-in directory, and the plug-in jar itself. You
+      place the plug-in jar into your Eclipse applications plug-in directory,
+      and restart Eclipse.</para>
     </section>
 
     <section>
       <title>Installing from the update site</title>
 
-      <para>Using the update site is a handy way to install the plug in, and
-      keep it up to date (the eclipse platform will check for updates as
+      <para>Using the update site is a handy way to install the plug-in, and
+      keep it up to date (the Eclipse platform will check for updates as
       needed). It gives you a good chance of staying up to date with
       improvements, fixes etc.</para>
 
       <para>Some firewalls may cause trouble with using update sites in
-      eclipse, if you have issues, then install it manually from the plugin.
-      Also, if you have previously installed the plug in manually, you will
-      need to manually remove it from your plug in directory.</para>
+      Eclipse, if you have issues, then install it manually from the plug-in.
+      Also, if you have previously installed the plug-in manually, you will
+      need to manually remove it from your plug-in directory.</para>
 
-      <para>Step 1. Use the eclipse help menu to find the feature installer.
+      <para>Step 1. Use the Eclipse help menu to find the feature installer.
       <screenshot>
           <screeninfo>Access the software updates menu</screeninfo>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Maven_build.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Maven_build.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Install/Section-Maven_build.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -8,21 +8,21 @@
     <para>Now that we have the source the next step is to build and install
     the source. Since version 3.1 Drools uses <indexterm>  Maven 2 </indexterm> to build the system. There are two profiles
     available which enable the associated modules "documentation" and
-    "eclipse"; this enables quicker building of the core modules for
-    developers. The eclipse profile will download eclipse into the
-    drools-eclipse folder, which is over 100MB download (It depends on your operating system), however this only
-    needs to be done once; if you wish you can move that eclipse download into
+    "Eclipse"; this enables quicker building of the core modules for
+    developers. The Eclipse profile will download Eclipse into the
+    drools-Eclipse folder, which is over 100MB download (It depends on your operating system), however this only
+    needs to be done once; if you wish you can move that Eclipse download into
     another location and specify it with
-    -DlocalEclipseDrop=/folder/jboss-rules/local-eclipse-drop-mirror. The
-    following builds all the jars, the documentation and the eclipse zip with
-    a local folder specified to avoid downloading eclipse:</para>
+    -DlocalEclipseDrop=/folder/jboss-rules/local-Eclipse-drop-mirror. The
+    following builds all the jars, the documentation and the Eclipse zip with
+    a local folder specified to avoid downloading Eclipse:</para>
 
-    <para><programlisting>mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-rules/local-eclipse-drop-mirror </programlisting></para>
+    <para><programlisting>mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-rules/local-Eclipse-drop-mirror </programlisting></para>
 
     <para>You can produce distribution builds, which puts everything into
     zips, as follows:
-<programlisting>mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-rules/local-eclipse-drop-mirror
-mvn -Ddocumentation -Declipse -Dmaven.test.skip package javadoc:javadoc assembly:assembly -DlocalEclipseDrop=/folder/jboss-rules/local-eclipse-drop-mirror
+<programlisting>mvn -Declipse -Ddocumentation clean install -DlocalEclipseDrop=/folder/jboss-rules/local-Eclipse-drop-mirror
+mvn -Ddocumentation -Declipse -Dmaven.test.skip package javadoc:javadoc assembly:assembly -DlocalEclipseDrop=/folder/jboss-rules/local-Eclipse-drop-mirror
 </programlisting></para>
 
     <para>Note that install must be done first as javadoc:javadoc won't work
@@ -82,9 +82,9 @@
       </listitem>
 
       <listitem>
-        <para>eclipse</para>
+        <para>Eclipse</para>
 
-        <para>Documentation suitable for including in an eclipse plugin</para>
+        <para>Documentation suitable for including in an Eclipse plug-in</para>
       </listitem>
     </itemizedlist>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Release_Notes/Section-Upgrade_tips.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Release_Notes/Section-Upgrade_tips.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Release_Notes/Section-Upgrade_tips.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -184,7 +184,7 @@
     and as so, it is a safe tool to use for upgrade large sets of rule
     files.</para>
 
-    <para>The drools update tool can be found as a maven project in the
+    <para>The Drools update tool can be found as a maven project in the
     following source repository
     http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/experimental/drools-update/
     you just need to check it out, and execute the maven clean install action
@@ -248,7 +248,7 @@
     <title>Rule flow Update for 4.0.2</title>
 
     <para>
-    	The Rule flow feature was updated for 4.0.2, and now all your ruleflows must decalre a package name.
+    	The Rule flow feature was updated for 4.0.2, and now all your ruleflows must declare a package name.
     </para>
 
   <figure>
@@ -263,4 +263,5 @@
     </figure>
 
   </section>
+  
 </section>
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rete_Algorithm.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rete_Algorithm.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rete_Algorithm.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -41,8 +41,7 @@
   it. This way, if an application asserts a new account, it won't propagate to
   the nodes for the Order object. In Drools when an object is asserted it
   retrieves a list of valid ObjectTypesNodes via a lookup in a HashMap from
-  the object's Class; if this list doesn't exist it scans all the ObjectTypde
-  nodes finding valid matches which it caches in the list. This enables Drools
+  the object's Class; if this list doesn't exist it scans all the ObjectTypeNodes finding valid matches which it caches in the list. This enables Drools
   to match against any Class type that matches with an
   <literal>instanceof</literal> check.</para>
 
@@ -56,7 +55,7 @@
     </mediaobject>
   </figure>
 
-  <para>ObjectTypdeNodes can propagate to AlphaNodes, LeftInputAdapterNodes
+  <para>ObjectTypeNodes can propagate to AlphaNodes, LeftInputAdapterNodes
   and BetaNodes. AlphaNodes are used to evaluate literal conditions. Although
   the 1982 paper only covers equality conditions, many RETE implementations
   support other operations. For example, Account.name == "Mr Trout" is a
@@ -78,10 +77,10 @@
     </mediaobject>
   </figure>
 
-  <para>Drools extends Rete by optimizing the propagation from ObjectTypdeNode
+  <para>Drools extends Rete by optimizing the propagation from ObjectTypeNode
   to AlphaNode using hashing. Each time an AlphaNode is added to an
-  ObjectTypdeNode it adds the literal value as a key to the HashMap with the
-  AlphaNode as the value. When a new instance enters the ObjectTypde node,
+  ObjectTypeNode it adds the literal value as a key to the HashMap with the
+  AlphaNode as the value. When a new instance enters the ObjectType node,
   rather than propagating to each AlphaNode, it can instead retrieve the
   correct AlphaNode from the HashMap - avoiding unnecessary literal
   checks.</para>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rules.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rules.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Rules.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -314,6 +314,7 @@
     private String studentName;
     private int score;
     
+    }
     </programlisting>
 
     <para>Java is Turing complete in that you can write code, among other
@@ -345,7 +346,7 @@
 
     <programlisting>
 
-      select 
+select
     * 
 from 
     Students s 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-The_Drools_Rule_Engine.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-The_Drools_Rule_Engine.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-The_Drools_Rule_Engine.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -512,7 +512,7 @@
       does not help to use update(). The only way to safely change an
       attribute of a fact whose shadow fact is disabled is to call
       modifyRetract() before changing the attribute, change the attribute and
-      call modifyAssert().</remark>
+      call modifyInsert().</remark>
     </section>
 
     <section>
@@ -523,7 +523,7 @@
       means that the engine will automatically know when a fact has changed,
       and behave accordingly (you don't need to tell it that it is modified).
       There are proxy libraries that can help automate this (a future version
-      of drools will bundle some to make it easier). To use the Object in
+      of Drools will bundle some to make it easier). To use the Object in
       dynamic mode specify true for the second assertObject parameter.</para>
 
       <programlisting>Cheese stilton = new Cheese("stilton");
@@ -568,7 +568,7 @@
       external source). For instance, if a new working memory is created, and
       no facts are asserted, calling the fireAllRules will cause the Initial
       Fact to propagate, possibly activating rules (otherwise, nothing would
-      happen as there area no other facts to start with).</para>
+      happen as there are no other facts to start with).</para>
     </section>
   </section>
 
@@ -633,14 +633,14 @@
     need access to any results information they can use the executeWithResults
     method, which returns a StatelessSessionResult. The reason for this is in
     remoting situations you do not always want the return payload, so this way
-    its optional.</para>
+    it's optional.</para>
 
     <para>setAgendaFilter, setGlobal and setGlobalResolver share their state
     across sessions; so each call to execute() will use the set AgendaFilter,
     or see any previous set globals etc.</para>
 
     <para>StatelessSessions do not currently support
-    propertyChangeLissteners.</para>
+    propertyChangeListeners.</para>
 
     <para>Async versions of the Execute method are supported, remember to
     override the ExecutorService implementation when in special managed thread
@@ -663,7 +663,7 @@
     </figure>
 
     <para>StatelessSession.executeWithResults(....) returns a minimal api to
-    examine the sessions data. The inserted Objects can be iterated over,
+    examine the session's data. The inserted Objects can be iterated over,
     queries can be executed and globals retrieved. Once the
     StatelessSessionResult is serialized it loses the reference to the
     underlying WorkingMemory and RuleBase, so queries can no longer be
@@ -679,7 +679,7 @@
     ReferenceOriginalGlobalExporter just passes a reference to the original
     Global Resolver; the latter should be used with care as identifier
     instances can be changed at any time by the StatelessSession and the
-    GlobalResolver may not be serializable freindly.</para>
+    GlobalResolver may not be serializable friendly.</para>
 
     <example>
       <title>GlobalExporter with StatelessSessions</title>
@@ -716,7 +716,7 @@
     <orderedlist>
       <listitem>
         <para>Working Memory Actions - this is where most of the work takes
-        place - in either the Consequence or the main java application
+        place - in either the Consequence or the main Java application
         process. Once the Consequence has finished or the main Java
         application process calls fireAllRules() the engine switches to the
         Agenda Evaluation phase.</para>
@@ -791,7 +791,7 @@
 
       <para>Each time setFocus(...) is called it pushes that Agenda Group onto
       a stack, when the focus group is empty it is popped off and the next one
-      of the stack evaluates. An Agenda Group can appear in multiple locations
+      on the stack evaluates. An Agenda Group can appear in multiple locations
       on the stack. The default Agenda Group is "MAIN", all rules which do not
       specify an Agenda Group are placed there, it is also always the first
       group on the Stack and given focus as default.</para>
@@ -817,7 +817,7 @@
 
       <itemizedlist>
         <listitem>
-          <para>RuleNameEndWithAgendaFilter</para>
+          <para>RuleNameEndsWithAgendaFilter</para>
         </listitem>
 
         <listitem>
@@ -834,8 +834,7 @@
       </itemizedlist>
 
       <para>To use a filter specify it while calling FireAllRules. The
-      following example will filter out all rules ending with the text
-      "Test":</para>
+      following example will only allow activation of rules ending with the test <emphasis>Test</emphasis>. All others will be filtered out:</para>
 
       <programlisting>workingMemory.fireAllRules( new RuleNameEndsWithAgendaFilter( "Test" ) );      </programlisting>
     </section>
@@ -1031,7 +1030,7 @@
 
     <programlisting>session.addEventListener( new DebugWorkingMemoryEventListener() );        </programlisting>
 
-    <para>The Eclipse based Rule IDE also provides an audit logger and
+    <para>The Eclipse-based Rule IDE also provides an audit logger and
     graphical viewer, so that the rule engine can log events for later
     viewing, and auditing.</para>
   </section>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Engine/Section-Why_use_a_Rule_Engine.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -66,7 +66,7 @@
         <para>Speed and Scalability</para>
 
         <para>The Rete algorithm, Leaps algorithm, and its descendants such as
-        Drools' Reteoo (and Leaps), provide very efficient ways of matching
+        Drools' ReteOO (and Leaps), provide very efficient ways of matching
         rule patterns to your domain object data. These are especially
         efficient when you have datasets that do not change entirely (as the
         rule engine can remember past matches). These algorithms are battle

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-DSL.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-DSL.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-DSL.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -67,7 +67,7 @@
     part on the right of the "=" is the mapping into the rule language (of
     course the form of this depends on if you are talking about the RHS or the
     LHS - if its the LHS, then its the normal LHS syntax, if its the RHS then
-    its fragments of java code for instance).</para>
+    its fragments of Java code for instance).</para>
 
     <para>The parser will take the expression you specify, and extract the
     values that match where the {something} (named Tokens) appear in the

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Function.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Function.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Function.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -19,7 +19,7 @@
   </figure>
 
   <para>Functions are a way to put semantic code in your rule source file, as
-  opposed to in normal java classes. They can't do anything more then what you
+  opposed to in normal Java classes. They can't do anything more then what you
   can do with helper classes (in fact, the compiler generates the helper class
   for you behind the scenes). The main advantage of using functions in a rule
   is that you can keep the logic all in one place, and you can change the
@@ -37,7 +37,7 @@
 </programlisting>
 
   <para>Note that the "function" keyword is used, even though its not really
-  part of java. Parameters to the function are just like a normal method (and
+  part of Java. Parameters to the function are just like a normal method (and
   you don't have to have parameters if they are not needed). Return type is
   just like a normal method.</para>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Package.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Package.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Package.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -25,7 +25,7 @@
 
   <para>The following rail road diagram shows all the components that may make
   up a package. Note that a package MUST have a namespace and be declared
-  using standard java conventions for package names; i.e. no spaces, unlike
+  using standard Java conventions for package names; i.e. no spaces, unlike
   rule names which allow spaces. In terms of the order of elements, they can
   appear in any order in the rule file, with the exception of the "package"
   and "expander" statements being at the top of the file, before any rules
@@ -59,7 +59,7 @@
     <para>Import statements work like import statements in Java. You need to
     specify the fully qualified paths and type names for any objects you want
     to use in the rules. Drools automatically imports classes from the same
-    named java package and from the java.lang package.</para>
+    named Java package and from the java.lang package.</para>
   </section>
 
   <section>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Rule.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Rule.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-Rule.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -480,7 +480,7 @@
           <title>JavaBeans as facts</title>
 
           <para>A field is an accessible method on the object. If your model
-          objects follow the java bean pattern, then fields are exposed using
+          objects follow the Java bean pattern, then fields are exposed using
           "getXXX" or "isXXX" methods (these are methods that take no
           arguments, and return something). You can access fields either by
           using the bean-name convention (so "getType" can be accessed as
@@ -607,7 +607,7 @@
                 </indexterm>Regular Expression. Typically that regexp is a
               String, but variables that resolve to a valid regexp are also
               allowed. It is important to note that <emphasis>different from
-              java</emphasis>, if you write a String regexp directly on the
+              Java</emphasis>, if you write a String regexp directly on the
               source file, <emphasis>you don't need to escape '\'</emphasis>.
               Example:</para>
 
@@ -627,7 +627,7 @@
               fields. Returns true when the match is false. Typically that
               regexp is a String, but variables that resolve to a valid regexp
               are also allowed.It is important to note that
-              <emphasis>different from java</emphasis>, if you write a String
+              <emphasis>different from Java</emphasis>, if you write a String
               regexp directly on the source file, <emphasis>you don't need to
               escape '\'</emphasis>. Example:</para>
 
@@ -751,7 +751,7 @@
             <simplesect>
               <title>Numeric</title>
 
-              <para>All standard java numeric primitives are supported.</para>
+              <para>All standard Java numeric primitives are supported.</para>
 
               <example>
                 <title>Numeric Literal Restriction</title>
@@ -851,7 +851,7 @@
               <para>'likes' is our variable, our Declaration, that is bound to
               the favouriteCheese field for any matching Person instance and
               is used to constrain the type of Cheese in the following
-              Pattern. Any valid java variable name can be used, including
+              Pattern. Any valid Java variable name can be used, including
               '$'; which you will often see used to help differentiate
               declarations from fields. The example below shows a declaration
               bound to the Patterns Object Type instance itself and used with
@@ -1530,7 +1530,7 @@
       <para>The <emphasis role="bold">collect</emphasis> CE result pattern can
       be any concrete class that implements tha java.util.Collection interface
       and provides a default no-arg public constructor. I.e., you can use
-      default java collections like ArrayList, LinkedList, HashSet, etc, or
+      default Java collections like ArrayList, LinkedList, HashSet, etc, or
       your own class, as long as it implements the java.util.Collection
       interface and provide a default no-arg public constructor.</para>
 
@@ -1675,7 +1675,7 @@
       result with the Number() pattern and if the double value is greater than
       100, the rule will fire.</para>
 
-      <para>The example used java as the semantic dialect, and as such, note
+      <para>The example used Java as the semantic dialect, and as such, note
       that the usage of ';' is mandatory in the init, action and reverse code
       blocks. The result is an expression and as such, it does not admit ';'.
       If the user uses any other dialect, he must comply to that dialect
@@ -1775,7 +1775,7 @@
         needed, custom, domain specific functions can easily be added to the
         engine and rules can start to use them without any restrictions. To
         implement a new Accumulate Functions all one needs to do is to create
-        a java class that implements the
+        a Java class that implements the
         org.drools.base.acumulators.AccumulateFunction interface and add a
         line to the configuration file or set a system property to let the
         engine know about the new function. As an example of an Accumulate
@@ -1919,7 +1919,7 @@
     cuts to the KnowldgeHelper instance (refer to the KnowledgeHelper
     interface for more advanced operations). The KnowledgeHelper interface is
     made available to the RHS code block as a variable called "drools". If you
-    provide "Property Change Listeners" to your java beans that you are
+    provide "Property Change Listeners" to your Java beans that you are
     inserting into the engine, you can avoid the need to call "update" when
     the object changes.</para>
   </section>

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-RuleFlow.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-RuleFlow.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-RuleFlow.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -80,7 +80,7 @@
     <title>How to build a rule flow</title>
 
     <para>Ruleflows can only be created by using the graphical ruleflow editor which is
-    part of the Drools plugin for Eclipse.  Once you have set up a Drools project (check
+    part of the Drools plug-in for Eclipse.  Once you have set up a Drools project (check
     the IDE chapter if you do not know how to do this), you can start adding ruleflows.
     When in a project, use "control+N" to launch the new wizard, or right-click the directory
     you would like to put your ruleflow in and select "New ... Other ...":</para>
@@ -102,7 +102,7 @@
     <para>Next you will see the graphical ruleflow editor. Now would be a good time to
     switch to the "Drools perspective" (if you haven't done so already) - this will tweak the UI so
     it is optimal for rules. Then ensure that you can see the "properties"
-    panel down the bottom of the eclipse window, as it will be necessary to fill in the different
+    panel down the bottom of the Eclipse window, as it will be necessary to fill in the different
     properties of the elements in your ruleflow.  If you cannot see the properties view, open it using
     the Menu Window - Show View - Other ..., and under the General folder select the Properties view.</para>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-XML.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-XML.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/Chapter-Rule_Language/Section-XML.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -33,7 +33,7 @@
     between XML formats). Note you can always generate normal DRL as
     well.</para>
 
-    <para>Alternatively you may be embedding drools in a product that already
+    <para>Alternatively you may be embedding Drools in a product that already
     uses XML for configuration, so you would like the rules to be in an XML
     format. You may be creating your own rule language on XML - note that you
     can always use the AST objects directly to create your own rule language
@@ -283,7 +283,7 @@
     specify a type (class) and perhaps bind a variable to an instance of that
     class. Nested under the pattern object are constraints and conditional
 	elements that have to be met. The Predicate and Return Value constraints 
-	allow java expressions to be embedded.</para>
+	allow Java expressions to be embedded.</para>
 
     <para>That leaves the conditional elements, not, exists, and, or etc. They
     work like their DRL counterparts. Elements that are nested under and an
@@ -292,7 +292,7 @@
     for the existence or non existence of a fact meeting its
     constraints.</para>
 
-    <para>The Eval element allows the execution of a valid snippet of java
+    <para>The Eval element allows the execution of a valid snippet of Java
     code - as long as it evaluates to a boolean (do not end it with a
     semi-colon, as it is just a fragment) - this can include calling a
     function. The Eval is less efficient then then columns, as the rule engine

Modified: labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/master.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/master.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-docs/drools-docs-userguide/en/master.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<book xmlns:xi="http://www.w3.org/2003/XInclude">
+<book xmlns:xi="http://www.w3.org/2001/XInclude">
   <bookinfo>
     <title>Drools User Guide</title>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleFlowLauncherSample.java.template	2008-03-17 17:22:29 UTC (rev 19037)
@@ -50,7 +50,7 @@
 		
 		PackageBuilder builder = new PackageBuilder();
 
-		//this wil parse and compile in one step
+		//this will parse and compile in one step
 		//NOTE: There are 2 methods here, the one argument one is for normal DRL.
 		builder.addPackageFromDrl( source );
 

Modified: labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-eclipse/drools-eclipse-plugin/src/main/resources/org/drools/eclipse/wizard/project/RuleLauncherSample.java.template	2008-03-17 17:22:29 UTC (rev 19037)
@@ -49,7 +49,7 @@
 		
 		PackageBuilder builder = new PackageBuilder();
 
-		//this wil parse and compile in one step
+		//this will parse and compile in one step
 		//NOTE: There are 2 methods here, the one argument one is for normal DRL.
 		builder.addPackageFromDrl( source );
 

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/manners/MannersBenchmark.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -2,6 +2,7 @@
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -9,13 +10,17 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Properties;
 import java.util.Random;
 import java.util.StringTokenizer;
 
 import org.drools.RuleBase;
+import org.drools.RuleBaseConfiguration;
+import org.drools.RuleBaseConfigurationTest;
 import org.drools.RuleBaseFactory;
 import org.drools.StatefulSession;
 import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
 import org.drools.rule.Package;
 
 public class MannersBenchmark {
@@ -32,13 +37,20 @@
 	private int maxHobbies = 3;
 
 	public static void main(final String[] args) throws Exception {
-		PackageBuilder builder = new PackageBuilder();
+	    PackageBuilderConfiguration config = new PackageBuilderConfiguration();
+	    config.setDumpDir( new File("/stash") );
+	    
+		PackageBuilder builder = new PackageBuilder(config);
 		builder.addPackageFromDrl(new InputStreamReader(MannersBenchmark.class
 				.getResourceAsStream("manners.drl")));
 		Package pkg = builder.getPackage();
+		
 
-		// add the package to a rulebase
-		final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
+        RuleBaseConfiguration conf = new RuleBaseConfiguration();
+        conf.setShadowProxy( false );
+        
+        // add the package to a rulebase
+		final RuleBase ruleBase = RuleBaseFactory.newRuleBase(conf);
 		ruleBase.addPackage(pkg);
 
 		StatefulSession session = ruleBase.newStatefulSession();

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/waltz/WaltzBenchmark.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/waltz/WaltzBenchmark.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/benchmark/waltz/WaltzBenchmark.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -40,10 +40,10 @@
             PackageBuilder builder = new PackageBuilder();
             builder.addPackageFromDrl( new InputStreamReader( WaltzBenchmark.class.getResourceAsStream( "waltz.drl" ) ) );
             Package pkg = builder.getPackage();
-            
             //add the package to a rulebase
             RuleBaseConfiguration conf = new RuleBaseConfiguration();
             //conf.setAlphaMemory( true );
+            conf.setShadowProxy( false );
             final RuleBase ruleBase = RuleBaseFactory.newRuleBase( conf );
             ruleBase.addPackage( pkg );
             

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/HelloWorldExample.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/HelloWorldExample.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/HelloWorldExample.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -28,7 +28,7 @@
 
         final PackageBuilder builder = new PackageBuilder();
 
-        //this wil parse and compile in one step
+        //this will parse and compile in one step
         builder.addPackageFromDrl( source );
         
         // Check the builder for errors

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/sudoku/rules/DroolsUtil.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/sudoku/rules/DroolsUtil.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/java/org/drools/examples/sudoku/rules/DroolsUtil.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -48,7 +48,7 @@
    
       PackageBuilder builder = new PackageBuilder();
    
-      //this wil parse and compile in one step
+      //this will parse and compile in one step
       //NOTE: There are 2 methods here, the one argument one is for normal DRL.
       builder.addPackageFromDrl( source );
    

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners/manners.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners/manners.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/manners/manners.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -14,13 +14,11 @@
         Path path = new Path( count.getValue(), 1, guestName );
         insert( path );
         
-        count.setValue(  count.getValue() + 1 );        
-        update( count );
+        modify( count ) { setValue ( count.getValue() + 1 )  }
 
 		System.out.println( "assign first seat :  " + seating + " : " + path );
 
-        context.setState( Context.ASSIGN_SEATS );        
-        update( context );
+        modify( context ) { setState( Context.ASSIGN_SEATS ) } 
 end
 
 rule findSeating
@@ -50,11 +48,8 @@
 
 	   System.err.println( "find seating : " + seating + " : " + path + " : " + chosen);
 
-       count.setValue(  countValue + 1 );
-       update( count );       
-
-       context.setState( Context.MAKE_PATH );
-       update( context );
+       modify( count ) {setValue(  countValue + 1 )}        
+       modify( context ) {setState( Context.MAKE_PATH )} 
 end
 
 rule makePath
@@ -72,11 +67,9 @@
         context : Context( state == Context.MAKE_PATH ) 
         seating : Seating( pathDone == false ) 
     then
-        seating.setPathDone( true ); 
-        update( seating );
+        modify( seating ) {setPathDone( true )} 
         
-        context.setState( Context.CHECK_DONE ); 
-		update( context );
+		modify( context ) {setState( Context.CHECK_DONE)}
 end
 
 
@@ -86,16 +79,14 @@
         LastSeat( lastSeat: seat )
         Seating( rightSeat == lastSeat ) 
     then
-        context.setState(Context.PRINT_RESULTS ); 
-        update( context );
+        modify( context ) {setState(Context.PRINT_RESULTS )}
 end
 
 rule continue
     when
         context : Context( state == Context.CHECK_DONE ) 
     then
-        context.setState( Context.ASSIGN_SEATS ); 
-        update( context );
+        modify( context ) {setState( Context.ASSIGN_SEATS )}
 end
 
 

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz/waltz.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz/waltz.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltz/waltz.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -30,8 +30,7 @@
         $stage: Stage ( value == Stage.DUPLICATE )
         not ( Line() )
 	then
-        $stage.setValue ( Stage.DETECT_JUNCTIONS );
-        update($stage);
+        modify($stage) {setValue ( Stage.DETECT_JUNCTIONS )} 
         long current = System.currentTimeMillis();
     	System.out.println("reversing done  : " + ( current - time ) );
     	drools.getWorkingMemory().setGlobal( "time", current);
@@ -52,12 +51,9 @@
 	    Junction junction = WaltzUtil.make_3_junction( $basePoint, $edge1P2, $edge2P2, $edge3P2 );
         System.out.println( junction );
 	    insert( junction );
-	    $edge1.setJoined(true);
-	    $edge2.setJoined(true);
-	    $edge3.setJoined(true);
-	    update( $edge1 );
-	    update( $edge2 );
-	    update( $edge3 );
+	    modify( $edge1 ) {setJoined(true)}
+	    modify( $edge2 ) {setJoined(true)}
+	    modify( $edge3 ) {setJoined(true)}
 end
 
 #If two, and only two, edges meet that have not already been joined, then
@@ -70,10 +66,8 @@
         not Edge( p1==$basePoint, p2 != $edge1P2, p2 != $edge2P2 )
 	then
 	    insert( new Junction($edge1P2, $edge2P2, 0, $basePoint, Junction.L) );
-	    $edge1.setJoined(true);
-	    $edge2.setJoined(true);
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setJoined(true)}
+	    modify( $edge2 ) {setJoined(true)}
 	    System.out.println("make L");
 end
 
@@ -83,8 +77,7 @@
     when
         $stage : Stage ( value == Stage.DETECT_JUNCTIONS )
  	then
- 	    $stage.setValue( Stage.FIND_INITIAL_BOUNDARY );
- 	    update( $stage );
+ 	    modify( $stage ) {setValue( Stage.FIND_INITIAL_BOUNDARY )}
     	System.out.println("detecting done");
 end
 
@@ -97,12 +90,9 @@
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
         not Junction( basePoint > $basePoint )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.B );
-	    $stage.setValue( Stage.FIND_SECOND_BOUNDARY );
-	    update( $edge1 );
-	    update( $edge2 );
-	    update( $stage );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.B )}
+	    modify( $stage ) {setValue( Stage.FIND_SECOND_BOUNDARY )}
     	System.out.println("initial boundary junction L");
 end
 
@@ -116,14 +106,10 @@
 	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
         not Junction( basePoint > $basePoint )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.PLUS );
-	    $edge3.setLabel( Edge.B );
-	    $stage.setValue( Stage.FIND_SECOND_BOUNDARY );
-	    update( $edge1 );
-	    update( $edge2 );
-	    update( $edge3 );
-	    update( $stage );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
+	    modify( $edge3 ) {setLabel( Edge.B )}
+	    modify( $stage ) {setValue( Stage.FIND_SECOND_BOUNDARY )}
     	System.out.println("initial boundary junction arrow");
 end
 
@@ -137,12 +123,9 @@
 	    $edge2 : Edge ( p1 == $basePoint, p2 == $p2 )
         not Junction( basePoint < $basePoint )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.B );
-	    $stage.setValue( Stage.LABELING );
-	    update( $edge1 );
-	    update( $edge2 );
-	    update( $stage );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.B )}
+	    modify( $stage ) {setValue( Stage.LABELING )}
     	System.out.println("second boundary junction L");
 end
 
@@ -156,14 +139,10 @@
 	    $edge3 : Edge ( p1 == $basePoint, p2 == $p3 )
         not Junction( basePoint < $basePoint )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.PLUS );
-	    $edge3.setLabel( Edge.B );
-	    $stage.setValue( Stage.LABELING );
-	    update( $edge1 );
-	    update( $edge2 );
-	    update( $edge3 );
-	    update( $stage );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
+	    modify( $edge3 ) {setLabel( Edge.B )}
+	    modify( $stage ) {setValue( Stage.LABELING )}
     	System.out.println("second boundary junction arrow");
 end
  
@@ -175,11 +154,8 @@
         $edge1: Edge( $p1:p1, $p2:p2, $label:label in ( Edge.PLUS, Edge.MINUS, Edge.B ) )
         $edge2: Edge( p1 == $p2, p2 == $p1, label == Edge.NIL )
 	then
-	    $edge1.setPlotted( true );
-	    $edge2.setLabel( $label );
-	    $edge2.setPlotted( true );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setPlotted( true )}
+	    modify( $edge2 ) {setLabel( $label ), setPlotted( true ) }
 	    System.out.println("match edge - Plot "+$label+" "+$p1+" "+$p2);
 end
 
@@ -197,8 +173,7 @@
 	    Edge( p1 == $basePoint, $Edge1P2 : p2, label in ( Edge.PLUS, Edge.MINUS ) )
         $edge: Edge( p1 == $basePoint, p2 != $Edge1P2, label == Edge.NIL )
 	then
-	    $edge.setLabel( Edge.B );
-	    update( $edge );
+	    modify( $edge ) {setLabel( Edge.B )}
   	    System.out.println("Label L");
 end 
  
@@ -209,10 +184,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.B );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.B )}
   	    System.out.println("Label tee A");	    
 end 
 
@@ -224,10 +197,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p1 )
         $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.B );
-	    $edge2.setLabel( Edge.B );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.B )}
+	    modify( $edge2 ) {setLabel( Edge.B )}
   	    System.out.println("Label tee B");	    	    
 end
 
@@ -239,10 +210,8 @@
         $edge1: Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2 )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label fork 1");	    	    
 end
 
@@ -254,8 +223,7 @@
         Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
         $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
-	    $edge.setLabel( Edge.B );
-	    update( $edge );
+	    modify( $edge ) {setLabel( Edge.B )}
   	    System.out.println("label fork 2");	   	    
 end
 
@@ -267,8 +235,7 @@
         Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.B )
         $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
-	    $edge.setLabel( Edge.MINUS );
-	    update( $edge );
+	    modify( $edge ) {setLabel( Edge.MINUS )}
   	    System.out.println("label fork 3");	   	    
 end
 
@@ -280,8 +247,7 @@
         Edge( p1 == $basePoint, $p2:p2 != $p1, label == Edge.MINUS )
         $edge: Edge( p1 == $basePoint, p2 != $p1, p2 != $p2, label == Edge.NIL )
 	then
-	    $edge.setLabel( Edge.MINUS );
-	    update( $edge );
+	    modify( $edge ) {setLabel( Edge.MINUS )}
   	    System.out.println("label fork 4");	   	    
 end
  
@@ -293,10 +259,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( $label );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( $label )}
   	    System.out.println("label arrow 1A");	   	    
 end
  
@@ -308,10 +272,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2 )
         $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( $label );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( $label )}
   	    System.out.println("label arrow 1B");	  
 end
  
@@ -323,10 +285,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p1 )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( $label );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( $label )}
   	    System.out.println("label arrow 2A");	  	    
 end
  
@@ -338,10 +298,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2 )
         $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( $label );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( $label )}
   	    System.out.println("label arrow 2B");	  	    	    
 end
  
@@ -353,10 +311,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
-	    $edge1.setLabel( Edge.MINUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.MINUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 3A");	  	    	    
 end
  
@@ -368,10 +324,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2 )
         $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.MINUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.MINUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 3B");	  	    	    
 end
  
@@ -383,10 +337,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p1 )
 	then
-	    $edge1.setLabel( Edge.MINUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.MINUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 4A");	  	    	    
 end
  
@@ -398,10 +350,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p2 )
         $edge2: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.MINUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.MINUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 4B");	  	    	    
 end
  
@@ -413,10 +363,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p1 )
         $edge2: Edge( p1 == $basePoint, p2 == $p3, label == Edge.NIL )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 5A");	  	    	    
 end
 
@@ -428,10 +376,8 @@
         $edge1: Edge( p1 == $basePoint, p2 == $p1, label == Edge.NIL )
         $edge2: Edge( p1 == $basePoint, p2 == $p3 )
 	then
-	    $edge1.setLabel( Edge.PLUS );
-	    $edge2.setLabel( Edge.PLUS );
-	    update( $edge1 );
-	    update( $edge2 );
+	    modify( $edge1 ) {setLabel( Edge.PLUS )}
+	    modify( $edge2 ) {setLabel( Edge.PLUS )}
   	    System.out.println("label arrow 5B");	  	    	    
 end
  
@@ -443,8 +389,7 @@
 	when
         $stage: Stage( value == Stage.LABELING )
 	then
-        $stage.setValue( Stage.PLOT_REMAINING_EDGES );
-        update( $stage );
+        modify( $stage ) {setValue( Stage.PLOT_REMAINING_EDGES )}
     	System.out.println("done labeling");
 end
 
@@ -455,8 +400,7 @@
 	    $edge: Edge( plotted == false, $label:label != Edge.NIL, $p1:p1, $p2:p2 )
 	then
 	    System.out.println("Plot "+$label+" "+$p1+" "+$p2);
-	    $edge.setPlotted( true );
-	    update( $edge );
+	    modify( $edge ) {setPlotted( true )}
 end
 
 # If we have been un able to label an edge, assume that it is a boundary.
@@ -468,8 +412,7 @@
 	    $edge: Edge( plotted == false, label == Edge.NIL, $p1:p1, $p2:p2 )
 	then
 	    System.out.println("Plot B "+$p1+" "+$p2);
-	    $edge.setPlotted( true );
-	    update( $edge );
+	    modify( $edge ) {setPlotted( true )}
 end
 
 # If there is no more work to do, then we are done and flag it.
@@ -477,7 +420,6 @@
 	when
 	    $stage: Stage( value == Stage.PLOT_REMAINING_EDGES )
 	then
-	    $stage.setValue( Stage.DONE );
-	    update( $stage );
+	    modify( $stage ) {setValue( Stage.DONE )}
     	System.out.println("Stage: done");
 end
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb/waltzdb.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb/waltzdb.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/benchmark/waltzdb/waltzdb.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -40,8 +40,7 @@
 		$stage : Stage( value == Stage.DUPLICATE )
 		not ( Line( ) )
 	then
-		$stage.setValue( Stage.DETECT_JUNCTIONS );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.DETECT_JUNCTIONS )}
 		System.out.println( "Stage.DETECT_JUNCTIONS" );
 end
 
@@ -71,15 +70,9 @@
 		Junction junction = new Junction( $basePoint, "3j", "make_3_junction " + $basePoint + " " + $p1 + " " + " " + $p2 + " " + $p3, "no" );
 		insert( junction );
 		System.out.println( junction.toString( ) );
-		$edge1.setJoined( true );
-		$edge1.setType( "3j" );
-		$edge2.setJoined( true );
-		$edge2.setType( "3j" );
-		$edge3.setJoined( true );
-		$edge3.setType( "3j" );
-		update( $edge1 );
-		update( $edge2 );
-		update( $edge3 );
+		modify( $edge1 ) {setJoined( true ), setType( "3j" )}
+		modify( $edge2 ) {setJoined( true ), setType( "3j" )}
+		modify( $edge3 ) {setJoined( true ), setType( "3j" )}
 end
 /*
 (p make_L
@@ -109,12 +102,8 @@
 		Junction junction = new Junction( "2j", "L", $basePoint, $p2, $p3, "no" );
 		insert( junction );
 		System.out.println( junction.toString() );
-		$edge1.setJoined( true );
-		$edge1.setType( "2j" );
-		$edge2.setJoined( true );
-		$edge2.setType( "2j" );
-		update( $edge1 );
-		update( $edge2 );
+		modify( $edge1 ) {setJoined( true ), setType( "2j" )}
+		modify( $edge2 ) {setJoined( true ), setType( "2j" )}
 end
 
 /*
@@ -130,8 +119,7 @@
 		$stage : Stage( value == Stage.DETECT_JUNCTIONS )
 		not( Edge ( joined == false ) )
 	then
-		$stage.setValue( Stage.FIND_INITIAL_BOUNDARY );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.FIND_INITIAL_BOUNDARY )}
 		System.out.println( "Stage: FIND_INITIAL_BOUNDARY" );
 end
 
@@ -156,12 +144,10 @@
 		Edge( p1 == $basePoint, p2 == $p2 )
 		not Junction( type == "2j", basePoint > $basePoint )//type == "2j" not in original
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 		insert( new EdgeLabel( $basePoint, $p1, "B", "1" ) );
 		insert( new EdgeLabel( $basePoint, $p2, "B", "1" ) );
-		$stage.setValue( Stage.FIND_SECOND_BOUDARY );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.FIND_SECOND_BOUDARY )}
 		System.out.println( "Stage.FIND_SECOND_BOUDARY" );
 end
 /*
@@ -190,13 +176,11 @@
         $edge3 : Edge( p1 == $basePoint, p2 == $p3 ) //@FIXME, is this correct? I changed edge2 to edge3
 		not ( Junction( basePoint > $basePoint ) )
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 		insert( new EdgeLabel( $basePoint, $p1, "B", "14" ) );
 		insert( new EdgeLabel( $basePoint, $p2, "+", "14" ) );
 		insert( new EdgeLabel( $basePoint, $p3, "B", "14" ) );
-		$stage.setValue( Stage.FIND_SECOND_BOUDARY );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.FIND_SECOND_BOUDARY )}
 		System.out.println( "Stage.FIND_SECOND_BOUDARY" );
 end
 
@@ -223,12 +207,10 @@
 		Edge( p1 == $basePoint, p2 == $p2)
 		not (Junction ( basePoint < $basePoint ) )
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 		insert( new EdgeLabel( $basePoint, $p1, "B", "1" ) );
 		insert( new EdgeLabel($basePoint, $p2, "B", "1" ) );
-		$stage.setValue( Stage.LABELING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.LABELING )}
 		System.out.println( "Stage.LABELING" );
 end
 
@@ -258,13 +240,11 @@
 		Edge( p1 == $basePoint, p2 == $p3 )
 		not ( Junction( basePoint < $basePoint ) )
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 		insert( new EdgeLabel( $basePoint, $p1, "B", "14" ) );
 		insert( new EdgeLabel( $basePoint, $p2, "+", "14" ) );
 		insert( new EdgeLabel( $basePoint, $p3, "B", "14" ) );
-		$stage.setValue( Stage.LABELING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.LABELING )}
 		System.out.println( "Stage.LABELING" );
 end
 
@@ -282,10 +262,8 @@
 		$stage : Stage( value == Stage.LABELING )
 		$junction : Junction( type == "3j", $basePoint : basePoint, $p1 : p1, $p2 : p2, $p3 : p3, visited == "no" )
 	then
-		$stage.setValue( Stage.VISITING_3J );
-		update( $stage );
-		$junction.setVisited( "now" );
-		update( $junction );
+		modify( $stage ) {setValue( Stage.VISITING_3J )}
+		modify( $junction ) {setVisited( "now" )}
 		System.out.println( "Stage.VISITING_3J" );
 end
 
@@ -599,11 +577,9 @@
 		$stage : Stage( value == Stage.LABELING )
 		$junction : Junction( $basePoint : basePoint, type == "2j", $p1 : p1, $p2 : p2, visited == "no" )
 	then
-		$stage.setValue( Stage.VISITING_2J );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.VISITING_2J )}
 		System.out.println( "Stage.VISITING_2J" );
-		$junction.setVisited( "now" );
-		update( $junction );
+		modify( $junction ) {setVisited( "now" )}
 end
 
 /*
@@ -746,8 +722,7 @@
 		$stage : ( Stage( value == Stage.VISITING_2J ) || Stage( value == Stage.VISITING_3J ) )
 		$junction : Junction( visited == "now" )
 	then
-		$stage.setValue( Stage.MARKING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.MARKING )}
 		System.out.println( "Stage.MARKING" );
 end
 /*
@@ -767,8 +742,7 @@
 		Edge( $p1 : p1, p2 == $basePoint )
 		$junction : Junction( basePoint == $p1, visited == "yes" )
 	then
-		$junction.setVisited( "check" );
-		update( $junction );
+		modify( $junction ) {setVisited( "check" )}
 end
 
 /*
@@ -784,8 +758,7 @@
 		Stage( value == Stage.MARKING )
 		$junction : Junction( $basePoint : basePoint, visited == "now" )
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 end
 		
 /*
@@ -798,8 +771,7 @@
 	when
 		$stage : Stage( value == Stage.MARKING )
 	then
-		$stage.setValue( Stage.CHECKING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.CHECKING )}
 		System.out.println( "Stage.CHECKING" );
 end
 
@@ -822,8 +794,7 @@
 		Junction( basePoint == $p2, visited == "yes" )
 		not ( EdgeLabel( p1 == $p2, p2 == $basePoint, labelName == $labelName ) ) 
 	then
-		$stage.setValue( Stage.REMOVE_LABEL );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.REMOVE_LABEL )}
 		System.out.println( "Stage.REMOVE_LABEL" );
 		insert ( new Illegal( $basePoint, $labelId ) );
 end
@@ -854,8 +825,7 @@
 		$edgeLabel2 : EdgeLabel( p1 == $basePoint, p2 == $p2, labelId == $labelId )
 		$edgeLabel3 : EdgeLabel( p1 == $basePoint, p2 == $p3, labelId == $labelId )
 	then
-		$stage.setValue( Stage.CHECKING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.CHECKING )}
 		System.out.println( "Stage.CHECKING" );
 		retract( $illegal );
 		retract( $edgeLabel1 );
@@ -886,8 +856,7 @@
 		$edgeLabel1 : EdgeLabel( p1 == $basePoint, p2 == $p1, labelId == $labelId )
 		$edgeLabel2 : EdgeLabel( p1 == $basePoint, p2 == $p2, labelId == $labelId )
 	then
-		$stage.setValue( Stage.CHECKING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.CHECKING )}
 		System.out.println( "Stage.CHECKING" );
 		retract( $illegal );
 		retract( $edgeLabel1 );
@@ -907,8 +876,7 @@
 		Stage( value == Stage.CHECKING )
 		$junction : Junction( $basePoint : basePoint, visited == "check" )
 	then
-		$junction.setVisited( "yes" );
-		update( $junction );
+		modify( $junction ) {setVisited( "yes" )}
 end
 
 /*
@@ -921,8 +889,7 @@
 	when
 		$stage : Stage( value == Stage.CHECKING )
 	then
-		$stage.setValue( Stage.LABELING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.LABELING )}
 		System.out.println( "Stage.LABELING" );
 end
 /*
@@ -935,8 +902,7 @@
 	when
 		$stage : Stage( value == Stage.LABELING )
 	then
-		$stage.setValue( Stage.PRINTING );
-		update( $stage );
+		modify( $stage ) {setValue( Stage.PRINTING )}
 		System.out.println( "Stage.PRINTING" );
 end
 

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HonestPolitician.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HonestPolitician.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/HonestPolitician.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -32,7 +32,6 @@
         exists( Hope() )
     then
         System.out.println( "I'm an evil corporation and I have corrupted " + politician.getName() );
-        politician.setHonest( false );
-        update( politician );
+        modify( politician ) {setHonest( false )}
 end
 

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-agendagroup.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-agendagroup.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-agendagroup.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -59,8 +59,7 @@
 #	A live cell has fewer than 2 live neighbors
 	theCell: Cell(liveNeighbors < 2, cellState == CellState.LIVE, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.KILL);
-	update( theCell );
+	modify( theCell ) {setPhase(Phase.KILL)}
 end
 
 rule "Kill The Overcrowded"
@@ -70,8 +69,7 @@
 #	A live cell has more than 3 live neighbors
 	theCell: Cell(liveNeighbors > 3, cellState == CellState.LIVE, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.KILL);
-	update( theCell );
+	modify( theCell ) {setPhase(Phase.KILL)}
 end
 
 rule "Give Birth"
@@ -81,8 +79,7 @@
 #	A dead cell has 3 live neighbors
 	theCell: Cell(liveNeighbors == 3, cellState == CellState.DEAD, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.BIRTH);
-	update( theCell );
+	modify( theCell ){setPhase(Phase.BIRTH)}
 end
 
 rule "reset calculate"
@@ -99,9 +96,7 @@
 when
 	theCell: Cell(phase == Phase.KILL)
 then
-	theCell.setCellState(CellState.DEAD);
-	theCell.setPhase(Phase.DONE);	
-	update( theCell );
+	modify( theCell ) {setCellState(CellState.DEAD), setPhase(Phase.DONE) }
 end	
  
 rule "birth"
@@ -110,9 +105,7 @@
 when
 	theCell: Cell(phase == Phase.BIRTH)
 then
-	theCell.setCellState(CellState.LIVE);
-	theCell.setPhase(Phase.DONE);
-	update( theCell );	
+	modify( theCell ){setCellState(CellState.LIVE), setPhase(Phase.DONE) }
 end	
 
 rule "Calculate Live"
@@ -122,9 +115,7 @@
 	theCell: Cell(cellState == CellState.LIVE)
 	Neighbor(cell == theCell, $neighbor : neighbor)	
 then
-	$neighbor.setLiveNeighbors( $neighbor.getLiveNeighbors() + 1 );
-	$neighbor.setPhase( Phase.EVALUATE );	
-	update( $neighbor );
+	modify( $neighbor ) {setLiveNeighbors( $neighbor.getLiveNeighbors() + 1 ), setPhase( Phase.EVALUATE )}
 end	
 
 rule "Calculate Dead"
@@ -134,9 +125,7 @@
 	theCell: Cell(cellState == CellState.DEAD)
     Neighbor(cell == theCell, $neighbor : neighbor )
 then
-	$neighbor.setLiveNeighbors( $neighbor.getLiveNeighbors() - 1 );
-	$neighbor.setPhase( Phase.EVALUATE );
-	update( $neighbor );	
+	modify( $neighbor ) {setLiveNeighbors( $neighbor.getLiveNeighbors() - 1 ), setPhase( Phase.EVALUATE )}
 end	
 
 rule "Kill All"
@@ -145,6 +134,5 @@
 when
 	theCell: Cell(cellState == CellState.LIVE)
 then
-	theCell.setCellState(CellState.DEAD);
-	update( theCell );
+	modify( theCell ) {setCellState(CellState.DEAD)}
 end
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-ruleflow.drl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-ruleflow.drl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/conway/conway-ruleflow.drl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -59,8 +59,7 @@
 #	A live cell has fewer than 2 live neighbors
 	theCell: Cell(liveNeighbors < 2, cellState == CellState.LIVE, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.KILL);
-	update( theCell );
+	modify( theCell ) {setPhase(Phase.KILL)}
 end
 
 rule "Kill The Overcrowded"
@@ -70,8 +69,7 @@
 #	A live cell has more than 3 live neighbors
 	theCell: Cell(liveNeighbors > 3, cellState == CellState.LIVE, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.KILL);
-	update( theCell );
+	modify( theCell ) {setPhase(Phase.KILL)}
 end
 
 rule "Give Birth"
@@ -81,8 +79,7 @@
 #	A dead cell has 3 live neighbors
 	theCell: Cell(liveNeighbors == 3, cellState == CellState.DEAD, phase == Phase.EVALUATE)
 then
-	theCell.setPhase(Phase.BIRTH);
-	update( theCell );
+	modify( theCell ) {setPhase(Phase.BIRTH)}
 end
 
 rule "reset calculate"
@@ -99,9 +96,7 @@
 when
 	theCell: Cell(phase == Phase.KILL)
 then
-	theCell.setCellState(CellState.DEAD);
-	theCell.setPhase(Phase.DONE);	
-	update( theCell );
+	modify( theCell ) {setCellState(CellState.DEAD), setPhase(Phase.DONE)}
 end	
  
 rule "birth"
@@ -110,9 +105,7 @@
 when
 	theCell: Cell(phase == Phase.BIRTH)
 then
-	theCell.setCellState(CellState.LIVE);
-	theCell.setPhase(Phase.DONE);
-	update( theCell );	
+	modify( theCell ) {setCellState(CellState.LIVE), setPhase(Phase.DONE)}
 end	
 
 rule "Calculate Live"
@@ -122,9 +115,7 @@
 	theCell: Cell(cellState == CellState.LIVE)
 	Neighbor(cell == theCell, $neighbor : neighbor)	
 then
-	$neighbor.setLiveNeighbors( $neighbor.getLiveNeighbors() + 1 );
-	$neighbor.setPhase( Phase.EVALUATE );	
-	update( $neighbor );
+	modify( $neighbor ) {setLiveNeighbors( $neighbor.getLiveNeighbors() + 1 ), setPhase( Phase.EVALUATE )}
 end	
 
 rule "Calculate Dead"
@@ -134,9 +125,7 @@
 	theCell: Cell(cellState == CellState.DEAD)
     Neighbor(cell == theCell, $neighbor : neighbor )
 then
-	$neighbor.setLiveNeighbors( $neighbor.getLiveNeighbors() - 1 );
-	$neighbor.setPhase( Phase.EVALUATE );
-	update( $neighbor );	
+	modify( $neighbor ) {setLiveNeighbors( $neighbor.getLiveNeighbors() - 1 ), setPhase( Phase.EVALUATE )}	
 end	
 
 rule "Kill All"
@@ -145,6 +134,5 @@
 when
 	theCell: Cell(cellState == CellState.LIVE)
 then
-	theCell.setCellState(CellState.DEAD);
-	update( theCell );
+	modify( theCell ) {setCellState(CellState.DEAD)}
 end
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/troubleticket/ticketing.dsl
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/troubleticket/ticketing.dsl	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-examples/drools-examples-drl/src/main/rules/org/drools/examples/troubleticket/ticketing.dsl	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,5 +1,5 @@
 [condition][]There is a customer ticket with status of "{status}"=customer : Customer( )   ticket : Ticket( customer == customer, status == "{status}" )
 [condition][]There is a "{subscription}" customer with a ticket status of "{status}"=customer : Customer(subscription == "{subscription}") ticket : Ticket( customer == customer, status == "{status}")
 [consequence][]Log "{message}"=System.out.println("{message} ");
-[consequence][]Escalate the ticket=ticket.setStatus("Escalate"); update(ticket);
+[consequence][]Escalate the ticket=modify(ticket) {setStatus("Escalate")}
 [consequence][]Send escalation email=sendEscalationEmail( customer, ticket );

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/build-readme.html
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/build-readme.html	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/build-readme.html	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,3 +0,0 @@
-<html><head>
-      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
-   <title>Introduction</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.70.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e1"></a>Introduction</h2></div></div><hr></div><p>This section covers the innards of the BRMS - it is not neccesary to use this if you are integrating or an end user of the BRMS application. However, JBoss Rules is open source, so build instructions form part of the manual.</p><p>You may want to build from source if you want to re-use components, or embed the application in your own.</p><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e8"></a>Design</h3></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e11"></a>Building!
  from source</h3></div></div></div><p>This section will go over the steps you will need to take to build various components. Mostly this is automated, but the manual process is described for thoroughness.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e16"></a>Modules</h4></div></div></div><p>There are 2 modules: drools-repository (back end) and drools-jbrms (front end and rules integration). The drools-jbrms module depends on the drools-repository module, as well as other components.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e21"></a>Working with Maven 2</h4></div></div></div><p>Maven 2 is used as the underlying build system. To get started, you will need to check out the WHOLE of the source tree for JBoss Rules. This includes the other modules, and the top level lib and repository directories (which are needed by the build). As the BRMS build is part of the main dr!
 ools build.</p><p>Initially, you should go into the root of the jboss-
rules checked out source tree, and run mvn install to install all the components for the inter project depedencies. If the build is broken (no ! say it isn't so !) you can use the flag -Dmaven.test.skip=true to prevent failing unit tests from preventing the build.</p><p>As the BRMS depends on drools-repository (which is the back end version storage subsystem), you then go into the drools-repository directory, and run "mvn install" to make it available. Finally, you can go into the drools-jbrms directory and run "mvn test" to check it all works, or "mvn package" to generate the web application (as well as run the tests). You should now be good to go !</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e30"></a>Working with GWT</h4></div></div></div><p>The GUI widgets for the web front end are developed with GWT (google web toolkit). If you need to make changes to or build the GUI, you will need to download GWT seperately. Onc!
 e GWT is downloaded, you can modify the build.properties file in the drools-jbrms directory to point to where you installed GWT. Once you have this, you can use the ant tasks to build the GWT components, as well as launch GWT in debug/hosted mode should you desire. If you run the build, it will update the webapp directory in the project with the new "compiled" artifacts (GWT does not use JSP, only html and javascript at runtime).</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="d0e35"></a>Debugging, Editing and running with Eclipse</h4></div></div></div><p>Each module has a ready to go and up to date eclipse project configuration, so you can just import them into your eclipse workspace. These projects are generated by maven (mvn eclipse:eclipse to refresh them). They have been manually modified to have project dependencies (means you can step through code when debugging).</p><p>Some environment variables are required in ecl!
 ipse (Window-&gt;Preferences-&gt;Java-&gt;Build path-&gt;Classpath var
iables): the M2_REPO, as normal, to point to where maven downloads shared dependencies. GWT_HOME should point to where you installed GWT. GWT_DEV must point to the platform specific "dev" jar that ships with the version of GWT you have.</p><p>How you launch from eclipse: you can launch unit test, as normal (in which case you only need M2_REPO setup - you don't even need to download GWT seperately) - OR, you can launch it in "hosted mode" using the GWT browser, which is great for debugging (from GUI to back end, you can step through code, and make changes on the fly and simply hit refresh). There is a JBRMS.launch file in in the drools-jbrms directory. This should allow Eclipse to launch the JBRMS in debug mode - open the Run dialog (Run-&gt;Run), and then choose "JBRMS" from the list. Launching this will open a new window, with the BRMS in debug mode, ready to go.</p><p>Downloading and debugging the BRMS with GWT is optional, and if you are only working on non GUI issues, yo!
 u can skip this step.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e46"></a>Re-usable components</h3></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="d0e49"></a>Versioning and Storage</h3></div></div></div></div></div></body></html>
\ No newline at end of file

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/build.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/build.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/build.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -17,7 +17,7 @@
 		<gwt:compile outDir="src/main/webapp" 
 			gwtHome="${gwt.home}"
 			classBase="org.drools.brms.JBRMS" 
-			sourceclasspath="src/main/java; ../drools-compiler/src/main/java; ../m2_repo/com/gwtext/gwtext/0.9.3/gwtext-0.9.3.jar" 
+			sourceclasspath="src/main/java; ../drools-compiler/src/main/java; ../m2_repo/com/gwtext/gwtext/2.0.1/gwtext-2.0.1.jar" 
 		/>
 	</target>
 

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/admin/CategoryManager.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -25,10 +25,16 @@
 import org.drools.brms.client.common.PrettyFormLayout;
 import org.drools.brms.client.decisiontable.GuidedDecisionTableWidget;
 import org.drools.brms.client.modeldriven.dt.ActionCol;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.AttributeCol;
 import org.drools.brms.client.modeldriven.dt.ConditionCol;
 import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+import org.drools.brms.client.packages.SuggestionCompletionCache;
+import org.drools.brms.client.rpc.MetaData;
 import org.drools.brms.client.rpc.RepositoryServiceFactory;
+import org.drools.brms.client.rpc.RuleAsset;
 
+import com.google.gwt.user.client.Command;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Composite;
@@ -99,25 +105,38 @@
 
 
         GuidedDecisionTable dt = new GuidedDecisionTable();
-        dt.data = new String[][] {
-        		new String[] {"1", "a", "b", "c"},
-        		new String[] {"2", "d", "e", "f"},
-        		new String[] {"3", "d", "q", "x"}
-        };
-        ConditionCol c1 = new ConditionCol();
-        c1.header = "Driver 1 age";
-        dt.conditionCols.add(c1);
-        ConditionCol c2 = new ConditionCol();
-        c2.header = "Driver 2 age";
-        dt.conditionCols.add(c2);
+//        dt.data = new String[][] {
+//        		new String[] {"1", "des1","", "a", "b", "c"},
+//        		new String[] {"2", "des1","" , "d", "e", "f"},
+//        		new String[] {"3",  "des3", "groupA", "d", "q", "x"}
+//        };
+//        ConditionCol c1 = new ConditionCol();
+//        c1.header = "Driver 1 age";
+//
+//        dt.conditionCols.add(c1);
+//        ConditionCol c2 = new ConditionCol();
+//        c2.header = "Driver 2 age";
+//        dt.conditionCols.add(c2);
+//
+//        AttributeCol attr = new AttributeCol();
+//        attr.attr = "rule-flow";
+//        dt.attributeCols.add(attr);
+//
+//        ActionCol a1 = new ActionSetFieldCol();
+//        a1.header = "Do something !";
+//        dt.actionCols.add(a1);
 
-
-        ActionCol a1 = new ActionCol();
-        a1.header = "Do something !";
-        dt.actionCols.add(a1);
-
-        initWidget( form );
-        //initWidget( new GuidedDecisionTableWidget(dt) );
+        SuggestionCompletionCache.getInstance().doAction("com.billasurf.manufacturing.plant", new Command() {
+			public void execute() {
+				System.err.println("loaded SCE");
+			}
+        });
+        //initWidget( form );
+        RuleAsset asset_ = new RuleAsset();
+        asset_.metaData = new MetaData();
+        asset_.metaData.packageName = "com.billasurf.manufacturing.plant";
+        asset_.content = dt;
+        initWidget( new GuidedDecisionTableWidget(asset_) );
     }
 
 

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/common/FormStylePopup.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/common/FormStylePopup.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/common/FormStylePopup.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -38,6 +38,9 @@
 	private Boolean shadow;
 	private Integer width;
 	private Integer height;
+	private boolean modal = true;
+	private int popLeft = -1;
+	private int popTop;
 
     public FormStylePopup(String image,
                           final String title) {
@@ -72,19 +75,27 @@
     	this.dialog.destroy();
     }
 
+    public void setPopupPosition(int left, int top) {
+    	this.popLeft = left;
+    	this.popTop = top;
+    }
 
 
+
 	public void show() {
 
 		dialog = new Window();
 		dialog.setAutoScroll(true);
-		dialog.setModal(true);
+		dialog.setModal(modal );
 		dialog.setWidth((width == null)? 500 : width.intValue());
 		//dialog.setHeight((height == null)? form.getNumAttributes() * 40 + 100 : height.intValue());
 		dialog.setShadow((shadow == null)? true : shadow.booleanValue());
 		dialog.setResizable(true);
 		dialog.setClosable(true);
 		dialog.setTitle(title);
+		if (popLeft > -1) {
+			dialog.setPosition(popLeft, popTop);
+		}
 
 
 
@@ -96,5 +107,17 @@
 		this.dialog.show();
 	}
 
+	public void setModal(boolean m) {
+		this.modal = m;
+	}
 
+	public void setTitle(String t) {
+		this.title = t;
+	}
+
+	public void setWidth(int i) {
+		this.width = new Integer(i);
+	}
+
+
 }
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java (from rev 19036, labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ActionSetColumn.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,186 @@
+package org.drools.brms.client.decisiontable;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.drools.brms.client.common.FormStylePopup;
+import org.drools.brms.client.common.ImageButton;
+import org.drools.brms.client.common.SmallLabel;
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.ConditionCol;
+import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+public class ActionSetColumn extends FormStylePopup {
+
+	private ActionSetFieldCol editingCol;
+	private SmallLabel bindingLabel = new SmallLabel();
+	private SmallLabel fieldLabel = new SmallLabel();
+	private GuidedDecisionTable dt;
+	private SuggestionCompletionEngine sce;
+
+	public ActionSetColumn(SuggestionCompletionEngine sce, final GuidedDecisionTable dt, final Command refreshGrid, final ActionSetFieldCol col, final boolean isNew) {
+		this.editingCol = new ActionSetFieldCol();
+		this.dt = dt;
+		this.sce = sce;
+
+		editingCol.boundName = col.boundName;
+		editingCol.factField = col.factField;
+		editingCol.header = col.header;
+		editingCol.type = col.type;
+		super.setModal(false);
+		setTitle("Column configuration (set a field on a fact)");
+
+		final TextBox header = new TextBox();
+		header.setText(col.header);
+		header.addChangeListener(new ChangeListener() {
+			public void onChange(Widget w) {
+				editingCol.header = header.getText();
+			} });
+		addAttribute("Column header (description):", header);
+
+		HorizontalPanel pattern = new HorizontalPanel();
+		pattern.add(bindingLabel);
+		doBindingLabel();
+
+		Image changePattern = new ImageButton("images/edit.gif", "Choose a bound fact that this column pertains to", new ClickListener() {
+			public void onClick(Widget w) {
+				showChangeFact(w);
+			}
+		});
+		pattern.add(changePattern);
+		addAttribute("Fact:", pattern);
+
+
+		HorizontalPanel field = new HorizontalPanel();
+		field.add(fieldLabel);
+		Image editField = new ImageButton("images/edit.gif", "Edit the field that this column operates on", new ClickListener() {
+			public void onClick(Widget w) {
+				showFieldChange();
+			}
+		});
+		field.add(editField);
+		addAttribute("Field:", field);
+		doFieldLabel();
+
+		Button apply = new Button("Apply changes");
+		apply.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				if (isNew) {
+					dt.actionCols.add(editingCol);
+
+				} else {
+					col.boundName = editingCol.boundName;
+					col.factField = editingCol.factField;
+					col.header = editingCol.header;
+					col.type = editingCol.type;
+				}
+				refreshGrid.execute();
+				hide();
+
+			}
+		});
+		addAttribute("", apply);
+
+
+	}
+
+	private void showFieldChange() {
+		final FormStylePopup pop = new FormStylePopup();
+		pop.setModal(false);
+		final String factType = getFactType(this.editingCol.boundName);
+		String[] fields = this.sce.getFieldCompletions(factType);
+		final ListBox box = new ListBox();
+		for (int i = 0; i < fields.length; i++) {
+			box.addItem(fields[i]);
+		}
+		pop.addAttribute("Field:", box);
+		Button b = new Button("OK");
+		pop.addAttribute("", b);
+		b.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				editingCol.factField = box.getItemText(box.getSelectedIndex());
+				editingCol.type = sce.getFieldType(factType, editingCol.factField);
+				doFieldLabel();
+				pop.hide();
+			}
+		});
+		pop.show();
+
+	}
+
+	private void doFieldLabel() {
+		if (this.editingCol.factField != null) {
+			this.fieldLabel.setText(this.editingCol.factField);
+		} else {
+			this.fieldLabel.setText("(please choose a fact pattern first)");
+		}
+	}
+
+	private String getFactType(String boundName) {
+		for (Iterator iterator = dt.conditionCols.iterator(); iterator.hasNext();) {
+			ConditionCol col = (ConditionCol) iterator.next();
+			if (col.boundName.equals(boundName)) {
+				return col.factType;
+			}
+		}
+		return "";
+	}
+
+	private void showChangeFact(Widget w) {
+		final FormStylePopup pop = new FormStylePopup();
+
+		final ListBox pats = this.loadBoundFacts();
+		pop.addAttribute("Choose fact to set field of:", pats);
+		Button ok = new Button("OK");
+		pop.addAttribute("", ok);
+
+		ok.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				String val = pats.getValue(pats.getSelectedIndex());
+				editingCol.boundName = val;
+				doBindingLabel();
+				pop.hide();
+			}
+		});
+
+		pop.show();
+
+	}
+
+	private ListBox loadBoundFacts() {
+		Set facts = new HashSet();
+		for (int i = 0; i < this.dt.conditionCols.size(); i++) {
+			ConditionCol c = (ConditionCol) dt.conditionCols.get(i);
+			facts.add(c.boundName);
+		}
+
+		ListBox box = new ListBox();
+		for (Iterator iterator = facts.iterator(); iterator.hasNext();) {
+			String b = (String) iterator.next();
+			box.addItem(b);
+		}
+
+		return box;
+	}
+
+	private void doBindingLabel() {
+		if (this.editingCol.boundName != null) {
+			this.bindingLabel.setText("" + this.editingCol.boundName);
+		} else {
+			this.bindingLabel.setText("(please choose a bound fact for this column)");
+		}
+	}
+
+}

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/DeleteAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,70 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for deleting a row.
- * @author Steven Williams
- */
-public class DeleteAction extends Composite {
-
-    private HorizontalPanel panel = new HorizontalPanel();
-    private Image delete;
-    private int row;
-    
-
-    
-    
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked
-     * @param clickListener
-     * @param okClickListener
-     */
-    public DeleteAction(final int currentRow, final RowClickListener clickListener) {
-        row = currentRow;
-        delete = new Image("images/clear_item.gif");
-        delete.setTitle( "Delete row " + row );
-        delete.addClickListener( new ClickListener() {
-			public void onClick(final Widget w) {
-				clickListener.onClick(w, row);
-			}
-        });
-        
-        panel.add( delete);
-        
-        initWidget( panel );
-    }
-    
-    public void setRow(final int row) {
-    	this.row = row;
-    	delete.setTitle("Delete row " + row);
-    }
-    
-    public int getRow() {
-    	return row;
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditActions.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,101 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widgets for editing a row.
- * @author Michael Neale
- */
-public class EditActions extends Composite {
-
-    private HorizontalPanel panel = new HorizontalPanel();
-    private Image edit;
-    private Image ok;
-	private int row;
-    
-
-    
-    
-    /**
-     * Pass in the click listener delegates for when the respective action is clicked
-     * @param editClickListener
-     * @param okClickListener
-     */
-    public EditActions(final int currentRow,
-    				   final RowClickListener editClickListener, 
-                       final RowClickListener okClickListener) {
-        row = currentRow;
-        edit = new Image("images/edit.gif");
-        edit.setTitle( "Edit this row" );
-        edit.addClickListener( new ClickListener() {
-
-            public void onClick(Widget w) {
-                makeEditable();
-                editClickListener.onClick( w, row );
-            }
-            
-        });
-        
-        ok = new Image("images/tick.gif");
-        ok.setTitle( "Apply the edit changes to this row." );
-        ok.addClickListener( new ClickListener() {
-
-            public void onClick(Widget w) {
-                makeReadOnly();
-                okClickListener.onClick( w, row );                
-            }
-            
-        });
-        
-        panel.add( edit );
-        panel.add( ok );
-        ok.setVisible( false );
-        
-        initWidget( panel );
-    }
-    
-    public void makeEditable() {
-       edit.setVisible( false );
-       ok.setVisible( true );
-
-    }
-    
-    public void makeReadOnly() {
-        edit.setVisible( true );
-        ok.setVisible( false );
-    }
-
-	public int getRow() {
-		return row;
-	}
-
-	public void setRow(int row) {
-		this.row = row;
-	}
-    
-    
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/EditableDTGrid.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,470 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import java.util.Iterator;
-
-import org.drools.brms.client.decisiontable.model.Cell;
-import org.drools.brms.client.decisiontable.model.Column;
-import org.drools.brms.client.decisiontable.model.DecisionTable;
-import org.drools.brms.client.decisiontable.model.Row;
-
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.SourcesTableEvents;
-import com.google.gwt.user.client.ui.TableListener;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-
-/**
- * The decision table viewer and editor.
- * 
- * @author Michael Neale
- * @author Steven Williams
- * 
- * TODO: add editors for header stuff, and ability to add rows/cols and shift
- * rows around This probably can be done from a seperate "editor" such that it
- * is re-rendered when you need to add/move a col or row.
- * 
- * Should be able to add/shift stuff around by entering a row number to deal
- * with.
- * 
- */
-public class EditableDTGrid extends Composite {
-
-	private static final int START_DATA_ROW = 1;
-
-	private DecisionTable dt;
-
-	private FlexTable table = new FlexTable();
-
-	private int currentRow;
-
-	private int currentCol;
-
-	private Cell currentCell;
-
-	private FlexCellFormatter cellFormatter = table.getFlexCellFormatter();
-
-	public EditableDTGrid(String dtName) {
-		this(dtName, createDecisionTable());
-	}
-
-	private static DecisionTable createDecisionTable() {
-		DecisionTable dt = new DecisionTable();
-		Column[] columns = { dt.createColumn(), dt.createColumn(),
-				dt.createColumn(), dt.createColumn(), dt.createColumn(),
-				dt.createColumn() };
-		createHeader(dt, columns);
-		for (int i = 0; i < 15; i++) {
-			Row row = dt.createRow();
-			for (int j = 0; j < columns.length; j++) {
-				Cell cell = dt.createCell(row, columns[j]);
-				cell.setValue("boo " + i + ":" + j);
-			}
-		}
-		return dt;
-	}
-
-	private static void createHeader(DecisionTable dt, Column[] columns) {
-		Row row = dt.getHeaderRow();
-		for (int i = 0; i < 6; i++) {
-			Cell cell = dt.createCell(row, columns[i]);
-			cell.setValue("some header " + i);
-		}
-	}
-
-	public EditableDTGrid(final String dtName, final DecisionTable dt) {
-		this.dt = dt;
-		VerticalPanel vert = new VerticalPanel();
-
-		Label title = new Label(dtName);
-		title.setStyleName("dt-editor-Title");
-
-		HorizontalPanel header = new HorizontalPanel();
-		header.add(new Image("images/decision_table.gif"));
-		header.add(title);
-
-		Toolbar toolbar = new Toolbar(this);
-
-		vert.add(header);
-		vert.add(toolbar);
-		vert.add(table);
-
-		table.setStyleName("dt-editor-Grid");
-		table.addTableListener(new TableListener() {
-
-			public void onCellClicked(SourcesTableEvents ste, int row, int col) {
-				setCurrentCell(row, col);
-			}
-		});
-
-		// set up the header
-		populateHeader();
-
-		// and the data follows
-		populateDataGrid();
-
-		// needed for Composite
-		initWidget(vert);
-	}
-
-	protected void setCurrentCell(int row, int column) {
-		if (column > 0 && column <= numCols() && row >= START_DATA_ROW) {
-			Cell selectedCell = dt.getRow(row - 1).getCell(column - 1);
-			if (selectedCell != currentCell) {
-				int col = selectedCell.getColumnIndex() + 1;
-
-				if (currentRow >= START_DATA_ROW) {
-					TextBox text = (TextBox) table.getWidget(currentRow,
-							currentCol);
-					newCell(currentRow, currentCol, text.getText());
-				}
-				if (currentCell == null || currentRow != row) {
-					if (currentCell != null) {
-						cellFormatter.setStyleName(currentRow, 0,
-								"dt-editor-CountColumn");
-					}
-					cellFormatter.setStyleName(row, 0,
-							"dt-editor-CountColumn-selected");
-				}
-				if (currentCell == null || (currentCell.getColumnIndex() + 1) != col) {
-					if (currentCell != null) {
-						cellFormatter.setStyleName(0, currentCell
-								.getColumnIndex() + 1,
-								"dt-editor-DescriptionCell");
-					}
-					cellFormatter.setStyleName(0, col,
-							"dt-editor-DescriptionCell-selected");
-				}
-				cellFormatter.setStyleName(row, column,
-						"dt-editor-Cell-selected");
-				currentRow = row;
-				currentCol = column;
-				currentCell = selectedCell;
-				editColumn(row, column);
-			}
-		}
-	}
-
-	private void populateHeader() {
-		Row row = dt.getHeaderRow();
-		// for the count column
-		cellFormatter.setStyleName(0, 0, "dt-editor-DescriptionCell");
-
-		table.setText(0, 0, "");
-		cellFormatter.setStyleName(0, 0, "dt-editor-CountColumn");
-
-		for (Iterator it = dt.getColumns().iterator(); it.hasNext();) {
-			Column column = (Column) it.next();
-			newHeaderCell(row.getCell(column));
-		}
-
-	}
-
-	/**
-	 * This populates the "data" part of the decision table (not the header
-	 * bits). It starts at the row offset.
-	 * 
-	 * @param cellFormatter
-	 *            So it can set the style of each cell that is created.
-	 */
-	private void populateDataGrid() {
-		int i = 1;
-		for (Iterator it = dt.getRows().iterator(); it.hasNext(); i++) {
-			Row row = (Row) it.next();
-			table.setText(i, 0, Integer.toString(i));
-			cellFormatter.setStyleName(i, 0, "dt-editor-CountColumn");
-			for (Iterator it2 = dt.getColumns().iterator(); it2.hasNext();) {
-				Column column = (Column) it2.next();
-				newCell(row.getCell(column));
-			}
-
-		}
-	}
-
-	private void newCell(Cell cell) {
-		int rowIndex = cell.getRowIndex() + START_DATA_ROW;
-		int columnIndex = cell.getColumnIndex() + 1;
-		newCell(cell, rowIndex, columnIndex, "dt-editor-Cell");
-	}
-
-	private void newHeaderCell(Cell cell) {
-		int columnIndex = cell.getColumnIndex() + 1;
-		newCell(cell, 0, columnIndex, "dt-editor-DescriptionCell");
-	}
-
-	private void newCell(Cell cell, int rowIndex, int columnIndex, String style) {
-		table.setText(rowIndex, columnIndex, cell.getValue());
-		cellFormatter.setStyleName(rowIndex, columnIndex, style);
-		cellFormatter.setColSpan(rowIndex, columnIndex, cell.getColspan());
-		cellFormatter.setRowSpan(rowIndex, columnIndex, cell.getRowspan());
-	}
-
-	private void newCell(int row, int column, String text) {
-		table.setText(row, column, text);
-		cellFormatter.setStyleName(row, column, "dt-editor-Cell");
-	}
-
-	public void mergeCol() {
-		if (currentCell != null) {
-			dt.mergeCol(currentCell);
-			// if (currentRow >= START_DATA_ROW && currentCol > 0) {
-			int currentSpan = cellFormatter.getColSpan(currentRow, currentCol);
-			if (currentCol + currentSpan <= numCols()) {
-				int nextSpan = cellFormatter.getColSpan(currentRow,
-						currentCol + 1);
-				int currentRowSpan = cellFormatter.getRowSpan(currentRow,
-						currentCol);
-				int nextRowSpan = cellFormatter.getRowSpan(currentRow,
-						currentCol + 1);
-				while (nextRowSpan < currentRowSpan) {
-					mergeRow(currentRow, currentCol + 1);
-					nextRowSpan++;
-				}
-				table.removeCell(currentRow, currentCol + 1);
-				cellFormatter.setColSpan(currentRow, currentCol, currentSpan
-						+ nextSpan);
-			}
-		}
-	}
-
-	public void mergeRow() {
-		if (currentCell != null) {
-			// if (currentRow >= START_DATA_ROW && currentCol > 0) {
-			mergeRow(currentRow, currentCol);
-		}
-	}
-
-	private void mergeRow(int row, int col) {
-		dt.mergeRow(currentCell);
-		int currentSpan = cellFormatter.getRowSpan(row, col);
-		if (row + currentSpan <= numRows) {
-			int nextSpan = cellFormatter.getRowSpan(row + currentSpan, col);
-			table.removeCell(row + currentSpan, col);
-			cellFormatter.setRowSpan(row, col, currentSpan + nextSpan);
-		}
-	}
-
-	public void splitCol() {
-		if (currentRow >= START_DATA_ROW && currentCol > 0) {
-			int currentSpan = cellFormatter.getColSpan(currentRow, currentCol);
-			if (currentSpan > 1) {
-				cellFormatter.setColSpan(currentRow, currentCol,
-						currentSpan - 1);
-				int newCol = currentCol + 1;
-				table.insertCell(currentRow, newCol);
-				newCell(currentRow, newCol, "");
-				cellFormatter
-						.setStyleName(currentRow, newCol, "dt-editor-Cell");
-			}
-		}
-	}
-
-	public void splitRow() {
-		if (currentRow >= START_DATA_ROW && currentCol > 0) {
-			int currentSpan = cellFormatter.getRowSpan(currentRow, currentCol);
-			if (currentSpan > 1) {
-				cellFormatter.setRowSpan(currentRow, currentCol,
-						currentSpan - 1);
-				int newRow = currentRow + currentSpan - 1;
-				table.insertCell(newRow, currentCol);
-				newCell(newRow, currentCol, "");
-				cellFormatter
-						.setStyleName(newRow, currentCol, "dt-editor-Cell");
-			}
-		}
-	}
-
-	/**
-	 * Listener for click events that affect a whole row
-	 */
-	interface RowClickListener {
-		void onClick(Widget w, int row);
-	}
-
-	private int numRows = 14;
-
-	/**
-	 * Shuffle the given row up one
-	 * 
-	 * @param row
-	 */
-	void moveUp() {
-		if (currentRow > START_DATA_ROW) {
-			// create a new row above the given row
-			// remember that insertRow will insert above the given row
-			// so this is two above the original row
-			int newRow = addNewRow(currentRow - 1);
-
-			copyRow(currentRow + 1, newRow);
-
-			// remove the original row
-			table.removeRow(currentRow + 1);
-
-			renumberRow(currentRow);
-			currentRow = -1;
-			setCurrentCell(newRow, currentCol);
-		}
-
-	}
-
-	/**
-	 * Copy the data from the source row to the target row
-	 * 
-	 * @param sourceRow
-	 * @param targetRow
-	 */
-	private void copyRow(int sourceRow, int targetRow) {
-		int column = 1;
-		int colIndex = 1;
-		while (column <= numCols()) {
-			if (column == currentCol) {
-				TextBox box = (TextBox) table.getWidget(sourceRow, column);
-				newCell(targetRow, colIndex, box.getText());
-			} else {
-				newCell(targetRow, colIndex, table.getText(sourceRow, colIndex));
-			}
-			int colSpan = cellFormatter.getColSpan(sourceRow, colIndex);
-			column = column + colSpan;
-			cellFormatter.setColSpan(targetRow, colIndex++, colSpan);
-		}
-	}
-
-	/**
-	 * Add a new row and set the row number
-	 * 
-	 * @param row
-	 * @return
-	 */
-	private int addNewRow(int row) {
-		int newRow = table.insertRow(row);
-		table.setText(newRow, 0, Integer.toString(newRow));
-		cellFormatter.setStyleName(newRow, 0, "dt-editor-CountColumn");
-		return newRow;
-	}
-
-	/**
-	 * Shuffle the given row down one
-	 * 
-	 * @param row
-	 */
-	void moveDown() {
-		if (currentRow < numRows) {
-			// create a new row below the given row
-			// remember that insertRow will insert above the given row
-			// so this is two below the original row
-			int newRow = addNewRow(currentRow + 2);
-
-			copyRow(currentRow, newRow);
-			// remove row before adding action widgets so that the row number
-			// is correct (otherwise the shuffle down button may not be
-			// displayed
-			table.removeRow(currentRow);
-			renumberRow(currentRow);
-			renumberRow(currentRow + 1);
-			currentRow = -1;
-			setCurrentCell(newRow - 1, currentCol);
-		}
-	}
-
-	/**
-	 * Delete the specified row
-	 */
-	void deleteRow() {
-		numRows--;
-		table.removeRow(currentRow);
-		reorderRows(currentRow);
-		currentRow = -1;
-		clearCurrentCell();
-	}
-
-	private void clearCurrentCell() {
-		if (currentRow > 0) {
-			cellFormatter
-					.setStyleName(currentRow, currentCol, "dt-editor-Cell");
-			currentRow = -1;
-		}
-		if (currentCol > 0) {
-			cellFormatter.setStyleName(0, currentCol,
-					"dt-editor-DescriptionCell");
-			currentCol = -1;
-		}
-	}
-
-	/**
-	 * Renumber the rows from the start row and change the row the actions will
-	 * act on
-	 * 
-	 * @param startRow
-	 */
-	private void reorderRows(final int startRow) {
-		for (int r = startRow; r < table.getRowCount(); r++) {
-			renumberRow(r);
-		}
-	}
-
-	/**
-	 * Renumber the given row and change the row the actions will act on
-	 * 
-	 * @param row
-	 */
-	private void renumberRow(int row) {
-		table.setText(row, 0, Integer.toString(row));
-	}
-
-	/**
-	 * Add a new row after the specified row
-	 */
-	void insertRow() {
-		if (currentRow >= START_DATA_ROW) {
-			numRows++;
-			int newRow = addNewRow(currentRow + 1);
-			int column = 1;
-			for (; column < numCols() + 1; column++) {
-				newCell(newRow, column, "");
-			}
-			// addActions(column, newRow, true);
-			reorderRows(newRow);
-			setCurrentCell(newRow, 1);
-		}
-	}
-
-	private void editColumn(int row, int column) {
-		String text = table.getText(row, column);
-		editColumn(row, column, text);
-	}
-
-	private void editColumn(int row, int column, String text) {
-		TextBox box = new TextBox();
-		box.setText(text);
-		box.setStyleName("dt-field-TextBox");
-		table.setWidget(row, column, box);
-		box.setFocus(true);
-	}
-
-	private int numCols() {
-		return 6;
-	}
-
-}
\ No newline at end of file

Copied: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java (from rev 19036, labs/jbossrules/trunk/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java)
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java	                        (rev 0)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDTColumnConfig.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -0,0 +1,346 @@
+package org.drools.brms.client.decisiontable;
+
+import org.drools.brms.client.common.FormStylePopup;
+import org.drools.brms.client.common.ImageButton;
+import org.drools.brms.client.common.SmallLabel;
+import org.drools.brms.client.modeldriven.HumanReadable;
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.dt.ConditionCol;
+import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ChangeListener;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.RadioButton;
+import com.google.gwt.user.client.ui.TextBox;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * This is a configuration editor for a column in a the guided decision table.
+ * @author Michael Neale
+ *
+ */
+public class GuidedDTColumnConfig extends FormStylePopup {
+
+	private GuidedDecisionTable dt;
+	private SuggestionCompletionEngine sce;
+	private ConditionCol editingCol;
+	private SmallLabel patternLabel = new SmallLabel();
+	private SmallLabel fieldLabel = new SmallLabel();
+	private SmallLabel operatorLabel = new SmallLabel();
+
+	/**
+	 * Pass in a null col and it will create a new one.
+	 */
+	public GuidedDTColumnConfig(SuggestionCompletionEngine sce, final GuidedDecisionTable dt, final Command refreshGrid, final ConditionCol col, final boolean isNew) {
+		super();
+		this.setModal(false);
+		this.dt = dt;
+		this.sce = sce;
+		this.editingCol = new ConditionCol();
+		editingCol.boundName = col.boundName;
+		editingCol.constraintValueType = col.constraintValueType;
+		editingCol.factField = col.factField;
+		editingCol.factType = col.factType;
+		editingCol.header = col.header;
+		editingCol.operator = col.operator;
+
+
+		setTitle("Condition column configuration");
+
+		final TextBox header = new TextBox();
+		header.setText(col.header);
+		header.addChangeListener(new ChangeListener() {
+			public void onChange(Widget w) {
+				editingCol.header = header.getText();
+			} });
+		addAttribute("Column header (description):", header);
+
+
+		HorizontalPanel pattern = new HorizontalPanel();
+		pattern.add(patternLabel);
+		doPatternLabel();
+
+		Image changePattern = new ImageButton("images/edit.gif", "Choose an existing pattern that this column adds to", new ClickListener() {
+			public void onClick(Widget w) {
+				showChangePattern(w);
+			}
+		});
+		pattern.add(changePattern);
+
+
+		addAttribute("Pattern:", pattern);
+
+		//now a radio button with the type
+		RadioButton literal = new RadioButton("constraintValueType", "Literal value");
+		RadioButton formula = new RadioButton("constraintValueType", "Formula");
+		RadioButton predicate = new RadioButton("constraintValueType", "Predicate");
+
+
+		HorizontalPanel valueTypes = new HorizontalPanel();
+		valueTypes.add(literal);
+		valueTypes.add(formula);
+		valueTypes.add(predicate);
+		addAttribute("Calculation type:", valueTypes);
+
+		switch (editingCol.constraintValueType) {
+			case ISingleFieldConstraint.TYPE_LITERAL:
+				literal.setChecked(true);
+				break;
+			case ISingleFieldConstraint.TYPE_RET_VALUE :
+				formula.setChecked(true);
+				break;
+			case ISingleFieldConstraint.TYPE_PREDICATE :
+				predicate.setChecked(true);
+		}
+
+		literal.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				applyConsTypeChange(ISingleFieldConstraint.TYPE_LITERAL);
+			}
+		});
+
+
+		formula.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				applyConsTypeChange(ISingleFieldConstraint.TYPE_RET_VALUE);
+			}
+		});
+		predicate.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				applyConsTypeChange(ISingleFieldConstraint.TYPE_PREDICATE);
+			}
+		});
+
+
+		HorizontalPanel field = new HorizontalPanel();
+		field.add(fieldLabel);
+		Image editField = new ImageButton("images/edit.gif", "Edit the field that this column operates on", new ClickListener() {
+			public void onClick(Widget w) {
+				showFieldChange();
+			}
+		});
+		field.add(editField);
+		addAttribute("Field:", field);
+		doFieldLabel();
+
+
+		HorizontalPanel operator = new HorizontalPanel();
+		operator.add(operatorLabel);
+		Image editOp = new ImageButton("images/edit.gif", "Edit the operator that is used to compare data with this field", new ClickListener() {
+			public void onClick(Widget w) {
+				showOperatorChange();
+			}
+		});
+		operator.add(editOp);
+		addAttribute("Operator:", operator);
+		doOperatorLabel();
+
+
+		Button apply = new Button("Apply changes");
+		apply.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				if (isNew) {
+					dt.conditionCols.add(editingCol);
+
+				} else {
+					col.boundName = editingCol.boundName;
+					col.constraintValueType = editingCol.constraintValueType;
+					col.factField = editingCol.factField;
+					col.factType = editingCol.factType;
+					col.header = editingCol.header;
+					col.operator = editingCol.operator;
+
+				}
+				refreshGrid.execute();
+				hide();
+
+			}
+		});
+		addAttribute("", apply);
+
+
+
+
+
+	}
+
+	private void applyConsTypeChange(int newType) {
+		editingCol.constraintValueType = newType;
+		doFieldLabel();
+		doOperatorLabel();
+	}
+
+
+	private void doOperatorLabel() {
+		if (editingCol.constraintValueType == ISingleFieldConstraint.TYPE_PREDICATE) {
+			operatorLabel.setText("(not needed for predicate)");
+		} else if (nil(editingCol.factType)) {
+			operatorLabel.setText("(please select a pattern first)");
+		} else if (nil(editingCol.factField)) {
+			operatorLabel.setText("(please choose a field first)");
+		} else if (nil(editingCol.operator)) {
+			operatorLabel.setText("(please select a field)");
+		} else {
+			operatorLabel.setText(HumanReadable.getOperatorDisplayName(editingCol.operator));
+		}
+	}
+
+	private void showOperatorChange() {
+		final FormStylePopup pop = new FormStylePopup();
+		pop.setModal(false);
+		String[] ops = this.sce.getOperatorCompletions(editingCol.factType, editingCol.factField);
+		final ListBox box = new ListBox();
+		for (int i = 0; i < ops.length; i++) {
+			box.addItem(HumanReadable.getOperatorDisplayName(ops[i]), ops[i]);
+		}
+		pop.addAttribute("Operator:", box);
+		Button b = new Button("OK");
+		pop.addAttribute("", b);
+		b.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				editingCol.operator = box.getValue(box.getSelectedIndex());
+				doOperatorLabel();
+				pop.hide();
+			}
+		});
+		pop.show();
+
+	}
+
+	private void doFieldLabel() {
+		if (editingCol.constraintValueType == ISingleFieldConstraint.TYPE_PREDICATE) {
+			fieldLabel.setText("(not needed for predicate)");
+		} else if (nil(editingCol.factType)) {
+			fieldLabel.setText("(please select a pattern first)");
+		}
+		else if (nil(editingCol.factField)) {
+			fieldLabel.setText("(please select a field)");
+		} else {
+			fieldLabel.setText(this.editingCol.factField);
+		}
+	}
+
+	private boolean nil(String s) {
+		return s == null || s.equals("");
+	}
+
+	protected void showFieldChange() {
+		final FormStylePopup pop = new FormStylePopup();
+		pop.setModal(false);
+		String[] fields = this.sce.getFieldCompletions(this.editingCol.factType);
+		final ListBox box = new ListBox();
+		for (int i = 0; i < fields.length; i++) {
+			box.addItem(fields[i]);
+		}
+		pop.addAttribute("Field:", box);
+		Button b = new Button("OK");
+		pop.addAttribute("", b);
+		b.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				editingCol.factField = box.getItemText(box.getSelectedIndex());
+				doFieldLabel();
+				doOperatorLabel();
+				pop.hide();
+			}
+		});
+		pop.show();
+	}
+
+	private void doPatternLabel() {
+		if (this.editingCol.factType != null) {
+			this.patternLabel.setText(this.editingCol.factType + " [" + editingCol.boundName + "]");
+		}
+		doFieldLabel();
+		doOperatorLabel();
+
+	}
+
+	protected void showChangePattern(Widget w) {
+
+		final ListBox pats = this.loadPatterns();
+		if (pats.getItemCount() == 0) {
+			showNewPatternDialog();
+			return;
+		}
+		final FormStylePopup pop = new FormStylePopup();
+		Button ok = new Button("OK");
+		HorizontalPanel hp = new HorizontalPanel();
+		hp.add(pats);
+		hp.add(ok);
+
+
+		pop.addAttribute("Choose existing pattern to add column to:", hp);
+		pop.addAttribute("", new HTML("<i><b>---OR---</i></b>"));
+
+		Button createPattern = new Button("Create new fact pattern");
+		createPattern.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				pop.hide();
+				showNewPatternDialog();
+			}
+		});
+		pop.addAttribute("", createPattern);
+
+
+
+
+		ok.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				String[] val = pats.getValue(pats.getSelectedIndex()).split("\\s");
+				editingCol.factType = val[0];
+				editingCol.boundName = val[1];
+				doPatternLabel();
+				pop.hide();
+			}
+		});
+
+		pop.show();
+	}
+
+	protected void showNewPatternDialog() {
+		final FormStylePopup pop = new FormStylePopup();
+		pop.setTitle("Create a new fact pattern");
+		final ListBox types = new ListBox();
+		for (int i = 0; i < sce.factTypes.length; i++) {
+			types.addItem(sce.factTypes[i]);
+		}
+		pop.addAttribute("Fact type:", types);
+		final TextBox binding = new TextBox();
+		pop.addAttribute("name:", binding);
+
+		Button ok = new Button("OK");
+		ok.addClickListener(new ClickListener() {
+			public void onClick(Widget w) {
+				editingCol.boundName = binding.getText();
+				editingCol.factType = types.getItemText(types.getSelectedIndex());
+				doPatternLabel();
+				pop.hide();
+			}
+		});
+		pop.addAttribute("", ok);
+
+		pop.show();
+
+	}
+
+	private ListBox loadPatterns() {
+		ListBox patterns = new ListBox();
+		for (int i = 0; i < dt.conditionCols.size(); i++) {
+			ConditionCol c = (ConditionCol) dt.conditionCols.get(i);
+			patterns.addItem(c.factType + " [" + c.boundName + "]", c.factType + " " + c.boundName);
+		}
+
+		return patterns;
+
+	}
+
+
+
+}

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/GuidedDecisionTableWidget.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,12 +1,30 @@
 package org.drools.brms.client.decisiontable;
 
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.brms.client.common.FormStylePopup;
+import org.drools.brms.client.common.ImageButton;
+import org.drools.brms.client.common.SmallLabel;
+import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
 import org.drools.brms.client.modeldriven.dt.ActionCol;
+import org.drools.brms.client.modeldriven.dt.ActionSetFieldCol;
+import org.drools.brms.client.modeldriven.dt.AttributeCol;
 import org.drools.brms.client.modeldriven.dt.ConditionCol;
 import org.drools.brms.client.modeldriven.dt.GuidedDecisionTable;
+import org.drools.brms.client.packages.SuggestionCompletionCache;
+import org.drools.brms.client.rpc.RuleAsset;
 
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
 import com.google.gwt.user.client.ui.KeyboardListener;
 import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
+import com.google.gwt.user.client.ui.ListBox;
 import com.google.gwt.user.client.ui.TextBox;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
@@ -21,10 +39,13 @@
 import com.gwtext.client.data.SortState;
 import com.gwtext.client.data.Store;
 import com.gwtext.client.data.StringFieldDef;
+import com.gwtext.client.widgets.Component;
 import com.gwtext.client.widgets.Panel;
 import com.gwtext.client.widgets.Toolbar;
 import com.gwtext.client.widgets.ToolbarMenuButton;
 import com.gwtext.client.widgets.Window;
+import com.gwtext.client.widgets.form.FieldSet;
+import com.gwtext.client.widgets.form.FormPanel;
 import com.gwtext.client.widgets.grid.BaseColumnConfig;
 import com.gwtext.client.widgets.grid.CellMetadata;
 import com.gwtext.client.widgets.grid.ColumnConfig;
@@ -45,23 +66,391 @@
 public class GuidedDecisionTableWidget extends Composite {
 
     private GuidedDecisionTable dt;
+	private VerticalPanel layout;
+	private GridPanel grid;
+	private FieldDef[] fds;
+	private VerticalPanel attributeConfigWidget;
+	private VerticalPanel conditionsConfigWidget;
+	private String packageName;
+	private VerticalPanel actionsConfigWidget;
 
 
-	public GuidedDecisionTableWidget(GuidedDecisionTable dt) {
+	public GuidedDecisionTableWidget(RuleAsset asset) {
 
-    	this.dt = dt;
+    	this.dt = (GuidedDecisionTable) asset.content;
+    	this.packageName = asset.metaData.packageName;
 
-        GridPanel grid = doGrid();
-        VerticalPanel p = new VerticalPanel();
-        p.add(grid);
 
+        layout = new VerticalPanel();
 
-        initWidget(p);
+        FormPanel config = new FormPanel();
+        config.setTitle("Decision table");
+
+        config.setBodyBorder(false);
+        config.setCollapsed(true);
+        config.setCollapsible(true);
+
+
+        FieldSet attributes = new FieldSet("Attribute columns");
+        attributes.setCollapsible(true);
+
+        attributes.setFrame(true);
+        attributes.add(getAttributes());
+        config.add(attributes);
+
+
+        FieldSet conditions = new FieldSet("Condition columns");
+        conditions.setCollapsible(true);
+        conditions.add(getConditions());
+        config.add(conditions);
+
+
+        FieldSet actions = new FieldSet("Action columns");
+        actions.setCollapsible(true);
+        actions.add(getActions());
+        config.add(actions);
+
+
+        layout.add(config);
+
+        refreshGrid();
+
+
+        initWidget(layout);
     }
 
+	private Widget getActions() {
+		actionsConfigWidget = new VerticalPanel();
+		refreshActionsWidget();
+		return actionsConfigWidget;
+	}
+
+	private void refreshActionsWidget() {
+		this.actionsConfigWidget.clear();
+		for (int i = 0; i < dt.actionCols.size(); i++) {
+			ActionCol c = (ActionCol) dt.actionCols.get(i);
+			HorizontalPanel hp = new HorizontalPanel();
+			hp.add(removeAction(c));
+			hp.add(editAction(c));
+			hp.add(new SmallLabel(c.header));
+			actionsConfigWidget.add(hp);
+		}
+		actionsConfigWidget.add(newAction());
+
+	}
+
+	private Widget editAction(ActionCol c) {
+		return new Image("images/edit.gif");
+	}
+
+	private Widget newAction() {
+		return new ImageButton( "images/new_item.gif", "Create a new action column", new ClickListener() {
+			public void onClick(Widget w) {
+				final FormStylePopup pop = new FormStylePopup();
+				pop.setModal(false);
+
+				final ListBox choice = new ListBox();
+				choice.addItem("Set the value of a field", "set");
+				choice.addItem("Set the value of a field on a new fact", "insert");
+				choice.addItem("Retract an existing fact", "retract");
+				Button ok = new Button("OK");
+				ok.addClickListener(new ClickListener() {
+					public void onClick(Widget w) {
+						String s = choice.getValue(choice.getSelectedIndex());
+						if (s.equals("set")) {
+							showSet();
+						} else if (s.equals("insert")) {
+							showInsert();
+						} else if (s.equals("retract")) {
+							showRetract();
+						}
+						pop.hide();
+					}
+
+					private void showRetract() {
+						// TODO Auto-generated method stub
+
+					}
+
+					private void showInsert() {
+						// TODO Auto-generated method stub
+
+					}
+
+					private void showSet() {
+						ActionSetColumn set = new ActionSetColumn(getSCE(), dt, new Command() {
+							public void execute() {
+								//want to add in a blank row into the data
+								scrapeData(dt.attributeCols.size() + dt.conditionCols.size() + dt.actionCols.size() + 1);
+								refreshGrid();
+								refreshActionsWidget();
+							}
+						}, new ActionSetFieldCol(), true);
+						set.show();
+					}
+				});
+
+				pop.addAttribute("Type of action column:", choice);
+
+				pop.addAttribute("", ok);
+
+				pop.show();
+
+			}
+
+		});
+
+
+	}
+
+	private Widget removeAction(final ActionCol c) {
+		Image del = new ImageButton("images/delete_item_small.gif", "Remove this action column", new ClickListener() {
+			public void onClick(Widget w) {
+				if (com.google.gwt.user.client.Window.confirm("Are you sure you want to delete the column for " + c.header + " - all data in that column will be removed?")) {
+					dt.actionCols.remove(c);
+					removeField(c.header);
+					scrapeData(-1);
+					refreshGrid();
+					refreshActionsWidget();
+				}
+			}
+		});
+
+		return del;
+	}
+
+	private Widget getConditions() {
+		conditionsConfigWidget = new VerticalPanel();
+		refreshConditionsWidget();
+		return conditionsConfigWidget;
+	}
+
+	private void refreshConditionsWidget() {
+		this.conditionsConfigWidget.clear();
+		for (int i = 0; i < dt.conditionCols.size(); i++) {
+			ConditionCol c = (ConditionCol) dt.conditionCols.get(i);
+			HorizontalPanel hp = new HorizontalPanel();
+			hp.add(removeCondition(c));
+			hp.add(editCondition(c));
+			hp.add(new SmallLabel(c.header));
+			conditionsConfigWidget.add(hp);
+		}
+		conditionsConfigWidget.add(newCondition());
+
+
+
+	}
+
+	private Widget newCondition() {
+		final ConditionCol newCol = new ConditionCol();
+		newCol.constraintValueType = ISingleFieldConstraint.TYPE_LITERAL;
+		return new ImageButton("images/new_item.gif", "Add a new condition column", new ClickListener() {
+			public void onClick(Widget w) {
+				GuidedDTColumnConfig dialog = new GuidedDTColumnConfig(getSCE(), dt, new Command() {
+					public void execute() {
+						//want to add in a blank row into the data
+						scrapeData(dt.attributeCols.size() + dt.conditionCols.size() + 1);
+						refreshGrid();
+						refreshConditionsWidget();
+					}
+				}, newCol, true);
+				dialog.show();
+			}
+		});
+	}
+
+	private Widget editCondition(final ConditionCol c) {
+		return new ImageButton("images/edit.gif", "Edit this columns configuration", new ClickListener() {
+			public void onClick(Widget w) {
+				GuidedDTColumnConfig dialog = new GuidedDTColumnConfig(getSCE(), dt, new Command() {
+					public void execute() {
+						scrapeData(-1);
+						refreshGrid();
+						refreshConditionsWidget();
+					}
+				}, c, false);
+				dialog.show();
+			}
+		});
+	}
+
+	protected SuggestionCompletionEngine getSCE() {
+		return SuggestionCompletionCache.getInstance().getEngineFromCache(this.packageName);
+	}
+
+	private Widget removeCondition(final ConditionCol c) {
+		Image del = new ImageButton("images/delete_item_small.gif", "Remove this condition column", new ClickListener() {
+			public void onClick(Widget w) {
+				if (com.google.gwt.user.client.Window.confirm("Are you sure you want to delete the column for " + c.header + " - all data in that column will be removed?")) {
+					dt.conditionCols.remove(c);
+					removeField(c.header);
+					scrapeData(-1);
+					refreshGrid();
+					refreshConditionsWidget();
+				}
+			}
+		});
+
+		return del;
+	}
+
+	private Widget getAttributes() {
+		attributeConfigWidget = new VerticalPanel();
+		refreshAttributeWidget();
+		return attributeConfigWidget;
+	}
+
+	private void refreshAttributeWidget() {
+		this.attributeConfigWidget.clear();
+		for (int i = 0; i < dt.attributeCols.size(); i++) {
+			AttributeCol at = (AttributeCol) dt.attributeCols.get(i);
+			HorizontalPanel hp = new HorizontalPanel();
+			hp.add(removeAttr(at));
+			hp.add(new SmallLabel(at.attr));
+			attributeConfigWidget.add(hp);
+		}
+		attributeConfigWidget.add(newAttr());
+	}
+
+	private Widget newAttr() {
+		ImageButton but = new ImageButton("images/new_item.gif", "Add a new attribute.", new ClickListener() {
+			public void onClick(Widget w) {
+				//show choice of attributes
+				final FormStylePopup pop = new FormStylePopup();
+		        final ListBox list = new ListBox();
+		        list.addItem( "Choose..." );
+
+
+		        addItem( "salience",list);
+		        addItem( "enabled", list );
+		        addItem( "date-effective", list );
+		        addItem( "date-expires", list );
+		        addItem( "no-loop", list );
+		        addItem( "agenda-group", list );
+		        addItem( "activation-group", list );
+		        addItem( "duration", list );
+		        addItem( "auto-focus", list );
+		        addItem( "lock-on-active", list );
+		        addItem( "ruleflow-group", list );
+
+		        pop.addAttribute("New attribute:", list);
+
+		        Button ok = new Button("Add");
+		        ok.addClickListener(new ClickListener() {
+					public void onClick(Widget w) {
+
+						AttributeCol attr = new AttributeCol();
+						attr.attr = list.getItemText(list.getSelectedIndex());
+						if (attr.attr.equals("Choose...")) {
+							com.google.gwt.user.client.Window.alert("Please pick a valid attribute");
+							return;
+						}
+						dt.attributeCols.add(attr);
+						scrapeData(dt.attributeCols.size() + 1);
+						refreshGrid();
+						refreshAttributeWidget();
+						pop.hide();
+					}
+		        });
+
+		        pop.addAttribute("", ok);
+		        pop.show();
+			}
+
+			private void addItem(String at, final ListBox list) {
+				if (!hasAttribute(at, dt.attributeCols)) list.addItem( at );
+			}
+
+			private boolean hasAttribute(String at, List attributeCols) {
+				for (Iterator iterator = attributeCols.iterator(); iterator
+						.hasNext();) {
+					AttributeCol c = (AttributeCol) iterator.next();
+					if (c.attr.equals(at)) {
+						return true;
+					}
+				}
+				return false;
+			}
+		});
+		return but;
+	}
+
+	private Widget removeAttr(final AttributeCol at) {
+		Image del = new ImageButton("images/delete_item_small.gif", "Remove this attribute", new ClickListener() {
+			public void onClick(Widget w) {
+				if (com.google.gwt.user.client.Window.confirm("Are you sure you want to delete the column for " + at.attr + " - all data in that column will be removed?")) {
+					dt.attributeCols.remove(at);
+					removeField(at.attr);
+					scrapeData(-1);
+					refreshGrid();
+					refreshAttributeWidget();
+				}
+			}
+		});
+
+		return del;
+	}
+
+	/**
+	 * Here we read the record data from the grid into the data in the model.
+	 * if we have an insertCol - then a new empty column of data will be added in that
+	 * row position.
+	 */
+	private void scrapeData(int insertCol) {
+		Record[] recs = grid.getStore().getRecords();
+		dt.data = new String[recs.length][];
+		for (int i = 0; i < recs.length; i++) {
+			Record r = recs[i];
+			if (insertCol == -1) {
+				String[] row = new String[fds.length];
+				dt.data[i] = row;
+				for (int j = 0; j < fds.length; j++) {
+					row[j] = r.getAsString(fds[j].getName());
+				}
+			} else {
+				String[] row = new String[fds.length + 1];
+				dt.data[i] = row;
+				for (int j = 0; j < fds.length; j++) {
+					if (j < insertCol) {
+						row[j] = r.getAsString(fds[j].getName());
+					} else if (j >= insertCol) {
+						row[j + 1] = r.getAsString(fds[j].getName());
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * removes the field from the field def.
+	 * @param headerName
+	 */
+	private void removeField(String headerName) {
+		FieldDef[] fds_ = new FieldDef[fds.length -1];
+		int new_i = 0;
+		for (int i = 0; i < fds.length; i++) {
+			FieldDef fd = fds[i];
+			if (!fd.getName().equals(headerName)) {
+				fds_[new_i] = fd;
+				new_i++;
+			}
+		}
+		this.fds = fds_;
+
+	}
+
+
+	private void refreshGrid() {
+		if (layout.getWidgetCount() > 1) {
+			layout.remove(1);
+		}
+		grid = doGrid();
+        layout.add(grid);
+	}
+
 	private GridPanel doGrid() {
 
-		FieldDef[] fds = new FieldDef[dt.actionCols.size() + dt.conditionCols.size() + 2]; //its +2 as we have counter and description data
+		fds = new FieldDef[dt.attributeCols.size() + dt.actionCols.size() + dt.conditionCols.size() + 2]; //its +2 as we have counter and description data
 
 		fds[0] = new StringFieldDef("num");
 		fds[1] = new StringFieldDef("desc");
@@ -94,7 +483,21 @@
 		colCount++;
 
 
+		//now to attributes
+		for (int i = 0; i < dt.attributeCols.size(); i++) {
+			final AttributeCol attr = (AttributeCol) dt.attributeCols.get(i);
+			fds[colCount] = new StringFieldDef(attr.attr);
+			cols[colCount] = new ColumnConfig() {
+				{
+					setHeader(attr.attr);
+					setDataIndex(attr.attr);
+					setSortable(true);
+				}
+			};
+			colCount++;
+		}
 
+
 		//do all the condition cols
 		for (int i = 0; i < dt.conditionCols.size(); i++) {
 			//here we could also deal with numeric type?
@@ -175,8 +578,8 @@
 
 
         grid.setStore(store);
-        grid.setWidth(500);
-        grid.setHeight(300);
+        grid.setWidth(700);
+        grid.setHeight(500);
 
 
         grid.addGridCellListener(new GridCellListenerAdapter() {

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/InsertAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,71 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for inserting a row.
- * @author Steven Williams
- */
-public class InsertAction extends Composite {
-
-    private HorizontalPanel panel = new HorizontalPanel();
-    private Image insert;
-    private int row;
-    
-
-    
-    
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked
-     * @param clickListener
-     * @param okClickListener
-     */
-    public InsertAction(final int currentRow, final RowClickListener clickListener) {
-        row = currentRow;
-        insert = new Image("images/new_item.gif");
-        insert.setTitle( "Insert row after row " + row );
-        insert.addClickListener( new ClickListener() {
-			public void onClick(final Widget w) {
-				clickListener.onClick(w, row);
-			}
-        });
-        
-        panel.add( insert);
-        
-        initWidget( panel );
-    }
-    
-    public void setRow(final int row) {
-    	this.row = row;
-    	insert.setTitle( "Insert row after row " + row );
-    	
-    }
-    
-    public int getRow() {
-    	return row;
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/MergeAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,69 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for merging cells in a row.
- * @author Steven Williams
- */
-public class MergeAction extends Composite {
-
-    private HorizontalPanel panel = new HorizontalPanel();
-    private Image merge;
-    private int row;
-    
-
-    
-    
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked
-     * @param clickListener
-     * @param okClickListener
-     */
-    public MergeAction(final int currentRow, final RowClickListener clickListener) {
-        row = currentRow;
-        merge = new Image("images/refresh.gif");
-        merge.setTitle( "Merge cells in this row" );
-        merge.addClickListener( new ClickListener() {
-			public void onClick(final Widget w) {
-				clickListener.onClick(w, row);
-			}
-        });
-        
-        panel.add( merge);
-        
-        initWidget( panel );
-    }
-    
-    public void setRow(final int row) {
-    	this.row = row;
-    }
-    
-    public int getRow() {
-    	return row;
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,75 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for moving a row up or down.
- * @author Steven Williams
- */
-public class ShuffleAction extends Composite {
-
-    private HorizontalPanel panel = new HorizontalPanel();
-    private Image shuffle;
-    private int row;
-    
-    public final static ShuffleAction EMPTY1 = new ShuffleAction() {
-    	
-    };
-    
-    public ShuffleAction() {
-    	initWidget(panel);
-    }
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked and the
-     * direction to move the row
-     * @param currentRow
-     * @param clickListener
-     * @param direction
-     */
-    public ShuffleAction(final int currentRow, final RowClickListener clickListener, final String direction) {
-        row = currentRow;
-        shuffle = new Image("images/shuffle_" + direction + ".gif");
-        shuffle.setTitle( "Move this row " + direction );
-        shuffle.addClickListener( new ClickListener() {
-			public void onClick(final Widget w) {
-				clickListener.onClick(w, row);
-			}
-        });
-        
-        panel.add( shuffle);
-        
-        initWidget( panel );
-    }
-    
-    public void setRow(final int row) {
-    	this.row = row;
-    }
-    
-    public int getRow() {
-    	return row;
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleDownAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,37 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-/**
- * This shows the widget for moving a row down.
- * @author Steven Williams
- */
-public class ShuffleDownAction extends ShuffleAction {
-
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked
-     * @param clickListener
-     * @param okClickListener
-     */
-    public ShuffleDownAction(final int currentRow, final RowClickListener clickListener) {
-    	super(currentRow, clickListener, "down");
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/ShuffleUpAction.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,37 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import org.drools.brms.client.decisiontable.EditableDTGrid.RowClickListener;
-
-/**
- * This shows the widget for moving a row up.
- * @author Steven Williams
- */
-public class ShuffleUpAction extends ShuffleAction {
-
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked
-     * @param clickListener
-     * @param okClickListener
-     */
-    public ShuffleUpAction(final int currentRow, final RowClickListener clickListener) {
-    	super(currentRow, clickListener, "up");
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/Toolbar.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,143 +0,0 @@
-package org.drools.brms.client.decisiontable;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import com.google.gwt.user.client.ui.ClickListener;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Widget;
-
-/**
- * This shows the widget for moving a row up or down.
- * @author Steven Williams
- */
-public class Toolbar extends Composite {
-
-    private HorizontalPanel toolbar = new HorizontalPanel();
-    private int row;
-    
-    public Toolbar() {
-    	initWidget(toolbar);
-    }
-    /**
-     * Pass in the click listener delegate for when the respective action is clicked and the
-     * direction to move the row
-     * @param currentRow
-     * @param clickListener
-     * @param direction
-     */
-    public Toolbar(final EditableDTGrid grid) {
-		toolbar.add(createInsertRow(grid));
-		toolbar.add(createDeleteRow(grid));
-		toolbar.add(createMoveUp(grid));
-		toolbar.add(createMoveDown(grid));
-		toolbar.add(createMergeCol(grid));
-		toolbar.add(createSplitCol(grid));
-		toolbar.add(createMergeRow(grid));
-		toolbar.add(createSplitRow(grid));
-		toolbar.setStyleName("dt-editor-Toolbar");
-        
-        initWidget( toolbar );
-    }
-	private Image createSplitRow(final EditableDTGrid grid) {
-		Image split = new Image("images/split_row.gif");
-		split.addClickListener(new ClickListener() {
-
-			public void onClick(Widget w) {
-				grid.splitRow();
-			}});
-		return split;
-	}
-	private Image createMergeRow(final EditableDTGrid grid) {
-		Image merge = new Image("images/merge_row.gif");
-		merge.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.mergeRow();
-			}});
-		return merge;
-	}
-	private Image createSplitCol(final EditableDTGrid grid) {
-		Image split = new Image("images/split_col.gif");
-		split.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.splitCol();
-			}});
-		return split;
-	}
-	private Image createMergeCol(final EditableDTGrid grid) {
-		Image merge = new Image("images/merge_col.gif");
-		merge.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.mergeCol();
-			}});
-		return merge;
-	}
-	private Image createMoveDown(final EditableDTGrid grid) {
-		Image moveDown = new Image("images/shuffle_down.gif");
-		moveDown.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.moveDown();
-			}});
-		return moveDown;
-	}
-	private Image createMoveUp(final EditableDTGrid grid) {
-		Image moveUp = new Image("images/shuffle_up.gif");
-		moveUp.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.moveUp();
-			}
-		});
-		return moveUp;
-	}
-	private Image createDeleteRow(final EditableDTGrid grid) {
-		Image delete = new Image("images/clear_item.gif");
-        delete.setTitle( "Delete row" );
-		delete.addClickListener(new ClickListener() {
-			
-			public void onClick(Widget w) {
-				grid.deleteRow();
-			}
-		});
-		return delete;
-	}
-	private Image createInsertRow(final EditableDTGrid grid) {
-		Image insert = new Image("images/new_item.gif");
-		insert.addClickListener(new ClickListener() {
-
-			public void onClick(Widget w) {
-				grid.insertRow();
-			}
-		});
-		return insert;
-	}
-    
-    public void setRow(final int row) {
-    	this.row = row;
-    }
-    
-    public int getRow() {
-    	return row;
-    }
-    
-}
\ No newline at end of file

Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Cell.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,75 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-public 
-class Cell {
-	private int rowspan;
-	private int colspan;
-	private String value;
-	private Row row;
-	private Column column;
-	
-	Cell(Row row, Column col) {
-		this(row, col, 1, 1);
-	}
-	Cell(final Row r, final Column c, final int colspan, final int rowspan) {
-		this.row = r;
-		this.column = c;
-		this.colspan = colspan;
-		this.rowspan = rowspan;
-	}
-	public void setValue(final String value) {
-		this.value = value;
-	}
-	public int getRowIndex() {
-		return row.getIndex();
-	}
-	public int getColumnIndex() {
-		return column.getIndex();
-	}
-	public Row getRow() {
-		return row;
-	}
-	public void setRow(Row row) {
-		this.row = row;
-	}
-	public int getRowspan() {
-		return rowspan;
-	}
-	public void setRowspan(int rowspan) {
-		this.rowspan = rowspan;
-	}
-	public int getColspan() {
-		return colspan;
-	}
-	public Column getColumn() {
-		return column;
-	}
-	public String getValue() {
-		return value;
-	}
-	public String toString() {
-		return "Cell[" + getRowIndex() + ", " + getColumnIndex() + ", " + getValue() + "]";
-	}
-	public void setColspan(int colspan) {
-		this.colspan = colspan;
-	}
-	
-	
-}
Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Column.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,40 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Column {
-	private List cells = new ArrayList();
-	private DecisionTable parent;
-	
-	Column(DecisionTable dt) {
-		this.parent = dt;
-	}
-	void addCell(final Cell cell) {
-		cells.add(cell);
-	}
-
-	public int getIndex() {
-		return parent.getColumnIndex(this);
-	}
-	public void removeCell(Cell cell) {
-		cells.remove(cell);
-	}
-}
Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/DecisionTable.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,98 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class DecisionTable {
-	private Row headerRow = new HeaderRow(this);
-	private List rows = new ArrayList();
-	private List columns = new ArrayList();
-	
-	void addRow() {
-		
-	}
-	
-	void addColumn(final Column column) {
-		columns.add(column);
-	}
-	
-	public Row createRow() {
-		Row row = new Row(this);
-		rows.add(row);
-		return row;
-	}
-	
-	public Column createColumn() {
-		Column column = new Column(this);
-		columns.add(column);
-		return column;
-	}
-
-	public Cell createCell(Row row, Column column) {
-		Cell cell = new Cell(row, column);
-		row.addCell(cell);
-		column.addCell(cell);
-		return cell;
-	}
-
-	public Row getHeaderRow() {
-		return headerRow;
-	}
-
-	public List getColumns() {
-		return columns;
-	}
-
-	public List getRows() {
-		return rows;
-	}
-	public Row getRow(int index) {
-		return (Row) rows.get(index);
-	}
-	
-	public int getRowIndex(Row row) {
-		return rows.indexOf(row);
-	}
-	public int getColumnIndex(Column column) {
-		return columns.indexOf(column);
-	}
-
-	public void mergeCol(Cell currentCell) {
-		Row row = currentCell.getRow();
-		int currentColspan = currentCell.getColspan();
-		int nextCellColumnIndex = currentCell.getColumnIndex() + currentColspan;
-		Column nextColumn = (Column) columns.get(nextCellColumnIndex);
-		Cell nextCell = row.getCell(nextColumn);
-		currentCell.setColspan(currentColspan + nextCell.getColspan());
-		row.removeColumn(nextColumn);
-		nextColumn.removeCell(nextCell);
-	}
-	
-	public void mergeRow(Cell currentCell) {
-		Column column = currentCell.getColumn();
-		int currentRowspan = currentCell.getRowspan();
-		int nextCellRowIndex = currentCell.getRowIndex() + currentRowspan;
-		Row nextRow = (Row) rows.get(nextCellRowIndex);
-		Cell nextCell = nextRow.getCell(column);
-		currentCell.setRowspan(currentRowspan + nextCell.getRowspan());
-		nextRow.removeColumn(column);
-		column.removeCell(nextCell);
-	}
-}
Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/HeaderRow.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,32 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-public class HeaderRow extends Row {
-
-	HeaderRow(DecisionTable dt) {
-		super(dt);
-	}
-
-	int getIndex() {
-		return -1;
-	}
-	
-	
-
-}
Deleted: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/client/decisiontable/model/Row.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -1,56 +0,0 @@
-package org.drools.brms.client.decisiontable.model;
-/*
- * Copyright 2005 JBoss Inc
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-public class Row {
-	private Map cells = new HashMap();
-	private DecisionTable parent;
-	
-	Row(DecisionTable dt) {
-		this.parent = dt;
-	}
-	void addCell(final Cell cell) {
-		cells.put(cell.getColumn(), cell);
-	}
-	int getIndex() {
-		return parent.getRowIndex(this);
-	}
-	public Cell getCell(Column column) {
-		return (Cell) cells.get(column);
-	}
-	public Cell getCell(int col) {
-		Iterator columns = parent.getColumns().iterator();
-		int i = 0;
-		Column column = null;
-		while (i <= col) {
-			column = (Column) columns.next();
-			Cell cell = (Cell) cells.get(column);
-			if (cell != null) {
-				i++;
-			}
-		}
-		return getCell(column);
-	}
-	public void removeColumn(Column nextColumn) {
-		cells.remove(nextColumn);
-	}
-}
Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/ServiceImplementation.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/ServiceImplementation.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/ServiceImplementation.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -17,29 +17,7 @@
 
 
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectOutput;
-import java.text.DateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.JarEntry;
-import java.util.jar.JarInputStream;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.jcr.ItemExistsException;
-import javax.jcr.RepositoryException;
-
+import com.google.gwt.user.client.rpc.SerializableException;
 import org.apache.commons.io.IOUtils;
 import org.apache.log4j.Logger;
 import org.drools.RuleBase;
@@ -79,8 +57,8 @@
 import org.drools.brms.server.util.TableDisplayHandler;
 import org.drools.common.AbstractRuleBase;
 import org.drools.common.DroolsObjectInputStream;
-import org.drools.common.InternalWorkingMemory;
 import org.drools.common.DroolsObjectOutputStream;
+import org.drools.common.InternalWorkingMemory;
 import org.drools.compiler.DrlParser;
 import org.drools.compiler.DroolsParserException;
 import org.drools.compiler.PackageBuilderConfiguration;
@@ -89,8 +67,8 @@
 import org.drools.repository.AssetHistoryIterator;
 import org.drools.repository.AssetItem;
 import org.drools.repository.AssetItemIterator;
-import org.drools.repository.CategoryItem;
 import org.drools.repository.AssetPageList;
+import org.drools.repository.CategoryItem;
 import org.drools.repository.PackageItem;
 import org.drools.repository.PackageIterator;
 import org.drools.repository.RulesRepository;
@@ -107,7 +85,27 @@
 import org.jboss.seam.annotations.remoting.WebRemote;
 import org.jboss.seam.annotations.security.Restrict;
 
-import com.google.gwt.user.client.rpc.SerializableException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.RepositoryException;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutput;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.jar.JarEntry;
+import java.util.jar.JarInputStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * This is the implementation of the repository service to drive the GWT based front end.

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/repository/RulesRepositoryManager.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/repository/RulesRepositoryManager.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/repository/RulesRepositoryManager.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -64,7 +64,7 @@
     }
     
     @Destroy
-    void close() {
+    public void close() {
         repository.logout();
     }
     

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/main/java/org/drools/brms/server/security/SecurityServiceImpl.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -76,7 +76,8 @@
         } else {
         	HashSet<String> disabled = new HashSet<String>();
         	//disabled.add("QA");
-            return new UserSecurityContext(null, new HashSet());//new UserSecurityContext("SINGLE USER MODE (DEBUG) USE ONLY", disabled);
+            //return new UserSecurityContext(null, new HashSet());
+            return new UserSecurityContext("SINGLE USER MODE (DEBUG) USE ONLY", disabled);
         }
     }
 

Modified: labs/jbossrules/branches/ming-serialization/drools-jbrms/src/test/java/org/drools/brms/server/ServiceImplementationTest.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jbrms/src/test/java/org/drools/brms/server/ServiceImplementationTest.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jbrms/src/test/java/org/drools/brms/server/ServiceImplementationTest.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -19,32 +19,61 @@
 import com.google.gwt.user.client.rpc.IsSerializable;
 import com.google.gwt.user.client.rpc.SerializableException;
 import junit.framework.TestCase;
-
-import org.apache.commons.io.IOUtils;
 import org.drools.Person;
 import org.drools.RuleBase;
 import org.drools.StatelessSession;
 import org.drools.brms.client.common.AssetFormats;
 import org.drools.brms.client.modeldriven.SuggestionCompletionEngine;
-import org.drools.brms.client.modeldriven.brl.*;
-import org.drools.brms.client.modeldriven.testing.*;
-import org.drools.brms.client.rpc.*;
+import org.drools.brms.client.modeldriven.brl.ActionFieldValue;
+import org.drools.brms.client.modeldriven.brl.ActionSetField;
+import org.drools.brms.client.modeldriven.brl.FactPattern;
+import org.drools.brms.client.modeldriven.brl.ISingleFieldConstraint;
+import org.drools.brms.client.modeldriven.brl.RuleModel;
+import org.drools.brms.client.modeldriven.brl.SingleFieldConstraint;
+import org.drools.brms.client.modeldriven.testing.ExecutionTrace;
+import org.drools.brms.client.modeldriven.testing.FactData;
+import org.drools.brms.client.modeldriven.testing.FieldData;
+import org.drools.brms.client.modeldriven.testing.Scenario;
+import org.drools.brms.client.modeldriven.testing.VerifyFact;
+import org.drools.brms.client.modeldriven.testing.VerifyField;
+import org.drools.brms.client.modeldriven.testing.VerifyRuleFired;
+import org.drools.brms.client.rpc.AnalysisReport;
+import org.drools.brms.client.rpc.BuilderResult;
+import org.drools.brms.client.rpc.BulkTestRunResult;
+import org.drools.brms.client.rpc.DetailedSerializableException;
+import org.drools.brms.client.rpc.PackageConfigData;
+import org.drools.brms.client.rpc.RepositoryService;
+import org.drools.brms.client.rpc.RuleAsset;
+import org.drools.brms.client.rpc.RuleContentText;
+import org.drools.brms.client.rpc.ScenarioResultSummary;
+import org.drools.brms.client.rpc.ScenarioRunResult;
+import org.drools.brms.client.rpc.SnapshotInfo;
+import org.drools.brms.client.rpc.TableConfig;
+import org.drools.brms.client.rpc.TableDataResult;
+import org.drools.brms.client.rpc.TableDataRow;
+import org.drools.brms.client.rpc.ValidatedResponse;
 import org.drools.brms.server.util.BRXMLPersistence;
 import org.drools.brms.server.util.IO;
 import org.drools.brms.server.util.ScenarioXMLPersistence;
 import org.drools.brms.server.util.TableDisplayHandler;
 import org.drools.brms.server.util.TestEnvironmentSessionHelper;
 import org.drools.common.DroolsObjectInputStream;
-import org.drools.repository.*;
+import org.drools.repository.AssetItem;
+import org.drools.repository.CategoryItem;
+import org.drools.repository.PackageItem;
+import org.drools.repository.RulesRepository;
+import org.drools.repository.RulesRepositoryException;
+import org.drools.repository.StateItem;
 import org.drools.rule.Package;
 import org.drools.util.BinaryRuleBaseLoader;
 
 import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.ObjectInputStream;
-import java.io.StringReader;
 import java.io.ObjectInput;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
 
 public class ServiceImplementationTest extends TestCase {
 

Modified: labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94EventFactHandle.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94EventFactHandle.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94EventFactHandle.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -77,7 +77,7 @@
     Jsr94EventFactHandle(final long id,
                          final Object object,
                          final long recency) {
-        super( id,
+        super( (int) id,
                object,
                recency );
     }
@@ -96,7 +96,7 @@
                                 final long recency,
                                 final long timestamp,
                                 final long duration) {
-        super( id,
+        super( (int) id,
                object,
                recency,
                timestamp,

Modified: labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandle.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandle.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandle.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -77,7 +77,7 @@
     Jsr94FactHandle(final long id,
                     final Object object,
                     final long recency) {
-        super( id,
+        super( (int) id,
                object,
                recency );
     }

Modified: labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandleFactory.java
===================================================================
--- labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandleFactory.java	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/drools-jsr94/src/main/java/org/drools/jsr94/rules/Jsr94FactHandleFactory.java	2008-03-17 17:22:29 UTC (rev 19037)
@@ -32,7 +32,7 @@
 
 	private static final long serialVersionUID = 4964273923122006124L;
 
-	protected final InternalFactHandle newFactHandle(final long id,
+	protected final InternalFactHandle newFactHandle(final int id,
 			final Object object, final long recency, final boolean isEvent,
 			final WorkingMemory workingMemory) {
 		return this.newFactHandle(id, object, recency, isEvent, 0,
@@ -44,7 +44,7 @@
 	 * 
 	 * @see org.drools.reteoo.FactHandleFactory#newFactHandle(long)
 	 */
-	protected final InternalFactHandle newFactHandle(final long id,
+	protected final InternalFactHandle newFactHandle(final int id,
 			final Object object, final long recency, final boolean isEvent,
 			final long duration, final WorkingMemory workingMemory) {
 		if (isEvent) {

Modified: labs/jbossrules/branches/ming-serialization/src/main/assembly/bin.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/src/main/assembly/bin.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/src/main/assembly/bin.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -36,7 +36,7 @@
     		<include>org.drools:drools-compiler</include>
     		<include>org.drools:drools-jsr94</include>
     		<include>org.drools:drools-decisiontables</include>
-    		<!-- <include>org.drools:drools-analytics</include> -->
+    		<include>org.drools:drools-analytics</include>
      		<include>org.drools:drools-ant</include>
     		<!--include>org.drools:drools-clips</include-->
     		<include>org.drools:drools-examples</include>

Modified: labs/jbossrules/branches/ming-serialization/src/main/assembly/src.xml
===================================================================
--- labs/jbossrules/branches/ming-serialization/src/main/assembly/src.xml	2008-03-17 15:57:16 UTC (rev 19036)
+++ labs/jbossrules/branches/ming-serialization/src/main/assembly/src.xml	2008-03-17 17:22:29 UTC (rev 19037)
@@ -15,10 +15,11 @@
          <include>drools-compiler/**</include>
          <include>drools-decisiontables/**</include>
          <include>drools-jsr94/**</include>
-         <include>drools-eclipse/**</include>
-         <include>drools-repository/**</include>
+         <include>drools-eclipse/**</include>
+         <include>drools-repository/**</include>
          <include>drools-jbrms/**</include>
-         <include>drools-ant</include>
+         <include>drools-ant/**</include>
+		 <include>drools-analytics/**</include>
          <include>documentation/**</include>
          <include>m2_repo/**</include>
          <include>*.xml</include>
@@ -38,4 +39,4 @@
       </excludes>
     </fileSet>
   </fileSets>
-</assembly>
+</assembly>




More information about the jboss-svn-commits mailing list