-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an MDENet Education Platform tools endpoint
- Loading branch information
1 parent
b3016e4
commit a749bf7
Showing
18 changed files
with
430 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
http-server/src/main/java/org/eclipse/epsilon/labs/playground/Application.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...c/main/java/org/eclipse/epsilon/labs/playground/fn/tooldesc/ToolDescriptorController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package org.eclipse.epsilon.labs.playground.fn.tooldesc; | ||
|
||
import java.util.HashMap; | ||
|
||
import org.eclipse.epsilon.egl.EglTemplateFactoryModuleAdapter; | ||
import org.eclipse.epsilon.eol.execute.context.Variable; | ||
import org.eclipse.epsilon.labs.playground.fn.emfatic2plantuml.Emfatic2PlantUMLController; | ||
import org.eclipse.epsilon.labs.playground.fn.flexmi2plantuml.Flexmi2PlantUMLController; | ||
import org.eclipse.epsilon.labs.playground.fn.run.RunEpsilonController; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import io.micronaut.http.HttpRequest; | ||
import io.micronaut.http.HttpResponse; | ||
import io.micronaut.http.MediaType; | ||
import io.micronaut.http.annotation.Controller; | ||
import io.micronaut.http.annotation.Get; | ||
import io.micronaut.http.server.util.HttpHostResolver; | ||
import jakarta.inject.Inject; | ||
|
||
@Controller("/tools") | ||
public class ToolDescriptorController { | ||
|
||
@Inject | ||
private HttpHostResolver hostResolver; | ||
|
||
private static final Logger LOGGER = LoggerFactory.getLogger(ToolDescriptorController.class); | ||
|
||
@Get("/") | ||
public HttpResponse<String> render(HttpRequest<?> request) { | ||
try { | ||
EglTemplateFactoryModuleAdapter module = new EglTemplateFactoryModuleAdapter(); | ||
module.parse(getClass().getResource("/mdenet_tool.egl").toURI()); | ||
|
||
var urls = new HashMap<String, String>(); | ||
urls.put("epsilon", resolve(request, RunEpsilonController.PATH)); | ||
urls.put("flexmi2plantuml", resolve(request, Flexmi2PlantUMLController.PATH)); | ||
urls.put("emfatic2plantuml", resolve(request, Emfatic2PlantUMLController.PATH)); | ||
|
||
module.getContext().getFrameStack().put( | ||
Variable.createReadOnlyVariable("urls", urls) | ||
); | ||
|
||
return HttpResponse.ok("" + module.execute()).contentType(MediaType.APPLICATION_JSON); | ||
} catch (Exception e) { | ||
LOGGER.error(e.getMessage()); | ||
return HttpResponse.serverError("Failed to render the tools configuration: error has been logged"); | ||
} | ||
} | ||
|
||
private String resolve(HttpRequest<?> request, String path) { | ||
return hostResolver.resolve(request) + path; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Serve the icon files as well | ||
micronaut.router.static-resources.default.enabled=true | ||
micronaut.router.static-resources.default.mapping=/**/* | ||
micronaut.router.static-resources.default.paths=classpath:public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
{ | ||
"tool": | ||
{ | ||
"id": "epsilon", | ||
"name": "playground-micronaut", | ||
"version": "0.1.0", | ||
"author": "Epsilon Labs", | ||
"homepage": "https://eclipse.dev/epsilon/", | ||
|
||
"functions": [ | ||
{ | ||
"id": "function-eol", | ||
"name": "eol", | ||
"parameters": [ {"name":"language", "type":"text"}, | ||
{"name":"outputType", "type":"text"}, | ||
{"name":"outputLanguage", "type":"text"}, | ||
{"name":"program", "type":"eol"}, | ||
{"name":"secondProgram", "type":"eol"}, | ||
{"name":"emfatic", "type":"emfatic"}, | ||
{"name":"flexmi", "type":"flexmi", "instanceOf": "emfatic"}, | ||
{"name":"secondEmfatic", "type":"emfatic"}, | ||
{"name":"secondFlexmi", "type":"flexmi", "instanceOf": "secondEmfatic"}, | ||
{"name":"thirdEmfatic", "type":"emfatic"}, | ||
{"name":"thirdFlexmi", "type":"flexmi", "instanceOf": "thirdEmfatic"} | ||
], | ||
"returnType": "text", | ||
"path": "[%= urls.get("epsilon") %]" | ||
}, | ||
|
||
{ | ||
"id": "function-etl", | ||
"name": "etl", | ||
"parameters": [ {"name":"language", "type":"text"}, | ||
{"name":"outputType", "type":"text"}, | ||
{"name":"outputLanguage", "type":"text"}, | ||
{"name":"program", "type":"etl"}, | ||
{"name":"secondProgram", "type":"etl"}, | ||
{"name":"emfatic", "type":"emfatic"}, | ||
{"name":"flexmi", "type":"flexmi", "instanceOf": "emfatic"}, | ||
{"name":"secondEmfatic", "type":"emfatic"}, | ||
{"name":"secondFlexmi", "type":"flexmi", "instanceOf": "secondEmfatic"}, | ||
{"name":"thirdEmfatic", "type":"emfatic"}, | ||
{"name":"thirdFlexmi", "type":"flexmi", "instanceOf": "thirdEmfatic"} | ||
], | ||
"returnType": "text", | ||
"path": "[%= urls.get("epsilon") %]" | ||
}, | ||
|
||
{ | ||
"id": "function-egl", | ||
"name": "egl", | ||
"parameters": [ {"name":"language", "type":"text"}, | ||
{"name":"outputType", "type":"text"}, | ||
{"name":"outputLanguage", "type":"text"}, | ||
{"name":"program", "type":"egl"}, | ||
{"name":"secondProgram", "type":"egl"}, | ||
{"name":"emfatic", "type":"emfatic"}, | ||
{"name":"flexmi", "type":"flexmi", "instanceOf": "emfatic"}, | ||
{"name":"secondEmfatic", "type":"emfatic"}, | ||
{"name":"secondFlexmi", "type":"flexmi", "instanceOf": "secondEmfatic"}, | ||
{"name":"thirdEmfatic", "type":"emfatic"}, | ||
{"name":"thirdFlexmi", "type":"flexmi", "instanceOf": "thirdEmfatic"} | ||
], | ||
"returnType": "text", | ||
"path": "[%= urls.get("epsilon") %]" | ||
}, | ||
|
||
{ | ||
"id": "function-evl", | ||
"name": "evl", | ||
"parameters": [ {"name":"language", "type":"text"}, | ||
{"name":"outputType", "type":"text"}, | ||
{"name":"outputLanguage", "type":"text"}, | ||
{"name":"program", "type":"evl"}, | ||
{"name":"secondProgram", "type":"evl"}, | ||
{"name":"emfatic", "type":"emfatic"}, | ||
{"name":"flexmi", "type":"flexmi", "instanceOf": "emfatic"}, | ||
{"name":"secondEmfatic", "type":"emfatic"}, | ||
{"name":"secondFlexmi", "type":"flexmi", "instanceOf": "secondEmfatic"}, | ||
{"name":"thirdEmfatic", "type":"emfatic"}, | ||
{"name":"thirdFlexmi", "type":"flexmi", "instanceOf": "thirdEmfatic"} | ||
], | ||
|
||
"returnType": "text", | ||
"path": "[%= urls.get("epsilon") %]" | ||
}, | ||
|
||
{ | ||
"id": "function-flexmi2plantuml", | ||
"name": "FlexmiToPlantUML", | ||
"parameters": [ {"name":"flexmi", "type":"flexmi"}, | ||
{"name":"emfatic", "type":"emfatic"} | ||
], | ||
"returnType": "diagram", | ||
"path": "[%= urls.get("flexmi2plantuml") %]" | ||
}, | ||
|
||
{ | ||
"id": "function-flexmi2plantuml", | ||
"name": "EmfaticToPlantUML", | ||
"parameters": [ {"name":"emfatic", "type":"emfatic"} ], | ||
"returnType": "diagram", | ||
"path": "[%= urls.get("emfatic2plantuml") %]" | ||
} | ||
], | ||
|
||
"panelDefs": [ | ||
|
||
{ | ||
"id": "eol", | ||
"name": "eol", | ||
"panelclass": "ProgramPanel", | ||
"icon": "eol", | ||
"language": "eol", | ||
"buttons" : [ | ||
{ | ||
"id": "action-button", | ||
"icon": "run", | ||
"actionfunction": "function-eol", | ||
"hint": "Run the program (Ctrl/Cmd+S)" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://www.eclipse.org/epsilon/doc/eol/", | ||
"hint": "EOL Language Reference" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"id": "etl", | ||
"name": "etl", | ||
"panelclass": "ProgramPanel", | ||
"icon": "etl", | ||
"language": "etl", | ||
"buttons" : [ | ||
{ | ||
"id": "action-button", | ||
"icon": "run", | ||
"actionfunction": "function-etl", | ||
"hint": "Run the program (Ctrl/Cmd+S)" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://www.eclipse.org/epsilon/doc/etl/", | ||
"hint": "ETL Language Reference" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"id": "egl", | ||
"name": "egl", | ||
"panelclass": "ProgramPanel", | ||
"icon": "egl", | ||
"help": "https://www.eclipse.org/epsilon/doc/egl/", | ||
"language": "egl", | ||
"buttons" : [ | ||
{ | ||
"id": "action-button", | ||
"icon": "run", | ||
"actionfunction": "function-egl", | ||
"hint": "Run the program (Ctrl/Cmd+S)" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://www.eclipse.org/epsilon/doc/egl/", | ||
"hint": "EGL Language Reference" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"id": "evl", | ||
"name": "evl", | ||
"panelclass": "ProgramPanel", | ||
"icon": "evl", | ||
"language": "evl", | ||
"buttons" : [ | ||
{ | ||
"id": "action-button", | ||
"icon": "run", | ||
"actionfunction": "function-evl", | ||
"hint": "Run the program (Ctrl/Cmd+S)" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://www.eclipse.org/epsilon/doc/evl/", | ||
"hint": "EVL Language Reference" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"id": "flexmi", | ||
"name": "flexmi", | ||
"panelclass": "ProgramPanel", | ||
"icon": "flexmi", | ||
"language": "flexmi", | ||
"buttons" : [ | ||
{ | ||
"id": "refresh-button", | ||
"icon": "refresh", | ||
"renderfunction": "function-flexmi2plantuml", | ||
"hint": "Render the model object diagram" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://www.eclipse.org/epsilon/doc/flexmi/", | ||
"hint": "Flexmi Reference" | ||
} | ||
] | ||
}, | ||
|
||
{ | ||
"id": "emfatic", | ||
"name": "emfatic", | ||
"panelclass": "ProgramPanel", | ||
"icon": "emfatic", | ||
"language": "emfatic", | ||
"buttons" : [ | ||
{ | ||
"id": "refresh-button", | ||
"icon": "refresh", | ||
"renderfunction": "function-emfatic2plantuml", | ||
"hint": "Render the model object diagram" | ||
}, | ||
{ | ||
"id": "help-button", | ||
"icon": "info", | ||
"url": "https://eclipse.org/emfatic", | ||
"hint": "Emfatic Website" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.mif-eol::before { | ||
content: url("./icons/eol.gif"); | ||
} | ||
|
||
.mif-flock::before { | ||
content: url("./icons/flock.png"); | ||
} | ||
|
||
.mif-egl::before { | ||
content: url("./icons/egl.png"); | ||
} | ||
|
||
.mif-egx::before { | ||
content: url("./icons/egx.png"); | ||
} | ||
|
||
.mif-etl::before { | ||
content: url("./icons/etl.gif"); | ||
} | ||
|
||
.mif-epl::before { | ||
content: url("./icons/epl.gif"); | ||
} | ||
|
||
.mif-evl::before { | ||
content: url("./icons/evl.gif"); | ||
} | ||
|
||
.mif-flexmi::before { | ||
content: url("./icons/flexmi.png"); | ||
} | ||
|
||
.mif-emfatic::before { | ||
content: url("./icons/emfatic.png"); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.