Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Invalid attributes during template invocation
Re: [Acceleo] Invalid attributes during template invocation [message #1015015 is a reply to message #1014849] Wed, 27 February 2013 08:22 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Michael,

Quote:
eProxyURI: platform:/plugin/org.example.mm0/model/mm0.ecore#//Z/Attr0


That would mean that what you registered

Quote:
getURIMap.put(platformURI, NsUri)


does not correspond to the real URI : "platformURI", here, needs to be what you see as the "eProxyURI" (platform:/plugin/org.example.mm0/model/mm0.ecore). Can you double-check that?

Laurent Goubet
Obeo
Re: [Acceleo] Invalid attributes during template invocation [message #1015066 is a reply to message #1015015] Wed, 27 February 2013 10:56 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
Hi,

Thank you both four your replies.

The URI string was correct. I triple checked by copying it straight from the debugger.
Re: [Acceleo] Invalid attributes during template invocation [message #1015389 is a reply to message #1015066] Thu, 28 February 2013 13:12 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
It may not be clear from my previous message, but I am still stuck with java.lang.IllegalArgumentException. So, I am more than ever open to suggestions.

Michaël
Re: [Acceleo] Invalid attributes during template invocation [message #1015572 is a reply to message #1015389] Fri, 01 March 2013 09:14 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

As I wrote before:

/Yes: eProxyURI is very smelly.

You have almost certainly failed to ensure that MM0 is registered in a
way that corresponds to its plugin:/... references. /

So if you are unable to resolve the problem by analysis you have to
resolve it by debugging.

In EcoreUtil.resolve(EObject proxy, ResourceSet resourceSet)

set a breakpoint on the second

resolvedObject = resourceSet.getEObject(proxyURI, false);

and see why the retry fails.

Regards

Ed Willink

On 28/02/2013 13:12, Michaël Melchiore wrote:
> It may not be clear from my previous message, but I am still stuck
> with java.lang.IllegalArgumentException. So, I am more than ever open
> to suggestions.
>
> Michaël
Re: [Acceleo] Invalid attributes during template invocation [message #1015598 is a reply to message #1015389] Fri, 01 March 2013 10:37 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Michaël,

Just double-checked from my end ... Seems like I had done something else when tinkering with your samples, since it indeed does not work. EMF will not use the normalized URI when checking if an URI is that of an ePackage in the resource resolution process.

So the only workaround for this is to change the way your models reference themselves, i.e. open "mm1.ecore" textually, and replace occurences of "platform:/plugin/org.example.mm0/model/mm0.ecore" with "http://example.org/mm0" (leave the fragments "#..." intact, only change the ecore URI). Ed mentionned that
Quote:
href="http://www.eclipse.org/ocl/XBNF#//Syntax/grammars" is wrong.
... but that is exactly how EMF references metamodels, and it makes use of a specific handling for such URIs (which is part of why your use case is failing).

The only impact you will see after having done this is that when you open "mm1.ecore" in the ecore editor, you will not "see" a tree node for the "mm0" resource. It will remain hidden. That is the only change : you will still be able to reference parts of that other metamodel, you will still be able to edit and save your model. Once you've change the platform URI once, you won't have to do it again after edits. You will also need to recompile the mtl file since the references there will react to the change in mm1 too.

As I previously mentionned, we can implement changes in Acceleo to allow for this uses case without forcing this cumbersome workaround on you, but that is not a planned change yet.

Laurent Goubet
Obeo
Re: [Acceleo] Invalid attributes during template invocation [message #1016033 is a reply to message #1015598] Mon, 04 March 2013 16:20 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
Laurent,

The proposed fix prevents me from reloading the "mm1.genmodel" file. I get the following exception:

java.lang.reflect.InvocationTargetException
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:121)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
	at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:1008)
	at org.eclipse.emf.converter.ui.contribution.base.ModelConverterWizard.performFinish(ModelConverterWizard.java:246)
	at org.eclipse.emf.importer.ui.contribution.base.ModelImporterWizard.performFinish(ModelImporterWizard.java:157)
	at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:811)
	at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:430)
	at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
	at org.eclipse.jface.window.Window.open(Window.java:801)
	at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:254)
	at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:274)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
	at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3540)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3161)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Caused by: org.eclipse.core.runtime.CoreException: An error occurred while performing this operation.
	at org.eclipse.emf.common.util.DiagnosticException.toCoreException(DiagnosticException.java:47)
	at org.eclipse.emf.converter.ui.contribution.base.ModelConverterWizard$1.execute(ModelConverterWizard.java:235)
	at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.java:106)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:118)
	... 51 more
