[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[smila-dev] ipc (de)serialization vs. generic handling

Hi folks,

 

Some time ago I discussed with igor that it would be nice to support all serialization formats equally on the handlers and he agreed. I was looking into this and how this could be done. The initial idea I had, was to refactor the JsonRequestHandler such that it would generically convert any incoming stream to a record for internal usage from any of our serialization formats, i.e. adding XML!

 

The idea was to either

-          auto detect the format (could be done by investigating the 1st byte in the stream. But this might lead to problems when we allow to extend the formats, see below) OR

-          to have a URL param such as inputFormat and then go from there.

Also I was thinking that it would be neat to be able to define the output format if desired with the default being the same as the inputFormat.

 

I have been looking at the IPC code and donât think it is well factored such that

-          what I want to do is an easy job/generic

-          it is extendable for other future formats

 

What I would have supposed/liked to see is a generic interface named smth. like IpcStreamReader or IpcRecordReader (I know classes exist for these names already but they are not generic) that allows to impl the method Record read(InputStream | byte[]| String) and be done with it. The same ideas apply for writing records. The specific impl to support XML, JSON, BON could come (for now) from a simple un-configurable factory/registry.

Ultimately I think I would be neat to allow also 3rd party formats. To support this the IpcXXXReader impls for the specific format could be requested from a OSGi ServiceFactory by a name/ID where the impls could register themselves against.

 

Since I have seen that there has been some refactoring and extension in the IPC area I was wondering if there are plans in that direction or not.

 

While adding XML to the request handler can still be done with the current code, the way I would do it know with the current IPC code is far from being generic, as it will need to hard code the 3 formats JSON, BON, XML to the respective classes/methods that handle the serialization.

 

Any ideas/suggestions/input on this?

How much is the code under dev ATM? â I would like to avoid having too many conflicts when checking in, as this would take a little time to impl.

 

Thomas Menzel @ brox IT-Solutions GmbH

 



Taglocity Tags: smila, spec