I've been trying to serialize an instance of
org.drools.rule.Package and have come upon some
problems.  The object itself is Externalizable, but
several objects it uses are not:

org.drools.base.ClassObjectType
org.drools.rule.Column
org.drools.base.evaluators.StringFactory$StringEqualEvaluator

That's no problem, I just implemented Serializable on
those classes.  (org.drools.base.BaseEvaluator to
cover all of the evaluators...)

The problem lies in these classes:
org.drools.spi.FieldValue and
org.drools.base.FieldImpl.

FieldValue has a methods that returns Object and
FieldImpl contains a reference to Object.  I changed
that to Serializable, but unfortunately that would
mean every field of every WM object would need to be
Serializable, and that ain't kosher.  (And, even after
that change I was getting ClassNotFoundExceptions
because class names of my fields were having
"org.drools.fieldaccess." prepended to them...)  

At this point I think org.drools.rule.Package should
not implement Externalizable.  Seems there's some
difficult issues deep down in making it functional.  I
thought on first blush that I'd be able to ship
packages over the wire for some mobile agent stuff I'm
doing, but have had to back off to just sending DRL,
globals, and the content of working memory and
reconstituting at the other end of the line.

I tried Serializing reteoo.WorkingMemoryImpl and got
similar results.  I had to implement Serializable on:

org.drools.common.AgendaGroupImpl
org.drools.common.ActivationQueue
org.drools.util.LinkedList
org.drools.util.LinkedListNode
org.drools.common.PropagationContextImpl

Then it wrapped around again onto the Package
serialization problems...

As a side note, org.drools.lang.descr.PackageDescr was
easily serialized by making
org.drools.lang.descr.PaternDescr Serializable. 
Worked like a champ. :)

GreG


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Reply via email to