break;
}
case PersisterEnums.LEFT_TUPLE : {
int sinkId = stream.readInt();
LeftTupleSink childSink = (LeftTupleSink) sinks.get( sinkId );
LeftTuple childLeftTuple = new LeftTupleImpl( parentLeftTuple,
accctx.result,
childSink,
true );
readLeftTuple( childLeftTuple,
context );
break;
}
default : {
throw new RuntimeDroolsException( "Marshalling error. This is a bug. Please contact the development team." );
}
}
}
break;
}
case NodeTypeEnums.RightInputAdaterNode : {
// RIANs generate new fact handles on-demand to wrap tuples and need special procedures when de-serializing from persistent storage
ObjectHashMap memory = (ObjectHashMap) context.wm.getNodeMemory( (NodeMemory) sink );
// create fact handle
int id = stream.readInt();
long recency = stream.readLong();
InternalFactHandle handle = new DefaultFactHandle( id,
parentLeftTuple,
recency,
context.wm.getEntryPoints().get( EntryPoint.DEFAULT.getEntryPointId() ) );
memory.put( parentLeftTuple, handle );
readRightTuples( handle, context );
stream.readShort(); // Persistence.END
break;
}
case NodeTypeEnums.FromNode: {
// context.out.println( "FromNode" );
// FNs generate new fact handles on-demand to wrap objects and need special procedures when serializing to persistent storage
FromMemory memory = (FromMemory) context.wm.getNodeMemory( (NodeMemory) sink );
memory.betaMemory.getLeftTupleMemory().add( parentLeftTuple );
Map<Object, RightTuple> matches = new LinkedHashMap<Object, RightTuple>();
parentLeftTuple.setObject( matches );
while( stream.readShort() == PersisterEnums.FACT_HANDLE ) {
// we de-serialize the generated fact handle ID
InternalFactHandle handle = readFactHandle( context );
context.handles.put( handle.getId(),
handle );
readRightTuples( handle,
context );
matches.put( handle.getObject(), handle.getFirstRightTuple() );
}
while( stream.readShort() == PersisterEnums.RIGHT_TUPLE ) {
LeftTupleSink childSink = (LeftTupleSink) sinks.get( stream.readInt() );
int factHandleId = stream.readInt();
RightTupleKey key = new RightTupleKey( factHandleId,
null ); // created tuples in from node always use null sink
RightTuple rightTuple = context.rightTuples.get( key );
LeftTuple childLeftTuple = new LeftTupleImpl( parentLeftTuple,
rightTuple,
childSink,
true );
readLeftTuple( childLeftTuple,
context );
}
// context.out.println( "FromNode --- END" );
break;
}
case NodeTypeEnums.UnificationNode : {
boolean isOpen = context.readBoolean();
if ( isOpen ) {
QueryElementNode node = (QueryElementNode) sink;
InternalFactHandle handle = readFactHandle( context );
context.handles.put( handle.getId(),
handle );
node.createDroolsQuery( parentLeftTuple, handle, context.wm );
readLeftTuples( context );
} else {
while ( stream.readShort() == PersisterEnums.LEFT_TUPLE ) {
LeftTupleSink childSink = (LeftTupleSink) sinks.get( stream.readInt() );
// we de-serialize the generated fact handle ID
InternalFactHandle handle = readFactHandle( context );
context.handles.put( handle.getId(),
handle );
RightTuple rightTuple = new RightTuple( handle );
// @TODO check if open query
LeftTuple childLeftTuple = new LeftTupleImpl( parentLeftTuple,
rightTuple,
childSink,
true );
readLeftTuple( childLeftTuple,
context );