Running MWE2 Generator from external code [message #640041] |
Thu, 18 November 2010 14:06  |
Eclipse User |
|
|
|
I'm trying to run the MWE2 Luncher in an external project code (using Xtext to build the parser for a general purpose language ), without Eclipse (corresponding to the right click->run as MWE workflow). I found this for the old one, but trying this code I've a nullPointerException and not the expected IllegalArgumentException (source)
...
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine;
import org.eclipse.emf.mwe2.launch.runtime.*;
public class RunWF {
public static void main (String[] args ) {
Map<String, String> params = null;
new Mwe2Runner().run(URI.createURI("wf.mwe"), params);
}
}
Thank you in advance,
Jake
|
|
|
|
|
|
|
Re: Running MWE2 Generator from external code [message #999232 is a reply to message #640124] |
Fri, 11 January 2013 10:56   |
Eclipse User |
|
|
|
I have a similar problem, running MWE2 standalone.
The unit test within Eclipse works fine, but when running in the WebLogic context, the MWE2 module is not found.
I call the workflow like:
Injector injector = new MyFactoryStandaloneSetup().createInjectorAndDoEMFRegistration();
slots.put("injector", injector);
Mwe2Runner mweRunner = injector.getInstance(Mwe2Runner.class);
mweRunner.run(URI.createURI("com/mycompany/path/filename.mwe2"), prepareWorkflowProperties(), slots);
I get
java.io.FileNotFoundException: C:\Apps\appsrv\domains\MyDomain_6002\com\mycompany\path\filename.mwe2 (The system cannot find the path specified)
Under MyDomain_6002, there is a completely different hierarchy.
According to your proposal, I also tried this syntax:
mweRunner.run("com.mycompany.path.modulename", prepareWorkflowProperties(), slots);
using the module name which is specified in the MWE2 file (and matching the package/file naming), but I got the error
java.lang.IllegalStateException: Couldn't find module com.mycompany.path.modulename
I verified that the MWE2 file is within the jar.
Using Mwe2Launcher() isn't an option for me, because I need to support these additional parameters for workflow properties and slots.
How do I need to address the MWE2 workflow?
One more detail:
Due to very strong restrictions and a heavy Java framework in our company, some folder names are hard-coded in the framework. So I cannot use xtend-gen or src-gen folders. I had to set the Xtend build target to the src folder itself. In another post, I found that the MWE2 module would be searched in the src-gen folder only: http://jevopisdeveloperblog.blogspot.ch/2011/06/when-your-mwe2-workflow-is-not-working.html
[Updated on: Fri, 11 January 2013 11:13] by Moderator
|
|
|
Re: Running MWE2 Generator from external code [message #1001699 is a reply to message #999232] |
Thu, 17 January 2013 03:33  |
Eclipse User |
|
|
|
Finally I got the solution by myself. The problem was to find any documentation about the syntax expected for the URI. I found the syntax in the forums only...
mweRunner.run(URI.createURI("classpath:/com/mycompany/path/filename.mwe2"), prepareWorkflowProperties(), slots);
|
|
|
Powered by
FUDForum. Page generated in 0.09376 seconds