Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XPand2 / MWE: Load file for XPand generator from outside the Java classpath?
XPand2 / MWE: Load file for XPand generator from outside the Java classpath? [message #898051] Wed, 25 July 2012 16:54 Go to next message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Hello everyone,

I'm using MWE to run a XPand2 generator. I had a look at the documentation of the generator and it states that the file containing the XPand template (the .xpt file) has to be located on the Java classpath. Since I am developing a plugin for MagicDraw, I have little influence on the classpath (besides from adding Jar files) and can't just "add" the .xpt file to the classpath. Adding it to the plugin Jar file unfortunately did not help either, the workflow engine is just unable to locate the file.

However, what I do know is the absolute filepath of the .xpt file - can I somehow tell the generator to use the .xpt file from the filepath instead of looking it up on the classpath?


Thanks,


Alan
Re: XPand2 / MWE: Load file for XPand generator from outside the Java classpath? [message #898595 is a reply to message #898051] Thu, 26 July 2012 18:49 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Xpand is using an instance of org.eclipse.xtend.expression.ResourceManager to locate resources (i.e. Xpand/Xtend templates) by qualified name. By default AbstractExpressionUsingWorkflowComponent#getResourceManager (Xpand's Generator component derives from it) instantiates an instance of org.eclipse.xtend.expression.ResourceManagerDefaultImpl, which loads resources by accessing ResourceLoaderFactory#createResourceLoader(). The implementation of ResourceLoader to instantiate can be passed as System property "org.eclipse.emf.mwe.core.resources.ResourceLoader", or derive ResourceManagerDefaultImpl and set it to the Generator component.

Kind regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: XPand2 / MWE: Load file for XPand generator from outside the Java classpath? [message #898612 is a reply to message #898595] Thu, 26 July 2012 21:24 Go to previous messageGo to next message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Hello,

thank you for your response. So, what you are basically suggesting is to subclass the ResourceManagerDefaultImpl() and override the lookup/load method (did I get that right?). That's actually a nice idea. Right now, I have some advice from the MagicDraw forums which may enable me to get the .xpt file on the classpath after all, but if that is not applicable, I will definitly try your approach as it sounds very promising.

I really whish that there was more in-depth documentation on XPand and MWE on the web, though. That could avoid having to ask such questions. Just as a side note Wink


Thank you very much for your help,


Alan
Re: XPand2 / MWE: Load file for XPand generator from outside the Java classpath? [message #899012 is a reply to message #898051] Mon, 30 July 2012 07:33 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

Hi Alan,

it is not that common use case to change the resource loading. This is one of the reasons why you don't see it in the documentation. There could always be more docs, but someone has to write it Wink

Kind regards,
~Karsten


Need professional support for Xtext, EMF, Eclipse IDE?
Go to: http://devhub.karakun.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Previous Topic:[Acceleo] Getting errors when invoking sortedBy
Next Topic:[Acceleo] Internal Error ArrayIndexOutOfBoundsException
Goto Forum:
  


Current Time: Thu Mar 28 21:52:45 GMT 2024

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

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

Back to the top