Java – Web application / Domain model integration using JSON capable DTOs

cdomain-modeljavajsonpythonweb-applications

I'm a bit confused about architectural choices for the // world. For / world the available (open source) choices to implement web applications is pretty limited to zero, involving or the choices explode to a,- hard to sort out -, mess of available 'frameworks' and application approaches. I want to sort out a clean MVC model, where the M stands for a fully blown (POCO, POJO driven) domain model (according M.Fowler's EAA pattern) using a mature OO language (Java,C++) for implementation.

The background is: I have a system with certain hardware components (that introduce system immanent active behavior) and a configuration database for system meta and HW-components configuration data (these are even usually self contained, since the HW-components are capable to persist their configuration data anyway).
For realization of the configuration/status data exchange protocol with the HW-components we have chosen the Google Protobuf format, which works well for the directly wired communication with these components.
This protocol is already used successfully with a Java based GUI application via TCP/IP connection to the main system controlling HW-component. This application has some drawbacks and design flaws for historical reasons.

Now we want to develop an abstract model (domain model) for configuration and monitoring those HW-components, that represents a more use case oriented view to the overall system behavior. I have the feeling that a plain Java class model would fit best for this (c++ implementation seems to have too much implementation/integration overhead with viable language-bridge interfaces).

Google Protobuf message definitions could still serve well to describe DTO objects used to interact with a domain model API. But integrating Google Protobuf messages client side for e.g. data binding in the current view doesn't seem to be a good choice. I'm thinking about some extra serialization features, e.g. for JSON based data exchange with the views/controllers.
Most lightweight solutions seem to involve a python based presentation layer using WSGI or JSON based data transfer (I'm at least not sure to be fully informed about this).

Can someone give good advice about best practices or easy to integrate frameworks for such case?

UPDATE:
According to my recent research and comments of colleagues I've noticed that using Java (and some JVM) might not be the preferable choice for integration with on a limited linux system as we have (running on ARM9 with hard to discuss memory and MCU costs), but C/C++ modules would do well for this (since this forms the native interface to python extensions, doesn't it?).
E.g. a pyramid based solution seems to provide a lightweight framework, that allows to integrate a domain model using an appropriate python facade. Protobuf also provides python class generation support, does someone have experience with integrating protobuf messages as DTO's with python?

I can imagine to provide a domain model from an appropriate C/C++ API (though I still think it's more efforts and higher skill requirements for the involved developers to do with these languages). Still I'm searching for a good approach that supports such architecture. I'll appreciate any pointers!

Best Answer

It is hard to understand your exact question but generally speaking JSON would be a good choice to integrate with the client side in Java. You can serialize POJOs using jackson. But better yet you can deserialize proto buffers to JSON.
In terms of a framework for Java, I would recommend Spring MVC. You need an instance of an application server (tomcat, jetty etc.) i.e. a jvm in which to run. It has great RESTful support and provides to and fro conversion from POJO's to JSON by simply including jackson in the classpath.

Related Topic