Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Executing EGX headless without files
Executing EGX headless without files [message #1863878] Sun, 03 March 2024 18:46 Go to next message
Francisco Martínez Lasaca is currently offline Francisco Martínez LasacaFriend
Messages: 3
Registered: March 2024
Junior Member
Hi,

I'm trying to get EGX to work in a headless environment where the coordination script and the referred EGL templates are all injected directly via Strings.

This is partially achieved in Epsilon's Playground EGX cloud execution [1], via a custom EglTemplateFactory but only supports a single template -- it's called "template.egl" throughout the code -- instead of multiple ones.

This is the minimum example of what I would like to accomplish:
var module = new EgxModule(new StringGeneratingTemplateFactory());

var factory = (StringGeneratingTemplateFactory) module.getTemplateFactory();
factory.defineTemplate("template1.egl", "Hi from template #1!");
factory.defineTemplate("template2.egl", "Hi from template #2!");

var code = """
    rule Rule1 {
        template: "template1.egl"
        target: "gen/a.html"
    }

    rule Rule2 {
        template: "template2.egl"
        target: "gen/b.html"
    }
                """;
module.parse(code);
module.execute();

Map<String, String> results = factory.getResults();
return results;


This should return something like {"gen/a.html" -> "Hi from template #1!", "gen/b.html" -> "Hi from template #2!"}

I'd appreciate some pointers on what to change on the StringGeneratingTemplate*.java files [2], since I'm getting a bit stuck.

Thanks!

[1] https://github.com/epsilonlabs/playground/blob/2caf2813a7cb39721a5dfa64c70c3fc9e617406c/src/main/java/org/eclipse/epsilon/live/RunEpsilonFunction.java#L164
[2] https://github.com/epsilonlabs/playground/tree/main/src/main/java/org/eclipse/epsilon/live/egl
Re: Executing EGX headless without files [message #1863888 is a reply to message #1863878] Mon, 04 March 2024 09:05 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2165
Registered: July 2009
Location: York, UK
Senior Member

Hi Paco,

Thanks for your message. I've just shared an example that shows how to achieve this: https://github.com/eclipse/epsilon/tree/main/examples/org.eclipse.epsilon.examples.egl.strings

Cheers,
Dimitris
Re: Executing EGX headless without files [message #1863889 is a reply to message #1863888] Mon, 04 March 2024 09:48 Go to previous message
Francisco Martínez Lasaca is currently offline Francisco Martínez LasacaFriend
Messages: 3
Registered: March 2024
Junior Member
Works like a charm! Thanks
Previous Topic:Evaluating Metamodel Quality Metrics
Next Topic:Using Xtext with Epsilon
Goto Forum:
  


Current Time: Sat Apr 27 12:16:36 GMT 2024

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

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

Back to the top