Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » MTL Project - first evaluation
MTL Project - first evaluation [message #48440] Fri, 08 August 2008 22:14 Go to next message
Timothy Marc is currently offline Timothy MarcFriend
Messages: 547
Registered: July 2009
Senior Member
Hi MTL-Team,

i've installed the today release of your MTL implemenation. I have
problems, to get it run. My current approach is the following:

********

final URI tmp = URI.createFileURI("...");

final URI model = URI.createFileURI("...");
File output = new File("..");

final List<URI> tmpls = new Vector<URI>();
tmpls.add(tmp);
final List<File> files = new Vector<File>();
files.add(new File("..."));

MTLParser parser = new MTLParser(); //parse the mtl-file
parser.parse(files, tmpls, new Vector());

ResourceSet set = new ResourceSetImpl(); //causes an Exception
Resource s = set.getResource(tmp, true);

Module moduled = (Module)s.getContents().get(0);
System.out.println(moduled.getName());

ResourceSet rss = new ResourceSetImpl();
Resource rs = rss.getResource(model, true);
EObject umlModel = rs.getContents().get(0).eContents().get(4);

MTLService.doGenerate(moduled, "generate", umlModel, output);

********

The module will be correctly transformed into an UML model, but it
cannot be parsed. As i mentioned as a comment in the snippet, an
Exception is thrown:

********
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'XMI' not found.
(file:/F:/Softwareentwicklung/Eclipse/runtime-EclipseApplica tion/Test/templates/generateModel.mtl,
2, 236)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
at
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
at runner.TransformationRunner.testTranse(TransformationRunner. java:34)...
********

Can you verify, whether my approach is the correct one?

And some more general questions:

1. The MTL module project is ment for the creation of user defined modules?
2. The module UI project for the creation of specific UI things.

Thank you for your answers, and i hope i can give you some more feedback
about bugs in the project in the future.

Cheers

Timothy
Re: MTL Project - first evaluation [message #48466 is a reply to message #48440] Mon, 11 August 2008 07:56 Go to previous message
Jonathan MUSSET is currently offline Jonathan MUSSETFriend
Messages: 43
Registered: July 2009
Member
Hi Timoty,

It is dificult to initialize the parser your-self...
At the moment you should use the wizards and the eclipse builder to
initialize your generator
"New>MTL>MTL Module Project"
You have to create one MTL file

The MTL builder creates atomatically a java class next to the MTL file
(only if the MTL file contains a [file] block)

This java class is the entry point of your module, if you want to call
it programmatically.

An ANT task is also created by the builder in the folder 'tasks' of the
project.

The last build is I200808081155.

Cheers,

Jonathan





Timothy Marc a écrit :
> Hi MTL-Team,
>
> i've installed the today release of your MTL implemenation. I have
> problems, to get it run. My current approach is the following:
>
> ********
>
> final URI tmp = URI.createFileURI("...");
>
> final URI model = URI.createFileURI("...");
> File output = new File("..");
>
> final List<URI> tmpls = new Vector<URI>();
> tmpls.add(tmp);
> final List<File> files = new Vector<File>();
> files.add(new File("..."));
>
> MTLParser parser = new MTLParser(); //parse the mtl-file
> parser.parse(files, tmpls, new Vector());
>
> ResourceSet set = new ResourceSetImpl(); //causes an Exception
> Resource s = set.getResource(tmp, true);
>
> Module moduled = (Module)s.getContents().get(0);
> System.out.println(moduled.getName());
>
> ResourceSet rss = new ResourceSetImpl();
> Resource rs = rss.getResource(model, true);
> EObject umlModel = rs.getContents().get(0).eContents().get(4);
>
> MTLService.doGenerate(moduled, "generate", umlModel, output);
>
> ********
>
> The module will be correctly transformed into an UML model, but it
> cannot be parsed. As i mentioned as a comment in the snippet, an
> Exception is thrown:
>
> ********
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1Diagnos ticWrappedException:
> org.eclipse.emf.ecore.xmi.ClassNotFoundException: Class 'XMI' not found.
> (file:/F:/Softwareentwicklung/Eclipse/runtime-EclipseApplica tion/Test/templates/generateModel.mtl,
> 2, 236)
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDe mandLoadException(ResourceSetImpl.java:315)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLo adHelper(ResourceSetImpl.java:274)
>
> at
> org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResou rce(ResourceSetImpl.java:397)
>
> at
> runner.TransformationRunner.testTranse(TransformationRunner. java:34)...
> ********
>
> Can you verify, whether my approach is the correct one?
>
> And some more general questions:
>
> 1. The MTL module project is ment for the creation of user defined modules?
> 2. The module UI project for the creation of specific UI things.
>
> Thank you for your answers, and i hope i can give you some more feedback
> about bugs in the project in the future.
>
> Cheers
>
> Timothy
H
Previous Topic:Load UML model in JET
Next Topic:Model-To-Text-Language (MTL) Implementation
Goto Forum:
  


Current Time: Tue Apr 16 08:39:38 GMT 2024

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

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

Back to the top