[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[ecf-dev] Using non-serializable object as shared objects
|
Title: Using non-serializable object as shared objects
Hi,
is there a way to use non-serializable object as shared objects in ECF? At the moment I'm using somethings that looks a littly hacky to me and doesn't feel correct... I wrote a bundle which tracks the IContainerManager services. When a new SOContainer is created I'm calling the setSharedObjectMessageSerializer to inject my own message serializer. The serializer uses a special input and output stream for object reading/writing where known non-serializable objects are serialized by hand and wrapped in a container.
@Override
protected Object replaceObject(Object obj) throws IOException {
if (obj instanceof OWLObject) {
OWLObjectContainer cont = new OWLObjectContainer();
final String owlObjectString = renderer.render((OWLObject) obj);
cont.setOWLObjectString(owlObjectString);
return cont;
}
return obj;
}
On the client side the container is resolved and replaced by the unserialiable object.
@Override
protected Object resolveObject(Object obj) throws IOException {
if (obj instanceof OWLObjectContainer) {
String owlObjectString = ((OWLObjectContainer) obj).getOWLObjectString();
OWLObject owlObj = parser.parse(owlObjectString));
return owlObj;
}
return obj;
}
Is it possible to register something like a "serializer service" in ecf that is used to serialize a special class of objects?