Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » XMI Serialization - Multiple Ecore Models with cross-references
XMI Serialization - Multiple Ecore Models with cross-references [message #632141] Mon, 11 October 2010 17:47 Go to next message
Nelson Ramos is currently offline Nelson RamosFriend
Messages: 3
Registered: October 2010
Junior Member
Hi,


I'm facing a problem regarding xmi serialization of two ecore models together.

Problem Context:

I'm developing an application with MVC pattern. The data model is being modeled with Ecore.

The M (model) and C (controller) are shared by two view technology (GMF and GWT). So, we decided to have an aditional ecore model for GUI where graphical information are being stored (like x,y coordinates, etc).

So, we have two models: DATAModel and GUIModel.
The GUIModel objects implements the Adapter interface and are being registered in the eAdapters list of the DATAModel eObjects.

Problem

1st try: Create a resource for DATAModel and hope for automatically adapters serialization (from GUIModel) ---> don't work....the adapters are not serializable (maybe the containment is false by default)

2nd try: Create a list with containment=true in the rootContainer of DATAModel for all adapters. The result was :

 

  <allAdapters>com.nsn.on.xxxxx.nse.model.impl.NseExternalDirectionImpl@120a8f3</allAdapters>
  <allAdapters>com.nsn.on.xxxxx.nse.model.impl.NseCardImpl@133fa82 (userLabel: null)</allAdapters>



so, It returns an error during desserialization (because the stored adapter is just a reference for a Java Object).


3rd try: I'm trying to use the resourceSet and put here the two models DATAModel and GUIModel. However I'm not seeing how the references between the two models will be kept.

Is it the correct approach? If so, can you post some example code that deal with this requirements? If not, do you know other approaches?


Thanks in advance,
Nelson



Re: XMI Serialization - Multiple Ecore Models with cross-references [message #632153 is a reply to message #632141] Mon, 11 October 2010 18:42 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Nelson,

Comments below.

Nelson Ramos wrote:
> Hi,
>
>
> I'm facing a problem regarding xmi serialization of two ecore models
> together.
>
> Problem Context:
>
> I'm developing an application with MVC pattern. The data model is
> being modeled with Ecore.
>
> The M (model) and C (controller) are shared by two view technology
> (GMF and GWT). So, we decided to have an aditional ecore model for GUI
> where graphical information are being stored (like x,y coordinates, etc).
>
> So, we have two models: DATAModel and GUIModel.
> The GUIModel objects implements the Adapter interface and are being
> registered in the eAdapters list of the DATAModel eObjects.
>
> Problem
>
> 1st try: Create a resource for DATAModel and hope for automatically
> adapters serialization (from GUIModel) ---> don't work....the adapters
> are not serializable (maybe the containment is false by default)
You should not expect the data model to serialize its eAdapters. That's
not a modeled feature and in fact isn't even part of the data model;
it's for viewing the data model.
>
> 2nd try: Create a list with containment=true in the rootContainer of
> DATAModel for all adapters. The result was :
>
>
>
> <allAdapters>com.nsn.on.xxxxx.nse.model.impl.NseExternalDirectionImpl@120a8f3</allAdapters>
>
> <allAdapters>com.nsn.on.xxxxx.nse.model.impl.NseCardImpl@133fa82
> (userLabel: null)</allAdapters>
It doesn't look like you're actually serializing EObjects here. You'll
need this to be an EReference.
>
>
>
> so, It returns an error during desserialization (because the stored
> adapter is just a reference for a Java Object).
Yes, it sounds like you have modeled this as an EAttribute rather than
an EReference.
>
>
> 3rd try: I'm trying to use the resourceSet and put here the two models
> DATAModel and GUIModel. However I'm not seeing how the references
> between the two models will be kept.
If you model things as EReference, they should definitely be kept.
>
> Is it the correct approach? If so, can you post some example code that
> deal with this requirements? If not, do you know other approaches?
>
>
> Thanks in advance,
> Nelson
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:UML class model
Next Topic:Unable to Load resource from the jar
Goto Forum:
  


Current Time: Fri Apr 26 00:52:26 GMT 2024

Powered by FUDForum. Page generated in 0.02740 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top