[jboss-svn-commits] JBL Code SVN: r25208 - in labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools: marshalling and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Feb 10 10:47:30 EST 2009


Author: salaboy21
Date: 2009-02-10 10:47:29 -0500 (Tue, 10 Feb 2009)
New Revision: 25208

Modified:
   labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/SessionConfiguration.java
   labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
Log:
Session Configuration persistence strategy file load. InputMarshaller add variableScopeInstance

Modified: labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/SessionConfiguration.java
===================================================================
--- labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/SessionConfiguration.java	2009-02-10 15:11:15 UTC (rev 25207)
+++ labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/SessionConfiguration.java	2009-02-10 15:47:29 UTC (rev 25208)
@@ -71,7 +71,8 @@
     private ProcessInstanceManagerFactory  processInstanceManagerFactory;
     private SignalManagerFactory           processSignalManagerFactory;
     private WorkItemManagerFactory         workItemManagerFactory;
-    private CommandService                 commandService; 
+    private CommandService                 commandService;
+    private String persistenceStrategies;
 
     public void writeExternal(ObjectOutput out) throws IOException {
         out.writeObject( chainedProperties );
@@ -111,7 +112,9 @@
         if ( properties != null ) {
             this.chainedProperties.addProperties( properties );
         }
-
+        
+        setPersistenceStrategies(this.chainedProperties.getProperty("drools.persistence.strategies", ""));
+        
         setKeepReference( Boolean.valueOf( this.chainedProperties.getProperty( "drools.keepReference",
                                                                                "true" ) ).booleanValue() );
 
@@ -143,8 +146,10 @@
             return Boolean.toString( this.keepReference );
         } else if ( name.equals( "drools.clockType" ) ) {
             return this.clockType.toExternalForm();
+        } else if ( name.equals("drools.persistence.strategies") ){
+            return this.getPersistenceStrategies();
         }
-        
+
         return null;
     } 
 
@@ -375,4 +380,18 @@
             throw new IllegalArgumentException( "Command service '" + className + "' not found" );
         }
     }
+
+    /**
+     * @return the persistenceStrategies
+     */
+    public String getPersistenceStrategies() {
+        return persistenceStrategies;
+    }
+
+    /**
+     * @param persistenceStrategies the persistenceStrategies to set
+     */
+    public void setPersistenceStrategies(String persistenceStrategies) {
+        this.persistenceStrategies = persistenceStrategies;
+    }
 }

Modified: labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java
===================================================================
--- labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java	2009-02-10 15:11:15 UTC (rev 25207)
+++ labs/jbossrules/branches/salaboy_VariablePersistenceStrategy/drools-core/src/main/java/org/drools/marshalling/InputMarshaller.java	2009-02-10 15:47:29 UTC (rev 25208)
@@ -780,7 +780,7 @@
     }
 
     public static ProcessInstance readProcessInstance(MarshallerReaderContext context, boolean readVariables) throws IOException {
-        //@TODO: fix this method to get the variable with the persistence strategy
+        
         ObjectInputStream stream = context.stream;
         InternalRuleBase ruleBase = context.ruleBase;
         InternalWorkingMemory wm = context.wm;
@@ -799,7 +799,8 @@
         if(readVariables){
             int nbVariables = stream.readInt();
             if ( nbVariables > 0 ) {
-                VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
+                VariableScopeInstance variableScopeInstance = new VariableScopeInstance();
+                //VariableScopeInstance variableScopeInstance = (VariableScopeInstance) processInstance.getContextInstance( VariableScope.VARIABLE_SCOPE );
                 for ( int i = 0; i < nbVariables; i++ ) {
                     String name = stream.readUTF();
                     try {
@@ -810,8 +811,10 @@
                         throw new IllegalArgumentException( "Could not reload variable " + name );
                     }
                 }
+                variableScopeInstance.setProcessInstance(processInstance);
+                processInstance.setContextInstance(VariableScope.VARIABLE_SCOPE, variableScopeInstance);
             }
-           
+
             //@TODO: should i use another flag for swimlanes? or refactor the name to includeContexts
 
             int nbSwimlanes = stream.readInt();
@@ -825,9 +828,9 @@
                 }
             }
         }
-         
         
 
+
         while ( stream.readShort() == PersisterEnums.NODE_INSTANCE ) {
             readNodeInstance( context,
                               processInstance,




More information about the jboss-svn-commits mailing list