Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » using the uml2 code generator
using the uml2 code generator [message #473277] Mon, 25 June 2007 09:05 Go to next message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Is it possible to use the extended emf generator provided by uml2 for
another purpose than generating uml.ecore ?
If yes, what is the procedure to set up such a project ?

Thanks in advance
regards
Romain
Re: using the uml2 code generator [message #473284 is a reply to message #473277] Mon, 25 June 2007 16:09 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

If I understand this correctly, you will want to have a look at the
UML2EcoreConverter in UMLUtil. That is the heart behind the UML to ecore
conversion process. You can create a subclass and override any of the
caseXXX() to do what you want ( or extend it in any way ).

If there is functionality lacking you might want to raise a bugzilla.

Cheers,
- James.

"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5o0g9$ssn$1@build.eclipse.org...
> Is it possible to use the extended emf generator provided by uml2 for
> another purpose than generating uml.ecore ?
> If yes, what is the procedure to set up such a project ?
>
> Thanks in advance
> regards
> Romain
>
>
Re: using the uml2 code generator [message #473288 is a reply to message #473284] Mon, 25 June 2007 16:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Thank you for your response!

but I was not clear enough, I guess....

What I want to do is generating my own "mydsl.ecore" using the extended uml2
emf generator (not the standard emf one), so I can benefit of extended
functionalities such as "generating derived relations, cache adapter
support, factory methods, invariant prefixes, "pluralized" getters, safe
strings, operation utility classes, resource interfaces, etc."

regards
Romain

"James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #473309 is a reply to message #473288] Tue, 26 June 2007 15:12 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

To extend the uml gen model options (gen features) for things like
"pluralize getters" have a look at org.eclipse.uml2.codegen.ecore.

- James.

"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5orku$5aq$1@build.eclipse.org...
> Thank you for your response!
>
> but I was not clear enough, I guess....
>
> What I want to do is generating my own "mydsl.ecore" using the extended
uml2
> emf generator (not the standard emf one), so I can benefit of extended
> functionalities such as "generating derived relations, cache adapter
> support, factory methods, invariant prefixes, "pluralized" getters, safe
> strings, operation utility classes, resource interfaces, etc."
>
> regards
> Romain
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #473311 is a reply to message #473288] Tue, 26 June 2007 15:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Romain,

Do you just want to generate code from a UML model instead of from an Ecore
model? The OCL component of MDT does exactly that.

When you create your genmodel using the "New EMF Model" wizard, just select
your UML model as the input instead of an Ecore model. The wizard has a
variety of options that pertain to the process of converting the UML to a
suitable Ecore representation for UML2's codegen extensions. You will also
find some UML-specific properties on the root GenModel element of the
genmodel, that determine whether to user cache adapters, operation classes,
etc.

Cheers,

Christian


Romain BERNARD wrote:

> Thank you for your response!
>
> but I was not clear enough, I guess....
>
> What I want to do is generating my own "mydsl.ecore" using the extended
> uml2 emf generator (not the standard emf one), so I can benefit of
> extended functionalities such as "generating derived relations, cache
> adapter support, factory methods, invariant prefixes, "pluralized"
> getters, safe strings, operation utility classes, resource interfaces,
> etc."
>
> regards
> Romain
>
> "James Bruck" <jbruck@ca.ibm.com> a �rit dans le message de news:
> f5opc8$ptt$2@build.eclipse.org...
>> Hi Romain,
>>
>> If I understand this correctly, you will want to have a look at the
>> UML2EcoreConverter in UMLUtil. That is the heart behind the UML to
>> ecore
>> conversion process. You can create a subclass and override any of the
>> caseXXX() to do what you want ( or extend it in any way ).
>>
>> If there is functionality lacking you might want to raise a bugzilla.
>>
>> Cheers,
>> - James.
>>
>> "Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in
>> message news:f5o0g9$ssn$1@build.eclipse.org...
>>> Is it possible to use the extended emf generator provided by uml2 for
>>> another purpose than generating uml.ecore ?
>>> If yes, what is the procedure to set up such a project ?
>>>
>>> Thanks in advance
>>> regards
>>> Romain
>>>
>>>
>>
>>
Re: using the uml2 code generator [message #473319 is a reply to message #473309] Wed, 27 June 2007 12:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Yes ! that's exactly what I mean... Sorry, I should have titled this post
"using the org.eclipse.uml2.codegen.ecore generator"...

And the only way I found to use it was to make my own .genmodel by hands
(copy & paste the content of uml2.genmodel in another file (mydsl.genmodel),
removing all except the root package, renaming and linking to mydsl.ecore
file. It worked, but :
- I was wondering if there were a better way to initialize my genmodel
- I have no predefined ideas about the meaning of certain number of
genAnnotations (genmodel) and eAnnotations (ecore model) that will influence
the generation, like :
<genAnnotations
source=" http://www.eclipse.org/emf/2002/GenModel/importer/org.eclips e.uml2.uml.ecore.importer">
<details key="DUPLICATE_FEATURES" value="PROCESS"/>
<details key="DUPLICATE_FEATURE_INHERITANCE" value="PROCESS"/>
<details key="REDEFINING_PROPERTIES" value="PROCESS"/>
<details key="DUPLICATE_OPERATIONS" value="PROCESS"/>
<details key="DERIVED_FEATURES" value="PROCESS"/>
<details key="SUBSETTING_PROPERTIES" value="PROCESS"/>
<details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
<details key="REDEFINING_OPERATIONS" value="PROCESS"/>
<details key="ANNOTATION_DETAILS" value="PROCESS"/>
<details key="SUPER_CLASS_ORDER" value="PROCESS"/>
<details key="UNION_PROPERTIES" value="PROCESS"/>
<details key="DUPLICATE_OPERATION_INHERITANCE" value="PROCESS"/>
</genAnnotations>

or

<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
</eAnnotations>

The others are easier to undestand :

<eAnnotations source="union"/>

<eAnnotations source="subsets" references="#//Element/ownedElement"/>

<eAnnotations source="duplicates">
<contents xsi:type="ecore:EOperation" name="mustBeOwned" ordered="false"
lowerBound="1" eType="#//Boolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The query mustBeOwned()
indicates whether elements of this type must have an owner.&#xD;&#xA;result
= false"/>
</eAnnotations>
<eAnnotations source="redefines"
references="#//Element/mustBeOwned"/>
</contents>
</eAnnotations>

I did not find specific information about how to set up properly my
..genmodel file, all the different types of Annotations, and I was asking if
there was any documentation that could help me... If not, I will have a look
at the source code of the org.eclipse.uml2.codegen.ecore generator...

Cheers,

Romain


"James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #473326 is a reply to message #473319] Wed, 27 June 2007 13:47 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

Unfortunately, there is no documentation listing the resulting annotations
and the exact effect these options have. Some of them might be self
explanatory by virtue of their names but they should be documented fully.
Several documents are being worked on as we speak and this is the topic of
one of them.
For now, having a look at the source code is the best way to figure these
out. I will post a document as soon as it becomes available.

Good luck,

- James.




"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5tk8i$2bl$1@build.eclipse.org...
> Yes ! that's exactly what I mean... Sorry, I should have titled this post
> "using the org.eclipse.uml2.codegen.ecore generator"...
>
> And the only way I found to use it was to make my own .genmodel by hands
> (copy & paste the content of uml2.genmodel in another file
(mydsl.genmodel),
> removing all except the root package, renaming and linking to mydsl.ecore
> file. It worked, but :
> - I was wondering if there were a better way to initialize my genmodel
> - I have no predefined ideas about the meaning of certain number of
> genAnnotations (genmodel) and eAnnotations (ecore model) that will
influence
> the generation, like :
> <genAnnotations
>
source=" http://www.eclipse.org/emf/2002/GenModel/importer/org.eclips e.uml2.u
ml.ecore.importer">
> <details key="DUPLICATE_FEATURES" value="PROCESS"/>
> <details key="DUPLICATE_FEATURE_INHERITANCE" value="PROCESS"/>
> <details key="REDEFINING_PROPERTIES" value="PROCESS"/>
> <details key="DUPLICATE_OPERATIONS" value="PROCESS"/>
> <details key="DERIVED_FEATURES" value="PROCESS"/>
> <details key="SUBSETTING_PROPERTIES" value="PROCESS"/>
> <details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
> <details key="REDEFINING_OPERATIONS" value="PROCESS"/>
> <details key="ANNOTATION_DETAILS" value="PROCESS"/>
> <details key="SUPER_CLASS_ORDER" value="PROCESS"/>
> <details key="UNION_PROPERTIES" value="PROCESS"/>
> <details key="DUPLICATE_OPERATION_INHERITANCE" value="PROCESS"/>
> </genAnnotations>
>
> or
>
> <eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> </eAnnotations>
>
> The others are easier to undestand :
>
> <eAnnotations source="union"/>
>
> <eAnnotations source="subsets" references="#//Element/ownedElement"/>
>
> <eAnnotations source="duplicates">
> <contents xsi:type="ecore:EOperation" name="mustBeOwned"
ordered="false"
> lowerBound="1" eType="#//Boolean">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="The query mustBeOwned()
> indicates whether elements of this type must have an
owner.&#xD;&#xA;result
> = false"/>
> </eAnnotations>
> <eAnnotations source="redefines"
> references="#//Element/mustBeOwned"/>
> </contents>
> </eAnnotations>
>
> I did not find specific information about how to set up properly my
> .genmodel file, all the different types of Annotations, and I was asking
if
> there was any documentation that could help me... If not, I will have a
look
> at the source code of the org.eclipse.uml2.codegen.ecore generator...
>
> Cheers,
>
> Romain
>
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #473331 is a reply to message #473326] Wed, 27 June 2007 14:21 Go to previous message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Thank you James !

"James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #622559 is a reply to message #473277] Mon, 25 June 2007 16:09 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

If I understand this correctly, you will want to have a look at the
UML2EcoreConverter in UMLUtil. That is the heart behind the UML to ecore
conversion process. You can create a subclass and override any of the
caseXXX() to do what you want ( or extend it in any way ).

If there is functionality lacking you might want to raise a bugzilla.

Cheers,
- James.

"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5o0g9$ssn$1@build.eclipse.org...
> Is it possible to use the extended emf generator provided by uml2 for
> another purpose than generating uml.ecore ?
> If yes, what is the procedure to set up such a project ?
>
> Thanks in advance
> regards
> Romain
>
>
Re: using the uml2 code generator [message #622563 is a reply to message #473284] Mon, 25 June 2007 16:48 Go to previous message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Thank you for your response!

but I was not clear enough, I guess....

What I want to do is generating my own "mydsl.ecore" using the extended uml2
emf generator (not the standard emf one), so I can benefit of extended
functionalities such as "generating derived relations, cache adapter
support, factory methods, invariant prefixes, "pluralized" getters, safe
strings, operation utility classes, resource interfaces, etc."

regards
Romain

"James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #622574 is a reply to message #473288] Tue, 26 June 2007 15:12 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

To extend the uml gen model options (gen features) for things like
"pluralize getters" have a look at org.eclipse.uml2.codegen.ecore.

- James.

"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5orku$5aq$1@build.eclipse.org...
> Thank you for your response!
>
> but I was not clear enough, I guess....
>
> What I want to do is generating my own "mydsl.ecore" using the extended
uml2
> emf generator (not the standard emf one), so I can benefit of extended
> functionalities such as "generating derived relations, cache adapter
> support, factory methods, invariant prefixes, "pluralized" getters, safe
> strings, operation utility classes, resource interfaces, etc."
>
> regards
> Romain
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #622575 is a reply to message #473288] Tue, 26 June 2007 15:21 Go to previous message
Eclipse UserFriend
Originally posted by: cdamus.ca.ibm.com

Hi, Romain,

Do you just want to generate code from a UML model instead of from an Ecore
model? The OCL component of MDT does exactly that.

When you create your genmodel using the "New EMF Model" wizard, just select
your UML model as the input instead of an Ecore model. The wizard has a
variety of options that pertain to the process of converting the UML to a
suitable Ecore representation for UML2's codegen extensions. You will also
find some UML-specific properties on the root GenModel element of the
genmodel, that determine whether to user cache adapters, operation classes,
etc.

Cheers,

Christian


Romain BERNARD wrote:

> Thank you for your response!
>
> but I was not clear enough, I guess....
>
> What I want to do is generating my own "mydsl.ecore" using the extended
> uml2 emf generator (not the standard emf one), so I can benefit of
> extended functionalities such as "generating derived relations, cache
> adapter support, factory methods, invariant prefixes, "pluralized"
> getters, safe strings, operation utility classes, resource interfaces,
> etc."
>
> regards
> Romain
>
> "James Bruck" <jbruck@ca.ibm.com> a �rit dans le message de news:
> f5opc8$ptt$2@build.eclipse.org...
>> Hi Romain,
>>
>> If I understand this correctly, you will want to have a look at the
>> UML2EcoreConverter in UMLUtil. That is the heart behind the UML to
>> ecore
>> conversion process. You can create a subclass and override any of the
>> caseXXX() to do what you want ( or extend it in any way ).
>>
>> If there is functionality lacking you might want to raise a bugzilla.
>>
>> Cheers,
>> - James.
>>
>> "Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in
>> message news:f5o0g9$ssn$1@build.eclipse.org...
>>> Is it possible to use the extended emf generator provided by uml2 for
>>> another purpose than generating uml.ecore ?
>>> If yes, what is the procedure to set up such a project ?
>>>
>>> Thanks in advance
>>> regards
>>> Romain
>>>
>>>
>>
>>
Re: using the uml2 code generator [message #622582 is a reply to message #473309] Wed, 27 June 2007 12:12 Go to previous message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Yes ! that's exactly what I mean... Sorry, I should have titled this post
"using the org.eclipse.uml2.codegen.ecore generator"...

And the only way I found to use it was to make my own .genmodel by hands
(copy & paste the content of uml2.genmodel in another file (mydsl.genmodel),
removing all except the root package, renaming and linking to mydsl.ecore
file. It worked, but :
- I was wondering if there were a better way to initialize my genmodel
- I have no predefined ideas about the meaning of certain number of
genAnnotations (genmodel) and eAnnotations (ecore model) that will influence
the generation, like :
<genAnnotations
source=" http://www.eclipse.org/emf/2002/GenModel/importer/org.eclips e.uml2.uml.ecore.importer">
<details key="DUPLICATE_FEATURES" value="PROCESS"/>
<details key="DUPLICATE_FEATURE_INHERITANCE" value="PROCESS"/>
<details key="REDEFINING_PROPERTIES" value="PROCESS"/>
<details key="DUPLICATE_OPERATIONS" value="PROCESS"/>
<details key="DERIVED_FEATURES" value="PROCESS"/>
<details key="SUBSETTING_PROPERTIES" value="PROCESS"/>
<details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
<details key="REDEFINING_OPERATIONS" value="PROCESS"/>
<details key="ANNOTATION_DETAILS" value="PROCESS"/>
<details key="SUPER_CLASS_ORDER" value="PROCESS"/>
<details key="UNION_PROPERTIES" value="PROCESS"/>
<details key="DUPLICATE_OPERATION_INHERITANCE" value="PROCESS"/>
</genAnnotations>

or

<eAnnotations source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
<details key="kind" value="element"/>
</eAnnotations>

The others are easier to undestand :

<eAnnotations source="union"/>

<eAnnotations source="subsets" references="#//Element/ownedElement"/>

<eAnnotations source="duplicates">
<contents xsi:type="ecore:EOperation" name="mustBeOwned" ordered="false"
lowerBound="1" eType="#//Boolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="The query mustBeOwned()
indicates whether elements of this type must have an owner.&#xD;&#xA;result
= false"/>
</eAnnotations>
<eAnnotations source="redefines"
references="#//Element/mustBeOwned"/>
</contents>
</eAnnotations>

I did not find specific information about how to set up properly my
..genmodel file, all the different types of Annotations, and I was asking if
there was any documentation that could help me... If not, I will have a look
at the source code of the org.eclipse.uml2.codegen.ecore generator...

Cheers,

Romain


"James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #622586 is a reply to message #473319] Wed, 27 June 2007 13:47 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Romain,

Unfortunately, there is no documentation listing the resulting annotations
and the exact effect these options have. Some of them might be self
explanatory by virtue of their names but they should be documented fully.
Several documents are being worked on as we speak and this is the topic of
one of them.
For now, having a look at the source code is the best way to figure these
out. I will post a document as soon as it becomes available.

Good luck,

- James.




"Romain BERNARD" <rbernard@extreme-modeling-software.com> wrote in message
news:f5tk8i$2bl$1@build.eclipse.org...
> Yes ! that's exactly what I mean... Sorry, I should have titled this post
> "using the org.eclipse.uml2.codegen.ecore generator"...
>
> And the only way I found to use it was to make my own .genmodel by hands
> (copy & paste the content of uml2.genmodel in another file
(mydsl.genmodel),
> removing all except the root package, renaming and linking to mydsl.ecore
> file. It worked, but :
> - I was wondering if there were a better way to initialize my genmodel
> - I have no predefined ideas about the meaning of certain number of
> genAnnotations (genmodel) and eAnnotations (ecore model) that will
influence
> the generation, like :
> <genAnnotations
>
source=" http://www.eclipse.org/emf/2002/GenModel/importer/org.eclips e.uml2.u
ml.ecore.importer">
> <details key="DUPLICATE_FEATURES" value="PROCESS"/>
> <details key="DUPLICATE_FEATURE_INHERITANCE" value="PROCESS"/>
> <details key="REDEFINING_PROPERTIES" value="PROCESS"/>
> <details key="DUPLICATE_OPERATIONS" value="PROCESS"/>
> <details key="DERIVED_FEATURES" value="PROCESS"/>
> <details key="SUBSETTING_PROPERTIES" value="PROCESS"/>
> <details key="ECORE_TAGGED_VALUES" value="PROCESS"/>
> <details key="REDEFINING_OPERATIONS" value="PROCESS"/>
> <details key="ANNOTATION_DETAILS" value="PROCESS"/>
> <details key="SUPER_CLASS_ORDER" value="PROCESS"/>
> <details key="UNION_PROPERTIES" value="PROCESS"/>
> <details key="DUPLICATE_OPERATION_INHERITANCE" value="PROCESS"/>
> </genAnnotations>
>
> or
>
> <eAnnotations
source="http:///org/eclipse/emf/ecore/util/ExtendedMetaData">
> <details key="kind" value="element"/>
> </eAnnotations>
>
> The others are easier to undestand :
>
> <eAnnotations source="union"/>
>
> <eAnnotations source="subsets" references="#//Element/ownedElement"/>
>
> <eAnnotations source="duplicates">
> <contents xsi:type="ecore:EOperation" name="mustBeOwned"
ordered="false"
> lowerBound="1" eType="#//Boolean">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="The query mustBeOwned()
> indicates whether elements of this type must have an
owner.&#xD;&#xA;result
> = false"/>
> </eAnnotations>
> <eAnnotations source="redefines"
> references="#//Element/mustBeOwned"/>
> </contents>
> </eAnnotations>
>
> I did not find specific information about how to set up properly my
> .genmodel file, all the different types of Annotations, and I was asking
if
> there was any documentation that could help me... If not, I will have a
look
> at the source code of the org.eclipse.uml2.codegen.ecore generator...
>
> Cheers,
>
> Romain
>
>
> "James Bruck" <jbruck@ca.ibm.com> a
Re: using the uml2 code generator [message #622591 is a reply to message #473326] Wed, 27 June 2007 14:21 Go to previous message
Eclipse UserFriend
Originally posted by: rbernard.extreme-modeling-software.com

Thank you James !

"James Bruck" <jbruck@ca.ibm.com> a
Previous Topic:Model import and referencing
Next Topic:org.eclipse.emf.ecore.xmi.IllegalValueException
Goto Forum:
  


Current Time: Fri Sep 22 17:17:20 GMT 2017

Powered by FUDForum. Page generated in 0.02702 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software