Re: MDR Stand-alone

Martin Matula <[email protected]> Fri, 15 Aug 2003 17:07:43 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <[email protected]>
Hi,

Joao Paulo Ferreira wrote:
> 1-Why i can convert (uml2mof) the poseidon model
> example that comes with the tool, even if i change it?
> But i cannot convert if i start a new Poseidon
> project. One clue i have is the <<metamodel>>
> Stereotype in all packages... what if i need classes
> outside packages? I've try to use the <<metamodel>> in
> the hole model, the uml2mof gives some warnings but, 
> apparently, it converts ok.

According to MOF constraints, everything but a package needs to have a 
container. So only packages do not need to have containers. Given that, 
it is clear, that transitively everything in MOF needs to be contained 
in a package or needs to be the package itself. So that's why you need 
to create your models in such a way that all the classes are contained 
in a MOF package. Now according to MOF profile 
(http://mdr.netbeans.org/uml2mof/profile.html), MOF package can be 
represented in UML using either UML Model or UML Package with 
<<metamodel>> stereotype.
If you realize the above, it should be clear to you why it works the way 
you describe.
BTW, why do you need UML2MOF tool? From your second question it seems to 
me that you do not need to convert UML models to MOF. You can generate 
the code from the UML models directly (by accessing them in a similar 
way as the UML2MOF tool).

> 2-I'm trying to use the mdr in my master's project, a
> kind of Code and Interface generation tool, the idea
> is to generate code and web interfaces based on UML
> models. So the role of the mdr will be parse the XMI
> 1.2 (UML, like the poseidon ones) and give me the
> models objects i.e: Classes, Packages, and so on... My
> question is: i'm i on the right way? MDR can do this
> for me?

Absolutely. You can use MDR to parse the XMI exported from the UML tool, 
then traverse through the model using JMI API generated from UML 
metamodel and generate the code.
Regards,
Martin