How to design a Eclipse RCP (Client/Server) using EMF for the model? - eclipse

We are planing a project where we will have an eclipse based client communicating with an glassfish server (+ Oracle database). The business logic will reside on the server, the client should act more or less as an view. We consider using EMF for our model (+ hibernate + teneo).
I'm not quite sure how this all works together. The workflow/architecture/whatever I imagine is something like this:
Create EMF model
Generate java model (+ edit code) from it
Use java model on the server together with hibernate/teneo to persist model objects in database
Create a SOAP interface in the server, serialize model objects to XML as appropriate
Use model on the client to access the SOAP interface of the server, serialize/deserialize model objects from/to XML and display (parts of the whole) model in eclipse
Is this basicly how it is intended? Or have I missed a central concept?

The link you are missing is called CDO. You can use this to transfer a live model to your client. So replace SOAP with CDO, and you are there!

Related

Is it better to use POCO objects or detached EntityFramework object to expose database via WCF?

I created a WCF service in charge of exposing my database's data since I don't want the database to be directly accessed by my application (for security reasons) and i need to be able to share data with third-party applications.
My solution is structured this way: WPF application -> WCFService library -> DataAccessLayer library. (Arrows define assembly dependencies 'depends on')
To implement the WCF service I considered to simply return detached EntityFramework objects from the service BUT it forces the main application to have a dependency on the DataAccessLayer library.
The only way i can get around that is generating POCO objects and use them to send them over the wire, but now i have to map values back and forth EntityFramework.
At the moment i'm generating POCOs dynamically via a T4 template and I'm using AutoMapper to map values back and forth EntityFramework.
The Wcf service will just have to implement the repository pattern to expose data.
Is this a good solution? Are there any other option?
Is there any shortcoming i should be aware of?
Depending on your constraints, I would have to agree with this solution.
I created an almost identical solution, although our motivations were slightly different. Our client was Delphi Win32, and at the time didn't have good support for JSON, so we had to use SOAP.
The client also didn't support nullable primitives, so the POCOs removed all unsupported types, and performed other changes to ensure interoperability, then we used Automapper custom mappings to handle the two way conversions.
All the WCF services (contracts and implementations) where also generated by T4 templates, using a generic repository. With T4 templates, I was able to generate a separate WCF service per table for CRUD operations, and then manually created WCF services that were business specific.
Finally, I was also able to used T4 templates to generate the Delphi repositories that interacted with the SOAP services.
Or
You could just as easily move the POCOs (and code generation) to a separate project, change your DataAccessLayer library to reference the POCOs library and only contain the Db context made up of DbSets of your POCOs, and Data access logic but no entities (which are now POCOs). Your clients will not need to have a dependency on the DataAccessLayer library.
So... a good solution, depending on your constraints.

GWT with Apache CXF

I am working with gwt code which involves call to web-service. We generated stub for web-service using Apache CXF. It generates all the request and response types. (I am not gwt expert) What I understand is, you need to have Common Data Models( Serilizable ) for accessing model classes on client side. Can we access model classes generated by Apache CXF on client side also ? Or Do we need to replicate all these classes for accessing them in client side ?
You need to first reference this before deciding which approach suits you best.
Depending on your performance requirements and screen type ( form vs chart vs tabular data ) you would have to choose the server communication type.
I am guessing RPC Or Json with Requestbuilder will serve you best. In both cases you might choose to have your own model classes layer on client side ( to be lightweight ).
If you intend to use CXF generated models then you would need to put them in shared folder of GWT and avoid pushing in data that is not serializable by GWT.

GWT: Integrating 3rd party webservices and exposing via REST / gwt-RPC to gwt-client

I'm a seasoned Java developer but new to GWT.
Consider a 3rd party http POST based webservices api, not completely REST based since there's configuration of servlets, among other things, to invoke these services. I'm building gwt components extending the base gwt composites and using these 3rd party data services to fetch/mutate the data.
In the normal java world, I'd have build a REST wrapper on these services and exposed them as Pojos via JaxB Xml/Json. In GWT, however, I read GWT-RPC will be the fastest, given the serialization required. The data is expected to be large (several thousands, paginated).
What's the best way to design the 'bridge' between the 3rd party data services and the gwt client components?
I ruled out RequestFactory since we have a custom servlet provided by the 3rd party that fetches the webservices.
Adding a rest wrapper adds a 3rd layer of indirection (3rd party api+rest+gwt-rpc serialization) that felt too heavy
Suggestions for a low latency design, where I don't have to write too many wrapper classes for each service call (pojo)?
I'd like to consider jaxb on the server side, making schema as the new contract, and converting them to JSON for gwt-client.
I am using RestEasy on the server side, which uses Hibernate JPA to access database. With a little modification, I should be able to switch over to Datanucleus JPA.
I am using RestyGWT on client side.
With careful consideration on the DTOs, I am able to
- share the same DTO between server and client
- share the same REST interface between server and client (after running a script over the server side REST interface to transform the return type into an async callback).
Integrating multiple GWT applications into a pluggable platform.
Currently I am also trying to merge JPA DTO with REST DTOs so that I have a single set of POJOs between server, database and client. Each DTO POJO would therefore have a mix of JAX-RS, JAXB, Jackson JSON and JPA annotation.
To reduce unnecessary client-server traffic, I use JSP as GWT hosting file in tandem with GWT Dictionary class to transfer all session-specific session-static information to the client.
My Suggestion would be to use Spring RestTemplate, Gwt-RPC and have a RemoteServiceServlet/Spring bridge - that would give you RPC calls via a POJO from Server-Client and a clean tier to communicate with your external web services..
This will be lightweight and clean..

Generation of Entity Framework classes from a WSDL

Good morning,
I am taking over from someone who has been using the Entity Framework to communicate with a database. How this has appears to have been done is that there is a WSDL that describes all of the objects that we use created in Enterprise Architect. This is then imported as a Service Reference in Visual Studio.
I am a bit confused by this so was wondering if it is a sensible approach. The WSDL has a sample port, binding and service that appears to be not used at all in the code. Do these exist in order that the WSDL gets imported properly?
I looked on Google and couldn't see any examples of people creating from WSDLs in this way so wasn't sure it was a common approach.
So when this is done you have the representations of the data as classes. Then it seems you add them to a class inheriting from a DbContext which creates the tables in the database. Is this correct?
If you are using WSDL just to get data from EA to VS it is of course completely wrong. WSDL describes web service - port and binding are mandatory for service description.
EA Professional edition and above has direct support for code generation from the model. You just have to set which language you want to use (in Project browser select folder containing your classes and interfaces and set language in properties) and then you can use Tools > Source Code Engineering > Generate Package Source Code.

Eclipse web service + EMF + Teneo

Briefly what I have done is a EMF project that model a shop and its products. The model is stored in a Mysql database using Teneo and EclipseLink.
Until now everything is fine. But now what I want is to create a webService where operations are exposed for example: addShop(String shopName) etcc.
So I create a Dynamic web project then a web service bottom up.
Now how can I invoke operation of the EMF project for example store the name sent send with a SOAP request? Should I include in the Dynamic web project the EMF model too?
Is architectural correct what am I doing?
Thank you for your answers.