Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [EWL] EMF proxies resolving
[EWL] EMF proxies resolving [message #1477434] Mon, 17 November 2014 22:36 Go to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member


Hi all,

I'm working on a wizard which changes objects ids in an EMF model.
I got some strange serialization errors until I discovered that the model was having a lot of unresolved proxies.
I learnt on ECoreUtil.resolveAll methods and the way to call it from EOL with Native and EmfTool.
I saw in the Epsilon class EmfModel that resolveAll was called during model loading. In my case, the model is already loaded and my entry point is the self object.
I can't figure out how to access the EMF Resource in order to pass it to resolveAll. I got a solution by iterating eContainer back to the model root object, but I'm not sure it's the most efficient way to get it ... Ideas ?
As resolveAll is time consuming on large models, I'd like to avoid calling it for each invocation of the wizard. I tried to mark the model root object with an Epsilon extended property to avoid unnecessary further calls, but it seems that it's not kept between two wizard invocations ?
Maybe somebody knows a method to know if a loaded model still have unresolved proxies ?

Cheers,
--Eric
Re: [EWL] EMF proxies resolving [message #1477457 is a reply to message #1477434] Mon, 17 November 2014 23:04 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Eric,

Model.resource should return the model's underlying EMF Resource. Off the top of my head, Model.allContents.exists(e|e.eIsProxy()) should return true if any proxies are left in the model.

Cheers,
Dimitris
Re: [EWL] EMF proxies resolving [message #1478238 is a reply to message #1477457] Tue, 18 November 2014 14:06 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Thanks Dimitris for this (very late)|(very soon) but anyway so quick answer.

Unfortunately, I'll be able to give it a try only on Thursday.
I saw that "Model" was a reserved keyword in the editor : what does it means ? Is it a related to object.owningModel ? Is it specific to EWL ?

Cheers,
--Eric

PS : I forgot to congratulate you for this very nice tool suite ... repared !
Re: [EWL] EMF proxies resolving [message #1478546 is a reply to message #1478238] Tue, 18 November 2014 19:35 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Eric,

Thanks for your feedback. "model" is a reserved word which we will use in the future to declare the models that an Epsilon program is expected to have access to at runtime (to enable static analysis etc.). Since EWL is case-sensitive, this should not conflict with "Model" which is the local alias for the model [1] on which EWL operates.

Cheers,
Dimitris

[1] https://dev.eclipse.org/svnroot/modeling/org.eclipse.epsilon/trunk/plugins/org.eclipse.epsilon.eol.engine/src/org/eclipse/epsilon/eol/models/IModel.java
Re: [EWL] EMF proxies resolving [message #1480832 is a reply to message #1478546] Thu, 20 November 2014 14:17 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Hi Dimitris,

operation resolveProxies(m) {
	if (m.allContents.exists(e | e.eIsProxy())) {
		var emfTool = new Native("org.eclipse.epsilon.emc.emf.tools.EmfTool");
		emfTool.ecoreUtil.resolveAll(m.resource);
	}
}


The code seems correct, even if I never go inside the if branch ... Nevertheless I removed the test to resolve systematically, but I still have my initial problems ...
I said I thought it was because of unresolved proxies, but I'm not so sure now !

The major problem, which I didn't explain yet, is that the references to the object which changed id are serialized with the old value.
Let's write an example with two objects A and B :
A.id = 1; B.refToA = A leads to <A id="1"/><B refToA = "#1"/> in the XMI file.
I set A.id to another value in my wizard. When the model is saved, I get <A id="2"/><B refToA = "#1"/>, with B.refToA unchanged and unresolvable ...

I tried to reproduce the error with a basic ecore metamodel, but it works like anybody should expect.
Do you have any idea why a metamodel implementation would serialize with this kind of error ?
It may not be an Epsilon problem, but I'd really like to be able to make it work and continue using Epsilon ...

Cheers,
--Eric
Re: [EWL] EMF proxies resolving [message #1484472 is a reply to message #1480832] Sun, 23 November 2014 13:15 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Eric,

Could you please provide a minimal example [1] I can use to reproduce this locally?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: [EWL] EMF proxies resolving [message #1494564 is a reply to message #1484472] Mon, 01 December 2014 15:28 Go to previous messageGo to next message
Eric Lépicier is currently offline Eric LépicierFriend
Messages: 25
Registered: October 2013
Junior Member
Hi Dimitris,

Unfortunately, as I said, when I try in a minimal example, it works well ... and I can't give you the whole thing due to confidentiality.
I think there's something special in the metamodel java implementation, in the API or in the serialization code. I have to speak with the authors ...

I also tried to modify the model with the Java generated API, using setId accessor, but it also failed.
Do you confirm it's the way to do it ?
I mean :
a.id = 3; // direct "data" access
a.setId(3); // Java API use

The first line doesn't call the Java API, true ?

Anther thing : the Java API seems to be the only way to access a derived feature, as it's only implemented there.
Does Epsilon try to call this API when one writes a "direct" access like e.derivedFeature ?

Cheers,
--Eric
Re: [EWL] EMF proxies resolving [message #1494922 is a reply to message #1494564] Mon, 01 December 2014 21:49 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Eric,

> Unfortunately, as I said, when I try in a minimal example, it works well ... and I can't give you the whole thing due to confidentiality.

No problem. If everything else fails I'm happy to sign an NDA (this is quite common).

> I also tried to modify the model with the Java generated API, using setId accessor, but it also failed.

a.id = 3 should delegate to a.setId(3) at runtime so the two statements should have the same effect.

> Anther thing : the Java API seems to be the only way to access a derived feature, as it's only implemented there.
> Does Epsilon try to call this API when one writes a "direct" access like e.derivedFeature ?

Yes.

Cheers,
Dimitris
Previous Topic:SVG
Next Topic:Using Epsilon in Java
Goto Forum:
  


Current Time: Fri Apr 19 21:03:14 GMT 2024

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

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

Back to the top