[TEXO][ACCELEO] Web-form Vaadin editor for Texo JPA classes [message #1727119] |
Sat, 19 March 2016 11:26 |
Mr Cur Messages: 35 Registered: September 2014 |
Member |
|
|
Dear all,
I use Texo to generate a JPA-based implementation based on an Ecore class diagram. Additionally, I use the annotation facility as part of Texo to influence the generation process.
Now, I want to develop a simple web/form based application to manage the JPA instances.
For a limited subset of my JPA class hierarchy, I developed a prototype using Vaadin. This works reasonably well but the implementation is not straightforward.
Therefore, the plan is the develop an web/form application generation using Acceleo.
Acceleo seems to well suited to generate code based on an Ecore class diagram. However, the code generation should follow the same 'generation' decision as Texo does (e.g. with respect to handling bi-directional relationships and decision on the ownership of such relations in JPA).
Therefore, the Acceleo generator needs to use both the Ecore class diagram and the Texo annotations model.
I have two questions:
1) How to work with the annotations model of Texo in Acceleo?
Acceleo can deal with different meta models, and while creating an Acceleo translator, the annotations model of Texo seems to be recognized.
However, if I develop a simple translator using Acceleo, I get the following error:
Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'EPackageModelGenAnnotation' is not found or is abstract.
At https://wiki.eclipse.org/Acceleo/FAQ#My_generation_fails_with_a_.27package_not_found.27_exception it suggest that can be solved easily.
I did the following:
In the method registerPackages (of the by Acceleo generated generate.java):
if (!isInWorkspace(
org.eclipse.emf.texo.annotations.annotationsmodel.AnnotationsmodelPackage.class)) {
resourceSet.getPackageRegistry().put(
org.eclipse.emf.texo.annotations.annotationsmodel.AnnotationsmodelPackage.eINSTANCE.getNsURI(),
org.eclipse.emf.texo.annotations.annotationsmodel.AnnotationsmodelPackage.eINSTANCE);
}
if (!isInWorkspace(
org.eclipse.emf.texo.modelgenerator.modelannotations.ModelcodegeneratorPackage.class)) {
resourceSet.getPackageRegistry().put(
org.eclipse.emf.texo.modelgenerator.modelannotations.ModelcodegeneratorPackage.eINSTANCE.getNsURI(),
org.eclipse.emf.texo.modelgenerator.modelannotations.ModelcodegeneratorPackage.eINSTANCE);
}
resourceSet.getPackageRegistry().put(
"http://www.eclipse.org/emf/texo/modelgenerator/modelannotations",
org.eclipse.emf.texo.annotations.annotationsmodel.AnnotationsmodelPackage.eINSTANCE);
Apparenty, the above is not complete, hence the Exception.
Please a suggestion what I have to add.
2. Rules that Texo uses, specifically to handle bi-directional relationships.
Is there an overview that explains how Texo generates bi-directional relationships, specificly with respect to ownership of relationships?
A suggestion where to look in the source code of Texo to find these rules would also be appreciated.
Thanks.
Cur.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03727 seconds