• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

EMF + UML 2 Tools [model to java code]

 
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all.

I'm trying to use EMF with UML 2 Tools to generate java code based in a class diagram model.
But with EMF when I start generating code from a class diagram, I've got a lot of undesirable stuff to my project.
I don't want to create Factories, Tests, Interfaces when generating code for a simple domain model.
There are also some ecore classes and interfaces being used when I use the generate java code from my model.

I'd like to know if anybody knows a way of creating a simple java code from an uml model diagram within EMF project.

Any help will be appreciated.

Thanks in advance.
 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you generate the code from a Class diagram? It seems like you are not using the EMF correctly. If you don't want the EMF implementation, then simply don't use EMF. Very simple.
 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Bennett wrote:If you don't want the EMF implementation, then simply don't use EMF. Very simple.



That's the point. I don't want to use the EMF implementation that ships on EMF generated code.
But if I don't use it, I can't generate my code simply by using the uml 2 tools, because the role to generate code belongs to EMF.

Is there another way of generating model based java code without using EMF? (with uml 2 tools).

Thanks.

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many UML-based editors have a feature for generating code from diagrams, e.g. ArgoUML, JUDE

Which editor did you create the Class diagrams with?

 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frank,

I'm using UML 2 Tools that is an EMF-based implementation of the Unified Modeling Language (UMLTM) 2.x OMG metamodel for the Eclipse platform.
I'd like to use an EMF based implementation because of the interoperability that it enables.

If I can't do it by now, I'd like to know another tool that can be used with eclipse, and have no such bugs like argouml and also have any free license.

Thank you.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your answer is very confusing. Are you saying that you have created the Class diagrams with Eclipse?
 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Frank!
I've created my class diagram with eclipse plugin.
Take a look at this url http://wiki.eclipse.org/MDT-UML2.

This tool, is integrated with eclipse and EMF framework.
UML 2 Tools being EMF based, enables the interoperability between another EMF based tools.
So using the UML 2 Tools I'd like to be provided with:
-> eclipse integrated tool
-> code generation from the model created
-> interoperability between EMF based tools

Thanks.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using JUDE for generating your simple Java objects from Class diagrams.

If you do not want to create a EMF-based model, then don't use these EMF-based tools. Since the plugin that you are using is EMF-based, then common sense says that you should not use it if you don't want an EMF model.

I currently use JUDE and it has code generation features....and they are not EMF-based.

I never encountered any bugs in ArgoUML either.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not confused with some special code generated from EMF model but I can't understand why assosiations are not generated to EMF (.ecore) from UML (.uml). I have Eclipse Galileo with UML2Tools installed and use UML2 2.2.0 Generator File for generating EMF model from a UML diagram (.genmodel file). The assosiations from .uml file are not generated to .ecore (though I can create them by hand in the .ecore file). What can be the reason of such behaviour? Unfortunately, Eclipse forums are disabled now...
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch, Oleg
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The EMF was originally design to only work with UML diagrams created with Rational Rose. As it evolves, you may be only working with test code or experimental versions when using the Eclipse-based UML tool.
 
Oleg Boshakov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I managed to find the answer to my question. Now associations from .uml file are generated to .ecore. The problem was in using an old version of UML2Tools (they are better for Galileo and Helios) and also I had to set the property 'Class' of assiciation ends.
But There's another question now about associations' multiplicity:
Whether or not the multiplicity of EReference in EMF model (.ecore) has any effect on generated Java code?
For example multiplicity 0..3 let me in Java code in runtime add to EList more than 4 objects.
 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Oleg

Oleg Boshakov wrote:I'm not confused with some special code generated from EMF model but I can't understand why assosiations are not generated to EMF (.ecore) from UML (.uml). I have Eclipse Galileo with UML2Tools installed and use UML2 2.2.0 Generator File for generating EMF model from a UML diagram (.genmodel file). The assosiations from .uml file are not generated to .ecore (though I can create them by hand in the .ecore file). What can be the reason of such behaviour? Unfortunately, Eclipse forums are disabled now...



Maybe I don't understand the purpose for EMF model, but could we use this model to create any valid enterprise application with all that stuff (EReference, E....)?

Thank you
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Maybe I don't understand the purpose for EMF model, but could we use this model to create any valid enterprise application with all that stuff (EReference, E....)?



In order to build applications with EMF-based models, you need to significantly understand the EMF model. Simply generating code with its tools is not sufficient to understand it. Nor is briefly browsing its web pages sufficient.

If you study and learn how EMF works, then you can certainly create enterprise applications with it.

If you don't understand the details and how it works and how to take advantage of the benefits, you cannot create enterprise applications with it.
 
Oleg Boshakov
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Bennett wrote:

Maybe I don't understand the purpose for EMF model, but could we use this model to create any valid enterprise application with all that stuff (EReference, E....)?



In order to build applications with EMF-based models, you need to significantly understand the EMF model. Simply generating code with its tools is not sufficient to understand it. Nor is briefly browsing its web pages sufficient.

If you study and learn how EMF works, then you can certainly create enterprise applications with it.

If you don't understand the details and how it works and how to take advantage of the benefits, you cannot create enterprise applications with it.



My aim is to create an enterprise application with using UML projecting. So my choiсe was Eclipse UML2Tools. Unfortunately it's not enough to know the UML standards since the instruments used (UML2 Tools) make me deal with EMF to Java code generation. And my questions concerned the tool usibility (Now I found answers for that - for validating the boundaries I have to use EMF Validation Framework). And if I have two properties in UML editor "upper bound" and "lower bound" for an assosiation end so I used to suppose that they must be maintained in the code generated. So it looks weird when it doesn't happen. Of course we can make everything we want if we know assembler and all the computer system details we are programming at. But when we speak about high-level languages and tools (like UML) we mean that we neglect the realisation features and are concentrated on the logical part of the application. That is one of the advantages of using UML.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is possible to use EMF without using UML or any type of diagrams. However, it is a complex framework, more complex than Struts or Hibernate, in my opinion. Once you get a good understanding of the EMF object model, things flow very smoothly. It is a powerful framework and a good tool to understand.
 
Adolfo Eloy
Ranch Hand
Posts: 146
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Bennett wrote:It is possible to use EMF without using UML or any type of diagrams. However, it is a complex framework, more complex than Struts or Hibernate, in my opinion. Once you get a good understanding of the EMF object model, things flow very smoothly. It is a powerful framework and a good tool to understand.



People,
considering all this, I think that for not EMF based software, there is no way to use UML 2 Tools.
So If I don't want to learn all EMF, the best way is looking for any other UML tool.

Do you agree?
 
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic