|
Re: [QVTo] Standalone transformation [message #524950 is a reply to message #524713] |
Sun, 04 April 2010 17:00 |
Sergey Boyko Messages: 171 Registered: July 2009 |
Senior Member |
|
|
Hi PBarendrecht ,
Comments are in-lined below.
Regards,
Sergey.
PBarendrecht wrote:
> Hi all,
>
> I've been working on a transformation for quite some time, it is finally
> finished. Now I would like to write a Java program that transforms any
> input-model to an output model by using my transform.qvto file.
>
> I read somewhere on the Forums this should be possible. I looked at a
> few pages:
> http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava
> http://wiki.eclipse.org/index.php/EMF-FAQ#How_do_I_use_EMF_i n_standalone_applications_.28such_as_an_ordinary_main.29.3F
>
>
> My knowledge about Java is very basic: I just use a text editor like
> notepad to write simple main-classes and compile them with javac in a
> terminal.
>
> From the above links I understood I have to include several Jar files:
>
> Quote:
>> org.eclipse.emf.ecore_2.6.0.v200912121603.jar
>> org.eclipse.emf.common_2.6.0.v200912121603.jar
>> org.eclipse.emf.ecore.xmi_2.5.0.v200912121603.jar
>> net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar
>> org.eclipse.ocl_3.0.0.v200912161120.jar
>> org.eclipse.ocl.ecore_3.0.0.v200912161120.jar
>> -- QVTo jars ----------
>> org.eclipse.m2m.qvt.oml
>> org.eclipse.m2m.qvt.oml.common
>> org.eclipse.m2m.qvt.oml.cst.parser
>> org.eclipse.m2m.qvt.oml.emf.util
>> org.eclipse.m2m.qvt.oml.ecore.imperativeocl
You have mixed up two different topics - (1) running QVTo transformation
as standalone application and (2) ordinary execution of QVTo
transformation from Java source.
I suppose your case is (2). Then you should create Java plug-in in your
Eclipse workspace and put Java code for QVTo invocation (mentioned in
http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava) in some Java method.
As I already wrote to you in email there's perfect complete example of
such task in "org.eclipse.m2m.qvt.oml.econ2009.tutorial" plug-in.
Eclipse CVS:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org .eclipse.qvtoml/examples/org.eclipse.m2m.qvt.oml.econ2009.tu torial/?root=Modeling_Project
Handy way for using that tutorial:
- check out tutorial plug-in from CVS to workspace
- launch new Eclipse instance
- call "New Other.." (Ctrl+N) wizard and browse for "QVT Operationl
EclipseCon2009 Tutorial" located in "QVT Operational Tutorials" folder
>
> However, my ecore.jar version is
> "org.eclipse.emf.ecore_2.5.0.v200906151043.jar" (I just updated Eclipse
> by clicking Help -> Check for Updates)?
> Furthermore, how can I include those files? When I use "import ...jar"
> it doesn't work.
>
> Next, I could write the transformation call by using the
> TransformationExecutor class. I have to refer to the qvto file and
> specify locations for input- and output files. Is it possible to
> parametrize this information? I would like to be able to use arguments
> in the terminal and specify which input model to use.
Yes, it's possible. Try the sample from
"org.eclipse.m2m.qvt.oml.econ2009.tutorial".
>
> Finally the used meta-models must be registered in some way, but I don't
> understand how I should do this.
Just create your metamodel and generate Java-code for it. Then in new
Eclipse instance it'll be accessible just like Ecore or UML models.
>
> I hope somebody can provide me with a basic example and some explanation :)
|
|
|
Re: [QVTo] Standalone transformation [message #525239 is a reply to message #524950] |
Mon, 05 April 2010 19:28 |
PBarendrecht Messages: 36 Registered: November 2009 Location: Eindhoven, Netherlands |
Member |
|
|
Hi Sergey,
Thanks for your reply. I completely overlooked the part about Java in your e-mail, I'm sorry.
I'm not sure how I should use the mentioned plug-in. When I create a .editor of an own model in Eclipse, I can right-click it and choose "Run As -> Eclipse Application". However, when I right-click the tutorial directory or any subdirectory, this option isn't available, neither is it in the "new -> Other" window.
Furthermore, I'm not sure I understand the difference between the Java plug-in and a standalone. Isn't it possible to create a standalone Java application (by including the used JAR files)?
The intention is that I can use the terminal to transform models conforming to a certain meta-model, for example like this:
java -jar Transform.jar -t MyTransformation.qvto -i inputmodel -o outputmodel -p parameter1=value,parameter2=value
I know I have to include the meta-models in some kind of Java format, but it would be nice to have a "flexible transformation (qvto) file", i.e. the possibility to slightly change the transformation (but of course still use the same included meta-models).
Is this possible?
[Updated on: Mon, 05 April 2010 19:33] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02762 seconds