Caused by: org.eclipse.emf.common.util.DiagnosticException: An error occurred while performing this operation.
	at org.eclipse.emf.converter.ui.contribution.base.ModelConverterWizard$1.execute(ModelConverterWizard.java:234)
	... 54 more
Caused by: java.io.IOException: PUT failed with HTTP response code 503
	at org.eclipse.emf.ecore.resource.impl.URIHandlerImpl$1.close(URIHandlerImpl.java:129)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfChangedWithMemoryBuffer(ResourceImpl.java:1223)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:980)
	at org.eclipse.emf.importer.ModelImporter.saveGenModelAndEPackages(ModelImporter.java:769)
	at org.eclipse.emf.importer.ui.contribution.base.ModelImporterWizard.doPerformFinish(ModelImporterWizard.java:150)
	at org.eclipse.emf.converter.ui.contribution.base.ModelConverterWizard$1.execute(ModelConverterWizard.java:228)
	... 54 more

[Updated on: Mon, 04 March 2013 16:34]

Report message to a moderator

Re: [Acceleo] Invalid attributes during template invocation [message #1016048 is a reply to message #1016033] Mon, 04 March 2013 17:41 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
The proposed fix does solve my problem on a confined test case: a specific generator of my framework ported to Acceleo 3.

But, as I said in my previous port, the "URI switch" also prevents every directly or indirectly depending genmodel from being synchronized w.r.t to their metamodels.

I think Acceleo 3 could improve on the issues my team currently faces when maintaining or adding features in our software. Currently, I have small internal test projects which I use to build a more educated opinion on your technology. Ideally, I would like Acceleo 3 to support the next major release of our framework.

Considering the issues I keep running into since last year, I am growing more and more hesitant to port more ambitious code generators....

For now, the trick is to apply the "URI switch" after all genmodel have been synchronized and model java classes generated

[Updated on: Mon, 04 March 2013 17:44]

Report message to a moderator

Re: [Acceleo] Invalid attributes during template invocation [message #1016155 is a reply to message #1016048] Tue, 05 March 2013 09:42 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Michael,

Changing the URI "textually" did not prevent me from doing anything with the model, I must admit I did not test with a genmodel, though I do not really understand why that would fail.

As mentionned, this is something Acceleo can fix. I only tried to find a workaround you could use for now, seems like there aren't any viable ones.

Laurent Goubet
Obeo

Re: [Acceleo] Invalid attributes during template invocation [message #1016383 is a reply to message #1016155] Wed, 06 March 2013 10:15 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Michaël Melchiore,

I have contributed a fix for your issue and I have tested it on Eclipse 3.6 and 3.7.
https://lh6.googleusercontent.com/-MDXt1xvC364/UTcVjUcMqgI/AAAAAAAANqE/v7ksF_bRcJY/s600/Fix.png

By the way, upon investigation, I've seen that if the MANIFEST.MF of your project does not contain any dependencies to the plug-ins containing your dependencies (which seems to be the case in the first projects that you had attached) our fix cannot work (since our builder can't compute all the meta-models that should be registered in our dedicated package registry).

An integration build containing the fix is available on this update site.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1016442 is a reply to message #1016383] Wed, 06 March 2013 13:25 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
Stephane,

I have installed the integration update site, upgrading my Acceleo installtion from 3.3.2 to 3.4.x. I have also followed your advice and taken special care of my metamodel dependencies. Here is my dependency structure

MM1 (contained in an installed plugin)

MM2 (in workspace)
requires MM1

MM3 (in workspace)
requires MM2, MM1

MM3.m2t (in workspace)
requires MM3


Now, I get compile time errors in the editors: every use of Attr1 et Attr2 is detected as an "Unrecognized variable" error. I still think this is an improvement because errors are now detected before runtime and reliably (every use of Attr1 and Attr2 in every project triggers an error).

A small question: in your template, you have referenced all three metamodels. Am I correct to think that only MM3 is required (provided all dependencies are properly set in plugins) ?

Regards,

Michaël

[Updated on: Wed, 06 March 2013 16:14]

Report message to a moderator

Re: [Acceleo] Invalid attributes during template invocation [message #1016525 is a reply to message #1016442] Wed, 06 March 2013 18:51 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

Quote:
A small question: in your template, you have referenced all three metamodels. Am I correct to think that only MM3 is required (provided all dependencies are properly set in plugins)?

It is strongly recommended to use all three.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1017762 is a reply to message #1016442] Tue, 12 March 2013 13:48 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

Now, I get compile time errors in the editors: every use of Attr1 et Attr2 is detected as an "Unrecognized variable" error. I still think this is an improvement because errors are now detected before runtime and reliably (every use of Attr1 and Attr2 in every project triggers an error).


I have successfully found a use case in which I can reproduce your issue. I am working on it.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1017780 is a reply to message #1017762] Tue, 12 March 2013 14:26 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi again,

So the use case where I could reproduce your issue involved the following situation. We are loading mm3 since it is a project dependency of our project (using the MANIFEST.MF) located in the workspace, but mm3 is referencing mm2 with the following relative path "../../mm2/model/mm2.ecore" whle we had loaded mm2 thanks to the following workspace relative path (/mm2/model/mm2.ecore), in a similar fashion we could have a problem finding mm1. This fix improves the consistency of our own package registry regarding metamodels in the workspace with dependencies to other metamodels. The new fix also improves Ctrl+click on attributes, references and variable declarations for types located in metamodels in the workspace (in my previous screenshot, Ctrl+clicking on 'AttrX' and 'aC : C').

The new build can be found on this update site. Tell me if this new build fixes all your problems regarding to this situation. Thanks.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1017785 is a reply to message #1017780] Tue, 12 March 2013 14:38 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
I am on it. Expect an update soon
Re: [Acceleo] Invalid attributes during template invocation [message #1017800 is a reply to message #1017780] Tue, 12 March 2013 15:04 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
I confirm this build fixes every problem I reported in this thread.

Will you release a new version or should I deploy the fix in my team using the hudson release site?

It has been a long road, thanks a bunch.

Michaël
Re: [Acceleo] Invalid attributes during template invocation [message #1017825 is a reply to message #1017800] Tue, 12 March 2013 15:54 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

This fix will be available in Acceleo 3.4.0 which will be release at the end of June. I will backport it on Acceleo 3.3 to make a new release for Acceleo 3.3.3 this week. If you need this fix as soon as possible, you can use the integration build of Acceleo 3.4.0 that I gave you since it contains almost no changes from Acceleo 3.3.2 released last month. We have just changed the way, Acceleo modules wrapping Java services are automatically generated by the new module wizard (nothing to worry about for your need here). If it's not critical, you could wait for Acceleo 3.3.3 which should be released this week. Given the minimal difference between the two version, I would personnaly just use the integration build of Acceleo 3.4.0.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1017841 is a reply to message #1017825] Tue, 12 March 2013 16:15 Go to previous messageGo to next message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
I will wait for 3.3.3 then.

I want to be able to enforce in my generators a minimal Acceleo version range that guarantees your fix is deployed in my colleagues' environments. If not , my generators will not compile. Simple and yet, safe.

Regards,

Michaël
Re: [Acceleo] Invalid attributes during template invocation [message #1018781 is a reply to message #1017841] Thu, 14 March 2013 13:13 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

We have released Acceleo 3.3.3 and it is now available on the Acceleo 3.3.x update site: http://download.eclipse.org/modeling/m2t/acceleo/updates/releases/3.3

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: [Acceleo] Invalid attributes during template invocation [message #1018815 is a reply to message #1018781] Thu, 14 March 2013 14:21 Go to previous message
Michaël Melchiore is currently offline Michaël MelchioreFriend
Messages: 47
Registered: April 2012
Member
Thanks, I am currently deploying it.

Michaël

[Updated on: Thu, 14 March 2013 14:32]

Report message to a moderator

Previous Topic:target folder from mtl file
Next Topic:[Acceleo] How to make a type cast?
Goto Forum:
  


Current Time: Tue May 07 03:33:13 GMT 2024

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

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

Back to the top