blob: a43e23a8544b0f8664241e8553b504dcf3bea7e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package org.opendc.common.utils
import io.javalin.Javalin
import io.javalin.http.Handler
/**
* Represents the digital twin monitoring server.
* @author Mateusz Kwiatkowski
* @see <a href=https://javalin.io/documentation>https://javalin.io/documentation</a>
*/
public class JavalinRunner {
private val handshake: Handler = Handler { ctx -> ctx.status(200) }
private val scenario: Handler = Handler { ctx ->
}
init {
// Make a CRUD RESTful API
// Specify server config
val app = Javalin.create().start()
// returns a list of all experiments
app.get("/experiment", handshake)
// returns a specific experiment
app.get("/experiment/:id", handshake)
// you need another endpoint for the metrics
// get the results for the metrics evaluation
app.get("/results/:id", handshake)
// returns all results
app.get("/results", handshake)
// sends a specific experiment
app.post("/experiment", scenario)
// changes a specific experiment
app.put("/experiment/:id", scenario)
// this should delete metrics associated with the experiment
// deletes an experiment with id
app.delete("/experiment/:id", scenario)
// deletes all experiments
app.delete("/experiment", scenario)
}
}
|