|Running Workflows from the command line [message #1064706]
||Thu, 20 June 2013 15:22
| James Williams
Registered: July 2009
I need to headlessly run some Epsilon workflows, and am running into some difficulties. I've used the epsilon-ant-standalone.jar and org.eclipse.epsilon.workflow.emf.jar to get hold of Epsilon and the ANT tasks. Note: the EMF workflow project was missing a task definition file, so I have created one - remind me to send you a patch.
I've also packaged up my own plugins and EOL scripts into a jar file - I can execute both EOL and the Java code fine. However.. the jar also contains some Ecore models and associated generated code. I'm not sure how to register the EPackages from my jar file, and so am having trouble creating models.
Initially, I thought it would be fine to simply register the Ecore models using the epsilon.emf.register task and use the reflective API:
This is fine up to the point where one of my EOL scripts passes a model object to a custom Java tool which is expecting an object conforming to a particular model class, but instead gets a DynamicEObject, which it is unable to cast to the actual class.
So instead I tried to define a Java class for ANT to execute in order to register my EPackages with the registry before creating the models. Sadly, this does not work.
I've uploaded a zip here: http://jamesrobertwilliams.co.uk/tmp/epsilon-workflow-cmd.zip In build.xml you can see the call to Java to register the metamodel before loading the model. If you run build.xml, it should crash due to not finding the appropriate EPackage when loading the model. If you uncomment the <epsilon.emf.register..> line, it should run the EOL module, but throw a ClassCastException when executing the tool.
Also: a note to anyone attempting to do similar, if you want to reference Epsilon modules stored in jars, you need to define your imports as follows:
Once resolved, I volunteer to write an article about all of this
Powered by FUDForum
. Page generated in 0.03354 seconds