Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:04 Go to next message
Andrea Sindico is currently offline Andrea SindicoFriend
Messages: 266
Registered: November 2010
Senior Member


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)


Follow me on Twitter @andreasindico

Re: [Acceleo] problem with primitive types when executed as Java application [message #904402 is a reply to message #902957] Tue, 28 August 2012 11:28 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
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 09:49 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,

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 18:25 Go to previous messageGo to next message
Tomas Balderas is currently offline Tomas BalderasFriend
Messages: 64
Registered: July 2010
Member
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.


/TB
Re: [Acceleo] problem with primitive types when executed as Java application [message #1859907 is a reply to message #1793371] Tue, 04 July 2023 23:22 Go to previous messageGo to next message
Ferenc Magnucz is currently offline Ferenc MagnuczFriend
Messages: 6
Registered: October 2017
Junior Member
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 18:46 Go to previous message
Olivier Bourgeat is currently offline Olivier BourgeatFriend
Messages: 1
Registered: February 2024
Junior Member
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
Goto Forum:
  


Current Time: Fri Mar 29 00:27:03 GMT 2024

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

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

Back to the top