First commit
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/Web/WebServer.java
Normal file
34
src/Web/WebServer.java
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user