Skip to content

Commit

Permalink
- Implementing readExternal and writeExternal on DefaultFactHandle
Browse files Browse the repository at this point in the history
- Adding missing JAX-B mappings to AbstractBaseLinkedListNode
  • Loading branch information
salaboy committed Nov 1, 2012
1 parent a21630a commit 999dc75
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
40 changes: 40 additions & 0 deletions drools-core/src/main/java/org/drools/common/DefaultFactHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@

package org.drools.common;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Map;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
Expand All @@ -27,9 +31,11 @@
import org.drools.FactHandle;
import org.drools.core.util.AbstractBaseLinkedListNode;
import org.drools.core.util.StringUtils;
import org.drools.definition.rule.Rule;
import org.drools.reteoo.LeftTuple;
import org.drools.reteoo.RightTuple;
import org.drools.runtime.rule.WorkingMemoryEntryPoint;
import org.drools.spi.RuleComponent;

/**
* Implementation of <code>FactHandle</code>.
Expand Down Expand Up @@ -494,4 +500,38 @@ private void createFromExternalFormat( String externalFormat ) {
this.disconnected = true;
}

@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
id = in.readInt();
recency = in.readLong();
object = in.readObject();
key = (EqualityKey) in.readObject();
objectHashCode = in.readInt();
identityHashCode = in.readInt();
firstRightTuple = (RightTuple) in.readObject();
lastRightTuple = (RightTuple) in.readObject();
firstLeftTuple = (LeftTuple) in.readObject();
lastLeftTuple = (LeftTuple) in.readObject();
entryPoint = (WorkingMemoryEntryPoint) in.readObject();
disconnected = in.readBoolean();
}

@Override
public void writeExternal(ObjectOutput out) throws IOException {
out.writeInt( id );
out.writeLong( recency );
out.writeObject( object );
out.writeObject( key );
out.writeInt(objectHashCode);
out.writeInt(identityHashCode);
out.writeObject(firstRightTuple);
out.writeObject(lastRightTuple);
out.writeObject(firstLeftTuple);
out.writeObject(lastLeftTuple);
out.writeObject(entryPoint);
out.writeBoolean(disconnected);

}


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Provides a abstract base implementation that an object can extend so that it can be used in a LinkedList.
*
* @see LinkedList
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name="linked-list")
public class AbstractBaseLinkedListNode<T extends LinkedListNode<T>>
implements
LinkedListNode<T> {
Expand Down

0 comments on commit 999dc75

Please sign in to comment.