Home » Modeling » M2T (model-to-text transformation) » UML2 to Java class without any ECore dependencies
| |
Re: UML2 to Java class without any ECore dependencies [message #58816 is a reply to message #58791] |
Sat, 21 March 2009 17:26 |
joel Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Hello Ed,
Sorry for the cross post, it was a mistake from my side...
> I don't know of any projects at Eclipse that generate Java directly from
> UML2.
My issue is not really related to the "directly". I don't really care if I
need to go through EMF and then genmodel to get my Java source code. The
main problem is how the Java code is generated (with dependencies on
ECore).
> Are you sure you won't need to serialize your objects as XML and you
> won't need to build a UI for them? What will you do with them?
I won't need a UI for them but I will maybe need to serialize them (for
that purpose I usually use JAXB). EMF provide some easier ways to achieve
what I need using an XML Schema (XSD) ?
Thanks a lot for your help,
Joël
> joel wrote:
>> Hi all,
>>
>> I'm trying to generate my Java domain class from my UML2 model. For
>> that purpose I did a class diagram using Eclipse UML2 plugin, I
>> generated its related EMF model and then loaded it into a genmodel, as
>> given here:
>>
http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>>
>>
>> The problem is that each class are extending EObject, etc. As I
>> understood (I'm new to EMF), EMF seems to be a "model of a model"
>> definition.
>> On my side, I only want to get my UML diagram as Java class without
>> having any EObject inheritence. Is there a way to simply achieve this ?
>>
>> Thank you in advance.
>>
>> Best regards,
>>
>> Joël
>>
>>
>>
>>
|
|
| |
Re: UML2 to Java class without any ECore dependencies [message #58866 is a reply to message #58765] |
Sat, 21 March 2009 17:38 |
Krzysztof Kowalczyk Messages: 113 Registered: July 2009 |
Senior Member |
|
|
joel pisze:
> Hi all,
>
> I'm trying to generate my Java domain class from my UML2 model. For that
> purpose I did a class diagram using Eclipse UML2 plugin, I generated its
> related EMF model and then loaded it into a genmodel, as given here:
> http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>
>
> The problem is that each class are extending EObject, etc. As I
> understood (I'm new to EMF), EMF seems to be a "model of a model"
> definition.
> On my side, I only want to get my UML diagram as Java class without
> having any EObject inheritence. Is there a way to simply achieve this ?
>
You can check
http://www.fornax-platform.org/cp/display/fornax/JavaBasic+(CJB)
it is based on Xpand. IMHO Xpand is best when it comes to reusing
existing cartridges, because aspect oriented features allow you to
customize what is generated easily.
Making your own basic transformation for your needs is easy. Making a
good general transformation is hard, so there are not many of them. With
all of them your UML model will need to follow some conventions.
Regards,
Krzysztof Kowalczyk
|
|
|
Re: UML2 to Java class without any ECore dependencies [message #58889 is a reply to message #58841] |
Sat, 21 March 2009 17:58 |
joel Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Ed,
Thanks for your quick reply !
> Yes, all models support serialization to XML. You can read about it here:
>
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.html
Ok, I will have a look ! I guess it use JAXB behind the scene...
> When generating the code, if you invoke Generate Test Code there will be
> a *.tests project and in there will be an XyzExample.java that shows how
> to load and save instances of your model. With Teneo, you'll also
> automatically have support for JPA or Hibernate as well.
Yes, just saw that a few minutes ago ! The hbm generation looks really
interesting !
> I find it's very common for folks to think they don't need EMF and then
> spending a lot of time manually doing things that EMF would do
> automatically.
You are totally right ! On my side, EMF still looks quite obscure. I still
don't really understand if it is only related to Eclipse RCP and I'm not
able to clearly see possible use cases of EMF usage into a project...
Will have a look to the like you gave me !
Thanks again,
Joël
>>> joel wrote:
>>>> Hi all,
>>>>
>>>> I'm trying to generate my Java domain class from my UML2 model. For
>>>> that purpose I did a class diagram using Eclipse UML2 plugin, I
>>>> generated its related EMF model and then loaded it into a genmodel,
>>>> as given here:
>>>>
>>
http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>>
>>>>
>>>>
>>>> The problem is that each class are extending EObject, etc. As I
>>>> understood (I'm new to EMF), EMF seems to be a "model of a model"
>>>> definition.
>>>> On my side, I only want to get my UML diagram as Java class without
>>>> having any EObject inheritence. Is there a way to simply achieve this ?
>>>>
>>>> Thank you in advance.
>>>>
>>>> Best regards,
>>>>
>>>> Joël
>>>>
>>>>
>>>>
>>>>
>>
>>
|
|
| |
Re: UML2 to Java class without any ECore dependencies [message #58939 is a reply to message #58889] |
Sat, 21 March 2009 18:07 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Joël,
Comments below.
joel wrote:
> Ed,
>
> Thanks for your quick reply !
>
>> Yes, all models support serialization to XML. You can read about it
>> here:
>
>>
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.emf.doc/references/overview/EMF.html
>
>
> Ok, I will have a look ! I guess it use JAXB behind the scene...
No. That's one of the many advantages of having a model. The Ecore
model of the instance is available at runtime so services like XML
serialization can be implemented a generic way once and for using EMF
reflection. Copying, structural equality checking, change recording
(with undo/redo support), structural comparison, and so on are all based
on this.
>
>> When generating the code, if you invoke Generate Test Code there will
>> be a *.tests project and in there will be an XyzExample.java that
>> shows how to load and save instances of your model. With Teneo,
>> you'll also automatically have support for JPA or Hibernate as well.
>
> Yes, just saw that a few minutes ago ! The hbm generation looks really
> interesting !
Once you have a model, the possibilities are quite amazing.
>
>> I find it's very common for folks to think they don't need EMF and
>> then spending a lot of time manually doing things that EMF would do
>> automatically.
>
> You are totally right ! On my side, EMF still looks quite obscure. I
> still don't really understand if it is only related to Eclipse RCP and
> I'm not able to clearly see possible use cases of EMF usage into a
> project...
All the EMF model code and the EMF runtime work stand alone so can be
reused in any type of Java application.
>
> Will have a look to the like you gave me !
I think that will help at least get an overview.
>
> Thanks again,
>
> Joël
>
>
>>>> joel wrote:
>>>>> Hi all,
>>>>>
>>>>> I'm trying to generate my Java domain class from my UML2 model.
>>>>> For that purpose I did a class diagram using Eclipse UML2 plugin,
>>>>> I generated its related EMF model and then loaded it into a
>>>>> genmodel, as given here:
>>>>>
>>>
> http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>
>>>
>>>>>
>>>>>
>>>>> The problem is that each class are extending EObject, etc. As I
>>>>> understood (I'm new to EMF), EMF seems to be a "model of a model"
>>>>> definition.
>>>>> On my side, I only want to get my UML diagram as Java class
>>>>> without having any EObject inheritence. Is there a way to simply
>>>>> achieve this ?
>>>>>
>>>>> Thank you in advance.
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Joël
>>>>>
>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: UML2 to Java class without any ECore dependencies [message #58964 is a reply to message #58939] |
Sat, 21 March 2009 18:15 |
joel Messages: 17 Registered: July 2009 |
Junior Member |
|
|
Ed,
>> Ok, I will have a look ! I guess it use JAXB behind the scene...
> No. That's one of the many advantages of having a model. The Ecore
> model of the instance is available at runtime so services like XML
> serialization can be implemented a generic way once and for using EMF
> reflection. Copying, structural equality checking, change recording
> (with undo/redo support), structural comparison, and so on are all based
> on this.
Ah, ok I understand now why everything is extending some ECore stuff :-)
> All the EMF model code and the EMF runtime work stand alone so can be
> reused in any type of Java application.
>>
Ah okay ! Would be nice to have a paper like: "what EMF provides and what
it does not provides"
So I only need to add a single Maven artifactId to my POM in order to have
it in my app as standalone ?
>> Will have a look to the like you gave me !
> I think that will help at least get an overview.
Will definitively have a look to it !
Regards,
Joël
>>>>> joel wrote:
>>>>>> Hi all,
>>>>>>
>>>>>> I'm trying to generate my Java domain class from my UML2 model.
>>>>>> For that purpose I did a class diagram using Eclipse UML2 plugin,
>>>>>> I generated its related EMF model and then loaded it into a
>>>>>> genmodel, as given here:
>>>>>>
>>>>
>>
http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>>
>>>>
>>>>>>
>>>>>>
>>>>>> The problem is that each class are extending EObject, etc. As I
>>>>>> understood (I'm new to EMF), EMF seems to be a "model of a model"
>>>>>> definition.
>>>>>> On my side, I only want to get my UML diagram as Java class
>>>>>> without having any EObject inheritence. Is there a way to simply
>>>>>> achieve this ?
>>>>>>
>>>>>> Thank you in advance.
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Joël
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>
>>
|
|
| |
Re: UML2 to Java class without any ECore dependencies [message #59014 is a reply to message #58964] |
Sat, 21 March 2009 18:28 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Joël,
Comments below.
joel wrote:
> Ed,
>
>>> Ok, I will have a look ! I guess it use JAXB behind the scene...
>> No. That's one of the many advantages of having a model. The Ecore
>> model of the instance is available at runtime so services like XML
>> serialization can be implemented a generic way once and for using EMF
>> reflection. Copying, structural equality checking, change recording
>> (with undo/redo support), structural comparison, and so on are all
>> based on this.
>
> Ah, ok I understand now why everything is extending some ECore stuff :-)
Exactly. EObject.eClass() is just like java.lang.Object.getClass()...
>
>
>> All the EMF model code and the EMF runtime work stand alone so can be
>> reused in any type of Java application.
>>>
>
> Ah okay ! Would be nice to have a paper like: "what EMF provides and
> what it does not provides"
We have a whole book.
http://www.amazon.com/gp/product/0321331885/
EM provides everything you need...
>
> So I only need to add a single Maven artifactId to my POM in order to
> have it in my app as standalone ?
I don't know about Maven and POM. The minimal runtime consists of
org.eclipse.emf.common, org.eclipse.emf.ecore, and
org.eclipse.emf.ecore.xmi (if you want XML serialization). The jarred
plugins themselves work on any classpath, so that and your own generated
models is all you need.
>
>>> Will have a look to the like you gave me !
>> I think that will help at least get an overview.
>
> Will definitively have a look to it !
>
> Regards,
>
> Joël
>
>>>>>> joel wrote:
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to generate my Java domain class from my UML2 model.
>>>>>>> For that purpose I did a class diagram using Eclipse UML2
>>>>>>> plugin, I generated its related EMF model and then loaded it
>>>>>>> into a genmodel, as given here:
>>>>>>>
>>>>>
>>>
> http://dev.eclipse.org/newslists/news.eclipse.modeling.mdt.u ml2tools/msg00703.html
>
>>>
>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The problem is that each class are extending EObject, etc. As I
>>>>>>> understood (I'm new to EMF), EMF seems to be a "model of a
>>>>>>> model" definition.
>>>>>>> On my side, I only want to get my UML diagram as Java class
>>>>>>> without having any EObject inheritence. Is there a way to simply
>>>>>>> achieve this ?
>>>>>>>
>>>>>>> Thank you in advance.
>>>>>>>
>>>>>>> Best regards,
>>>>>>>
>>>>>>> Joël
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 07:41:28 GMT 2024
Powered by FUDForum. Page generated in 0.04538 seconds
|