Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] cannot access the attributes of a uml interface
[Acceleo] cannot access the attributes of a uml interface [message #1411078] Fri, 22 August 2014 10:39 Go to next message
Mary P. is currently offline Mary P.Friend
Messages: 48
Registered: November 2012
Member
Hello,

I would like to use Acceleo in order to generate Java Interfaces from the UML Interfaces.
I have the following .mtl file used for the generation:

[comment encoding = UTF-8 /]

[module generateUML('http://www.eclipse.org/uml2/4.0.0/UML')]

[template public generateInterface(interface : Interface)]
[file (interface.name, false)]
some text
[/file]
[/template]



(this template will be called from the main template)

When I launch my application and try to generate whatever from a uml interface, I get the following exception:

!MESSAGE Couldn't evaluate URL of the file at line 6 in Module generateUML for block file(interface.name, false). Last recorded value of self was org.eclipse.uml2.uml.internal.impl.InterfaceImpl@ebcc2c5 (name: Interface1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false).
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Couldn't evaluate URL of the file at line 6 in Module generateUML for block file(interface.name, false). Last recorded value of self was org.eclipse.uml2.uml.internal.impl.InterfaceImpl@ebcc2c5 (name: Interface1, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false).
	at generateUML.generateInterface(Interface)(generateUML.mtl:6)
	at generateUML.generateInterface(Interface)(generateUML.mtl:5)
...


Does anybody have an idea of what might be the reason?

Thanks in advance!
Mary
Re: [Acceleo] cannot access the attributes of a uml interface [message #1411141 is a reply to message #1411078] Fri, 22 August 2014 13:49 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The diagnostic clearly shows that you can access the attributes of a UML
interface.

Line 6 looks like: [file (interface.name, false)]
and interface.name looks like: Interface1

so you are probably trying to create a file called "Interface1"
somewhere. The diagnostic is complaining that you have a bad URL,
probably because your default path is unsuitable.

Surely you at least wanted ".java" as a suffix, and probably on a path
that actually exists?

Regards

Ed Willink

On 22/08/2014 11:40, Mary P. wrote:
> Hello,
>
> I would like to use Acceleo in order to generate Java Interfaces from
> the UML Interfaces.
> I have the following .mtl file used for the generation:
>
>
> [comment encoding = UTF-8 /]
>
> [module generateUML('http://www.eclipse.org/uml2/4.0.0/UML')]
>
> [template public generateInterface(interface : Interface)]
> [file (interface.name, false)]
> some text
> [/file]
> [/template]
>
>
>
> (this template will be called from the main template)
>
> When I launch my application and try to generate whatever from a uml
> interface, I get the following exception:
>
>
> !MESSAGE Couldn't evaluate URL of the file at line 6 in Module
> generateUML for block file(interface.name, false). Last recorded value
> of self was org.eclipse.uml2.uml.internal.impl.InterfaceImpl@ebcc2c5
> (name: Interface1, visibility: <unset>) (isLeaf: false, isAbstract:
> false, isFinalSpecialization: false).
> !STACK 0
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Couldn't evaluate
> URL of the file at line 6 in Module generateUML for block
> file(interface.name, false). Last recorded value of self was
> org.eclipse.uml2.uml.internal.impl.InterfaceImpl@ebcc2c5 (name:
> Interface1, visibility: <unset>) (isLeaf: false, isAbstract: false,
> isFinalSpecialization: false).
> at generateUML.generateInterface(Interface)(generateUML.mtl:6)
> at generateUML.generateInterface(Interface)(generateUML.mtl:5)
> ..
>
>
> Does anybody have an idea of what might be the reason?
>
> Thanks in advance!
> Mary
>
Re: [Acceleo] cannot access the attributes of a uml interface [message #1411148 is a reply to message #1411141] Fri, 22 August 2014 14:13 Go to previous message
Mary P. is currently offline Mary P.Friend
Messages: 48
Registered: November 2012
Member
Yes, everything is right. Actually, I do
[file (interface.name.concat('.java'), false, 'UTF-8')]
some code
[/file]


in order to add ".java" to the name of the file. But it gives me the same kind of exception.

In order to find out what is the reason of the problem, I tried also to create a file with a given name, and to print the name of the interface to this file. The code of such module is given below:

[template public generateInterface(interface : Interface)]
[file ('Interface1.java', false, 'UTF-8')]
some text
[interface.name/]
[/file]
[/template]


As a result, a file called "Interface1.java" is created, and it has the text "some text" inside. But the name of the interface is not in the file, and an exception is thrown complaining about the line "[interface.name/]".

Best regards,
Mary
Previous Topic:push and pop in Acceleo
Next Topic:[Acceleo] error in definition of Set
Goto Forum:
  


Current Time: Thu Mar 28 23:08:41 GMT 2024

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

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

Back to the top