diff --git a/.idea/libraries/io_javalin.xml b/.idea/libraries/io_javalin.xml
new file mode 100644
index 0000000..efa907e
--- /dev/null
+++ b/.idea/libraries/io_javalin.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index af89096..39b110f 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,5 +1,9 @@
+
+
+
+
diff --git a/ProtegeToAASMini.iml b/ProtegeToAASMini.iml
index 994ace1..199b122 100644
--- a/ProtegeToAASMini.iml
+++ b/ProtegeToAASMini.iml
@@ -3,6 +3,7 @@
+
@@ -17,5 +18,6 @@
+
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
index e3a1771..48f7571 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -1,20 +1,22 @@
import AASMini.AASMini;
import ProtegeGX.ProtegeGX;
+import Web.WebServer;
public class Main {
private static AASMini aas;
private static ProtegeGX protegeGX;
-
+ private static WebServer web;
private static String aasIP = "192.168.10.10";
- private static int aasPort = 8080;
+ private static int aasPort = 5000;
+ private static int webPort = 8080;
public static void main(String[] args) {
- Runtime.getRuntime().addShutdownHook(new Thread() {
- public void run() {
- System.out.println("Shutting down...");
- if (aas!=null) aas.Disconnect();
- if (protegeGX!=null) protegeGX.Disconnect();
- }
- });
+ GetArguments(args);
+ Runtime.getRuntime().addShutdownHook(new Thread(() -> {
+ System.out.println("Shutting down...");
+ if (aas!=null) aas.Disconnect();
+ if (protegeGX!=null) protegeGX.Disconnect();
+ if (web!=null) web.Stop();
+ }));
System.out.println("Protege to AAS Mini Connector");
@@ -22,5 +24,22 @@ public class Main {
aas = new AASMini(aasIP, aasPort);
aas.Connect();
+
+ web = new WebServer();
+ web.Start(webPort);
+ }
+
+ private static void GetArguments(String[] args){
+ for(String arg: args){
+ if (arg.startsWith("-aasip=")){
+ aasIP = arg.substring(7);
+ }
+ if (arg.startsWith("-aasport=")){
+ aasPort = Integer.parseInt(arg.substring(9));
+ }
+ if (arg.startsWith("-webport=")){
+ webPort = Integer.parseInt(arg.substring(9));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/Web/WebServer.java b/src/Web/WebServer.java
new file mode 100644
index 0000000..5f65b23
--- /dev/null
+++ b/src/Web/WebServer.java
@@ -0,0 +1,34 @@
+package Web;
+
+import io.javalin.Javalin;
+
+import static io.javalin.apibuilder.ApiBuilder.path;
+
+public class WebServer {
+
+ Javalin app;
+ public WebServer(){
+ app = Javalin.create(config -> {
+ config.useVirtualThreads = true;
+ config.staticFiles.add("/Web");
+ config.router.apiBuilder(()->{
+ // API for AAS Mini
+ path("aasmini", ()->{
+ //TODO implement API for AAS Mini
+ });
+ // API for ProtegeGX
+ path("protegegx", ()->{
+ //TODO implement API for ProtegeGX
+ });
+ });
+ });
+ }
+
+ public void Start(int listenport){
+ app.start(listenport);
+ }
+
+ public void Stop(){
+ app.stop();
+ }
+}