diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..146ab09
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
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/libraries/projectlombok_lombok.xml b/.idea/libraries/projectlombok_lombok.xml
new file mode 100644
index 0000000..924b96b
--- /dev/null
+++ b/.idea/libraries/projectlombok_lombok.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ 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..deb8228 100644
--- a/ProtegeToAASMini.iml
+++ b/ProtegeToAASMini.iml
@@ -3,6 +3,7 @@
+
@@ -17,5 +18,7 @@
+
+
\ No newline at end of file
diff --git a/src/Main.java b/src/Main.java
index e3a1771..fe2c1f0 100644
--- a/src/Main.java
+++ b/src/Main.java
@@ -1,10 +1,7 @@
import AASMini.AASMini;
-import ProtegeGX.ProtegeGX;
public class Main {
private static AASMini aas;
- private static ProtegeGX protegeGX;
-
private static String aasIP = "192.168.10.10";
private static int aasPort = 8080;
public static void main(String[] args) {
@@ -12,14 +9,10 @@ public class Main {
public void run() {
System.out.println("Shutting down...");
if (aas!=null) aas.Disconnect();
- if (protegeGX!=null) protegeGX.Disconnect();
}
});
System.out.println("Protege to AAS Mini Connector");
-
- protegeGX = new ProtegeGX();
-
aas = new AASMini(aasIP, aasPort);
aas.Connect();
}
diff --git a/src/ProtegeGX/ProtegeData.java b/src/ProtegeGX/ProtegeData.java
new file mode 100644
index 0000000..e8e2025
--- /dev/null
+++ b/src/ProtegeGX/ProtegeData.java
@@ -0,0 +1,12 @@
+package ProtegeGX;
+
+public class ProtegeData {
+ public String ReaderID;
+ public String CardID;
+ public String Description;
+
+ @Override
+ public String toString(){
+ return "ReaderID = " + ReaderID + ", CardID = " + CardID + ", Description = " + Description;
+ }
+}
diff --git a/src/ProtegeGX/ProtegeGX.java b/src/ProtegeGX/ProtegeGX.java
index ca3f437..e71b189 100644
--- a/src/ProtegeGX/ProtegeGX.java
+++ b/src/ProtegeGX/ProtegeGX.java
@@ -1,12 +1,4 @@
package ProtegeGX;
public class ProtegeGX {
- public ProtegeGX(){
- System.out.println("ProtegeGX Constructor");
- //TODO belum ada codingan, tunggu apache cxf jar nya
- }
-
- public void Disconnect(){
- //TODO belum ada codingan, tunggu apache cxf jar nya
- }
}
diff --git a/src/Web/WebServer.java b/src/Web/WebServer.java
new file mode 100644
index 0000000..9a47437
--- /dev/null
+++ b/src/Web/WebServer.java
@@ -0,0 +1,51 @@
+package Web;
+
+import io.javalin.Javalin;
+import lombok.Setter;
+
+import java.util.function.Consumer;
+
+import static io.javalin.apibuilder.ApiBuilder.get;
+import static io.javalin.apibuilder.ApiBuilder.path;
+
+@SuppressWarnings("unused")
+public class WebServer {
+ @Setter private Consumer aasAPI;
+ @Setter private Consumer protegeGXAPI;
+
+ private void updateAASAPI(String data){
+ if (aasAPI!=null) aasAPI.accept(data);
+ }
+
+ private void updateProtegeGXAPI(String data){
+ if (protegeGXAPI!=null) protegeGXAPI.accept(data);
+ }
+
+ 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
+ get(ctx -> ctx.result("AAS Mini API"));
+ });
+ // API for ProtegeGX
+ path("protegegx", ()->{
+ //TODO implement API for ProtegeGX
+ get(ctx -> ctx.result("ProtegeGX API"));
+ });
+ });
+ });
+ }
+
+ public void Start(int listenport){
+ app.start(listenport);
+ }
+
+ public void Stop(){
+ app.stop();
+ }
+}