...
Made at ApacheCon EU 2009, Robert, Martijn, Felix and Marcel produced the following design on the flipover:
Service design
...
- The serialization service, that can serialize and deserialize an object graph to an output or input stream.
- Helpers that are used to (de)serialize specific objects.
Serialization Service
Code Block |
---|
interface SerializationService { void serialize(Object o, OutputStream s) throws IOException, UnknownObjectException; Object deserialize(InputStream s) throws IOException, UnknownObjectException; } |
The actual implementation of this service determines how objects are serialized.
Serialization Helper
Code Block |
---|
interface SerializationHelper { // TODO } |
We also discussed adding a special manifest header to a bundle to create a sort of declarative serialization helper. That way the bundle does not need to implement and register the service (if all of them use the same helper anyway).
Helpers in some way need to be linked to a specific serialization service (using an XML serialization with a JSON helper will probably not be what you want).