Home » Modeling » Epsilon » [EOL] Model Loading Errors(When loading multiple models they interfere with each other)
[EOL] Model Loading Errors [message #909644] |
Fri, 07 September 2012 13:29 |
Vasco Sousa Messages: 23 Registered: September 2009 |
Junior Member |
|
|
Hello,
I posted a topic a wile ago
with trouble loading models from java into an EOL script.
With your help this issue has been resolved, but now
when loading these models they interfere with each other
which shouldn't happened.
Basically the situation is as follows,
I am loading four models, three reading (Base, Advice, Joinpoint)
and one writing (output); and what it end up doing loading one of them
multiple times.
I tried to figure the source and the point where I detected the interference is
in the createEMFModel function taken from the load EOL from java example.
I state this because if I change the order of the function calls the model
that is loaded multiple times changes.
So I tried to figure out if there was an order that loaded correctly, and
not only there isn't, I can't figure a pattern to it.
in annex:
- is an excel file with all the combinations of createEMFModel orders,
at the top lines, and in the lower lines I have the models that are loaded into
the Base, Aspect, Joinpoint and Output EOL variables
- the project used in the previous problem, corrected and replicating the new problem
thread with the previous problem just in case both problems might have anything to do with each other:
http://www.eclipse.org/forums/index.php?t=rview&goto=877372#msg_877372
any ideas in how to solve this ?
Cheers,
Vasco
[Updated on: Fri, 07 September 2012 13:29] Report message to a moderator
|
|
|
Re: [EOL] Model Loading Errors [message #910057 is a reply to message #909644] |
Sat, 08 September 2012 14:09 |
|
Hello Vasco,
Sorry, I didn't see your reply in the other thread . I haven't been able to run your code yet, but I gave it a quick read. It looks like you have two separate models (.bpmn and .aspectmodel) and then a third .jp model that joins both. From there, you would like to generate a fourth .result.bpmn model, right?
The problem here is that you're effectively going to load the .bpmn and .aspectmodel models two times. When you read the .bpmn model, you're creating an EMF ResourceSet with a single Resource that contains it. Same for the .aspectmodel. However, the EMF ResourceSet for the .jp model has three Resources: the one for itself, a proxy for the .bpmn model (which will be loaded on demand) and the .aspectmodel proxy. Depending on the call order, the proxy or the actual model will be read first.
The thing is, due to various technical reasons, EMF only allows Resources to belong to a single ResourceSet. If you load .jp first and then .aspectmodel, EMF will move the .aspectmodel from the .jp ResourceSet into the .aspectmodel ResourceSet, which will usually be bad news.
The solution here is to only load the read-only .jp model and the write-only .result.bpmn model. EMF will see those cross-model references and load all three models into the .jp ResourceSet. If you load .jp as model "JP", you can refer to types using "Model!Package.Type", e.g. "JP!aspectModel.AdvNode".
Hope it helps,
Antonio
|
|
| |
Re: [EOL] Model Loading Errors [message #916770 is a reply to message #912205] |
Wed, 19 September 2012 12:40 |
Vasco Sousa Messages: 23 Registered: September 2009 |
Junior Member |
|
|
Hello Antonio,
So I updated my EOL files to deal only with the JP model,
and added information on the JP meta-model, so that
it can handle the remaining models(basically I added the roots of the other models
to make the accessible), the problem I am now facing is that the EOL script runs fine
and produces the correct results, but if I run it from an eclipse plug-in
the instances types change to DynamicEObjectImpl and Prevent-me from
correctly access the element's features, I tried some workarounds,
such as using eSetClass to make him know the type,
but that only works if I have another source of that type,
alternatively I tried dynamicSet, but it fails too.
I figure there is something more fundamental that I am missing
because just running the EOL scrips it sets the correct types and
the elements I am reading mach type with the ones I am creating
(e.g.: BPMNDiagram to BPMNDiagram), while running from a plugin the types change and
no longer mach (e.g. : org.eclipse.stp.bpmn.impl.BpmnDiagramImpl to
org.eclipse.emf.ecore.impl.DynamicEObjectImpl), although their eClass value mach.
any ideas ?
Cheers,
Vasco
(edit: forgot to add the updated EOL file just in case you want to try and see it crash)
[Updated on: Wed, 19 September 2012 14:31] Report message to a moderator
|
|
|
Re: [EOL] Model Loading Errors [message #923086 is a reply to message #916770] |
Tue, 25 September 2012 15:34 |
|
Have you ensured that your EPackages are listed in the EPackages Registry view in the workspace from where you try to run your plugin? It looks as if it wasn't picking up the Java classes that are generated from the ECore metamodels.
|
|
|
Re: [EOL] Model Loading Errors [message #931427 is a reply to message #923086] |
Wed, 03 October 2012 07:25 |
Vasco Sousa Messages: 23 Registered: September 2009 |
Junior Member |
|
|
Yes I checked that they are registered in the EPackages Registry, maybe it is some conflict between meta-models, because I am using BPMN for testing, but loaded from a path so I can use other meta-models, and the one available in eclipse itself.
Meanwhile I managed a workaround, by using eDynamicSet, the down side is that I have to search on the target meta-class, for the features I already know from my source model, otherwise he is unable to recognize them when running as a plugin, when in a normal eclipse execution it figured out they had the same meta-type.
All in all, it seems to be running now, but I will take note of your suggestion and
leave it on the documentation in case anyone pick this project again.
Thanks for all the help.
Cheers,
Vasco
|
|
|
Goto Forum:
Current Time: Thu Apr 25 06:31:03 GMT 2024
Powered by FUDForum. Page generated in 0.03637 seconds
|