Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Using Epsilon in Java(executing egl scripts from java)
Using Epsilon in Java [message #719551] Sat, 27 August 2011 18:54 Go to next message
vrm  is currently offline vrm Friend
Messages: 31
Registered: 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 :
Exception in thread "main" Method 'generate' not found (C:\Users\test\org.eclipse.epsilon.examples.standalone\src\org\eclipse\epsilon\examples\standalone\egl\Demo.egl@4:10)
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.egl.EglTemplateFactoryModuleAdapter.execute(EglTemplateFactoryModuleAdapter.java:63)
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 15:10 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
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
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Using Epsilon in Java [message #722918 is a reply to message #722721] Wed, 07 September 2011 07:56 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: 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 15:37 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 242
Registered: October 2009
Location: Mexico
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
Kinori Tech
Need professional support for Epsilon, EMF?
Go to: https://kinori.tech
Re: Using Epsilon in Java [message #723393 is a reply to message #719551] Thu, 08 September 2011 13:11 Go to previous messageGo to next message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: 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 :
Exception in thread "main" Method 'generate' not found (C:\Users\test\org.eclipse.epsilon.examples.standalone\src\org\eclipse\epsilon\examples\standalone\egl\Demo.egl@4:10)
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.egl.EglTemplateFactoryModuleAdapter.execute(EglTemplateFactoryModuleAdapter.java:63)
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() {
		return new EglTemplateFactoryModuleAdapter(new EglTemplateFactory());
	}


to this:

	@Override
	public IEolExecutableModule createModule() {
		return new EglTemplateFactoryModuleAdapter(new EglFileGeneratingTemplateFactory());
	}


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 13:22 Go to previous message
Louis Rose is currently offline Louis RoseFriend
Messages: 440
Registered: 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: Sat Apr 20 03:39:17 GMT 2024

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

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

Back to the top