It's all about the answers!

Ask a question

How to enrich data models with OCL


Tim Schumann (1464) | asked Feb 28 '08, 4:08 a.m.
Hi,

is there a possibility to enrich the data models processed by the codegen
tools with OCL defined operations?
The idea is the following:
We want to be able to manage models within Jazz's SCM system. A user can
provide a specific meta-model using Jazz's component data model mechanism.
So he defines an EMF Ecore Model that gets processed by Jazz's codegen tool.
To enable the user to easily define constraints of his meta-model, he should
be able to express this by enriching his EMF model with OCL expressions.

The question is, if its possible to adapt the codegen tool, to support that
(like the standard EMF codegen tool handles OCL).
Therefore, I'd need at least to be able to make some modifications to the
..genmodel file before the generation of the source code.
Unfortunately, I couldn't find the source files of the codegen tool to have
a closer look at how the things work. Could somebody provide access for
these?

Many thanks for your help!

--Tim

2 answers



permanent link
Chris Daly (61651) | answered Feb 29 '08, 12:18 p.m.
JAZZ DEVELOPER
Tim Schumann wrote:
Hi,

is there a possibility to enrich the data models processed by the codegen
tools with OCL defined operations?
The idea is the following:
We want to be able to manage models within Jazz's SCM system. A user can
provide a specific meta-model using Jazz's component data model mechanism.
So he defines an EMF Ecore Model that gets processed by Jazz's codegen tool.
To enable the user to easily define constraints of his meta-model, he should
be able to express this by enriching his EMF model with OCL expressions.

The question is, if its possible to adapt the codegen tool, to support that
(like the standard EMF codegen tool handles OCL).
Therefore, I'd need at least to be able to make some modifications to the
.genmodel file before the generation of the source code.
Unfortunately, I couldn't find the source files of the codegen tool to have
a closer look at how the things work. Could somebody provide access for
these?

Many thanks for your help!

--Tim


Hi Tim,

Currently the Jazz codegen tool doesn't have any extensibility hooks
that would allow you to tailor the .genmodel that we dynamically create
and use to generate code. This, and the fact that we don't have a
source download for codegen, are reasonable subjects to file workitems
about. However the Repository team will need to weigh in on the idea of
codegen extensibility because I imagine there would be many ways to
break the O/R mapping or other aspects of Item behavior through
extensibility.

I think there would be serious work required to get a clean codegen
extensibility story, so I want to turn your question around and see if
there is a way to get the behavior you want using Jazz as it is today.
Could your needs be met by developing a Jazz component with a service
that reads EMF models from clients and stores them as text/xml (either
using the Jazz filesystem or your own simple storage model based on
ManagedItems with Content)? You would develop Ecore models and use
normal EMF codegen to generate them. It would be the job of your
component to associate uploaded instance models with the correct Ecore
model and then do whatever validation and OCL interpretation makes sense
for your purposes. Does this make sense or am I reading too much into
your question?

--
Chris Daly
Jazz Component Development Team

permanent link
Tim Schumann (1464) | answered Mar 03 '08, 4:58 a.m.
Hi Chris,

thanks for your great post. Your suggestion looks good to me. I just wanted
to check out the different alternatives to implement this task. Following
your post, I agree that it might be kind of error-prone to extend the Jazz
codegen tool for these issues, especially since "users" should be able to
define the constraints.

Since I would have to define an "external EMF Ecore Model", so I guess the
easiest way is to put the constraints and such stuff into this external
model.

Many thanks!

--Tim

Hi Tim,

Currently the Jazz codegen tool doesn't have any extensibility hooks that
would allow you to tailor the .genmodel that we dynamically create and use
to generate code. This, and the fact that we don't have a source download
for codegen, are reasonable subjects to file workitems about. However the
Repository team will need to weigh in on the idea of codegen extensibility
because I imagine there would be many ways to break the O/R mapping or
other aspects of Item behavior through extensibility.

I think there would be serious work required to get a clean codegen
extensibility story, so I want to turn your question around and see if
there is a way to get the behavior you want using Jazz as it is today.
Could your needs be met by developing a Jazz component with a service that
reads EMF models from clients and stores them as text/xml (either using
the Jazz filesystem or your own simple storage model based on ManagedItems
with Content)? You would develop Ecore models and use normal EMF codegen
to generate them. It would be the job of your component to associate
uploaded instance models with the correct Ecore model and then do whatever
validation and OCL interpretation makes sense for your purposes. Does
this make sense or am I reading too much into your question?

--
Chris Daly
Jazz Component Development Team

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.