[jboss-svn-commits] JBL Code SVN: r19097 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Mar 19 00:43:36 EDT 2008


Author: mingjin
Date: 2008-03-19 00:43:36 -0400 (Wed, 19 Mar 2008)
New Revision: 19097

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MVELDialectData.java
Log:
JBRULES-1095 implemented read/writeExternal
- MVELDialectData.java:  read/write functionFactory.

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MVELDialectData.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MVELDialectData.java	2008-03-19 04:36:49 UTC (rev 19096)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/MVELDialectData.java	2008-03-19 04:43:36 UTC (rev 19097)
@@ -20,7 +20,7 @@
 	 * user, as it will result in an invalid state for the instance.
 	 */
 	public MVELDialectData() {
-        this(null);
+
 	}
 
 	public MVELDialectData(final DialectDatas datas) {
@@ -54,44 +54,46 @@
 	}
 
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        functionFactory = (MapFunctionResolverFactory)in.readObject();
     }
 
     public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeObject(functionFactory);
     }
 
-    public static class MapFunctionResolverFactory extends
-                                                   MapVariableResolverFactory implements Externalizable {
+	public static class MapFunctionResolverFactory extends
+			MapVariableResolverFactory implements Externalizable {
 
-        public MapFunctionResolverFactory() {
-            super(new HashMap<String, Object>());
-        }
+		public MapFunctionResolverFactory() {
+			super(new HashMap<String, Object>());
+		}
 
-        public void writeExternal(ObjectOutput out) throws IOException {
-            out.writeObject( this.variables );
-        }
+		public void writeExternal(ObjectOutput out) throws IOException {
+			out.writeObject( this.variables );
+		}
 
-        public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-            this.variables = ( Map ) in.readObject();
-        }
+		public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+			this.variables = ( Map ) in.readObject();
+		}
 
-        public void addFunction(Function function) {
-            this.variables.put(function.getName(), function);
-        }
+		public void addFunction(Function function) {
+			this.variables.put(function.getName(), function);
+		}
 
-        public void removeFunction(String functionName) {
-            this.variables.remove(functionName);
-            this.variableResolvers.remove(functionName);
-        }
+		public void removeFunction(String functionName) {
+			this.variables.remove(functionName);
+			this.variableResolvers.remove(functionName);
+		}
 
-        public VariableResolver createVariable(String name, Object value) {
-            throw new RuntimeException(
-                    "variable is a read-only function pointer");
-        }
+		public VariableResolver createVariable(String name, Object value) {
+			throw new RuntimeException(
+					"variable is a read-only function pointer");
+		}
 
-        public VariableResolver createIndexedVariable(int index, String name,
-                                                      Object value, Class<?> type) {
-            throw new RuntimeException(
-                    "variable is a read-only function pointer");
-        }
-    }
+		public VariableResolver createIndexedVariable(int index, String name,
+				Object value, Class<?> type) {
+			throw new RuntimeException(
+					"variable is a read-only function pointer");
+		}
+	}
 }




More information about the jboss-svn-commits mailing list