OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sdo message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: RE: [sdo] Possible Direction: SDO-156 - java.io.Serializationshould also be able to handle non-closed DataGraph (WIP)


Hi Blaise,

Have you thought about the case where there is more than one object on the stream, in particular, about the case where two root objects share the same orphan?  To be concrete, imagine that customer.getInstanceProperty("address").isContainment() is false and.

DataObject customer1 = ...
DataObject customer2 = ...
DataObject address = ...

customer1.set("address",address);
customer2.set("address",address);

ObjectOutputStream stream = ...
Stream.writeObject(customer1);
Stream.writeObject(customer2);

In the current algorithm, we serialize the graph only once.  Individual objects are serialized basically as pointers into the graph.  When a second object from the same is written onto the stream, Java's serialization mechanism recognizes that the graph is already on the stream, and references the already serialized graph, rather than serializing it anew.  But this works because in 2.1.1

a) Graphs are distinct (no two root objects share nodes)
b) From every object, we can quickly navigate to the root.

But in 3.0, these conditions are no longer met.  I believe that your approach can serialize the customer objects, but on deserialization, we will have 2 distinct address objects.  Is that right, and if so, is it acceptable.

I've been thinking here about another possible approach.  The format for sdo:ref currently is limited to references within a document (ie, it begins with "#").  If we expand the syntax, so that we can identify a distinct graph in the stream, then we could simply serialize orphans as top level objects in the stream.  But I haven't worked out any details here.  Perhaps we could discuss the approaches on today's call.


Talk to you later,
Ron



-----Original Message-----
From: Blaise Doughan [mailto:blaise.doughan@oracle.com] 
Sent: Montag, 11. Januar 2010 20:22
To: sdo@lists.oasis-open.org
Subject: [sdo] Possible Direction: SDO-156 - java.io.Serialization should also be able to handle non-closed DataGraph (WIP)

Hello All,

Below is an approach I am considering for SDO-156 - 
java.io.Serialization should also be able to handle non-closed DataGraph.

Introduce a new type called Serializable in the TypeHelper.SDO_JAVA_URI 
namespace.  This type would have two properties:  "value" to hold the 
data object being serialized, and "orphans" to hold the orphan data 
objects.  Then when a DataObject is serialized it is wrapped in the 
Serializable DO, and the Serializable DO is serialized.  In this way we 
are ensured that the root DataObject (an instance of Serializable) will 
always have an orphan holder property.

Attached is an untested version of what the new Resolvable class might 
look like.

-Blaise


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]