Eclipse Modeling framework Diagram generation - code-generation

Using Eclipse last version on Fedora system, I try to generate the diagram from the Ecore File. I find the option (1) but when I double Click ( several times on 2) to visualize the diagram it does not work.

Related

EMF : Keeping up with different version of ecore model

When we made initial release of our model we had the following model
1. Person:String:Name,String :Address
2. Version : 1.0
so export /import was easy using EMF's persistent APIs(Storing them as xmls).
Now we have changed the model to
1. Person :String:Name,Address
2. Address: String:House Number, String:Stree Name, String:City
3. Version : 2.0
The same thing explained below
Now how to support older xml files(which are exported using old model) in the new Model.
Is there any support in EMF to do this?
There are some tools/frameworks to help with model migration. Edapt is probably the most well-known (and an official Eclipse project). Basically, it includes tooling and runtime support that tracks the history of your metamodels and can migrate instances at runtime. There was a talk about it at EclipseCon earlier this year.
I've also heard of another project, EMF Migrate, but I don't know much about it.

Import XMI Deletes Sequences

I import XMI of a package hierarchy to a local model, and it's successfully imported.
When I import the same XMI to a shared model (Oracle DB), all the sequences and messages in sequence diagrams are deleted.
Any ideas?
That is a known issue. (search "version control" + "sequence diagram" in the EA forum)
Using instances instead of classifiers in sequence diagrams will to some degree solve that issue.
An XMI representation of a model contains information on the elements in the exported package, and their connectors. Structurally, however, the connectors are not stored within the package in EA's data model, so EA simply writes into the XMI file every connector that connects any of the elements to anything else, whether or not the element at the other end of the connector is in scope.
On the other hand, a connector is by definition connected at both ends -- you cannot create a connector in EA that is only connected to an element at one end. This means that each connector is written to the XMI file with a reference to both its elements.
If both elements are in the scope of the XMI export (in the same package tree), then all's well. But if only one of them is, EA is not able to recreate the connector on import -- only one element is present in the XMI file. When this occurs, EA will ignore the offending connector.
The exception to this is if the element which is missing from the XMI file happens to be in the model already. In that case, EA will recreate the connector. I think this might be what you're seeing in your "local" model.
With Enterprise Architect v.13 I managed to get rid of the trouble;
Supposing that your sequences has Lifelines with Instance Classifier set to the Class/Component that you would like to use in our sequence:
Right Click on the Package that you would like to Export
Go to Package Baseline and create New Baseline for the package
Once Baseline is shown, from the "Baseline" choose "Export File"
Save it as XMI File
Import XMI file in the other EAP Project.
I compared the XMI file generated from a Baseline with an XMI generated by clicking on the option "Import/Export" and they have differences... it seems like that the Exported XMI of the Baseline contains full information of the model (included root nodes), thus I think the import process might resolve each link to objects that are not hold in the same package...

how to generate code from a graphical model to a specefic api?

i am building an editor for manipulating graphical elements, each element must represent a type of element in an API Specification.
The elements of the API are basicaly some classes ad interfaces, they have certain usage constraints, like the element A can't be a child of the element B, or can't be connected with the element C, etc...
The editor should allow you to generate code accordinatly to what you have drawn and the generated code must be an implementation of the API that correspond to what you have drawn.
i know nothing (in practice) about model driven architecture and how i can generate code from a graphical model to some implmentation.
i don't want to mix the graphical model(containing graphical informations like the size and the coordinates, etc...) with the business model implementing the API Specification.
I am using eclipse GEF for building the editor
here're the problems i am facing:
Since the graphical model and the business model are separated, i was thinking of defining an emf model, the the editor would be an editor for that emf model. Is it possible then to transform the model drawn in the editor, using the emf model as basic construct elements, to a corresponding implementation of the API specification ?
i know since the graphical model and the business model are separated i have to implement some sort of a grammer sepcifiyng the usage constraints is antlr well suited for what i want to do (speaking about code generation and the grammer) or should i go with xtext ?
what eclipse framework tool whould help me to do what i want to do ?
If you already have a graphical editor, then it seems mostly unnecessary to create a lower-level textual model format (e.g. using antlr/Xtext) to execute code generation. Especially, if your model is already in EMF.
There are various code generator technologies for EMF model (e.g. Acceleo or Xtend can also be used for that); these generator will use the EMF model as an input, and provide the output code specific to the API you seem to be using. In both tools you have to manually assemble your output files by defining templates, and then serialize the results of these templates. This serialization is automatic in Acceleo, or you can do it using a Java-like API in Xtend.
If your model is not in EMF now, you can still use Xtend directly - however, I believe, Acceleo will not useful in this case.

Why is it called "EMF Generator _Model_"?

In the Eclipse Modeling Framework (EMF), there are ecore files to define a model. From this model code (and other things) can be generated. This generation step is described by an "EMF Generator Model". Now my question is, why this file is called "model" instead of "configuration" or something like that. In my opinion, it does not model anything, but it describes a generation step...
While the other answers are perfectly correct, there is one additional difference between a "model" and a "configuration". All EMF models (including this generator model) can be modified, transformed and so on by every already available EMF tool (because they all use the same meta model).
This is a huge difference compared to the situation that the configuration can only be read by another tool, if it knows the exact format of the configuration serialization.
So you can create an UML diagram of the generator model, you can use it in a model based graphical editor, you can transform it using model-to-model transformation plugins, you can put it into EMFstore, ... without any of these tools having been prepared specifically for that model.
The current implementation of EMF was created with a bootstrapping-approach.
At first, the model that describes the data that is stored in ecore and genmodel were written by hand. As soon as EMF was stable enough, these were modeled and generated with EMF itself.
This means, the ecore and genmodel are in every way a EMF model.
This is similar to how many compilers for new programming languages are developed. The initial implementation has to be written in a second language, but as soon as the compiler is complete, you can use the new language to write a new implementation, add features, and then use the binaries of the previous version of the compiler to create the next.
From the creator of EMF, Ed Merks:
After all, EMF's generator model generates both the Ecore model and itself, so we're not actually in a position to delete our generated code. We need it to bootstrap the environment. It's prickly problem.
http://ed-merks.blogspot.de/2008/10/hand-written-and-generated-code-never.html
Actually the genmodel as well as the ecore files are also EMF models technically speaking. So this is not a surprise that it is called this way.
In fact you have to understand that EMF allows to describe any kind of structured information. So it can be used to describe your own semantics as well as describe code generation configurations or even describe itself (ecore).

Netbeans generate hbm.xml files from multiple shcemas of database

i am using netbeans, I am generating POJO and hbm.xml files from a database, but i am able to generate only from one schema only. But I need to create from two different schemas and its tables have cross reference or relationship. How can I do it in Netbeans? or Is there any alternative solution?
Seems it Netbean's bug, while creating an reverse
engineering xml file, actually you can not create them from multiple schemas,
because simply Netbean does not simply generate them. There are several solutions
if you dont want to write by hand all codes in reverse engineering file:
1) First You can generate reverse engineering file from
Eclipse IDE, then you may copy it and paste in the
Netbeans reverse engineering file, then it should
work fine to generate POJO and hbm.xml files;