Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » automatic code generation
automatic code generation [message #41945] Tue, 30 October 2007 16:16 Go to next message
Eclipse User
Originally posted by: sjurack.informatik.uni-marburg.de

Hi all,

I'm investigating in EMF with OCL in order to integrate these topics in
a lecture. After I read the (very few) articles available in the net
(e.g.
http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
) and some threads posted here, I'm very confused.

I considered the process as follows: Create Ecore-Modell --> Embed
Annotations containing OCL contraints --> Create .Genmodel-file -->
Generate All (code)

Am I right, if I assume the OCL constraint code to be generated
automatically the same way the EMF model classes are generated? So are
there any JET templates contained (which I could not find yet) which the
generated constraint code is based on?

If so, what value for the annotation "source" property needs to be set?
Furthermore I set the .genmodel properties according to the mentioned
article. But if I try to generate the code, I get a lot of error
messages in particular if "Template & Merge"->"Dynamic Templates" is set
to true. If it is set to false, nothing constraint related is generated.
Error messages are for example:
java.lang.ClassNotFoundException:
org.eclipse.emf.codegen.ecore.templates.model.PackageClass_
java.lang.ClassNotFoundException:
org.eclipse.emf.codegen.ecore.templates.model.Class_
java.lang.ClassNotFoundException:
org.eclipse.emf.examples.generator.validator.templates.model .Validator_


Thanx for help in advance!

Stefan

PS:
Eclipse 3.3.1
EMF 2.3
EMF Validation 1.1.1
Re: automatic code generation [message #42007 is a reply to message #41945] Tue, 30 October 2007 18:36 Go to previous messageGo to next message
Miguel Garcia is currently offline Miguel Garcia
Messages: 77
Registered: July 2009
Member
Stefan,

There are limits to how short the explanation to use a design pattern can
be. Christian's article cannot wallpaper over the techniques involved in
generating the boilerplate code to interpret an OCL constraint. In fact, I
think his article does a good job of solving that recurring use case.

I've tried to automate in a different way such generation of "boilerplate"
code, the end result is called "OCL Compiler" and is described at:
http://www.sts.tu-harburg.de/%7Emi.garcia/pubs/2007/ese/oclc ompiler.pdf
(that compiler should soon be available as part of the MDT OCLTools
component).

I know this does not directly answer your question, but I hope it helps
anyway.


Miguel


"Stefan Jurack" <sjurack@informatik.uni-marburg.de> wrote in message
news:fg7le8$ltk$1@build.eclipse.org...
> Hi all,
>
> I'm investigating in EMF with OCL in order to integrate these topics in
> a lecture. After I read the (very few) articles available in the net
> (e.g.
> http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
> ) and some threads posted here, I'm very confused.
>
> I considered the process as follows: Create Ecore-Modell --> Embed
> Annotations containing OCL contraints --> Create .Genmodel-file -->
> Generate All (code)
>
> Am I right, if I assume the OCL constraint code to be generated
> automatically the same way the EMF model classes are generated? So are
> there any JET templates contained (which I could not find yet) which the
> generated constraint code is based on?
>
> If so, what value for the annotation "source" property needs to be set?
> Furthermore I set the .genmodel properties according to the mentioned
> article. But if I try to generate the code, I get a lot of error
> messages in particular if "Template & Merge"->"Dynamic Templates" is set
> to true. If it is set to false, nothing constraint related is generated.
> Error messages are for example:
> java.lang.ClassNotFoundException:
> org.eclipse.emf.codegen.ecore.templates.model.PackageClass_
> java.lang.ClassNotFoundException:
> org.eclipse.emf.codegen.ecore.templates.model.Class_
> java.lang.ClassNotFoundException:
> org.eclipse.emf.examples.generator.validator.templates.model .Validator_
>
>
> Thanx for help in advance!
>
> Stefan
>
> PS:
> Eclipse 3.3.1
> EMF 2.3
> EMF Validation 1.1.1
Re: automatic code generation [message #42221 is a reply to message #41945] Wed, 31 October 2007 12:43 Go to previous messageGo to next message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Stefan,

Miguel's compiler does provide a very cool alternative.

However, on the subject of the technique illustrated by this article, you
will find all of the JET templates in the ZIP file of the complete source
code, linked from the article, itself. You can import the projects that it
contains directly into your workspace and run it, to see how it works.

The article specifies in some detail the format of the annotations that its
templates use. In any case, you will see a working example in the Ecore
model included in the source ZIP that I mentioned, above.

HTH,

Christian


Stefan Jurack wrote:

> Hi all,
>
> I'm investigating in EMF with OCL in order to integrate these topics in
> a lecture. After I read the (very few) articles available in the net
> (e.g.
>
http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
> ) and some threads posted here, I'm very confused.
>
> I considered the process as follows: Create Ecore-Modell --> Embed
> Annotations containing OCL contraints --> Create .Genmodel-file -->
> Generate All (code)
>
> Am I right, if I assume the OCL constraint code to be generated
> automatically the same way the EMF model classes are generated? So are
> there any JET templates contained (which I could not find yet) which the
> generated constraint code is based on?
>
> If so, what value for the annotation "source" property needs to be set?
> Furthermore I set the .genmodel properties according to the mentioned
> article. But if I try to generate the code, I get a lot of error
> messages in particular if "Template & Merge"->"Dynamic Templates" is set
> to true. If it is set to false, nothing constraint related is generated.
> Error messages are for example:
> java.lang.ClassNotFoundException:
> org.eclipse.emf.codegen.ecore.templates.model.PackageClass_
> java.lang.ClassNotFoundException:
> org.eclipse.emf.codegen.ecore.templates.model.Class_
> java.lang.ClassNotFoundException:
> org.eclipse.emf.examples.generator.validator.templates.model .Validator_
>
>
> Thanx for help in advance!
>
> Stefan
>
> PS:
> Eclipse 3.3.1
> EMF 2.3
> EMF Validation 1.1.1
Re: automatic code generation [message #42254 is a reply to message #42221] Wed, 31 October 2007 13:01 Go to previous messageGo to next message
Eclipse User
Originally posted by: sjurack.informatik.uni-marburg.de

Hi Christian,

in fact the sources were very helpful, thanx for the hint! However, the
"dynamic template" compilation using Eclipse3.3 with EMF 2.3 did not
work at all. I even tried to download a fresh eclipse version and
accordant plugins but I get the errors again and again. Considering the
error messages I suspect the error rather on EMFs code generator side
than on MDT-OCL, so this would be rather a topic to discuss in the
emf-newsgroup.
Nevertheless, with Eclipse3.2, EMF2.2 and old configuration data i
found, the code generation works finally.

Thanx again!

Stefan


Christian W. Damus wrote:
> Hi, Stefan,
>
> Miguel's compiler does provide a very cool alternative.
>
> However, on the subject of the technique illustrated by this article, you
> will find all of the JET templates in the ZIP file of the complete source
> code, linked from the article, itself. You can import the projects that it
> contains directly into your workspace and run it, to see how it works.
>
> The article specifies in some detail the format of the annotations that its
> templates use. In any case, you will see a working example in the Ecore
> model included in the source ZIP that I mentioned, above.
>
> HTH,
>
> Christian
>
>
> Stefan Jurack wrote:
>
>> Hi all,
>>
>> I'm investigating in EMF with OCL in order to integrate these topics in
>> a lecture. After I read the (very few) articles available in the net
>> (e.g.
>>
> http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
>> ) and some threads posted here, I'm very confused.
>>
>> I considered the process as follows: Create Ecore-Modell --> Embed
>> Annotations containing OCL contraints --> Create .Genmodel-file -->
>> Generate All (code)
>>
>> Am I right, if I assume the OCL constraint code to be generated
>> automatically the same way the EMF model classes are generated? So are
>> there any JET templates contained (which I could not find yet) which the
>> generated constraint code is based on?
>>
>> If so, what value for the annotation "source" property needs to be set?
>> Furthermore I set the .genmodel properties according to the mentioned
>> article. But if I try to generate the code, I get a lot of error
>> messages in particular if "Template & Merge"->"Dynamic Templates" is set
>> to true. If it is set to false, nothing constraint related is generated.
>> Error messages are for example:
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.codegen.ecore.templates.model.PackageClass_
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.codegen.ecore.templates.model.Class_
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.examples.generator.validator.templates.model .Validator_
>>
>>
>> Thanx for help in advance!
>>
>> Stefan
>>
>> PS:
>> Eclipse 3.3.1
>> EMF 2.3
>> EMF Validation 1.1.1
>
Re: automatic code generation [message #42276 is a reply to message #42007] Wed, 31 October 2007 13:22 Go to previous messageGo to next message
Eclipse User
Originally posted by: sjurack.informatik.uni-marburg.de

Hi Miguel,

thanx for your help. I skip-read the paper due to lac of time, but it
sound promising. I will keep an eye on the mdt project for your compiler ;)

Stefan


Miguel Garcia wrote:
> Stefan,
>
> There are limits to how short the explanation to use a design pattern can
> be. Christian's article cannot wallpaper over the techniques involved in
> generating the boilerplate code to interpret an OCL constraint. In fact, I
> think his article does a good job of solving that recurring use case.
>
> I've tried to automate in a different way such generation of "boilerplate"
> code, the end result is called "OCL Compiler" and is described at:
> http://www.sts.tu-harburg.de/%7Emi.garcia/pubs/2007/ese/oclc ompiler.pdf
> (that compiler should soon be available as part of the MDT OCLTools
> component).
>
> I know this does not directly answer your question, but I hope it helps
> anyway.
>
>
> Miguel
>
>
> "Stefan Jurack" <sjurack@informatik.uni-marburg.de> wrote in message
> news:fg7le8$ltk$1@build.eclipse.org...
>> Hi all,
>>
>> I'm investigating in EMF with OCL in order to integrate these topics in
>> a lecture. After I read the (very few) articles available in the net
>> (e.g.
>> http://www.eclipse.org/articles/article.php?file=Article-EMF -Codegen-with-OCL/index.html
>> ) and some threads posted here, I'm very confused.
>>
>> I considered the process as follows: Create Ecore-Modell --> Embed
>> Annotations containing OCL contraints --> Create .Genmodel-file -->
>> Generate All (code)
>>
>> Am I right, if I assume the OCL constraint code to be generated
>> automatically the same way the EMF model classes are generated? So are
>> there any JET templates contained (which I could not find yet) which the
>> generated constraint code is based on?
>>
>> If so, what value for the annotation "source" property needs to be set?
>> Furthermore I set the .genmodel properties according to the mentioned
>> article. But if I try to generate the code, I get a lot of error
>> messages in particular if "Template & Merge"->"Dynamic Templates" is set
>> to true. If it is set to false, nothing constraint related is generated.
>> Error messages are for example:
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.codegen.ecore.templates.model.PackageClass_
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.codegen.ecore.templates.model.Class_
>> java.lang.ClassNotFoundException:
>> org.eclipse.emf.examples.generator.validator.templates.model .Validator_
>>
>>
>> Thanx for help in advance!
>>
>> Stefan
>>
>> PS:
>> Eclipse 3.3.1
>> EMF 2.3
>> EMF Validation 1.1.1
>
>
Re: automatic code generation [message #42307 is a reply to message #42254] Wed, 31 October 2007 14:03 Go to previous message
Eclipse User
Originally posted by: cdamus.ca.ibm.com

Hi, Stefan,

I'm glad you got the code generation to work, but I'm a little worried that
you had trouble with the latest EMF. When I get a chance, I'll give it a
try, myself.

In the mean-time, any more information that you can provide to follow up in
the EMF newsgroup would certainly be useful.

cW

Stefan Jurack wrote:

> Hi Christian,
>
> in fact the sources were very helpful, thanx for the hint! However, the
> "dynamic template" compilation using Eclipse3.3 with EMF 2.3 did not
> work at all. I even tried to download a fresh eclipse version and
> accordant plugins but I get the errors again and again. Considering the
> error messages I suspect the error rather on EMFs code generator side
> than on MDT-OCL, so this would be rather a topic to discuss in the
> emf-newsgroup.
> Nevertheless, with Eclipse3.2, EMF2.2 and old configuration data i
> found, the code generation works finally.
>
> Thanx again!
>
> Stefan

-----8<-----
Previous Topic:Adding variable-value bindings to queries
Next Topic:Re: Error by EMF-Update
Goto Forum:
  


Current Time: Wed Oct 22 23:15:18 GMT 2014

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

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