Eclipse Community Forums Forum Search:

Home » Modeling » Epsilon » Using Epsilon in Java(executing egl scripts from java)
Using Epsilon in Java Sat, 27 August 2011 14:54
 vrm Messages: 31Registered: June 2011 Member
I tried to modify the the example , "Use Epsilon in standalone Java applications" ;and I have two problems with getting it to work :
1) when using 'generate' command in the egl script,an exception is thrown :
at org.eclipse.epsilon.egl.internal.EglPreprocessorModule.execute(EglPreprocessorModule.java:70)
at org.eclipse.epsilon.egl.internal.EglModule.execute(EglModule.java:148)
at org.eclipse.epsilon.egl.internal.EglModule.execute(EglModule.java:158)
at org.eclipse.epsilon.egl.EglTemplate.process(EglTemplate.java:69)
at org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExample.execute(EpsilonStandaloneExample.java:67)
at org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExample.execute(EpsilonStandaloneExample.java:60)
at org.eclipse.epsilon.examples.standalone.egl.EglStandaloneExample.main(EglStandaloneExample.java:34)

2) Using templateFactory to load other templates does not seem to work.
Re: Using Epsilon in Java [message #722721 is a reply to message #719551] Tue, 06 September 2011 11:10
 Horacio HoyosMessages: 146Registered: October 2009 Senior Member
vrm,

The epsilon generation "mechanics" are way different form the rest of the languages. In my recent work in implementing my own set of standalone epsilon plugins I came across some bugs that where reported and fixed (coming out in next release?). I also made some changes to the examples to fit my needs, make them more robust and provide mode functionality. I have attached a zip file with my modifications to the executor and egl standalone classes. You can search sourceforge for project "riskc" where you can get other epsilon standalone clasess and complete sources from the svn. Epsilon classes can be found in the net.sourceforge.riskc.riskcopcode.generator plugin/project.

Regards,

Horacio

Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: Using Epsilon in Java [message #722918 is a reply to message #722721] Wed, 07 September 2011 03:56
 Louis RoseMessages: 438Registered: July 2009 Location: York, United Kingdom Senior Member
Hi Horacio and Vrm,

I've made some improvements to EGL in the last couple of releases, and it might be that the standalone example in our SVN doesn't work properly any more. I'll investigate and update it in the next week or so. Thanks very much for providing your versions of the example. I'll be sure to integrate your changes if I can.

More soon....

Cheers,
Louis.
Re: Using Epsilon in Java [message #723095 is a reply to message #722918] Wed, 07 September 2011 11:37
 Horacio HoyosMessages: 146Registered: October 2009 Senior Member
Louis,

The attached files are not a complete example, only the epsilon standalone implementations. I would love to discuss my implementation of the standalone "executors" with you to come up with improved versions and provided them to the community. I can send them to you or you can get them from the svn. We can discuss them via email.

Cheers,

Horacio

Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: Using Epsilon in Java [message #723393 is a reply to message #719551] Thu, 08 September 2011 09:11
 Louis RoseMessages: 438Registered: July 2009 Location: York, United Kingdom Senior Member
Hi vrm,

I've had a bit more time to investigate these issues now...

vrm wrote on Sat, 27 August 2011 14:54
I tried to modify the the example , "Use Epsilon in standalone Java applications" ;and I have two problems with getting it to work :
1) when using 'generate' command in the egl script,an exception is thrown :
at org.eclipse.epsilon.egl.internal.EglPreprocessorModule.execute(EglPreprocessorModule.java:70)
at org.eclipse.epsilon.egl.internal.EglModule.execute(EglModule.java:148)
at org.eclipse.epsilon.egl.internal.EglModule.execute(EglModule.java:158)
at org.eclipse.epsilon.egl.EglTemplate.process(EglTemplate.java:69)
at org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExample.execute(EpsilonStandaloneExample.java:67)
at org.eclipse.epsilon.examples.standalone.EpsilonStandaloneExample.execute(EpsilonStandaloneExample.java:60)
at org.eclipse.epsilon.examples.standalone.egl.EglStandaloneExample.main(EglStandaloneExample.java:34)

This is because the EglStandaloneExample doesn't use a template factory that can generate files. You need to change the following code from this:

	@Override
public IEolExecutableModule createModule() {
}


to this:

	@Override
public IEolExecutableModule createModule() {
}


vrm wrote on Sat, 27 August 2011 14:54
2) Using templateFactory to load other templates does not seem to work.

This works fine on my machine -- perhaps this could be a side-effect of the first error. Could you try using a EglFileGeneratingTemplateFactory and let me know if it doesn't work?

Hope this helps,
Louis.
Re: Using Epsilon in Java [message #723400 is a reply to message #723095] Thu, 08 September 2011 09:22
 Louis RoseMessages: 438Registered: July 2009 Location: York, United Kingdom Senior Member
Horacio wrote on Wed, 07 September 2011 11:37
Louis,

The attached files are not a complete example, only the epsilon standalone implementations. I would love to discuss my implementation of the standalone "executors" with you to come up with improved versions and provided them to the community. I can send them to you or you can get them from the svn. We can discuss them via email.

Cheers,

Horacio

Horacio,

That'd be great, thanks very much! If you would like to pursue this, please consider preparing a patch for the standalone example plugin. (We have to follow a somewhat strict process for incorporating contributions from collaborators, and a patch would help to get this started).

I had a quick look at your code, and it seems great. One small tip: rather than create an EMF model using StringProperties, you might prefer org.eclipse.epsilon.emc.emf.EmfModelFactory.getInstance().createEmfModel(...). That way, you're protected from any changes that are made to the keys and values used in the StringProperties. (As we discussed on the other thread, this do sometimes change).

Hope that helps,
Louis.
 Previous Topic: loading templates from another package Next Topic: [Epsilon] File modified outside the editor
Goto Forum:

Current Time: Sun Dec 08 20:48:49 EST 2013