Re: [mdr-users] createExtent(String, RefObject, RefPackage[])
Martin Matula <[email protected]> Mon, 05 Sep 2005 13:11:03 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Sorry, I do not understand the problem. What is the significance of the
array identity?
Martin
Pieter Van Gorp wrote:
>Hi all,
>I looked at the problem again with a fresh mind and found its cause.
>
>Apparantly, MDR does not check the actual contents of the array passed
>to createExtent(String, RefObject, RefPackage[])... therefore, when
>you want to cluster only one metapackage (say "C") into two different
>extents (say "A" and "B") and pass this C two times with an inline
>array initialization like:
>A= createExtent("A", A_M2, RefPackage[]{C}));
>B= createExtent("B", B_M2, RefPackage[]{C}));
>
>then MDR represents the content of C into B two times. This leads to
>reference problems when storing/loading B to/from XMI.
>
>I solved the problem by using the same array variable for creating the
>extent for A and B but I'd suggest to let MDR check the content of the
>array passed to createExtent instead of comparing its address...
>
>Regards,
>Pieter.
>
>On 8/10/05, Martin Matula <[email protected]> wrote:
>
>
>>Have you tried debugging it?
>>
>>Pieter Van Gorp wrote:
>>
>>
>>
>>>Hi again,
>>>
>>>On 8/9/05, Pieter Van Gorp <[email protected]> wrote:
>>>
>>>
>>>
>>>
>>>>On 8/8/05, Martin Matula <[email protected]> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>>To fix this, you need to load the tracing metamodel. Now find UML
>>>>>package in this tracing metamodel and instantiate it. If you now find
>>>>>tracing package, instantiate it and pass in the instance of UML package,
>>>>>the instance of UML package will be reused.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>Good to know,
>>>>thanks for the insight, I'll try it right away!
>>>>
>>>>
>>>>
>>>>
>>>After changing merely one line of code, the clustered extent was
>>>indeed filled up with the content of the UML-XMI: I replaced
>>><original>appMextent= (RefPackage)
>>>repo.createExtent(appMurl.toExternalForm(), getMainMP(appMMurl, "UML",
>>>xmiReader));</original>
>>>
>>>by:
>>>
>>><new>appMextent= (RefPackage)
>>>repo.createExtent(appMurl.toExternalForm(), getMainMP(traceMMurl,
>>>"UML", xmiReader));</new>
>>>
>>>Strange enough, I'm now confronted with the opposite problem: all UML
>>>elements seem to be available twice! Moreover, this leads to
>>>"duplicate IDREF" exceptions when using XMI modules for importing UML
>>>profiles. I started debugging with a UML file without XMI modules (by
>>>storing the UML profiles within my UML test project) and can now open
>>>the XMI that MDR writes from the clustered UML extent to a file called
>>>"standalone.xmi". Luckily, MagicDraw ignores the duplicate model
>>>elements... however, I believe I should remove the error in my code
>>>that causes the duplication of model elements... Martin, am I still
>>>using the API wrong?
>>>
>>>Please refer to yesterday's mail for reproducing my problem:
>>>http://mdr.netbeans.org/servlets/ReadMsg?list=users&msgNo=3255
>>>
>>>Regards,
>>>-- Pieter.
>>>
>>>
>>>
>>>
>>
>>