[jboss-svn-commits] JBL Code SVN: r14720 - 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 Aug 29 00:30:44 EDT 2007


Author: michael.neale at jboss.com
Date: 2007-08-29 00:30:44 -0400 (Wed, 29 Aug 2007)
New Revision: 14720

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java
Log:
valid flag was not being written/read in write/read external

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java	2007-08-29 02:29:48 UTC (rev 14719)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/rule/Package.java	2007-08-29 04:30:44 UTC (rev 14720)
@@ -2,13 +2,13 @@
 
 /*
  * 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.
@@ -40,11 +40,11 @@
 
 /**
  * Collection of related <code>Rule</code>s.
- * 
+ *
  * @see Rule
- * 
+ *
  * @author <a href="mail:bob at werken.com">bob mcwhirter </a>
- * 
+ *
  * @version $Id: Package.java,v 1.1 2005/07/26 01:06:31 mproctor Exp $
  */
 public class Package
@@ -55,7 +55,7 @@
     // ------------------------------------------------------------
 
     /**
-     * 
+     *
      */
     private static final long      serialVersionUID = 400L;
 
@@ -94,7 +94,7 @@
     // ------------------------------------------------------------
 
     /**
-     * Default constructor - for Externalizable. This should never be used by a user, as it 
+     * Default constructor - for Externalizable. This should never be used by a user, as it
      * will result in an invalid state for the instance.
      */
     public Package() {
@@ -103,7 +103,7 @@
 
     /**
      * Construct.
-     * 
+     *
      * @param name
      *            The name of this <code>Package</code>.
      */
@@ -114,7 +114,7 @@
 
     /**
      * Construct.
-     * 
+     *
      * @param name
      *            The name of this <code>Package</code>.
      */
@@ -142,7 +142,7 @@
     /**
      * Handles the write serialization of the Package. Patterns in Rules may reference generated data which cannot be serialized by default methods.
      * The Package uses PackageCompilationData to hold a reference to the generated bytecode. The generated bytecode must be restored before any Rules.
-     * 
+     *
      */
     public void writeExternal(final ObjectOutput stream) throws IOException {
         stream.writeObject( this.packageCompilationData );
@@ -151,7 +151,9 @@
         stream.writeObject( this.staticImports );
         stream.writeObject( this.globals );
         stream.writeObject( this.ruleFlows );
+        stream.writeBoolean( this.valid );
 
+
         // Rules must be restored by an ObjectInputStream that can resolve using a given ClassLoader to handle seaprately by storing as
         // a byte[]
         final ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -164,7 +166,7 @@
      * Handles the read serialization of the Package. Patterns in Rules may reference generated data which cannot be serialized by default methods.
      * The Package uses PackageCompilationData to hold a reference to the generated bytecode; which must be restored before any Rules.
      * A custom ObjectInputStream, able to resolve classes against the bytecode in the PackageCompilationData, is used to restore the Rules.
-     * 
+     *
      */
     public void readExternal(final ObjectInput stream) throws IOException,
                                                       ClassNotFoundException {
@@ -175,6 +177,7 @@
         this.staticImports = (Set) stream.readObject();
         this.globals = (Map) stream.readObject();
         this.ruleFlows = (Map) stream.readObject();
+        this.valid = stream.readBoolean();
 
         // Return the rules stored as a byte[]
         final byte[] bytes = (byte[]) stream.readObject();
@@ -192,7 +195,7 @@
 
     /**
      * Retrieve the name of this <code>Package</code>.
-     * 
+     *
      * @return The name of this <code>Package</code>.
      */
     public String getName() {
@@ -277,10 +280,10 @@
 
     /**
      * Add a <code>Rule</code> to this <code>Package</code>.
-     * 
+     *
      * @param rule
      *            The rule to add.
-     * 
+     *
      * @throws DuplicateRuleNameException
      *             If the <code>Rule</code> attempting to be added has the
      *             same name as another previously added <code>Rule</code>.
@@ -315,7 +318,7 @@
     }
 
     /**
-     * Rule flows can be removed by ID. 
+     * Rule flows can be removed by ID.
      */
     public void removeRuleFlow(String id) {
         if ( !this.ruleFlows.containsKey( id ) ) {
@@ -327,11 +330,11 @@
     public PackageCompilationData removeRule(final Rule rule) {
         this.rules.remove( rule.getName() );
         final String consequenceName = rule.getConsequence().getClass().getName();
-        
+
         // check for compiled code and remove if present.
-        if ( this.packageCompilationData.remove( consequenceName ) ) {    
+        if ( this.packageCompilationData.remove( consequenceName ) ) {
             removeClasses( rule.getLhs() );
-    
+
             // Now remove the rule class - the name is a subset of the consequence name
             this.packageCompilationData.remove( consequenceName.substring( 0,
                                                                            consequenceName.indexOf( "ConsequenceInvoker" ) ) );
@@ -368,10 +371,10 @@
 
     /**
      * Retrieve a <code>Rule</code> by name.
-     * 
+     *
      * @param name
      *            The name of the <code>Rule</code> to retrieve.
-     * 
+     *
      * @return The named <code>Rule</code>, or <code>null</code> if not
      *         such <code>Rule</code> has been added to this
      *         <code>Package</code>.
@@ -382,7 +385,7 @@
 
     /**
      * Retrieve all <code>Rules</code> in this <code>Package</code>.
-     * 
+     *
      * @return An array of all <code>Rules</code> in this <code>Package</code>.
      */
     public Rule[] getRules() {




More information about the jboss-svn-commits mailing list