Home » Archived » M2M (model-to-model transformation) » [ATL] problem while saving output model
[ATL] problem while saving output model [message #482895] |
Fri, 28 August 2009 13:27 |
urs zeidler Messages: 16 Registered: July 2009 |
Junior Member |
|
|
I try to move my plugin to ATL 3.0.
In ATL 3.0 (Version: 3.0.0.v200906160347 Build id: 200906160347) I can't save the output model, with the error
"/com.fortytwo.ines.emf.diagram/test1.xmi (No such file or directory)", an example.
I'm even not able to start the transformation via the ATL Launcher.
I have looked in the ASMExtractor and there I see that the platform/resource/ prefix is cutted and a fileURI is created, so the the extractor tries to
save the file in the normal file system, why this? Or do I miss some thing.
public void extract(IModel sourceModel, String target) throws ATLCoreException {
ASMModelWrapper modelWrapper = (ASMModelWrapper)sourceModel;
ASMModel asmModel = modelWrapper.getAsmModel();
try {
if (target.startsWith("file:/")) { //$NON-NLS-1$
modelWrapper.getModelLoader().save(asmModel,
URI.createFileURI(target.substring(6)).toString());
} else if (target.startsWith("platform:/resource")) { //$NON-NLS-1$
modelWrapper.getModelLoader().save(asmModel,
URI.createFileURI(target.substring(18)).toString());
}
} catch (IOException e) {
throw new ATLCoreException(e.getLocalizedMessage(), e);
}
}
grettings , urs.
|
|
|
Re: [ATL] problem while saving output model [message #483127 is a reply to message #482895] |
Mon, 31 August 2009 08:52 |
William Piers Messages: 303 Registered: July 2009 |
Senior Member |
|
|
Hello,
This code was made - a few month ago - to workaround a bug with ant
tasks / RegularVM wrapper. Anyway the current implementation is incorrect.
Could you please give more details about the code wich calls the extract
method ? It will help me to define the best fix.
Thanks in advance,
William
urs zeidler a écrit :
> I try to move my plugin to ATL 3.0.
>
>
> In ATL 3.0 (Version: 3.0.0.v200906160347 Build id: 200906160347) I can't
> save the output model, with the error
> "/com.fortytwo.ines.emf.diagram/test1.xmi (No such file or directory)",
> an example.
> I'm even not able to start the transformation via the ATL Launcher.
>
>
> I have looked in the ASMExtractor and there I see that the
> platform/resource/ prefix is cutted and a fileURI is created, so the the
> extractor tries to save the file in the normal file system, why this?
> Or do I miss some thing.
>
>
> public void extract(IModel sourceModel, String target) throws
> ATLCoreException {
> ASMModelWrapper modelWrapper = (ASMModelWrapper)sourceModel;
> ASMModel asmModel = modelWrapper.getAsmModel();
> try {
> if (target.startsWith("file:/")) { //$NON-NLS-1$
> modelWrapper.getModelLoader().save(asmModel,
> URI.createFileURI(target.substring(6)).toString());
> } else if (target.startsWith("platform:/resource")) {
> //$NON-NLS-1$
> modelWrapper.getModelLoader().save(asmModel,
>
> URI.createFileURI(target.substring(18)).toString());
> }
> } catch (IOException e) {
> throw new ATLCoreException(e.getLocalizedMessage(), e);
> }
> }
>
>
> grettings , urs.
|
|
|
Re: [ATL] problem while saving output model [message #483235 is a reply to message #483127] |
Mon, 31 August 2009 16:50 |
urs zeidler Messages: 16 Registered: July 2009 |
Junior Member |
|
|
> Hello,
>
> This code was made - a few month ago - to workaround a bug with ant
> tasks / RegularVM wrapper. Anyway the current implementation is incorrect.
> Could you please give more details about the code wich calls the extract
> method ? It will help me to define the best fix.
>
> Thanks in advance,
>
> William
>
Sorry for the small delay,
It is called by the org.eclipse.m2m.atl.core.service.LauncherService in
public static Object launch(String mode, IProgressMonitor monitor, ILauncher launcher,
Map<String, String> inModels, Map<String, String> inoutModels, Map<String, String> outModels,
Map<String, String> paths, Map<String, Object> options, Map<String, InputStream> libraries,
InputStream... modules) throws ATLCoreException
......
// OUTPUT MODELS EXTRACTION
for (Iterator<String> i = outModels.keySet().iterator(); i.hasNext();) {
String modelName = i.next();
extractor.extract(launcher.getModel(modelName), paths.get(modelName));
}
.......
and the extractor is created by the CoreService.
defaultFactory = CoreService.createModelFactory(launcher.getDefaultModelFacto ryName());
extractor = CoreService.getExtractor(defaultFactory.getDefaultExtractorN ame());
injector = CoreService.getInjector(defaultFactory.getDefaultInjectorNam e());
And this called by AtlLaunchConfigurationDelegate in
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor) throws CoreException {
......
} else {
LauncherService.launch(mode, monitor, launcher, sourceModels, Collections.EMPTY_MAP,
targetModels, modelPaths, options, libraries, modules);
}
......
Which is Called by the org.eclipse.debug.internal.core.LaunchConfiguration
What makes my wonder is, even a "normal" transformation (with the ATL Launch cofiguration) won't work, and obviously can't work with the current
implementation of the ASMExtractor, so does no one uses transformation in workspace, as no one has encountered this before ?
I hope this will help.
greetings, urs.
at last the stacktrace just pasted :
Thread [Worker-0] (Suspended)
ASMExtractor.extract(IModel, String) line: 60
LauncherService.launch(String, IProgressMonitor, ILauncher, Map<String,String>, Map<String,String>, Map<String,String>, Map<String,String>,
Map<String,Object>, Map<String,InputStream>, InputStream...) line: 140
AtlLaunchConfigurationDelegate.launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor) line: 222
LaunchConfiguration.launch(String, IProgressMonitor, boolean, boolean) line: 853
LaunchConfiguration.launch(String, IProgressMonitor, boolean) line: 703
DebugUIPlugin.buildAndLaunch(ILaunchConfiguration, String, IProgressMonitor) line: 866
DebugUIPlugin$8.run(IProgressMonitor) line: 1069
Worker.run() line: 55
|
|
|
Re: [ATL] problem while saving output model [message #483349 is a reply to message #483235] |
Tue, 01 September 2009 09:48 |
William Piers Messages: 303 Registered: July 2009 |
Senior Member |
|
|
> What makes my wonder is, even a "normal" transformation (with the ATL
> Launch cofiguration) won't work, and obviously can't work with the
> current implementation of the ASMExtractor, so does no one uses
> transformation in workspace, as no one has encountered this before ?
>
It sounds strange to mee too. I tried to reproduce the error you get but
even if the path is wrong, I get a "Resource '<path>' does not exist."
instead of your FileNotFoundException (i.e. "No such file or directory").
In fact, the extractor is used to adapt the loading process of the old
RegularVM api to the new one. The ModelLoader has, for instance, a
complex behaviour to decrypt uri's, that I don't want to break (to
prevent compatibility issues). That explains why we remove the
platform:/resource prefix: the ModelLoader recreates a correct uri using
the modified path (see
org.eclipse.m2m.atl.drivers.emf4atl.EMFModelLoader.realSave( ASMModel,
String)).
So I can strongly simplify the implementation of the ASMExtractor (and
injector too), making it more semantically correct, but I'm not sure it
will solve your bug.
Could you report a bug about your issue ? Giving if possible the
transformation project (eventually the java code you use to launch it).
Thanks in advance,
William
> I hope this will help.
> greetings, urs.
>
>
> at last the stacktrace just pasted :
>
> Thread [Worker-0] (Suspended)
> ASMExtractor.extract(IModel, String) line: 60
> LauncherService.launch(String, IProgressMonitor, ILauncher,
> Map<String,String>, Map<String,String>, Map<String,String>,
> Map<String,String>, Map<String,Object>, Map<String,InputStream>,
> InputStream...) line: 140
> AtlLaunchConfigurationDelegate.launch(ILaunchConfiguration, String,
> ILaunch, IProgressMonitor) line: 222
> LaunchConfiguration.launch(String, IProgressMonitor, boolean,
> boolean) line: 853
> LaunchConfiguration.launch(String, IProgressMonitor, boolean) line:
> 703
> DebugUIPlugin.buildAndLaunch(ILaunchConfiguration, String,
> IProgressMonitor) line: 866
> DebugUIPlugin$8.run(IProgressMonitor) line: 1069
> Worker.run() line: 55
|
|
| |
Goto Forum:
Current Time: Wed Jan 15 01:26:31 GMT 2025
Powered by FUDForum. Page generated in 0.03525 seconds
|