Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/909644/#msg_909644
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
Cheers,
Vasco
]]>Vasco Sousa2012-09-07T13:29:09-00:00Re: [EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/910057/#msg_910057
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]]>Antonio Garcia-Dominguez2012-09-08T14:09:06-00:00Re: [EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/912205/#msg_912205
thanks for the reply, regarding your question, it is exactly that; I will try your suggestion of only loading JP and from there reach the other models.
In regards to that, is there a way to retrieve all the contents of the BPMN model not just the ones directly referenced from the JP; my issue is that
this will not be fixed to BPMN so I can't know the types let alone the package beforehand.
Cheer,
Vasco]]>Vasco Sousa2012-09-13T06:16:48-00:00Re: [EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/916770/#msg_916770
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)]]>Vasco Sousa2012-09-19T12:40:58-00:00Re: [EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/923086/#msg_923086
]]>Antonio Garcia-Dominguez2012-09-25T15:34:59-00:00Re: [EOL] Model Loading Errors
https://www.eclipse.org/forums/index.php/mv/msg/373904/931427/#msg_931427
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.