Re: [mdr-users] createExtent(String, RefObject, RefPackage[])
Pieter Van Gorp <[email protected]> Fri, 5 Aug 2005 13:37:54 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Martin, On 8/5/05, Martin Matula <[email protected]> wrote: > Pieter Van Gorp wrote: > >Hi all, > >I'm looking for some information on the method to create an extent > >that clusters an already existing extent: > >(i.e. http://www.netbeans.org/download/dev/javadoc/MdrAPIs/org/netbeans/api/mdr/MDRepository.html#createExtent(java.lang.String,%20javax.jmi.reflect.RefObject,%20javax.jmi.reflect.RefPackage[]) > >) > > > >A short explanation of the array argument or some example code should do it. > > > >I passed a one-size array containing a UML extent to it but the > >clustered UML extent of my tracing extent (see > >http://www.fots.ua.ac.be/motmot/docs/traceability-p3.php) remains > >empty. > > > That's weird - it should work correctly. I.e. if package A clusters > package B and you create instance of B, then if you pass this instance B > into the createExtent() method to create extend A, the instance of B > should be reused. Well, this is not the case in my test: a call to handleToTraceModel.getUml().getCore().getAttribute().refAllOfClass().size() returns 0 while the original UML model contained a lot of attributes. My other mail also indicates the UML sub-extent is empty... I'll prepare a small test to reproduce this with minimal effort. > >I already found it a bit weird that I didn't have to specify > >in which package of the tracing extent the existing UML extent should > >be loaded. Sure, in my case there's only one clustered UML extent but > >problems should arise as soon as there would be more... therefore I > >must be missing something... > > > > > This is not weird. According to MOF semantics, if A and B both cluster > C, then only one instance of C is created and shared by both A and B. > Similarly, if an instance of C already exists and you are creating > instance of A and B (or D which owns A and B), then the instance of C is > reused for both. I was thinking of the situation of clustering the same metamodel twice but I guess MOF does not allow to do that because it would require importing the same package twice? Regards, -- Pieter.