Re: [mdr-users] createExtent(String, RefObject, RefPackage[])
Pieter Van Gorp <[email protected]> Mon, 5 Sep 2005 17:44:35 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin, On 9/5/05, Martin Matula <[email protected]> wrote: > >From the description of the method one would expect that as soon as > >the array includes existing extents they will be shared. > >This is not the case. > Well, I am even more confused. In the last paragraph of your e-mail you > say it is the case, They are only shared if you pass the *same* array variable. They are not shared if you use different arrays that are identical by value. I'm proposing to add code that checks whether the metapackages contained in the array are already loaded or not. > Why do you think this is not the case? Because it was demonstrated by my code: as described on http://mdr.netbeans.org/servlets/ReadMsg?list=users&msgNo=3260 all UML model elements were duplicated. > >Originally, I expected that I could even load a standalone extent and > >then pass it to the clustering extent. As you stated, MDR could > >support this but does not do this: > >http://mdr.netbeans.org/servlets/ReadMsg?list=users&msgNo=3259 > You can load a standalone extent and pass it to the clustering extent. My test illustrated that although MDR did not throw an exception when passing such a standalone extent, it did *not* fill the clustered UML extent with the elements from the already loaded UML extent. The clustered UML extent remained empty. The only fix was to load the UML elements in an extent conforming to the UML subpackage of the clustering metamodel. As stated, the next version of my test demonstrated the opposite problem: all UML elements were present two times. > What the XMI reader does not do is it does not recognize that an object > is already loaded - i.e. if you load the same model 1000x times, it will > create 1000 same instances of the same model elements. That is not > related to the clustering at all. I'm not reloading the UML model. It was accessible from a variable "appMextent" and I passed it two times with an inline array initialization "new RefPackage[]{appMextent}. > You can make it work smarter by writing your own reference resolver. Could you please explain when the XMI reference resolver would be called again for the UML extent? Interesting problem... Pieter