|Re: stereotypes not found on model reload [message #1273086 is a reply to message #1272946]
||Wed, 19 March 2014 13:22
| Christian W. Damus
Registered: July 2009
When the same model is loaded again, is it loaded in a different
ResourceSet than the first time? If so, was it unloaded in the first
resource set? And were the profiles also unloaded in that first
Because the CacheAdapter is a static singleton and maintains references
(for indexing of non-navigable inverse references, such as the
stereotypes' metaclass extensions) to every UML model element that is
loaded, is it important always to unload every resource in the
ResourceSet when you have finished with that ResourceSet. Otherwise,
it and all of its contents will leak.
I suspect that something cached in the CacheAdapter from the first copy
of the model is interfering with the inverse-reference searches in the
second copy when looking for applied stereotypes. Or else the dynamic
EPackage definitions of the profiles are not being resolved properly
the second time.
This is all guesswork, as you haven't provided many clues as to what
may be going wrong. You can step through the
getAppliedStereotypes(Element) or getStereotypeApplications(Element)
method of the ElementOperations class (depending on which your
application uses) in the debugger to see whether the problem is that
(a) inverse references from stereotype applications are not being found, or
(b) stereotype applications are not traceable to stereotypes
and why (step through the getStereotype(EObject) method and its call
tree to diagnose the latter case).
In any case, the only thing connected with the first time loading your
model that can reasonably be expected to interfere with the second time
is the CacheAdapter, because it is shared globally. So, I expect that
careful unloading should fix your problem.
On 2014-03-19 06:19:30 +0000, Andrew Miga said:
> We are working on an application which transforms UML behavior diagrams
> annotated with MARTE stereotypes into another EMF model. The
> application deserializes a .uml file (located in a directory with many
> supporting *.profile.uml files) into UML objects and then converts the
> MARTE annotated diagrams into another model. At many points MARTE
> stereotype tags and values which are attached to various diagram
> elements are successfully read.
> Everything works fine the first time a specific .uml model is
> transformed. The file is deserialized into a UML object model and the
> attached stereotypes are successfully read. However the second time the
> same .uml model file is transformed no stereotypes of any kind are
> found. The UML objects themselves are created but attached stereotypes
> can't be found. If the application is restarted the everything works
> fine again.
> Is there something that needs to be cleared or reset before the same
> .uml model is deserialized for a second time ?
Powered by FUDForum
. Page generated in 0.04234 seconds