Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] problem with primitive types when executed as Java application
[Acceleo] problem with primitive types when executed as Java application [message #902957] Tue, 21 August 2012 08:04 Go to next message
Eclipse UserFriend

As a consequence of this issue (http://www.eclipse.org/forums/index.php/t/369676/) I have an acceleo transformation which produces the desired output only when executed as a Java Application.

I have however notice that in this case there are some problems with primitive types. suppose I have a classifier property called att typed with an Integer UML Primitive type. If I run (as a Java Application) this code

   [att.type/] [att.type.name/]


I get

org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@548eb (eProxyURI: pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#Integer)
Re: [Acceleo] problem with primitive types when executed as Java application [message #904402 is a reply to message #902957] Tue, 28 August 2012 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi Andrea,

When using UML in standalone (Java Application), you need to properly register everything it needs, including the primitive types. See the UML FAQ.

The bits needed to register their models and factories can be done in your generated java launcher, within the "register*" methods.

Laurent Goubet
Obeo
Re: [Acceleo] problem with primitive types when executed as Java application [message #905390 is a reply to message #904402] Thu, 30 August 2012 05:49 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

You should use something like this in the method registerPackages of your generator:

Map uriMap = resourceSet.getURIConverter().getURIMap();
URI uri = URI.createURI("platform:/plugin/org.eclipse.uml2.uml.resources/");
uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri.appendSegment("libraries").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));


But for the stand alone, the path of the jar org.eclipse.uml2.uml.resources is not "platform:/plugin/org.eclipse.uml2.uml.resources/" but the absolute path of the jar.

Regards,

Stephane Begaudeau
Re: [Acceleo] problem with primitive types when executed as Java application [message #1793371 is a reply to message #905390] Mon, 06 August 2018 14:25 Go to previous messageGo to next message
Eclipse UserFriend
Hello Stephane and Laurent

I got the same problem with instances of PrimitiveType, when started to write a Swift code generator from class diagrams built using Papyrus. My class diagram has a number of classes containing properties typed by elements of UML Primitive Types (String and Integer), and when trying to get the names of such primitive types as strings ("String" and "Integer") I got blank, just like Andrea indicated previously. More details on my problem is in this thread: https://www.eclipse.org/forums/index.php/t/1094565/ I am running Acceleo 3.7.3... and Papyrus 4.0.0... on top of Eclipse Photon and my generator is not running as a stand-alone application.

My question is: do I have to modify the registerPackages() method in the Generator.java file? What modifications do I have to do to register the UML Primitive Type package? I am not really understanding this registering stuff and your assistance will be really appreciated.

Thank in advance for your help. Kindest regards.
Re: [Acceleo] problem with primitive types when executed as Java application [message #1859907 is a reply to message #1793371] Tue, 04 July 2023 19:22 Go to previous messageGo to next message
Eclipse UserFriend
I have posted my solution in this thread.
Re: [Acceleo] problem with primitive types when executed as Java application [message #1863834 is a reply to message #905390] Wed, 28 February 2024 13:46 Go to previous message
Eclipse UserFriend
Hello,

Thank you for the explanations about how to register packages, that's now pretty clear for eclipse plateform or standalone when we know the absolute path of the JAR.

How the Base URI for the Jar is supposed to be set when the dependency is retrieved by Maven - using org.eclipse.acceleo.maven.launcher" plugin for instance?
Is there a specific scheme available or another portable way to specify it?

Thank you for your help
Best regards.
Previous Topic:[Acceleo] Generate code from SHACL Shapes
Next Topic:[Acceleo] Problems building Acceleo generator with latest Tycho 4.0.7
Goto Forum:
  


Current Time: Fri Jun 13 22:56:24 EDT 2025

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

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

Back to the top